| 1 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 2 | // submesh.h |
|---|
| 3 | // Author : Francesco Giordana |
|---|
| 4 | // Start Date : January 13, 2005 |
|---|
| 5 | // Copyright : (C) 2006 by Francesco Giordana |
|---|
| 6 | // Email : fra.giordana@tiscali.it |
|---|
| 7 | //////////////////////////////////////////////////////////////////////////////// |
|---|
| 8 | |
|---|
| 9 | /********************************************************************************* |
|---|
| 10 | * * |
|---|
| 11 | * This program is free software; you can redistribute it and/or modify * |
|---|
| 12 | * it under the terms of the GNU Lesser General Public License as published by * |
|---|
| 13 | * the Free Software Foundation; either version 2 of the License, or * |
|---|
| 14 | * (at your option) any later version. * |
|---|
| 15 | * * |
|---|
| 16 | **********************************************************************************/ |
|---|
| 17 | |
|---|
| 18 | #ifndef _SUBMESH_H |
|---|
| 19 | #define _SUBMESH_H |
|---|
| 20 | |
|---|
| 21 | #include "mayaExportLayer.h" |
|---|
| 22 | #include "paramList.h" |
|---|
| 23 | #include "materialSet.h" |
|---|
| 24 | #include "animation.h" |
|---|
| 25 | #include "vertex.h" |
|---|
| 26 | #include "blendshape.h" |
|---|
| 27 | |
|---|
| 28 | namespace OgreMayaExporter |
|---|
| 29 | { |
|---|
| 30 | /***** Class Submesh *****/ |
|---|
| 31 | class Submesh |
|---|
| 32 | { |
|---|
| 33 | public: |
|---|
| 34 | //constructor |
|---|
| 35 | Submesh(const MString& name = ""); |
|---|
| 36 | //destructor |
|---|
| 37 | ~Submesh(); |
|---|
| 38 | //clear data |
|---|
| 39 | void clear(); |
|---|
| 40 | //load data |
|---|
| 41 | MStatus loadMaterial(MObject& shader,MStringArray& uvsets,ParamList& params); |
|---|
| 42 | MStatus load(const MDagPath& dag,std::vector<face>& faces, std::vector<vertexInfo>& vertInfo, MPointArray& points, |
|---|
| 43 | MFloatVectorArray& normals, MStringArray& texcoordsets,ParamList& params,bool opposite = false); |
|---|
| 44 | //load a keyframe for the whole mesh |
|---|
| 45 | MStatus loadKeyframe(Track& t,float time,ParamList& params); |
|---|
| 46 | //get number of triangles composing the submesh |
|---|
| 47 | long numTriangles(); |
|---|
| 48 | //get number of vertices |
|---|
| 49 | long numVertices(); |
|---|
| 50 | //get submesh name |
|---|
| 51 | MString& name(); |
|---|
| 52 | //write submesh data to an Ogre compatible mesh |
|---|
| 53 | MStatus createOgreSubmesh(Ogre::MeshPtr pMesh,const ParamList& params); |
|---|
| 54 | //create an Ogre compatible vertex buffer |
|---|
| 55 | MStatus createOgreVertexBuffer(Ogre::SubMesh* pSubmesh,Ogre::VertexDeclaration* pDecl,const std::vector<vertex>& vertices); |
|---|
| 56 | |
|---|
| 57 | public: |
|---|
| 58 | //public members |
|---|
| 59 | MString m_name; |
|---|
| 60 | Material* m_pMaterial; |
|---|
| 61 | long m_numTriangles; |
|---|
| 62 | long m_numVertices; |
|---|
| 63 | std::vector<vertex> m_vertices; |
|---|
| 64 | std::vector<face> m_faces; |
|---|
| 65 | std::vector<uvset> m_uvsets; |
|---|
| 66 | bool m_use32bitIndexes; |
|---|
| 67 | MDagPath m_dagPath; |
|---|
| 68 | BlendShape* m_pBlendShape; |
|---|
| 69 | MBoundingBox m_boundingBox; |
|---|
| 70 | }; |
|---|
| 71 | |
|---|
| 72 | }; // end of namespace |
|---|
| 73 | |
|---|
| 74 | #endif |
|---|