#include "Objects.h"
extern XYZ viewer;
extern float viewdistance;
-extern float lightambient[3],lightbrightness[3];
extern float fadestart;
extern int environment;
extern float texscale;
extern float targetblurness;
extern Objects objects;
extern TGAImageRec texture;
-extern Game * pgame;
extern bool visibleloading;
extern bool skyboxtexture;
extern int tutoriallevel;
}
}
texture.bpp=24;
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
texdetail=temptexdetail;
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
float slopeness;
textureness[i][j]=-1;
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
for(i=0;i<size;i++){
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
for(i=0;i<size;i++){
for(j=0;j<size;j++){
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
/*float total;
int todivide;
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
patch_size=size/subdivision;
patch_elements=(patch_size)*(patch_size)*54;
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);
}
}
if(decaltype[i]==footprintdecal&&decaltype[i]!=lasttype){
- glBindTexture( GL_TEXTURE_2D, footprinttexture);
+ footprinttexture.bind();
if(!blend){
blend=1;
glAlphaFunc(GL_GREATER, 0.0001);
}
}
if(decaltype[i]==bodyprintdecal&&decaltype[i]!=lasttype){
- glBindTexture( GL_TEXTURE_2D, bodyprinttexture);
+ bodyprinttexture.bind();
if(!blend){
blend=1;
glAlphaFunc(GL_GREATER, 0.0001);
}
}
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);
}
}
if((decaltype[i]==blooddecalfast)&&decaltype[i]!=lasttype){
- glBindTexture( GL_TEXTURE_2D, bloodtexture2);
+ bloodtexture2.bind();
if(blend){
blend=0;
glAlphaFunc(GL_GREATER, 0.15);
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);
}
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
}
brightness=dotproduct(&lightloc,&normals[i][j]);
if(shadowed)brightness*=1-shadowed;
}
}
- if(visibleloading)pgame->LoadingScreen();
+ if(visibleloading) Game::LoadingScreen();
//Smooth shadows
for(i=0;i<size;i++){
Terrain::Terrain()
{
- bloodtexture = 0;
- bloodtexture2 = 0;
- shadowtexture = 0;
- footprinttexture = 0;
- bodyprinttexture = 0;
- breaktexture = 0;
- terraintexture = 0;
size = 0;
memset(patchobjectnum, 0, sizeof(patchobjectnum));
}
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();
}