about summary refs log tree commit diff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/client/gfx.cpp30
-rw-r--r--src/engine/interface.h1
2 files changed, 30 insertions, 1 deletions
diff --git a/src/engine/client/gfx.cpp b/src/engine/client/gfx.cpp
index e7ec3b37..d8b3041c 100644
--- a/src/engine/client/gfx.cpp
+++ b/src/engine/client/gfx.cpp
@@ -156,7 +156,7 @@ bool gfx_init()
 	
 	// create null texture, will get id=0
 	gfx_load_texture_raw(4,4,IMG_RGBA,null_texture_data);
-	
+
 	return true;
 }
 
@@ -222,7 +222,35 @@ int gfx_load_texture_raw(int w, int h, int format, const void *data)
 	
 	return tex;
 }
+/*
+int gfx_load_mip_texture_raw(int w, int h, int format, const void *data)
+{
+	// grab texture
+	int tex = first_free_texture;
+	first_free_texture = textures[tex].next;
+	textures[tex].next = -1;
+	
+	// set data and return
+	// TODO: should be RGBA, not BGRA
+	dbg_msg("gfx", "%d = %dx%d", tex, w, h);
+	dbg_assert(format == IMG_RGBA, "not an RGBA image");
 
+	unsigned mip_w = w;
+	unsigned mip_h = h;
+	unsigned level = 0;
+	const unsigned char *ptr = (const unsigned char*)data;
+	while(mip_w > 0 && mip_h > 0)
+	{
+		dbg_msg("gfx mip", "%d = %dx%d", level, mip_w, mip_h);
+		textures[tex].tex.data2d_mip(mip_w, mip_h, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, level, ptr);
+		level++;
+		ptr = ptr + mip_w*mip_h*4;
+		mip_w = mip_w>>1;
+		mip_h = mip_h>>1;
+	}
+	return tex;
+}
+*/
 // simple uncompressed RGBA loaders
 int gfx_load_texture(const char *filename)
 {
diff --git a/src/engine/interface.h b/src/engine/interface.h
index 33bfc95e..295528b0 100644
--- a/src/engine/interface.h
+++ b/src/engine/interface.h
@@ -99,6 +99,7 @@ int gfx_load_texture(const char *filename);
 		<gfx_unload_texture>
 */
 int gfx_load_texture_raw(int w, int h, int format, const void *data);
+//int gfx_load_mip_texture_raw(int w, int h, int format, const void *data);
 
 /*
 	Function: gfx_texture_set