]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Objects.cpp
rename for readability
[lugaru.git] / Source / Objects.cpp
index 353fa6e31f74b8d88215b2aa40928466b447bd74..06c8b8bdd360f41c9c8f754971a2c514ddde6e71 100644 (file)
@@ -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();
 };