fixed a bug in frustum culling.

objects that are not in the halfspace determined by the plane direction will be culled.
This commit is contained in:
Luigi Malomo 2013-09-26 11:16:26 +00:00
parent df97ef0c36
commit cf4844f4a4
1 changed files with 4 additions and 4 deletions
vcg/space/index/aabb_binary_tree

View File

@ -183,7 +183,7 @@ protected:
if ( if (
((fp->normal[0] * bminmax[fp->pVertexIndex[0]][0]) + ((fp->normal[0] * bminmax[fp->pVertexIndex[0]][0]) +
(fp->normal[1] * bminmax[fp->pVertexIndex[1]][1]) + (fp->normal[1] * bminmax[fp->pVertexIndex[1]][1]) +
(fp->normal[2] * bminmax[fp->pVertexIndex[2]][2]) + (fp->normal[2] * bminmax[fp->pVertexIndex[2]][2]) -
(fp->offset)) < ((ScalarType)0) (fp->offset)) < ((ScalarType)0)
) { ) {
return; return;
@ -192,7 +192,7 @@ protected:
if ( if (
((fp->normal[0] * bminmax[1 - fp->pVertexIndex[0]][0]) + ((fp->normal[0] * bminmax[1 - fp->pVertexIndex[0]][0]) +
(fp->normal[1] * bminmax[1 - fp->pVertexIndex[1]][1]) + (fp->normal[1] * bminmax[1 - fp->pVertexIndex[1]][1]) +
(fp->normal[2] * bminmax[1 - fp->pVertexIndex[2]][2]) + (fp->normal[2] * bminmax[1 - fp->pVertexIndex[2]][2]) -
(fp->offset)) < ((ScalarType)0) (fp->offset)) < ((ScalarType)0)
) { ) {
newMask |= k; newMask |= k;
@ -207,7 +207,7 @@ protected:
if ( if (
((fp->normal[0] * bminmax[fp->pVertexIndex[0]][0]) + ((fp->normal[0] * bminmax[fp->pVertexIndex[0]][0]) +
(fp->normal[1] * bminmax[fp->pVertexIndex[1]][1]) + (fp->normal[1] * bminmax[fp->pVertexIndex[1]][1]) +
(fp->normal[2] * bminmax[fp->pVertexIndex[2]][2]) + (fp->normal[2] * bminmax[fp->pVertexIndex[2]][2]) -
(fp->offset)) < ((ScalarType)0) (fp->offset)) < ((ScalarType)0)
) { ) {
node->Flags() = (node->Flags() & ((~0x0) & (0x7 << ClassType::FC_FIRST_PLANE_BIT))) | (i << ClassType::FC_FIRST_PLANE_BIT); node->Flags() = (node->Flags() & ((~0x0) & (0x7 << ClassType::FC_FIRST_PLANE_BIT))) | (i << ClassType::FC_FIRST_PLANE_BIT);
@ -217,7 +217,7 @@ protected:
if ( if (
((fp->normal[0] * bminmax[1 - fp->pVertexIndex[0]][0]) + ((fp->normal[0] * bminmax[1 - fp->pVertexIndex[0]][0]) +
(fp->normal[1] * bminmax[1 - fp->pVertexIndex[1]][1]) + (fp->normal[1] * bminmax[1 - fp->pVertexIndex[1]][1]) +
(fp->normal[2] * bminmax[1 - fp->pVertexIndex[2]][2]) + (fp->normal[2] * bminmax[1 - fp->pVertexIndex[2]][2]) -
(fp->offset)) < ((ScalarType)0) (fp->offset)) < ((ScalarType)0)
) { ) {
newMask |= k; newMask |= k;