Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-09-27 17:16:15 +0000
committerStijn Buys <ingar@osirion.org>2008-09-27 17:16:15 +0000
commitca0c1d3e6f8b5fa4eb2e0a86fcf47b12fb600786 (patch)
tree5d72e330f11350065806e83cc8712693241b9aad /src/render/render.cc
parent29984680d6e0e52efec489497b1796e056164442 (diff)
mission targets, texture unloading, private messages
Diffstat (limited to 'src/render/render.cc')
-rw-r--r--src/render/render.cc57
1 files changed, 30 insertions, 27 deletions
diff --git a/src/render/render.cc b/src/render/render.cc
index e91be23..8fce251 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -22,8 +22,6 @@
namespace render {
-GLuint textures[32];
-
core::Cvar *r_arraysize = 0;
core::Cvar *r_bbox = 0;
core::Cvar *r_grid = 0;
@@ -32,31 +30,11 @@ core::Cvar *r_sky = 0;
core::Cvar *r_wireframe = 0;
using model::VertexArray;
-
VertexArray *vertexarray = 0;
-bool texture(const char *filename, size_t id)
+void func_list_textures(std::string const &args)
{
- Image *image = TGA::load(filename);
- if (!image)
- return false;
-
- glGenTextures(1, &textures[id]);
- glBindTexture(GL_TEXTURE_2D, textures[id]);
-
- int texture_type;
- if (image->channels() == 4)
- texture_type = GL_RGBA;
- else
- texture_type = GL_RGB;
-
- gluBuild2DMipmaps(GL_TEXTURE_2D, image->channels(),
- image->width(), image->height(), texture_type, GL_UNSIGNED_BYTE, image->data());
-
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
- glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
-
- return true;
+ Textures::list();
}
void init()
@@ -101,12 +79,13 @@ void init()
Text::init();
Dust::init();
+
+ core::Func *func = core::Func::add("list_textures", func_list_textures);
+ func->set_info("list loaded textures");
}
-void shutdown()
+void clear()
{
- con_print << "^BShutting down renderer..." << std::endl;
-
// clear zone sky textures
for (core::Zone::Registry::iterator it = core::Zone::registry().begin(); it != core::Zone::registry().end(); it++) {
core::Zone *zone = (*it).second;
@@ -132,6 +111,30 @@ void shutdown()
// clear vertex array
delete vertexarray;
vertexarray = 0;
+}
+
+void unload()
+{
+ clear();
+
+ Textures::shutdown();
+ Textures::init();
+ size_t mb = (size_t) r_arraysize->value();
+ if (mb < 4 * sizeof(float))
+ mb = 4 * sizeof(float);
+ if (mb > 256)
+ mb = 256;
+ (*r_arraysize) = (float) mb;
+ vertexarray = new VertexArray(mb);
+
+}
+void shutdown()
+{
+ con_print << "^BShutting down renderer..." << std::endl;
+
+ core::Func::remove("list_textures");
+
+ clear();
Text::shutdown();