From d16ba90856e1111261818fef2b2677f1ec7cad05 Mon Sep 17 00:00:00 2001 From: Ian Curtis Date: Wed, 1 Nov 2023 16:01:13 +0000 Subject: [PATCH] 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. --- Src/Graphics/New3D/New3D.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Src/Graphics/New3D/New3D.cpp b/Src/Graphics/New3D/New3D.cpp index 1a5bb2e..6d2816c 100644 --- a/Src/Graphics/New3D/New3D.cpp +++ b/Src/Graphics/New3D/New3D.cpp @@ -561,7 +561,9 @@ bool CNew3D::DrawModel(UINT32 modelAddr) 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 -------- -------- -x------ -------- Switch bank -------- -------- --xxxxxx x------- X offset @@ -570,6 +572,23 @@ bool CNew3D::DrawModel(UINT32 modelAddr) 0x03 : xxxxxxxx xxxxx--- -------- -------- Color table address 1 -------- -----xxx xxxx---- -------- LOD table pointer -------- -------- ----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) @@ -597,6 +616,8 @@ void CNew3D::DescendCullingNode(UINT32 addr) return; } + printf("scale %x %f\n", node[1], Util::Uint32AsFloat(node[1])); + // Extract known fields nodeType = (NodeType)(node[0x00] & 3); child1Ptr = node[0x07 - m_offset] & 0x7FFFFFF; // mask colour table bits