diff options
author | Stijn Buys <ingar@osirion.org> | 2008-03-06 22:59:40 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-03-06 22:59:40 +0000 |
commit | df61a28d708c30e3e77d1f739dfb4561c042c89c (patch) | |
tree | d280b5eef345ea80f78f9d41df3c2367c9a88cd5 /src/core/model.h | |
parent | 6ade6c1c346743b8432600485e28682e276cfbd0 (diff) |
moved render::Model to core::Model
Diffstat (limited to 'src/core/model.h')
-rw-r--r-- | src/core/model.h | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/src/core/model.h b/src/core/model.h index eca896b..e22d87a 100644 --- a/src/core/model.h +++ b/src/core/model.h @@ -4,19 +4,44 @@ the terms of the GNU General Public License version 2 */ -#ifndef __INCLUDED_RENDER_MODEL_H__ -#define __INCLUDED_RENDER_MODEL_H__ +#ifndef __INCLUDED_CORE_MODEL_H__ +#define __INCLUDED_CORE_MODEL_H__ +#include <vector> #include <map> #include <list> +#include "math/mathlib.h" #include "math/plane3f.h" #include "core/entity.h" -#include "render/face.h" -namespace render +namespace core { +/// one face (polygon) of a model +class Face { +public: + Face(math::Vector3f const & normal, math::Color const *color=0); + ~Face(); + + /// the normal of this face + inline math::Vector3f const & normal() const { return face_normal; }; + + /// the color of this face + inline math::Color const *color() const { return face_color; }; + + /// add a vertex to the face + void add_vertex(math::Vector3f const &vertex); + + /// face vertexes + std::vector<math::Vector3f *> face_vertex; + +private: + math::Vector3f face_normal; + math::Color *face_color; + +}; + /// a spacecraft engine class Engine { @@ -50,16 +75,6 @@ public: /// the Model registry static std::map<std::string, Model*> registry; - /// draw the model for an entity - /** This will not draw attached engines, turrents and cannons - */ - 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, math::Vector3f const & eye); - /* ---- static functions for the Model registry -------------------- */ /// get name model, returns 0 if not found @@ -73,14 +88,18 @@ public: /// list the content of the model registry static void list(); + + /// list of Faces + std::list<Face *> model_face; + + /// list of Engines + std::list<Engine *> model_engine; private: void make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes); void add_engine(Engine *engine); void add_face(Face *face); - std::list<Face *> model_face; - std::list<Engine *> model_engine; std::string model_name; float model_scale; |