From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/render/textures.cc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/render/textures.cc') diff --git a/src/render/textures.cc b/src/render/textures.cc index 6817aa5..25521e9 100644 --- a/src/render/textures.cc +++ b/src/render/textures.cc @@ -37,7 +37,7 @@ void Textures::init() if (registry.size()) { clear(); } else { - memset(textures,0, sizeof(textures)); + memset(textures, 0, sizeof(textures)); } // "no texture" bitmap @@ -75,7 +75,7 @@ void Textures::list() void Textures::clear() { - for (size_t i=0; i < MAXTEXTURES; i++) { + for (size_t i = 0; i < MAXTEXTURES; i++) { if (textures[i]) { glDeleteTextures(1, &textures[i]); } @@ -83,7 +83,7 @@ void Textures::clear() } registry.clear(); - memset(textures,0, sizeof(textures)); + memset(textures, 0, sizeof(textures)); } void Textures::unload(const std::string &name) @@ -160,7 +160,7 @@ size_t Textures::load(const std::string &name, const bool filter) filename.append(".tga"); image = TGA::load(filename.c_str()); } - + if (!image) { // try the jpg version filename.assign(name); @@ -180,11 +180,11 @@ size_t Textures::load(const std::string &name, const bool filter) int texture_format; int texture_internalformat; - + if (filter) { // scaling functions - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // 4 levels of mipmaps glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 4); @@ -198,10 +198,10 @@ size_t Textures::load(const std::string &name, const bool filter) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } else { // scaling functions - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // no mipmaps, base level only - glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); } //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); @@ -212,15 +212,15 @@ size_t Textures::load(const std::string &name, const bool filter) texture_format = GL_RGB; texture_internalformat = GL_RGB8; } - + if (filter && (r_mipmap->value() <= 0)) { gluBuild2DMipmaps(GL_TEXTURE_2D, - texture_internalformat, image->width(), image->height(), - texture_format, GL_UNSIGNED_BYTE, image->data()); + texture_internalformat, image->width(), image->height(), + texture_format, GL_UNSIGNED_BYTE, image->data()); } else { glTexImage2D(GL_TEXTURE_2D, 0, - texture_internalformat, image->width(), image->height(), 0, - texture_format, GL_UNSIGNED_BYTE, image->data()); + texture_internalformat, image->width(), image->height(), 0, + texture_format, GL_UNSIGNED_BYTE, image->data()); } // add to the registry @@ -260,7 +260,7 @@ size_t Textures::bind(const std::string &name, const bool filter) } else { id = load(name, filter); } - + return id; } -- cgit v1.2.3