X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FObjects.cpp;h=06c8b8bdd360f41c9c8f754971a2c514ddde6e71;hb=8557e339c9a2d10afdf6465e02eca6b87efc961f;hp=353fa6e31f74b8d88215b2aa40928466b447bd74;hpb=9e06cb73424ca3f0eb971350c5dfb3cdaec0d5bf;p=lugaru.git diff --git a/Source/Objects.cpp b/Source/Objects.cpp index 353fa6e..06c8b8b 100644 --- a/Source/Objects.cpp +++ b/Source/Objects.cpp @@ -90,9 +90,9 @@ void Objects::Draw() if(type[i]!=firetype){ moved=DoRotation(model[i].boundingspherecenter,0,yaw[i],0); if(type[i]==tunneltype||frustum.SphereInFrustum(position[i].x+moved.x,position[i].y+moved.y,position[i].z+moved.z,model[i].boundingsphereradius)){ - distance=findDistancefast(&viewer,&position[i]); + distance=distsq(&viewer,&position[i]); distance*=1.2; - hidden=!(findDistancefastflat(&viewer,&position[i])>playerdist+3||(type[i]!=bushtype&&type[i]!=treeleavestype)); + hidden=!(distsqflat(&viewer,&position[i])>playerdist+3||(type[i]!=bushtype&&type[i]!=treeleavestype)); if(!hidden){ if(detail==2&&distance>viewdistance*viewdistance/4&&environment==desertenvironment)glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, blurness ); @@ -329,7 +329,7 @@ void Objects::Draw() if(type[i]==treeleavestype||type[i]==bushtype){ moved=DoRotation(model[i].boundingspherecenter,0,yaw[i],0); if(frustum.SphereInFrustum(position[i].x+moved.x,position[i].y+moved.y,position[i].z+moved.z,model[i].boundingsphereradius)){ - hidden=findDistancefastflat(&viewer,&position[i])<=playerdist+3; + hidden=distsqflat(&viewer,&position[i])<=playerdist+3; if(hidden){ distance=1; if(distance>0){ @@ -759,10 +759,6 @@ Objects::Objects() center = 0; radius = 0; numobjects = 0; - boxtextureptr = 0; - treetextureptr = 0; - bushtextureptr = 0; - rocktextureptr = 0; memset(position, 0, sizeof(position)); memset(type, 0, sizeof(type)); @@ -787,9 +783,9 @@ Objects::Objects() Objects::~Objects() { - if (boxtextureptr) glDeleteTextures( 1, &boxtextureptr ); - if (treetextureptr) glDeleteTextures( 1, &treetextureptr ); - if (bushtextureptr) glDeleteTextures( 1, &bushtextureptr ); - if (rocktextureptr) glDeleteTextures( 1, &rocktextureptr ); + boxtextureptr.destroy(); + treetextureptr.destroy(); + bushtextureptr.destroy(); + rocktextureptr.destroy(); };