Virtua fighter has a few massive polys that shouldn't be visible. It looks like these polys have a bad matrix, but the node distances are all zero. This means the bounding box that encapsulates them is of size zero. Skipping over these entirely seems to fix the issue.

This commit is contained in:
Ian Curtis 2017-04-12 15:47:57 +00:00
parent 4a70d5ec9a
commit 391aafd4c1
2 changed files with 10 additions and 12 deletions

View file

@ -419,6 +419,8 @@ void CNew3D::DescendCullingNode(UINT32 addr)
float x, y, z; float x, y, z;
int tx, ty; int tx, ty;
BBox bbox; BBox bbox;
UINT16 hDistance;
float fDistance;
if (m_nodeAttribs.StackLimit()) { if (m_nodeAttribs.StackLimit()) {
return; return;
@ -476,16 +478,11 @@ void CNew3D::DescendCullingNode(UINT32 addr)
MultMatrix(matrixOffset,m_modelMat); MultMatrix(matrixOffset,m_modelMat);
} }
hDistance = node[9 - m_offset] & 0xFFFF;
fDistance = R3DFloat::GetFloat16(hDistance);
if (m_nodeAttribs.currentClipStatus != Clip::INSIDE) { if (m_nodeAttribs.currentClipStatus != Clip::INSIDE) {
//================
UINT16 hDistance;
float fDistance;
//================
hDistance = node[9 - m_offset] & 0xFFFF;
fDistance = R3DFloat::GetFloat16(hDistance);
if (hDistance != R3DFloat::Pro16BitMax) { if (hDistance != R3DFloat::Pro16BitMax) {
CalcBox(fDistance, bbox); 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 // Descend down first link
if ((node[0x00] & 0x08)) // 4-element LOD table if ((node[0x00] & 0x08)) // 4-element LOD table

View file

@ -3,14 +3,15 @@
namespace R3DFloat 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 GetFloat16(UINT16 f);
float GetFloat32(UINT32 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); 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 #endif