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-07-28 19:37:31 +0000
committerStijn Buys <ingar@osirion.org>2008-07-28 19:37:31 +0000
commitd389a31f9816b55d8c7685ec24b9ab814252d693 (patch)
tree9b2577692e543fa6c59fcda508f92c3eb839ac7a /src/render
parent17408276791033e8122819185abf3bcb01740105 (diff)
zone support
Diffstat (limited to 'src/render')
-rw-r--r--src/render/draw.cc46
-rw-r--r--src/render/render.cc3
-rw-r--r--src/render/text.cc6
-rw-r--r--src/render/tga.cc5
4 files changed, 35 insertions, 25 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 2e72529..b26b8ce 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -41,6 +41,7 @@ math::Vector3f v7(-1, -1, -1);
const float drawdistance = 128.0f;
const float drawfxdistance = 64.0f;
+core::Zone *zone = 0;
float angle = 0;
@@ -367,10 +368,8 @@ void pass_prepare(float seconds)
glGetDoublev(GL_MODELVIEW, gl_model_matrix);
glGetIntegerv(GL_VIEWPORT, gl_viewport);
- std::map<unsigned int, core::Entity *>::iterator it;
- for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
-
- core::Entity *entity = (*it).second;
+ for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
+ core::Entity *entity = (*it);
// load entity models and light flare textures
if (!entity->model() && entity->modelname().size()) {
@@ -503,9 +502,8 @@ void pass_prepare(float seconds)
/* Draw entities without model */
void draw_pass_default()
{
- std::map<unsigned int, core::Entity *>::iterator it;
- for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
- core::Entity *entity = (*it).second;
+ for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
+ core::Entity *entity = (*it);
// draw entities without model
if (!entity->model()) {
@@ -590,10 +588,9 @@ void draw_pass_default()
/* draw model geometry fragments */
void draw_pass_model_fragments()
{
- std::map<unsigned int, core::Entity *>::iterator it;
- for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
+ for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
+ core::Entity *entity = (*it);
- core::Entity *entity = (*it).second;
if (entity->model() && entity->state()->visible()) {
gl::push();
gl::translate(entity->state()->location());
@@ -619,8 +616,8 @@ void draw_pass_model_fx(float elapsed)
gl::begin(gl::Quads);
- for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
- core::Entity *entity = (*it).second;
+ for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
+ core::Entity *entity = (*it);
if (entity->model() && entity->state()->detailvisible()) {
@@ -822,10 +819,10 @@ void draw_pass_model_corona()
if (!(r_radius && r_radius->value()))
return;
- for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
- core::Entity *entity = (*it).second;
+ for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
+ core::Entity *entity = (*it);
- if (entity->model() && entity->state() && entity->state()->visible()) {
+ if (entity->model() && entity->state()->visible()) {
gl::push();
gl::translate(entity->state()->location());
math::Color color = entity->color();
@@ -844,9 +841,20 @@ void draw_pass_sky()
if (!(r_sky && r_sky->value()))
return;
- size_t sky_texture = Textures::load("textures/env/sky");
- Textures::bind(sky_texture);
+ if (!core::localplayer()->zone())
+ return;
+
+ if (!core::localplayer()->zone()->sky_texture() && core::localplayer()->zone()->sky().size()) {
+ std::string texture_name("textures/env/");
+ texture_name.append(core::localplayer()->zone()->sky());
+ core::localplayer()->zone()->set_sky_texture(Textures::load(texture_name));
+
+ if (!core::localplayer()->zone()->sky_texture())
+ core::localplayer()->zone()->set_sky("");
+ }
+
+ Textures::bind(core::localplayer()->zone()->sky_texture());
gl::enable(GL_TEXTURE_2D);
gl::push();
@@ -901,7 +909,9 @@ void draw_pass_spacegrid()
void draw(float seconds)
{
- Stats::clear();
+ zone = core::localplayer()->zone();
+ if (!zone)
+ return;
// used for animations
angle += 180.0f * seconds;
diff --git a/src/render/render.cc b/src/render/render.cc
index cb0d4dd..dd5703a 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -108,8 +108,9 @@ void shutdown()
con_print << "^BShutting down renderer..." << std::endl;
// clear entity models, this will force a reload
- for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
+ for (core::Entity::Registry::iterator it = core::Entity::registry().begin(); it != core::Entity::registry().end(); it++) {
core::Entity *entity = (*it).second;
+
if (entity->model())
entity->entity_model = 0;
}
diff --git a/src/render/text.cc b/src/render/text.cc
index f5c221f..c64e331 100644
--- a/src/render/text.cc
+++ b/src/render/text.cc
@@ -32,13 +32,13 @@ void Text::init()
base_color[7] = new math::Color(1, 1, 1);
for (size_t i=0; i< 26; i++) {
- core_color[i] = new math::Color(.7, .7, .7);
+ core_color[i] = new math::Color(.75, .75, .75);
}
// N - normal color
- core_color[(size_t)('N'-'A')]->assign(.7, .7, .7);
+ core_color[(size_t)('N'-'A')]->assign(.75, .75, .75);
// D - Debug color
- core_color[(size_t)('D'-'A')]->assign(.6, .6, .6);
+ core_color[(size_t)('D'-'A')]->assign(.5, .5, .5);
// B - bold color
core_color[(size_t)('B'-'A')]->assign(1, 1, 1);
// W - warning color
diff --git a/src/render/tga.cc b/src/render/tga.cc
index fb4301b..fb65910 100644
--- a/src/render/tga.cc
+++ b/src/render/tga.cc
@@ -97,9 +97,6 @@ Image *TGA::load(const char *filename)
// byte 17 - image descriptor byte
unsigned int tga_descriptor = header[17];
- con_debug << " " << filename << " "
- << tga_width << "x" << tga_height << "x" << tga_depth << "bpp" << std::endl;
-
// read the image id if there is one
if (tga_idlength)
tga_file->skip(tga_idlength);
@@ -214,6 +211,8 @@ Image *TGA::load(const char *filename)
con_warn << filename << ": descriptor bit 4 (left-right) set!" << std::endl;
}
+ con_debug << " " << filename << " " << tga_width << "x" << tga_height << "x" << tga_depth << "bpp" << std::endl;
+
return image;
}