From a2dbf6d70f4868165bd412aa50eb8943f99b80ba Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 2 Nov 2009 17:15:51 +0000 Subject: ASE loader: support for multiple *GEOM objects and multiple materials --- src/model/asefile.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/model/asefile.h') diff --git a/src/model/asefile.h b/src/model/asefile.h index e129ec0..d8e3aea 100644 --- a/src/model/asefile.h +++ b/src/model/asefile.h @@ -10,11 +10,14 @@ #include "math/vector3f.h" #include "model/model.h" +#include "model/material.h" +#include "model/fragment.h" #include "model/triangle.h" #include "filesystem/filestream.h" #include #include +#include namespace model { @@ -31,14 +34,34 @@ public: static Model *load(std::string const &name); private: + /** + * @brief type definition for a list of materials in the ASE file + */ + typedef std::map MaterialList; + /** + * @brief type definition for a list of vertices in a GEOMOBJECT + */ typedef std::map VertexList; + /** + * @brief type definition for a list of faces in a GEOMOBJECT + */ typedef std::map FaceList; ASEFile(std::string const &name); ~ASEFile(); + /** + * @brief read *MATERIAL + */ + Material *read_material(std::istream &is); + + /** + * @brief read *MATERIAL_LIST + */ + bool read_material_list(std::istream &is); + /** * @brief read *MESH_NORMALS */ @@ -74,6 +97,11 @@ private: */ bool read_geom(std::istream &is); + /** + * @brief clear *GEOMOBJECT + */ + bool clear_geom(); + /** * @brief read the .ase header */ @@ -92,6 +120,18 @@ private: return asefile_ifs.is_open(); } + inline size_t vertexcount() const { + return ase_vertexcount; + } + + inline size_t facecount() const { + return ase_facecount; + } + + inline FragmentGroup *fragmentgroup() { + return ase_fragmentgroup; + } + std::string asefile_name; filesystem::IFileStream asefile_ifs; @@ -102,9 +142,16 @@ private: FaceList ase_facelist; + MaterialList ase_materiallist; + math::Vector3f ase_maxbbox; math::Vector3f ase_minbbox; + + FragmentGroup *ase_fragmentgroup; + + size_t ase_vertexcount; + size_t ase_facecount; }; } // namespace model -- cgit v1.2.3