]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Terrain.cpp
get it to compile on my mingw setup
[lugaru.git] / Source / Terrain.cpp
index 4c4ff7429afa3a3da34684225c29f776e6fa006b..ecc8757b7dc953971759fb7a595eff6a1b587cd6 100644 (file)
@@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "Objects.h"
 extern XYZ viewer;
 extern float viewdistance;
-extern float lightambient[3],lightbrightness[3];
 extern float fadestart;
 extern int environment;
 extern float texscale;
@@ -1048,7 +1047,7 @@ void Terrain::drawdecals()
                for(i=0;i<numdecals;i++){
                        if(decaltype[i]==blooddecalfast&&decalalivetime[i]<2)decalalivetime[i]=2;
                        if((decaltype[i]==shadowdecal||decaltype[i]==shadowdecalpermanent)&&decaltype[i]!=lasttype){
-                               glBindTexture( GL_TEXTURE_2D, shadowtexture);
+                               shadowtexture.bind();
                                if(!blend){
                                        blend=1;
                                        glAlphaFunc(GL_GREATER, 0.0001);
@@ -1056,7 +1055,7 @@ void Terrain::drawdecals()
                                }
                        }
                        if(decaltype[i]==footprintdecal&&decaltype[i]!=lasttype){
-                               glBindTexture( GL_TEXTURE_2D, footprinttexture);
+                               footprinttexture.bind();
                                if(!blend){
                                        blend=1;
                                        glAlphaFunc(GL_GREATER, 0.0001);
@@ -1064,7 +1063,7 @@ void Terrain::drawdecals()
                                }
                        }
                        if(decaltype[i]==bodyprintdecal&&decaltype[i]!=lasttype){
-                               glBindTexture( GL_TEXTURE_2D, bodyprinttexture);
+                               bodyprinttexture.bind();
                                if(!blend){
                                        blend=1;
                                        glAlphaFunc(GL_GREATER, 0.0001);
@@ -1072,7 +1071,7 @@ void Terrain::drawdecals()
                                }
                        }
                        if((decaltype[i]==blooddecal||decaltype[i]==blooddecalslow)&&decaltype[i]!=lasttype){
-                               glBindTexture( GL_TEXTURE_2D, bloodtexture);
+                               bloodtexture.bind();
                                if(blend){
                                        blend=0;
                                        glAlphaFunc(GL_GREATER, 0.15);
@@ -1080,7 +1079,7 @@ void Terrain::drawdecals()
                                }
                        }
                        if((decaltype[i]==blooddecalfast)&&decaltype[i]!=lasttype){
-                               glBindTexture( GL_TEXTURE_2D, bloodtexture2);
+                               bloodtexture2.bind();
                                if(blend){
                                        blend=0;
                                        glAlphaFunc(GL_GREATER, 0.15);
@@ -1459,7 +1458,7 @@ void Terrain::DoShadows()
                                        if(objects.type[l]!=treetrunktype){
                                                testpoint=terrainpoint;
                                                testpoint2=terrainpoint+lightloc*50*(1-shadowed);
-                                               if(objects.model[l].LineCheck(&testpoint,&testpoint2,&col,&objects.position[l],&objects.rotation[l])!=-1){
+                                               if(objects.model[l].LineCheck(&testpoint,&testpoint2,&col,&objects.position[l],&objects.yaw[l])!=-1){
                                                        shadowed=1-(findDistance(&terrainpoint,&col)/50);       
                                                }
                                        }
@@ -1517,13 +1516,6 @@ void Terrain::DoShadows()
 
 Terrain::Terrain()
 {
-       bloodtexture = 0;
-       bloodtexture2 = 0;
-       shadowtexture = 0;
-       footprinttexture = 0;
-       bodyprinttexture = 0;
-       breaktexture = 0;
-       terraintexture = 0;
        size = 0;
 
        memset(patchobjectnum, 0, sizeof(patchobjectnum));
@@ -1564,12 +1556,12 @@ Terrain::Terrain()
 }
 Terrain::~Terrain()
 {
-       if(terraintexture)glDeleteTextures( 1, &terraintexture );
-       if(shadowtexture) glDeleteTextures( 1, &shadowtexture );
-       if(bodyprinttexture) glDeleteTextures( 1, &bodyprinttexture );
-       if(footprinttexture) glDeleteTextures( 1, &footprinttexture );
-       if(bloodtexture) glDeleteTextures( 1, &bloodtexture );
-       if(bloodtexture2) glDeleteTextures( 1, &bloodtexture2 );
-       if(breaktexture) glDeleteTextures( 1, &breaktexture );
+       terraintexture.destroy();
+       shadowtexture.destroy();
+       bodyprinttexture.destroy();
+       footprinttexture.destroy();
+       bloodtexture.destroy();
+       bloodtexture2.destroy();
+       breaktexture.destroy();
 }