diff --git a/Src/Graphics/New3D/New3D.cpp b/Src/Graphics/New3D/New3D.cpp index 27edc2c..5b1ea52 100644 --- a/Src/Graphics/New3D/New3D.cpp +++ b/Src/Graphics/New3D/New3D.cpp @@ -419,6 +419,8 @@ void CNew3D::DescendCullingNode(UINT32 addr) float x, y, z; int tx, ty; BBox bbox; + UINT16 hDistance; + float fDistance; if (m_nodeAttribs.StackLimit()) { return; @@ -476,16 +478,11 @@ void CNew3D::DescendCullingNode(UINT32 addr) MultMatrix(matrixOffset,m_modelMat); } + hDistance = node[9 - m_offset] & 0xFFFF; + fDistance = R3DFloat::GetFloat16(hDistance); + if (m_nodeAttribs.currentClipStatus != Clip::INSIDE) { - //================ - UINT16 hDistance; - float fDistance; - //================ - - hDistance = node[9 - m_offset] & 0xFFFF; - fDistance = R3DFloat::GetFloat16(hDistance); - if (hDistance != R3DFloat::Pro16BitMax) { CalcBox(fDistance, bbox); @@ -502,7 +499,7 @@ void CNew3D::DescendCullingNode(UINT32 addr) } } - if (m_nodeAttribs.currentClipStatus != Clip::OUTSIDE) { + if (m_nodeAttribs.currentClipStatus != Clip::OUTSIDE && fDistance > R3DFloat::Pro16BitFltMin) { // Descend down first link if ((node[0x00] & 0x08)) // 4-element LOD table diff --git a/Src/Graphics/New3D/R3DFloat.h b/Src/Graphics/New3D/R3DFloat.h index 9086756..fbdde7b 100644 --- a/Src/Graphics/New3D/R3DFloat.h +++ b/Src/Graphics/New3D/R3DFloat.h @@ -3,14 +3,15 @@ namespace R3DFloat { - static const UINT16 Pro16BitMax = 0x7fff; + static const UINT16 Pro16BitMax = 0x7fff; + static const float Pro16BitFltMin = 1e-7f; // float min in IEEE float GetFloat16(UINT16 f); float GetFloat32(UINT32 f); - UINT32 ConvertProFloat(UINT32 a1); // return float in hex or integer format + UINT32 ConvertProFloat(UINT32 a1); // return float in hex or integer format UINT32 Convert16BitProFloat(UINT32 a1); - float ToFloat(UINT32 a1); // integer float to actual IEEE 754 float + float ToFloat(UINT32 a1); // integer float to actual IEEE 754 float } #endif \ No newline at end of file