diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Decals.cpp | 15 | ||||
-rw-r--r-- | src/Decals.h | 3 | ||||
-rw-r--r-- | src/GameInitDispose.cpp | 61 | ||||
-rw-r--r-- | src/Sprites.cpp | 35 | ||||
-rw-r--r-- | src/Sprites.h | 7 | ||||
-rw-r--r-- | src/Text.cpp | 5 | ||||
-rw-r--r-- | src/Text.h | 1 | ||||
-rw-r--r-- | src/Textures.cpp | 12 | ||||
-rw-r--r-- | src/Textures.h | 3 |
9 files changed, 32 insertions, 110 deletions
diff --git a/src/Decals.cpp b/src/Decals.cpp index 30db128..ad98343 100644 --- a/src/Decals.cpp +++ b/src/Decals.cpp @@ -274,21 +274,6 @@ int Decals::DeleteDecal(int which){ return 0; } -void Decals::LoadBulletHoleTexture(char *fileName) -{ - bulletholetextureptr = loadTexture(fileName); -} - -void Decals::LoadBloodTexture(char *fileName, int which) -{ - bloodtextureptr[which] = loadTexture(fileName); -} - -void Decals::LoadCraterTexture(char *fileName) -{ - cratertextureptr = loadTexture(fileName); -} - void Decals::DoStuff() { for(int i=0;i<howmanydecals;i++){ diff --git a/src/Decals.h b/src/Decals.h index f63a0ca..c4e3a5a 100644 --- a/src/Decals.h +++ b/src/Decals.h @@ -52,9 +52,6 @@ public: int MakeDecal(int atype, XYZ location, float size, XYZ normal, int poly, Model *model, XYZ move, float rotation); void DoStuff(); - void LoadBulletHoleTexture(char *fileName); - void LoadCraterTexture(char *fileName); - void LoadBloodTexture(char *fileName, int which); ~Decals(); }; #endif // BLACKSHADES_DECALS_H diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp index ef5770e..c5c803e 100644 --- a/src/GameInitDispose.cpp +++ b/src/GameInitDispose.cpp @@ -411,13 +411,6 @@ void Game::LoadingScreen(float percent) glfwSwapBuffers(glfwGetCurrentContext()); } -void LoadPersonSpriteTexture(char *fileName, GLuint *textureid) -{ - *textureid = loadTexture(fileName); - glBindTexture(GL_TEXTURE_2D, *textureid); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); -} - void initGame(Game* game) { // Setup loading screen @@ -1749,33 +1742,31 @@ void initGame(Game* game) // Load some textures if (!game->initialized) { - LoadPersonSpriteTexture((char*) ":Data:Textures:Personsprite.png", - &game->personspritetextureptr); - LoadPersonSpriteTexture((char*) ":Data:Textures:DeadPersonsprite.png", - &game->deadpersonspritetextureptr); - LoadPersonSpriteTexture((char*) ":Data:Textures:Scope.png", - &game->scopetextureptr); - LoadPersonSpriteTexture((char*) ":Data:Textures:Flare.png", - &game->flaretextureptr); - sprites.LoadFlareTexture((char*) ":Data:Textures:HitFlash.png"); - sprites.LoadMuzzleFlareTexture((char*) ":Data:Textures:MuzzleFlash.png"); - sprites.LoadSmokeTexture((char*) ":Data:Textures:Smoke.png"); - sprites.LoadBloodTexture((char*) ":Data:Textures:Blood.png"); - sprites.LoadRainTexture((char*) ":Data:Textures:rain.png"); - sprites.LoadSnowTexture((char*) ":Data:Textures:snow.png"); - decals.LoadBulletHoleTexture((char*) ":Data:Textures:BulletHole.png"); - decals.LoadCraterTexture((char*) ":Data:Textures:Crater.png"); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood1.png", 0); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood2.png", 1); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood3.png", 2); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood4.png", 3); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood5.png", 4); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood6.png", 5); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood7.png", 6); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood8.png", 7); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood9.png", 8); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood10.png", 9); - decals.LoadBloodTexture((char*) ":Data:Textures:Blood:Blood11.png", 10); + game->personspritetextureptr = loadTexture((char*) ":Data:Textures:Personsprite.png"); + game->deadpersonspritetextureptr = loadTexture((char*) ":Data:Textures:DeadPersonsprite.png"); + game->scopetextureptr = loadTexture((char*) ":Data:Textures:Scope.png"); + game->flaretextureptr = loadTexture((char*) ":Data:Textures:Flare.png"); + + sprites.flaretextureptr = loadTexture((char*) ":Data:Textures:HitFlash.png"); + sprites.muzzleflaretextureptr = loadTexture((char*) ":Data:Textures:MuzzleFlash.png"); + sprites.smoketextureptr = loadTexture((char*) ":Data:Textures:Smoke.png"); + sprites.bloodtextureptr = loadTexture((char*) ":Data:Textures:Blood.png"); + sprites.raintextureptr = loadTexture((char*) ":Data:Textures:rain.png"); + sprites.snowtextureptr = loadTexture((char*) ":Data:Textures:snow.png"); + + decals.bulletholetextureptr = loadTexture((char*) ":Data:Textures:BulletHole.png"); + decals.cratertextureptr = loadTexture((char*) ":Data:Textures:Crater.png"); + decals.bloodtextureptr[0] = loadTexture((char*) ":Data:Textures:Blood:Blood1.png"); + decals.bloodtextureptr[1] = loadTexture((char*) ":Data:Textures:Blood:Blood2.png"); + decals.bloodtextureptr[2] = loadTexture((char*) ":Data:Textures:Blood:Blood3.png"); + decals.bloodtextureptr[3] = loadTexture((char*) ":Data:Textures:Blood:Blood4.png"); + decals.bloodtextureptr[4] = loadTexture((char*) ":Data:Textures:Blood:Blood5.png"); + decals.bloodtextureptr[5] = loadTexture((char*) ":Data:Textures:Blood:Blood6.png"); + decals.bloodtextureptr[6] = loadTexture((char*) ":Data:Textures:Blood:Blood7.png"); + decals.bloodtextureptr[7] = loadTexture((char*) ":Data:Textures:Blood:Blood8.png"); + decals.bloodtextureptr[8] = loadTexture((char*) ":Data:Textures:Blood:Blood9.png"); + decals.bloodtextureptr[9] = loadTexture((char*) ":Data:Textures:Blood:Blood10.png"); + decals.bloodtextureptr[10] = loadTexture((char*) ":Data:Textures:Blood:Blood11.png"); } // Setup clip plane equation @@ -1811,7 +1802,7 @@ void initGame(Game* game) void initGl(Game* game) { - game->text.LoadFontTexture((char*) ":Data:Textures:Font.png"); + game->text.FontTexture = loadTexture((char*) ":Data:Textures:Font.png"); game->text.BuildFont(); glAlphaFunc(GL_GREATER, 0.01); glDepthFunc(GL_LESS); diff --git a/src/Sprites.cpp b/src/Sprites.cpp index 2459593..df8eeb1 100644 --- a/src/Sprites.cpp +++ b/src/Sprites.cpp @@ -83,41 +83,6 @@ int Sprites::DeleteSprite(int which){ return 0; } -void Sprites::LoadFlareTexture(char *fileName) -{ - flaretextureptr = loadTexture(fileName); -} - -void Sprites::LoadMuzzleFlareTexture(char *fileName) -{ - muzzleflaretextureptr = loadTexture(fileName); -} - -void Sprites::LoadSmokeTexture(char *fileName) -{ - smoketextureptr = loadTexture(fileName); -} - -void Sprites::LoadBloodTexture(char *fileName) -{ - bloodtextureptr = loadTexture(fileName); -} - -void Sprites::LoadRainTexture(char *fileName) -{ - raintextureptr = loadTexture(fileName); -} - -void Sprites::LoadSnowTexture(char *fileName) -{ - snowtextureptr = loadTexture(fileName); -} - -void Sprites::LoadBulletTexture(char *fileName) -{ - bullettextureptr = loadTexture(fileName); -} - void Sprites::DoStuff() { for(int i=0;i<howmanysprites;i++){ diff --git a/src/Sprites.h b/src/Sprites.h index 5b2b0f9..734c71c 100644 --- a/src/Sprites.h +++ b/src/Sprites.h @@ -87,13 +87,6 @@ public: XYZ alocation, XYZ avelocity, float asize, int aowner); void DoStuff(); - void LoadMuzzleFlareTexture(char *fileName); - void LoadFlareTexture(char *fileName); - void LoadSmokeTexture(char *fileName); - void LoadBulletTexture(char *fileName); - void LoadBloodTexture(char *fileName); - void LoadSnowTexture(char *fileName); - void LoadRainTexture(char *fileName); ~Sprites(); }; #endif // BLACKSHADES_SPRITES_H diff --git a/src/Text.cpp b/src/Text.cpp index 2329360..5da702b 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -2,11 +2,6 @@ #include "Text.h" #include "Textures.h" -void Text::LoadFontTexture(char *fileName) -{ - FontTexture = loadTexture(fileName); -} - void Text::BuildFont() // Build Our Font Display List { float cx; // Holds Our X Character Coord diff --git a/src/Text.h b/src/Text.h index af25c2d..f284e43 100644 --- a/src/Text.h +++ b/src/Text.h @@ -33,7 +33,6 @@ public: GLuint FontTexture; GLuint base; - void LoadFontTexture(char *fileName); void BuildFont(); void glPrint(GLint x, GLint y, char *string, int set, float size, float width, float height); diff --git a/src/Textures.cpp b/src/Textures.cpp index 9e22c87..78808a1 100644 --- a/src/Textures.cpp +++ b/src/Textures.cpp @@ -24,8 +24,7 @@ #include "Textures.h" -GLuint loadTexture(const char* filename_, GLenum minFilter, - GLenum magFilter, bool mipmaps) +GLuint loadTexture(const char* filename_) { // TODO: get rid of the :Data: thing char filename[1024]; @@ -50,8 +49,8 @@ GLuint loadTexture(const char* filename_, GLenum minFilter, glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); GLint internal_format; GLenum pixel_format; @@ -66,9 +65,8 @@ GLuint loadTexture(const char* filename_, GLenum minFilter, glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, pixel_format, GL_UNSIGNED_BYTE, data); - if (mipmaps) - gluBuild2DMipmaps(GL_TEXTURE_2D, internal_format, width, height, - pixel_format, GL_UNSIGNED_BYTE, data); + gluBuild2DMipmaps(GL_TEXTURE_2D, internal_format, width, height, + pixel_format, GL_UNSIGNED_BYTE, data); stbi_image_free(data); return tex; diff --git a/src/Textures.h b/src/Textures.h index d9fb92a..abed931 100644 --- a/src/Textures.h +++ b/src/Textures.h @@ -21,7 +21,6 @@ #include <GL/gl.h> -GLuint loadTexture(const char* filename, GLenum minFilter = GL_LINEAR, - GLenum magFilter = GL_LINEAR, bool mipmaps = true); +GLuint loadTexture(const char*); #endif // BLACKSHADES_TEXTURES_H |