make view frustum culling default behavior, removed soem debug printf()s for now

This commit is contained in:
ZappoMan 2013-04-22 17:43:28 -07:00
parent 978a41f6ca
commit 9d17dc0387
2 changed files with 15 additions and 17 deletions

View file

@ -192,16 +192,16 @@ int ViewFrustum::sphereInFrustum(const glm::vec3& center, float radius) const {
int ViewFrustum::boxInFrustum(const AABox& box) const {
printf("ViewFrustum::boxInFrustum() box.corner=%f,%f,%f x=%f\n",
box.getCorner().x,box.getCorner().y,box.getCorner().z,box.getSize().x);
//printf("ViewFrustum::boxInFrustum() box.corner=%f,%f,%f x=%f\n",
// box.getCorner().x,box.getCorner().y,box.getCorner().z,box.getSize().x);
int result = INSIDE;
for(int i=0; i < 6; i++) {
printf("plane[%d] -- point(%f,%f,%f) normal(%f,%f,%f) d=%f \n",i,
_planes[i].getPoint().x, _planes[i].getPoint().y, _planes[i].getPoint().z,
_planes[i].getNormal().x, _planes[i].getNormal().y, _planes[i].getNormal().z,
_planes[i].getDCoefficient()
);
//printf("plane[%d] -- point(%f,%f,%f) normal(%f,%f,%f) d=%f \n",i,
// _planes[i].getPoint().x, _planes[i].getPoint().y, _planes[i].getPoint().z,
// _planes[i].getNormal().x, _planes[i].getNormal().y, _planes[i].getNormal().z,
// _planes[i].getDCoefficient()
//);
glm::vec3 normal = _planes[i].getNormal();
glm::vec3 boxVertexP = box.getVertexP(normal);
@ -210,13 +210,11 @@ int ViewFrustum::boxInFrustum(const AABox& box) const {
glm::vec3 boxVertexN = box.getVertexN(normal);
float planeToBoxVertexNDistance = _planes[i].distance(boxVertexN);
printf("plane[%d] normal=(%f,%f,%f) bVertexP=(%f,%f,%f) planeToBoxVertexPDistance=%f boxVertexN=(%f,%f,%f) planeToBoxVertexNDistance=%f\n",i,
normal.x,normal.y,normal.z,
boxVertexP.x,boxVertexP.y,boxVertexP.z,planeToBoxVertexPDistance,
boxVertexN.x,boxVertexN.y,boxVertexN.z,planeToBoxVertexNDistance
);
//printf("plane[%d] normal=(%f,%f,%f) bVertexP=(%f,%f,%f) planeToBoxVertexPDistance=%f boxVertexN=(%f,%f,%f) planeToBoxVertexNDistance=%f\n",i,
// normal.x,normal.y,normal.z,
// boxVertexP.x,boxVertexP.y,boxVertexP.z,planeToBoxVertexPDistance,
// boxVertexN.x,boxVertexN.y,boxVertexN.z,planeToBoxVertexNDistance
// );
if (planeToBoxVertexPDistance < 0) {
return OUTSIDE;

View file

@ -49,7 +49,7 @@ VoxelTree randomTree;
bool wantColorRandomizer = false;
bool debugViewFrustum = false;
bool viewFrustumCulling = false; // for now
bool viewFrustumCulling = true; // for now
void addSphere(VoxelTree * tree,bool random, bool wantColorRandomizer) {
float r = random ? randFloatInRange(0.05,0.1) : 0.25;
@ -276,8 +276,8 @@ int main(int argc, const char * argv[])
::debugViewFrustum = cmdOptionExists(argc, argv, DEBUG_VIEW_FRUSTUM);
printf("debugViewFrustum=%s\n", (::debugViewFrustum ? "yes" : "no"));
const char* VIEW_FRUSTUM_CULLING = "--ViewFrustumCulling";
::viewFrustumCulling = cmdOptionExists(argc, argv, VIEW_FRUSTUM_CULLING);
const char* NO_VIEW_FRUSTUM_CULLING = "--NoViewFrustumCulling";
::viewFrustumCulling = !cmdOptionExists(argc, argv, NO_VIEW_FRUSTUM_CULLING);
printf("viewFrustumCulling=%s\n", (::viewFrustumCulling ? "yes" : "no"));
const char* WANT_COLOR_RANDOMIZER = "--WantColorRandomizer";