mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 14:02:57 +02:00
make view frustum culling default behavior, removed soem debug printf()s for now
This commit is contained in:
parent
978a41f6ca
commit
9d17dc0387
2 changed files with 15 additions and 17 deletions
|
@ -192,16 +192,16 @@ int ViewFrustum::sphereInFrustum(const glm::vec3& center, float radius) const {
|
||||||
|
|
||||||
int ViewFrustum::boxInFrustum(const AABox& box) const {
|
int ViewFrustum::boxInFrustum(const AABox& box) const {
|
||||||
|
|
||||||
printf("ViewFrustum::boxInFrustum() box.corner=%f,%f,%f x=%f\n",
|
//printf("ViewFrustum::boxInFrustum() box.corner=%f,%f,%f x=%f\n",
|
||||||
box.getCorner().x,box.getCorner().y,box.getCorner().z,box.getSize().x);
|
// box.getCorner().x,box.getCorner().y,box.getCorner().z,box.getSize().x);
|
||||||
int result = INSIDE;
|
int result = INSIDE;
|
||||||
for(int i=0; i < 6; i++) {
|
for(int i=0; i < 6; i++) {
|
||||||
|
|
||||||
printf("plane[%d] -- point(%f,%f,%f) normal(%f,%f,%f) d=%f \n",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].getPoint().x, _planes[i].getPoint().y, _planes[i].getPoint().z,
|
||||||
_planes[i].getNormal().x, _planes[i].getNormal().y, _planes[i].getNormal().z,
|
// _planes[i].getNormal().x, _planes[i].getNormal().y, _planes[i].getNormal().z,
|
||||||
_planes[i].getDCoefficient()
|
// _planes[i].getDCoefficient()
|
||||||
);
|
//);
|
||||||
|
|
||||||
glm::vec3 normal = _planes[i].getNormal();
|
glm::vec3 normal = _planes[i].getNormal();
|
||||||
glm::vec3 boxVertexP = box.getVertexP(normal);
|
glm::vec3 boxVertexP = box.getVertexP(normal);
|
||||||
|
@ -210,13 +210,11 @@ int ViewFrustum::boxInFrustum(const AABox& box) const {
|
||||||
glm::vec3 boxVertexN = box.getVertexN(normal);
|
glm::vec3 boxVertexN = box.getVertexN(normal);
|
||||||
float planeToBoxVertexNDistance = _planes[i].distance(boxVertexN);
|
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,
|
||||||
printf("plane[%d] normal=(%f,%f,%f) bVertexP=(%f,%f,%f) planeToBoxVertexPDistance=%f boxVertexN=(%f,%f,%f) planeToBoxVertexNDistance=%f\n",i,
|
// boxVertexP.x,boxVertexP.y,boxVertexP.z,planeToBoxVertexPDistance,
|
||||||
normal.x,normal.y,normal.z,
|
// boxVertexN.x,boxVertexN.y,boxVertexN.z,planeToBoxVertexNDistance
|
||||||
boxVertexP.x,boxVertexP.y,boxVertexP.z,planeToBoxVertexPDistance,
|
// );
|
||||||
boxVertexN.x,boxVertexN.y,boxVertexN.z,planeToBoxVertexNDistance
|
|
||||||
);
|
|
||||||
|
|
||||||
if (planeToBoxVertexPDistance < 0) {
|
if (planeToBoxVertexPDistance < 0) {
|
||||||
return OUTSIDE;
|
return OUTSIDE;
|
||||||
|
|
|
@ -49,7 +49,7 @@ VoxelTree randomTree;
|
||||||
|
|
||||||
bool wantColorRandomizer = false;
|
bool wantColorRandomizer = false;
|
||||||
bool debugViewFrustum = false;
|
bool debugViewFrustum = false;
|
||||||
bool viewFrustumCulling = false; // for now
|
bool viewFrustumCulling = true; // for now
|
||||||
|
|
||||||
void addSphere(VoxelTree * tree,bool random, bool wantColorRandomizer) {
|
void addSphere(VoxelTree * tree,bool random, bool wantColorRandomizer) {
|
||||||
float r = random ? randFloatInRange(0.05,0.1) : 0.25;
|
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);
|
::debugViewFrustum = cmdOptionExists(argc, argv, DEBUG_VIEW_FRUSTUM);
|
||||||
printf("debugViewFrustum=%s\n", (::debugViewFrustum ? "yes" : "no"));
|
printf("debugViewFrustum=%s\n", (::debugViewFrustum ? "yes" : "no"));
|
||||||
|
|
||||||
const char* VIEW_FRUSTUM_CULLING = "--ViewFrustumCulling";
|
const char* NO_VIEW_FRUSTUM_CULLING = "--NoViewFrustumCulling";
|
||||||
::viewFrustumCulling = cmdOptionExists(argc, argv, VIEW_FRUSTUM_CULLING);
|
::viewFrustumCulling = !cmdOptionExists(argc, argv, NO_VIEW_FRUSTUM_CULLING);
|
||||||
printf("viewFrustumCulling=%s\n", (::viewFrustumCulling ? "yes" : "no"));
|
printf("viewFrustumCulling=%s\n", (::viewFrustumCulling ? "yes" : "no"));
|
||||||
|
|
||||||
const char* WANT_COLOR_RANDOMIZER = "--WantColorRandomizer";
|
const char* WANT_COLOR_RANDOMIZER = "--WantColorRandomizer";
|
||||||
|
|
Loading…
Reference in a new issue