summaryrefslogtreecommitdiff
path: root/lib/texture.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/texture.cc')
-rw-r--r--lib/texture.cc66
1 files changed, 33 insertions, 33 deletions
diff --git a/lib/texture.cc b/lib/texture.cc
index aa927c8..4ba5572 100644
--- a/lib/texture.cc
+++ b/lib/texture.cc
@@ -17,28 +17,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: texture.cc,v 1.14 2006-02-02 17:29:05 pixel Exp $ */
+/* $Id: texture.cc,v 1.15 2006-10-28 16:50:47 pixel Exp $ */
#include <sys/types.h>
#include <SDL.h>
#include <SDL_opengl.h>
#include <generic.h>
-#include "texture.h"
+#include "Texture.h"
#include "engine.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gettext.h"
-mogltk::texture * mogltk::texture::header = 0;
-mogltk::texture * mogltk::texture::footer = 0;
+mogltk::Texture * mogltk::Texture::header = 0;
+mogltk::Texture * mogltk::Texture::footer = 0;
-mogltk::texture * mogltk::texture::active = 0;
+mogltk::Texture * mogltk::Texture::active = 0;
-mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : width(w), height(h),
+mogltk::Texture::Texture(int w, int h, bool plane) throw (GeneralException) : width(w), height(h),
texture_allocated(false), planar(plane), tainted(true), taintable(true) {
if ((!ISPOT(w)) || (!ISPOT(h)))
- throw GeneralException(_("Size of the texture not a power of 2!"));
+ throw GeneralException(_("Size of the Texture not a power of 2!"));
if (!(surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -69,7 +69,7 @@ mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : wi
}
}
-mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
+mogltk::Texture::Texture(Handle * h, bool plane) throw (GeneralException) :
texture_allocated(false), planar(plane), tainted(true), taintable(true) {
SDL_Surface * temp;
@@ -78,11 +78,11 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
width = temp->w;
height = temp->h;
- printm(M_INFO, "Creating texture from file: size %ix%i\n", height, width);
+ printm(M_INFO, "Creating Texture from file: size %ix%i\n", height, width);
if ((!ISPOT(width)) || (!ISPOT(height))) {
SDL_FreeSurface(temp);
- throw GeneralException(_("Size of the texture not a power of 2!"));
+ throw GeneralException(_("Size of the Texture not a power of 2!"));
}
SDL_PixelFormat f;
@@ -115,7 +115,7 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
f.Aloss = 0;
if (!(surface = SDL_ConvertSurface(temp, &f, 0))) {
- throw GeneralException("Could not convert texture to OpenGL format");
+ throw GeneralException("Could not convert Texture to OpenGL format");
}
SDL_FreeSurface(temp);
@@ -131,16 +131,16 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
}
}
-mogltk::texture::texture(SDL_Surface * temp, bool plane) throw (GeneralException) :
+mogltk::Texture::Texture(SDL_Surface * temp, bool plane) throw (GeneralException) :
texture_allocated(false), planar(plane), tainted(true), taintable(true) {
width = temp->w;
height = temp->h;
- printm(M_INFO, "Creating texture from file: size %ix%i\n", height, width);
+ printm(M_INFO, "Creating Texture from file: size %ix%i\n", height, width);
if ((!ISPOT(width)) || (!ISPOT(height))) {
- throw GeneralException(_("Size of the texture not a power of 2!"));
+ throw GeneralException(_("Size of the Texture not a power of 2!"));
}
SDL_PixelFormat f;
@@ -173,7 +173,7 @@ mogltk::texture::texture(SDL_Surface * temp, bool plane) throw (GeneralException
f.Aloss = 0;
if (!(surface = SDL_ConvertSurface(temp, &f, 0))) {
- throw GeneralException("Could not convert texture to OpenGL format");
+ throw GeneralException("Could not convert Texture to OpenGL format");
}
next = 0;
@@ -203,7 +203,7 @@ inline static unsigned int nextpower(unsigned int n) {
}
}
-mogltk::texture::texture(int x, int y, int w, int h) : width(nextpower(w)), height(nextpower(h)),
+mogltk::Texture::Texture(int x, int y, int w, int h) : width(nextpower(w)), height(nextpower(h)),
texture_allocated(true), planar(false), tainted(false), taintable(false) {
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
@@ -215,7 +215,7 @@ mogltk::texture::texture(int x, int y, int w, int h) : width(nextpower(w)), heig
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, x, y, w, h);
}
-mogltk::texture::~texture() {
+mogltk::Texture::~Texture() {
if (surface) {
SDL_FreeSurface(surface);
}
@@ -241,39 +241,39 @@ mogltk::texture::~texture() {
}
}
-Uint32 * mogltk::texture::GetPixels() {
+Uint32 * mogltk::Texture::GetPixels() {
if (surface)
return (Uint32 *) surface->pixels;
else
return 0;
}
-SDL_Surface * mogltk::texture::GetSurface() {
+SDL_Surface * mogltk::Texture::GetSurface() {
return surface;
}
-SDL_PixelFormat * mogltk::texture::GetFormat() {
+SDL_PixelFormat * mogltk::Texture::GetFormat() {
if (surface)
return surface->format;
else
return 0;
}
-void mogltk::texture::Generate() {
+void mogltk::Texture::Generate() {
if (texture_allocated) {
glDeleteTextures(1, &tex);
}
glGenTextures(1, &tex);
- printm(M_INFO, "Generated texture " + name + " with index " + tex + "\n");
+ printm(M_INFO, "Generated Texture " + name + " with index " + tex + "\n");
glBindTexture(GL_TEXTURE_2D, tex);
#if 0
if (planar) {
#ifdef DEBUG
- printm(M_INFO, _("Generating planar texture: %i\n"), tex);
+ printm(M_INFO, _("Generating planar Texture: %i\n"), tex);
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -294,7 +294,7 @@ void mogltk::texture::Generate() {
tainted = false;
}
-void mogltk::texture::Bind(bool expand) {
+void mogltk::Texture::Bind(bool expand) {
if ((!texture_allocated) || tainted)
Generate();
glEnable(GL_TEXTURE_2D);
@@ -331,15 +331,15 @@ void mogltk::texture::Bind(bool expand) {
header = this;
}
-GLuint mogltk::texture::GetWidth() {
+GLuint mogltk::Texture::GetWidth() {
return width;
}
-GLuint mogltk::texture::GetHeight() {
+GLuint mogltk::Texture::GetHeight() {
return height;
}
-void mogltk::texture::Unbind(void) {
+void mogltk::Texture::Unbind(void) {
if (active) {
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
@@ -347,9 +347,9 @@ void mogltk::texture::Unbind(void) {
}
}
-void mogltk::texture::Taint(void) {
+void mogltk::Texture::Taint(void) {
if (taintable) {
- printm(M_INFO, "Tainting texture " + name + "\n");
+ printm(M_INFO, "Tainting Texture " + name + "\n");
tainted = true;
if (active == this)
Unbind();
@@ -360,13 +360,13 @@ void mogltk::texture::Taint(void) {
}
}
-void mogltk::texture::Taintall(void) {
+void mogltk::Texture::Taintall(void) {
Unbind();
if (header)
header->recTaint();
}
-void mogltk::texture::recTaint(void) {
+void mogltk::Texture::recTaint(void) {
Taint();
if (next)
next->recTaint();
@@ -378,7 +378,7 @@ void mogltk::texture::recTaint(void) {
#define NTEX_SIGNATURE 0x5845544e
#endif
-SDL_Surface * mogltk::texture::LoadNTEX(Handle * h) throw (GeneralException) {
+SDL_Surface * mogltk::Texture::LoadNTEX(Handle * h) throw (GeneralException) {
SDL_Surface * r;
char buffer[5];
Uint16 height, width;
@@ -412,7 +412,7 @@ SDL_Surface * mogltk::texture::LoadNTEX(Handle * h) throw (GeneralException) {
return r;
}
-void mogltk::texture::DumpBMP(const String & n) {
+void mogltk::Texture::DumpBMP(const String & n) {
if (surface)
SDL_SaveBMP(surface, n.to_charp());
}