Original Post
I'm thinking I'm nearly done with OctTrees but I'm getting random triangles not showing up as seen here (click to enlarge):
I'm thinking this is because of my Frustum-->Node check. Each node saves a max and min point, and the function is passed a cCamera* which contains six frustum planes: //Note: somehow in my mind the capital S stands for "sigma." Also SideOfPlane returns either -1 (opposite side of normal), 0 (on plane) or 1 (same side as normal) Does this function look right? If not, any ideas where else I should start looking (I know this is a longshot question but I suppose it's worth asking). More code (or pseudocode) available upon request. Thanks a bunch! [Edited by - ms291052 on November 10, 2004 3:45:13 PM]
I'm thinking this is because of my Frustum-->Node check. Each node saves a max and min point, and the function is passed a cCamera* which contains six frustum planes: //Note: somehow in my mind the capital S stands for "sigma." Also SideOfPlane returns either -1 (opposite side of normal), 0 (on plane) or 1 (same side as normal)
BOOL cOctTreeNode::CheckVisibility(cCamera* cam)
{
Vector3 p[8];
p[0] = Vector3(m_Min.x, m_Min.y, m_Min.z);
p[1] = Vector3(m_Max.x, m_Min.y, m_Min.z);
p[2] = Vector3(m_Max.x, m_Max.y, m_Min.z);
p[3] = Vector3(m_Min.x, m_Max.y, m_Min.z);
p[4] = Vector3(m_Min.x, m_Min.y, m_Max.z);
p[5] = Vector3(m_Min.x, m_Max.y, m_Max.z);
p[6] = Vector3(m_Max.x, m_Min.y, m_Max.z);
p[7] = Vector3(m_Max.x, m_Max.y, m_Max.z);
for(DWORD j=0; j < 6; j++)
{
int Sd = 0;
for(DWORD i=0; i < 8; i++)
{
int d = SideOfPlane(p, cam->m_Frustum[j]);
Sd += d;
}
if(Sd == -8)
return FALSE;
}
return TRUE;
}