Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __CS_CSTOOL_IMPORTKIT_H__
00021 #define __CS_CSTOOL_IMPORTKIT_H__
00022
00027 #include "cssysdef.h"
00028 #include "csextern.h"
00029 #include "csutil/array.h"
00030
00031 struct iObjectRegistry;
00032
00033 namespace CS
00034 {
00035 namespace Utility
00036 {
00037
00042 namespace Implementation
00043 {
00044 class Glue;
00045 struct GluedModel;
00046 }
00047
00053 class CS_CRYSTALSPACE_EXPORT ImportKit
00054 {
00055 Implementation::Glue* glue;
00056 public:
00060 class CS_CRYSTALSPACE_EXPORT Container
00061 {
00062 public:
00070 class CS_CRYSTALSPACE_EXPORT Model
00071 {
00072 public:
00074 const wchar_t* GetName () const { return name; }
00075
00077 class CS_CRYSTALSPACE_EXPORT Mesh
00078 {
00079 protected:
00080 friend class Model;
00081 friend class Implementation::Glue;
00082
00083 unsigned int vertexCount;
00084 float* verts;
00085 float* texcoords;
00086 float* normals;
00087 size_t triCount;
00088 unsigned int* tris;
00089 size_t material;
00090 public:
00092 unsigned int GetVertexCount () const { return vertexCount; }
00097 const float* GetVertices () const { return verts; }
00102 const float* GetTexCoords () const { return texcoords; }
00107 const float* GetNormals () const { return normals; }
00108
00110 size_t GetTriangleCount () const { return triCount; }
00115 const unsigned int* GetTriangles () const { return tris; }
00116
00121 size_t GetMaterial () const { return material; }
00122 };
00124 size_t GetMeshCount () const { return meshes.GetSize (); }
00126 const Mesh& GetMesh (size_t index) const { return meshes[index]; }
00128 enum ModelType
00129 {
00131 Factory,
00133 Object
00134 };
00135 ModelType GetType () const { return type; }
00136
00137 ~Model();
00138 Model (const Model& other);
00139 protected:
00140 friend class Container;
00141 friend class Implementation::Glue;
00142 wchar_t* name;
00143 Implementation::GluedModel* glueModel;
00144 csArray<Mesh> meshes;
00145 ModelType type;
00146
00147 Model () : type (Factory) {}
00148 };
00150 size_t GetModelCount () const { return models.GetSize (); }
00152 const Model& GetModel (size_t index) const { return models[index]; }
00153
00159 class CS_CRYSTALSPACE_EXPORT Material
00160 {
00161 protected:
00162 friend class Container;
00163 friend class Implementation::Glue;
00164 wchar_t* name;
00165 char* texture;
00166
00167 Material() {}
00168 public:
00170 const wchar_t* GetName () const { return name; }
00174 const char* GetTextureFile () const { return texture; }
00175
00176 ~Material();
00177 Material (const Material& other);
00178 };
00180 size_t GetMaterialCount () { return materials.GetSize (); }
00182 const Material& GetMaterial (size_t index) { return materials[index]; }
00183 protected:
00184 friend class ImportKit;
00185 friend class Implementation::Glue;
00186 csArray<Model> models;
00187 csArray<Material> materials;
00188 };
00189
00191 ImportKit (iObjectRegistry* objectReg);
00192 ~ImportKit ();
00201 Container* OpenContainer (const char* filename,
00202 const char* path = 0);
00203 };
00204
00205 }
00206
00207 }
00208
00209 #endif // __CS_CSTOOL_IMPORTKIT_H__