diff options
Diffstat (limited to 'src/core/model.h')
-rw-r--r-- | src/core/model.h | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/src/core/model.h b/src/core/model.h index 00c8a48..5deee35 100644 --- a/src/core/model.h +++ b/src/core/model.h @@ -18,27 +18,31 @@ namespace core { -/// one face (polygon) of a model -class Face { +/// Global vertex array + + +const size_t VERTEXARRAYSIZE=65536*512; + +class VertexArray +{ public: - Face(math::Vector3f const & normal, math::Color const *color=0); - ~Face(); + /// model vertices + static float vertex[VERTEXARRAYSIZE]; + static float vertex_color[VERTEXARRAYSIZE]; + static float vertex_normal[VERTEXARRAYSIZE]; - /// the normal of this face - inline math::Vector3f const & normal() const { return face_normal; }; + /// model vertices with entity color + static float evertex[VERTEXARRAYSIZE]; + static float evertex_normal[VERTEXARRAYSIZE]; - /// the color of this face - inline math::Color const *color() const { return face_color; }; + static size_t vertex_index; + static size_t evertex_index; - /// add a vertex to the face - void add_vertex(math::Vector3f const &vertex); + static void clear(); - /// face vertexes - std::vector<math::Vector3f *> face_vertex; + static void add_vertex(math::Vector3f const &v, math::Vector3f const &n, math::Color const &color); + static void add_evertex(math::Vector3f const &v, math::Vector3f const &n); -private: - math::Vector3f face_normal; - math::Color *face_color; }; @@ -95,6 +99,18 @@ public: /// minimum values of the bounding box inline math::Vector3f const & minbbox() const { return model_minbbox; } + /// first vertex in the global VertexArray + inline size_t first_vertex() const { return model_first_vertex; } + + /// number of vertexes in this model + inline size_t vertex_count() const { return model_vertex_count; } + + /// first vertex in the global VertexArray + inline size_t first_evertex() const { return model_first_evertex; } + + /// number of vertexes in this model + inline size_t evertex_count() const { return model_evertex_count; } + /// radius inline float radius() const { return model_radius; } @@ -115,19 +131,17 @@ 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; /// list of Lights std::list<Light *> model_light; + + private: void make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes); void add_engine(Engine *engine); - void add_face(Face *face); void add_light(Light *light); std::string model_name; @@ -138,6 +152,11 @@ private: math::Vector3f model_maxbbox; math::Vector3f model_minbbox; + + size_t model_first_vertex; + size_t model_vertex_count; + size_t model_first_evertex; + size_t model_evertex_count; }; } |