/* model/fragment.h This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2 */ #ifndef __INCLUDED_MODEL_FRAGMENT_H__ #define __INCLUDED_MODEL_FRAGMENT_H__ #include "math/vector3f.h" #include "math/color.h" namespace model { /// a fragment of a model, a pointer into a continuues part of the VertexArray containt Tris or Quad data class Fragment { public: /// fragment primitive type: triangles or quads enum Type {Triangles, Quads}; /// create a new fragment Fragment (Type type, unsigned int material); /// add a vertex to the fragment size_t add_vertex(math::Vector3f const & vertex, math::Vector3f const &normal, math::Color const & color, bool detail); /// VertexArray index of the start of the fragment inline size_t start() const { return fragment_start; } /// number of structural vertices in the fragment inline size_t structural_size() const { return fragment_structural_size; } /// number of detail vertices in the fragment inline size_t detail_size() const { return fragment_detail_size; } /// material flags inline unsigned int material() { return fragment_material; } private: Type fragment_type; size_t fragment_start; size_t fragment_structural_size; size_t fragment_detail_size; unsigned int fragment_material; }; } #endif // __INCLUDED_MODEL_FRAGMENT_H__