libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo es el conjunto de objetos y funciones, que permiten ejecutar las operaciones básicas de la plataforma Moldeo, y que compone su núcleo.
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Amigas 'defines' Grupos Páginas
mo3dModelManager.h
Ir a la documentación de este archivo.
1 #ifndef __MO_MODELOS3D_H__
2 #define __MO_MODELOS3D_H__
3 #include <moTypes.h>
4 //#include <moResourceManager.h>
5 //#include <moConfig.h>
6 //#include <moParam.h>
7 //#include <moTextureManager.h>
8 #include <moEffectState.h>
9 //#include <mo3ds.h>
10 //#include <moMathVector.h>
11 //#include <moMathVector3.h>
12 #include "moGLManager.h"
13 
14 
15 #define MO_3DMODEL_ERROR NULL
16 
17 typedef enum {
18 
24 
26 
27 typedef struct {
28 
30 
32 
33 #include "moMathVector.h"
34 #include "moMathVector3.h"
35 #include "moMathMatrix.h"
36 
38 public:
44  GLuint TextureId;
46 };
47 
49 
50 //=========== 3D ================//
52 {
53 public:
54  float x, y, z;
55 };
56 
57 // This is our 2D point class. This will be used to store the UV coordinates.
59 {
60 public:
61  float x, y;
62 };
63 
64 // This is our face structure. This is is used for indexing into the vertex
65 // and texture coordinate arrays. From this information we know which vertices
66 // from our vertex array go to which face, along with the correct texture coordinates.
67 struct mosFace
68 {
69  int vertIndex[3]; // indicies for the verts that make up this triangle
70  int coordIndex[3]; // indicies for the tex coords to texture this face
71 };
72 
73 // This holds the information for a material. It may be a texture map of a color.
74 // Some of these are not used, but I left them because you will want to eventually
75 // read in the UV tile ratio and the UV tile offset for some models.
76 
78 {
79  MOushort id; // id for type identification( opacity map, specular map, ...)
80  char strFile[255]; // The texture file name(If this is set it's a texture map)
81  int textureId; // the texture ID
82  float uTile;
83  float vTile;
84  float uOffset;
85  float vOffset;
86  float rotation;
87 };
88 
90 {
91 
92  char strName[255]; // The material name
93  MOubyte color[3]; // The color of the object (R, G, B)
94 
98 
99  float shininess;
101 
103 
104  bool twoSided;
105  bool wireFrame;
106 
107  std::vector<mo3DSTextureMapInfo> texMaps;
108 } ;
109 
110 
111 
112 
113 // This holds all the information for our model/scene.
114 // You should eventually turn into a robust class that
115 // has loading/drawing/querying functions like:
116 // LoadModel(...); DrawObject(...); DrawModel(...); DestroyModel(...);
118 {
119  int numOfVerts; // The number of verts in the model
120  int numOfFaces; // The number of faces in the model
121  int numTexVertex; // The number of texture coordinates
122  int materialID; // The texture ID to use, which is the index into our texture array
123  bool bHasTexture; // This is TRUE if there is a texture map for this object
124  char strName[255]; // The name of the object
125  CVector3 *pVerts; // The object's vertices
126  CVector3 *pNormals; // The object's normals
127  CVector2 *pTexVerts; // The texture's UV coordinates
128  mosFace *pFaces; // The faces information of the object
129 };
130 
131 // This holds our model information. This should also turn into a robust class.
132 // We use STL's(Standard Template Library) vector class to ease our link list burdens. :)
134 {
136  int numOfObjects; // The number of objects in the model
137  int numOfMaterials; // The number of materials for the model
138  vector<mo3DSMaterialInfo> pMaterials; // The list of material information(Textures and colors)
139  vector<mo3DSObject> pObject; // The object list for our model
140 };
141 
142 
143 
145 
155 moDeclareDynamicArray( moSceneNode*, moSceneNodePointerArray );
156 
158 
159  public:
160 
161  moSceneNode();
162  virtual ~moSceneNode();
163  moSceneNode( const moText& name );
164  moSceneNode( const moSceneNode& p_src );
165  moSceneNode& operator=(const moSceneNode& p_src);
166 
167  virtual MOboolean Init();
168  virtual MOboolean Finish();
169 
170  virtual void Draw( moEffectState *state, GLuint g_ViewMode );
171  virtual void Update();
172  virtual void Interaction();
173 
174  virtual moSceneNode* GetParent() {
175  return m_Parent;
176  }
177  virtual void SetParent( moSceneNode* p_parent ) {
178  m_Parent = p_parent;
179  }
180 
181  void SetProjectionMatrix( const moGLMatrixf& p_projection_matrix ) {
182  m_ProjectionMatrix = p_projection_matrix;
183  }
184  void SetModelMatrix( const moGLMatrixf& p_model_matrix ) {
185  m_ModelMatrix = p_model_matrix;
186  }
188  return m_ProjectionMatrix;
189  }
190  const moGLMatrixf& GetModelMatrix() const {
191  return m_ModelMatrix;
192  }
193 
194  virtual int AddChild( moSceneNodePointer p_child_node );
195  virtual int RemoveChild( moSceneNodePointer p_child_node );
196  virtual int RemoveChild( int p_node_index );
197 
198  virtual moSceneNode* GetChild( int p_index_child );
199  virtual moSceneNodePointerArray& GetChilds() {
200  return m_Childrens;
201  }
202  virtual moSceneNode* GetObjectByName( const moText& p_name );
203  virtual moSceneNode* GetObjectById( MOulong p_id );
204  MOulong GetId() { return m_Id; }
205  const moText& GetName() { return m_Name; }
206 
207  static MOulong UID;
208  static MOulong CreateUID();
209 
210 
211  protected:
212 
214 
217 
218  moSceneNodePointerArray m_Childrens;
222 };
223 
224 moDeclareDynamicArray( moSceneNode, moSceneNodeArray );
225 
227 
232 
233  public:
234 
236  virtual ~mo3DSModelSceneNode();
237 
238  virtual MOboolean Init();
239  virtual MOboolean Init( mo3DSModel* p_pModel ) {
240  m_pModel = p_pModel;
241  return true;
242  }
243  virtual MOboolean Finish();
244 
245  virtual void Draw( moEffectState *state, GLuint g_ViewMode );
246  virtual void Update();
247  virtual void Interaction();
248 
249  protected:
250 
253 };
254 
255 
257 
261 /*
262 class LIBMOLDEO_API moScene : public moAbstract {
263 
264  public:
265 
266  moScene();
267  virtual ~moScene();
268 
269  virtual MOboolean Init();
270  virtual MOboolean Finish();
271 
272  virtual void Draw( moEffectState *state, GLuint g_ViewMode );
273  virtual void Update();
274  virtual void Interaction();
275 
276  protected:
277 
278  void* SceneImplementation;
279 
280 };
281 */
283 
292 
293 public:
294 
296  mo3dModelManager(int);
297  virtual ~mo3dModelManager();
298 
299  virtual MOboolean Init();
300  virtual MOboolean Finish();
301 
302  moSceneNode* Get3dModel( const moText& p_object_name, bool force_load=false );
303 
304  void MoldeoLogo(long ticks=0);
305 
306 
307 protected:
308 
312  moSceneNode* Load3dModel( const moText& p_file_name );
313 /*
314  MOuint nModels;
315  MOuint nMaxModels;
316  mo3DSModel **Models;
317  mo3DSModel* Load3DSModel( moText namemodelo, moText datapath = "");
318 */
319 };
320 /*
321 class LIBMOLDEO_API mo3dModelManagerRef : public moAbstract{
322 public:
323 
324  MOuint nModels;
325  mo3DSModel **Models;
326 
327  mo3DSModelManagerRef();
328  virtual ~mo3DSModelManagerRef();
329 
330  MOboolean Init(moConfig*,MOuint,mo3dModelManager *);
331  void Draw(int imodel, moEffectState* state, GLuint g_ViewMode);
332  int Add(moText,mo3dModelManager*);
333  MOboolean Finish();
334  mo3DSModel* Get(int i);
335  //MOuint Get(int);//sin sincronizacion , como venga: si tiene frames por segundos...
336  //MOuint Get(int,int);//sin sincronizacion , un cuadro arbitrario
337  //MOuint Get(int,moTempo*);//con syncro
338  //MOuint GetType(int);//devuelve el type al que corresponde la imagen esa
339 
340  private:
341  void LoadModels(moConfig*,MOuint,mo3dModelManager*);
342 };
343 */
344 #endif /* __MO_MODELOS3D_H__ */
345 
moSceneNode m_MotherNode
moVector2f Raster
#define MOulong
Definition: moTypes.h:392
MOubyte colorSpecular[3]
Recurso ( objeto para cargar y manipular objetos físicos de datos de imágenes, audio, video, 3d, 2d, fuentes, shaders y de cualquier otro tipo extendible por un plugin )
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
Definition: moAbstract.cpp:147
CVector3 * pVerts
#define MOboolean
Definition: moTypes.h:385
Matrices para transformaciones en Open GL.
Definition: moGLManager.h:71
static MOulong UID
int vertIndex[3]
function x(bx)
Definition: jquery.js:30
virtual moSceneNode * GetParent()
moSceneNode * moSceneNodePointer
moSceneNode * m_pMoldeoLogo
moSceneNodePointerArray m_Childrens
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
virtual MOboolean Init()
Inicializa el objeto.
Definition: moAbstract.cpp:141
moTextureManager * mTM
virtual MOboolean Init(mo3DSModel *p_pModel)
char strName[255]
virtual void SetParent(moSceneNode *p_parent)
std::vector< mo3DSTextureMapInfo > texMaps
moVector3f Position
CVector2 * pTexVerts
#define LIBMOLDEO_API
Definition: moTypes.h:180
void SetProjectionMatrix(const moGLMatrixf &p_projection_matrix)
#define MOfloat
Definition: moTypes.h:403
virtual MOboolean Init()
GLuint TextureId
const moGLMatrixf & GetModelMatrix() const
virtual MOboolean Finish()
Finaliza el objeto, libera recursos.
clase de para manejar textos
Definition: moText.h:75
MOulong GetId()
moGLMatrixf m_ModelMatrix
#define MOushort
Definition: moTypes.h:402
MOubyte colorDiffuse[3]
virtual void Interaction()
moVector2f TextureCoords
MOubyte colorAmbient[3]
moDeclareExportedDynamicArray(moCoord, moCoords)
Clase base para los modelos tridimensionales.
void * SceneNodeImplementation
virtual MOboolean Init()
Inicializa el objeto.
vector< mo3DSObject > pObject
CVector3 * pNormals
void SetModelMatrix(const moGLMatrixf &p_model_matrix)
const moGLMatrixf & GetProjectionMatrix() const
moVector3f NextPosition
virtual MOboolean Finish()
int coordIndex[3]
const moText & GetName()
virtual void Update()
virtual void Draw(moEffectState *state, GLuint g_ViewMode)
mosFace * pFaces
moMatrix3 & operator=(const moMatrix3 &rkM)
moDeclareDynamicArray(moSceneNode *, moSceneNodePointerArray)
moVector3f Normal
#define MOuint
Definition: moTypes.h:387
vector< mo3DSMaterialInfo > pMaterials
moGLMatrixf m_ProjectionMatrix
moSceneNode * m_Parent
mo3dModelType
MOfloat Scale
#define MOubyte
Definition: moTypes.h:399
virtual moSceneNodePointerArray & GetChilds()