diff options
| author | zakk <zakk@5198baeb-e213-0410-be47-fc2ff85ca46f> | 2008-02-12 23:19:39 +0000 |
|---|---|---|
| committer | zakk <zakk@5198baeb-e213-0410-be47-fc2ff85ca46f> | 2008-02-12 23:19:39 +0000 |
| commit | 93c589034b80253f9653b192eda2a882f311c80b (patch) | |
| tree | 354b22a2338d4d24047e417c574f7d565d56dba7 /Source/Decals.cpp | |
| parent | 76ec0c3729dc9e8808a5db339148ad7454105537 (diff) | |
| download | blackshades-93c589034b80253f9653b192eda2a882f311c80b.tar.gz | |
PNG patch from Victor Eremin (ErV2005@rambler.ru)
git-svn-id: svn://svn.icculus.org/blackshades/trunk@107 5198baeb-e213-0410-be47-fc2ff85ca46f
Diffstat (limited to 'Source/Decals.cpp')
| -rw-r--r-- | Source/Decals.cpp | 82 |
1 files changed, 4 insertions, 78 deletions
diff --git a/Source/Decals.cpp b/Source/Decals.cpp index 612b89c..3cebb4c 100644 --- a/Source/Decals.cpp +++ b/Source/Decals.cpp @@ -1,4 +1,5 @@ #include "Decals.h" +#include "Textures.h" extern double multiplier; extern bool slomo; @@ -276,92 +277,17 @@ int Decals::DeleteDecal(int which){ void Decals::LoadBulletHoleTexture(char *fileName) { - TGAImageRec *tempTexture; - GLuint type; - - //Load Image - tempTexture = LoadTGA( fileName ); - //Is it valid? - if(tempTexture){ - //Alpha channel? - if ( tempTexture->bpp == 24 ) - type = GL_RGB; - else - type = GL_RGBA; - - glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); - - glGenTextures( 1, &bulletholetextureptr ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - - glBindTexture( GL_TEXTURE_2D, bulletholetextureptr); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - - gluBuild2DMipmaps( GL_TEXTURE_2D, type, tempTexture->sizeX, tempTexture->sizeY, type, GL_UNSIGNED_BYTE, tempTexture->data ); - free( tempTexture->data ); - free( tempTexture ); - } + bulletholetextureptr = loadTexture(fileName); } void Decals::LoadBloodTexture(char *fileName, int which) { - TGAImageRec *tempTexture; - GLuint type; - - //Load Image - tempTexture = LoadTGA( fileName ); - //Is it valid? - if(tempTexture){ - //Alpha channel? - if ( tempTexture->bpp == 24 ) - type = GL_RGB; - else - type = GL_RGBA; - - glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); - - glGenTextures( 1, &bloodtextureptr[which] ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - - glBindTexture( GL_TEXTURE_2D, bloodtextureptr[which]); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - - gluBuild2DMipmaps( GL_TEXTURE_2D, type, tempTexture->sizeX, tempTexture->sizeY, type, GL_UNSIGNED_BYTE, tempTexture->data ); - free( tempTexture->data ); - free( tempTexture ); - } + bloodtextureptr[which] = loadTexture(fileName); } void Decals::LoadCraterTexture(char *fileName) { - TGAImageRec *tempTexture; - GLuint type; - - //Load Image - tempTexture = LoadTGA( fileName ); - //Is it valid? - if(tempTexture){ - //Alpha channel? - if ( tempTexture->bpp == 24 ) - type = GL_RGB; - else - type = GL_RGBA; - - glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); - - glGenTextures( 1, &cratertextureptr ); - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - - glBindTexture( GL_TEXTURE_2D, cratertextureptr); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - - gluBuild2DMipmaps( GL_TEXTURE_2D, type, tempTexture->sizeX, tempTexture->sizeY, type, GL_UNSIGNED_BYTE, tempTexture->data ); - free( tempTexture->data ); - free( tempTexture ); - } + cratertextureptr = loadTexture(fileName); } void Decals::DoStuff() |
