From cf4844f4a4ee072cb0991df567ae4f02427c8246 Mon Sep 17 00:00:00 2001 From: malomo Date: Thu, 26 Sep 2013 11:16:26 +0000 Subject: [PATCH] fixed a bug in frustum culling. objects that are not in the halfspace determined by the plane direction will be culled. --- vcg/space/index/aabb_binary_tree/frustum_cull.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vcg/space/index/aabb_binary_tree/frustum_cull.h b/vcg/space/index/aabb_binary_tree/frustum_cull.h index e7da545a..d04914e3 100644 --- a/vcg/space/index/aabb_binary_tree/frustum_cull.h +++ b/vcg/space/index/aabb_binary_tree/frustum_cull.h @@ -183,7 +183,7 @@ protected: if ( ((fp->normal[0] * bminmax[fp->pVertexIndex[0]][0]) + (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) ) { return; @@ -192,7 +192,7 @@ protected: if ( ((fp->normal[0] * bminmax[1 - fp->pVertexIndex[0]][0]) + (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) ) { newMask |= k; @@ -207,7 +207,7 @@ protected: if ( ((fp->normal[0] * bminmax[fp->pVertexIndex[0]][0]) + (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) ) { node->Flags() = (node->Flags() & ((~0x0) & (0x7 << ClassType::FC_FIRST_PLANE_BIT))) | (i << ClassType::FC_FIRST_PLANE_BIT); @@ -217,7 +217,7 @@ protected: if ( ((fp->normal[0] * bminmax[1 - fp->pVertexIndex[0]][0]) + (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) ) { newMask |= k;