diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-01 13:33:18 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-01 13:33:18 +0000 |
commit | 83d6c17799c4d448a67ab5cdad02954282fa5c94 (patch) | |
tree | 2d76abb9bb501491f78e07822ed52e8302fdd247 /src/render | |
parent | a6bceed80f1b4315f23656efeceb6fe02cc7641c (diff) |
server-side model loading, initial @dock function
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 70 | ||||
-rw-r--r-- | src/render/render.cc | 3 |
2 files changed, 33 insertions, 40 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 69dcecb..7bbb89c 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -53,8 +53,8 @@ typedef std::map<float, core::EntityGlobe *> Globes; Globes globes_list; // function to test flags -inline bool flag_is_set(unsigned int const spawnflags, unsigned int const flag) { - return ((spawnflags & flag) == flag); +inline bool flag_is_set(unsigned int const flags, unsigned int const flag) { + return ((flags & flag) == flag); } /* ---- Prepare the renderer state --------------------------------- */ @@ -75,51 +75,43 @@ void pass_prepare(float seconds) core::Entity *entity = (*it); // load entity models and light flare textures - if (!entity->model() && entity->modelname().size()) { - entity->entity_model = Model::load(entity->modelname()); - - if (!entity->model()) { - entity->entity_modelname.clear(); - entity->entity_radius = 0.25; - } else { - // set entity radius to model radius - entity->entity_radius = entity->entity_model->radius(); + if (!entity->model() && entity->modelname().c_str()[0]) { + entity->set_modelname(entity->modelname()); + } + + if (entity->model()) { + model::Model *model = entity->model(); - for (Model::Lights::iterator lit = entity->model()->lights().begin(); lit != entity->model()->lights().end(); lit++) { - Light *light = (*lit); + for (Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); lit++) { + Light *light = (*lit); - // load light texture - std::stringstream flarename; - flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << light->flare(); - light->render_texture = Textures::load(flarename.str()); - } + // load light texture + std::stringstream flarename; + flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << light->flare(); + light->render_texture = Textures::load(flarename.str()); + } - for(Model::Engines::iterator eit = entity->model()->engines().begin(); eit != entity->model()->engines().end(); eit++) { - Engine *engine = (*eit); + for(Model::Engines::iterator eit = model->engines().begin(); eit != model->engines().end(); eit++) { + Engine *engine = (*eit); - if (!engine->flare()) engine->engine_flare = 1; + if (!engine->flare()) engine->engine_flare = 1; - // load engine texture - std::stringstream flarename; - flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << engine->flare(); - engine->render_texture = Textures::load(flarename.str()); - } + // load engine texture + std::stringstream flarename; + flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << engine->flare(); + engine->render_texture = Textures::load(flarename.str()); + } - for (Model::Flares::iterator flit = entity->model()->flares().begin(); flit != entity->model()->flares().end(); flit++) { - Flare *flare = (*flit); + for (Model::Flares::iterator flit = model->flares().begin(); flit != model->flares().end(); flit++) { + Flare *flare = (*flit); - // load flare texture - std::stringstream flarename; - flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << flare->flare(); - flare->render_texture = Textures::load(flarename.str()); - } + // load flare texture + std::stringstream flarename; + flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << flare->flare(); + flare->render_texture = Textures::load(flarename.str()); } } - - if (!entity->state()) { - entity->entity_clientstate = new core::ClientState(entity); - } - + entity->state()->state_visible = false; entity->state()->state_detailvisible = false; entity->state()->state_targetable = false; @@ -147,8 +139,8 @@ void pass_prepare(float seconds) if (entity->type() == core::Entity::Globe) { core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity); - // add the globe to the globes list + // add the globe to the globes list globes_list[globe->state()->distance()] = globe; // load globe textures diff --git a/src/render/render.cc b/src/render/render.cc index 55756d9..02bd586 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -184,6 +184,7 @@ void unload() // clear all assets void clear() { + con_debug << "Clearing render data...\n"; // 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; @@ -195,7 +196,7 @@ void clear() core::Entity *entity = (*it).second; if (entity->model()) - entity->entity_model = 0; + entity->set_model(0); if (entity->type() == core::Entity::Globe) { core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity); |