Update comments for the culling node function. gm_matthew worked out that the last 2 bits of the model scale float appear to be control bits for disable culling and valid model scale. Strange logic but the line of sight (LOS) function does something similar by re-using float bits for control words.

This commit is contained in:
Ian Curtis 2023-11-01 16:01:13 +00:00
parent 37065ce478
commit d16ba90856

View file

@ -561,7 +561,9 @@ bool CNew3D::DrawModel(UINT32 modelAddr)
0x01, 0x02 only present on Step 2 + 0x01, 0x02 only present on Step 2 +
0x01: xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx Model scale(float) 0x01: xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx-- Model scale (float32) last 2 bits are control words
-------- -------- -------- ------x- Disable culling
-------- -------- -------- -------x Valid model scale
0x02 : -------- -------- x------- -------- Texture replace 0x02 : -------- -------- x------- -------- Texture replace
-------- -------- -x------ -------- Switch bank -------- -------- -x------ -------- Switch bank
-------- -------- --xxxxxx x------- X offset -------- -------- --xxxxxx x------- X offset
@ -570,6 +572,23 @@ bool CNew3D::DrawModel(UINT32 modelAddr)
0x03 : xxxxxxxx xxxxx--- -------- -------- Color table address 1 0x03 : xxxxxxxx xxxxx--- -------- -------- Color table address 1
-------- -----xxx xxxx---- -------- LOD table pointer -------- -----xxx xxxx---- -------- LOD table pointer
-------- -------- ----xxxx xxxxxxxx Node matrix -------- -------- ----xxxx xxxxxxxx Node matrix
0x04: Translation X coordinate
0x05: Translation Y coordinate
0x06: Translation Z coordinate
0x07: xxxx---- -------- -------- -------- Color table address 2
-----x-- -------- -------- -------- Sibling table
------x- -------- -------- -------- Point
-------x -------- -------- -------- Leaf node
-------- xxxxxxxx xxxxxxxx xxxxxxxx Child pointer
0x08: xxxxxxx- -------- -------- -------- Color table address 3
-------x -------- -------- -------- Null sibling
-------- xxxxxxxx xxxxxxxx xxxxxxxx Sibling pointer
0x09: xxxxxxxx xxxxxxxx -------- -------- Blend radius
-------- -------- xxxxxxxx xxxxxxxx Culling radius
*/ */
void CNew3D::DescendCullingNode(UINT32 addr) void CNew3D::DescendCullingNode(UINT32 addr)
@ -597,6 +616,8 @@ void CNew3D::DescendCullingNode(UINT32 addr)
return; return;
} }
printf("scale %x %f\n", node[1], Util::Uint32AsFloat(node[1]));
// Extract known fields // Extract known fields
nodeType = (NodeType)(node[0x00] & 3); nodeType = (NodeType)(node[0x00] & 3);
child1Ptr = node[0x07 - m_offset] & 0x7FFFFFF; // mask colour table bits child1Ptr = node[0x07 - m_offset] & 0x7FFFFFF; // mask colour table bits