From b0af6f8e14449e8bd49efe94da1041628a549120 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 3 Mar 2008 17:39:02 +0000 Subject: usable models, target_engine --- src/render/model.h | 56 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'src/render/model.h') diff --git a/src/render/model.h b/src/render/model.h index dfde809..eca896b 100644 --- a/src/render/model.h +++ b/src/render/model.h @@ -1,7 +1,7 @@ /* render/model.h - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 */ #ifndef __INCLUDED_RENDER_MODEL_H__ @@ -14,7 +14,8 @@ #include "core/entity.h" #include "render/face.h" -namespace render { +namespace render +{ /// a spacecraft engine class Engine @@ -22,9 +23,12 @@ class Engine public: Engine(math::Vector3f const & location); ~Engine(); - - inline math::Vector3f const & location() const { return engine_location; } - + + inline math::Vector3f const & location() const + { + return engine_location; + } + private: math::Vector3f engine_location; }; @@ -36,45 +40,51 @@ public: /// load a model from disk Model(std::string const & name); ~Model(); - + /// the name of the model - inline std::string const & name() const { return model_name; } - + inline std::string const & name() const + { + return model_name; + } + /// the Model registry static std::map registry; - + /// draw the model for an entity /** This will not draw attached engines, turrents and cannons */ - void draw(core::Entity const * entity); - + void draw(core::Entity const * entity, math::Vector3f const & eye); + /// draw the model for a controlable enity /** This will draw all attached engines, turrents and cannons */ - void draw(core::EntityControlable const * entity); - -/* ---- static functions for the Model registry -------------------- */ - + void draw(core::EntityControlable const * entity, math::Vector3f const & eye); + + /* ---- static functions for the Model registry -------------------- */ + /// get name model, returns 0 if not found static Model *find(std::string const & name); - + /// get named model from the registry and load it if necessary static Model *get(std::string const & name); - - /// clear the Model registry + + /// clear the model registry static void clear(); - + + /// list the content of the model registry + static void list(); + private: void make_face(math::Plane3f *face, std::vector & planes); void add_engine(Engine *engine); void add_face(Face *face); - + std::list model_face; std::list model_engine; std::string model_name; - + float model_scale; - + }; } -- cgit v1.2.3