Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-11-02 17:15:51 +0000
committerStijn Buys <ingar@osirion.org>2009-11-02 17:15:51 +0000
commita2dbf6d70f4868165bd412aa50eb8943f99b80ba (patch)
treeb66bff69466e8d8cfffbd94750eeaee64f8ed8d7 /src/model/asefile.h
parenta1e67a1a6cf677a1eb937fc12954a06aa4a41c34 (diff)
ASE loader: support for multiple *GEOM objects and multiple materials
Diffstat (limited to 'src/model/asefile.h')
-rw-r--r--src/model/asefile.h47
1 files changed, 47 insertions, 0 deletions
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 <string>
#include <map>
+#include <vector>
namespace model
{
@@ -31,15 +34,35 @@ public:
static Model *load(std::string const &name);
private:
+ /**
+ * @brief type definition for a list of materials in the ASE file
+ */
+ typedef std::map<size_t, Material *> MaterialList;
+ /**
+ * @brief type definition for a list of vertices in a GEOMOBJECT
+ */
typedef std::map<size_t, math::Vector3f *> VertexList;
+ /**
+ * @brief type definition for a list of faces in a GEOMOBJECT
+ */
typedef std::map<size_t, Triangle *> 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
*/
bool read_mesh_normals(std::istream &is);
@@ -75,6 +98,11 @@ private:
bool read_geom(std::istream &is);
/**
+ * @brief clear *GEOMOBJECT
+ */
+ bool clear_geom();
+
+ /**
* @brief read the .ase header
*/
bool read_header(std::istream &is);
@@ -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