FCDocument/FCDGeometryMesh.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2006 Feeling Software Inc.
00003     MIT License: http://www.opensource.org/licenses/mit-license.php
00004 */
00005 /*
00006     Based on the FS Import classes:
00007     Copyright (C) 2005-2006 Feeling Software Inc
00008     Copyright (C) 2005-2006 Autodesk Media Entertainment
00009     MIT License: http://www.opensource.org/licenses/mit-license.php
00010 */
00011 
00017 #ifndef _FCD_GEOMETRY_MESH_H_
00018 #define _FCD_GEOMETRY_MESH_H_
00019 
00020 #include "FCDocument/FCDObject.h"
00021 #include "FUtils/FUDaeEnum.h"
00022 
00023 class FCDocument;
00024 class FCDGeometry;
00025 class FCDGeometryPolygons;
00026 class FCDGeometrySource;
00027 
00029 typedef vector<FCDGeometrySource*> FCDGeometrySourceList;
00031 typedef vector<FCDGeometryPolygons*> FCDGeometryPolygonsList;
00032 
00047 class FCOLLADA_EXPORT FCDGeometryMesh : public FCDObject
00048 {
00049 private:
00050     DeclareObjectType;
00051 
00052     FCDGeometry* parent;
00053     FCDGeometrySourceList sources;
00054     FCDGeometryPolygonsList polygons;
00055 
00056     FCDGeometrySourceList vertexSources;
00057     size_t faceCount, holeCount;
00058     size_t faceVertexCount;
00059     bool isDoubleSided; // Maya-specific, defaults to true
00060 
00061 public:
00065     FCDGeometryMesh(FCDocument* document, FCDGeometry* parent);
00066 
00068     virtual ~FCDGeometryMesh();
00069 
00072     inline size_t GetFaceCount() const { return faceCount; }
00073 
00077     inline size_t GetHoleCount() const { return holeCount; }
00078 
00082     inline size_t GetFaceVertexCount() const { return faceVertexCount; }
00083 
00087     inline bool IsDoubleSided() const { return isDoubleSided; }
00088 
00092     const string& GetDaeId() const;
00093 
00099     inline size_t GetPolygonsCount() const { return polygons.size(); }
00100 
00108     inline FCDGeometryPolygons* GetPolygons(size_t index) { FUAssert(index < GetPolygonsCount(), return NULL); return polygons.at(index); }
00109     inline const FCDGeometryPolygons* GetPolygons(size_t index) const { FUAssert(index < GetPolygonsCount(), return NULL); return polygons.at(index); } 
00116     FCDGeometryPolygons* AddPolygons();
00117 
00122     inline FCDGeometrySourceList& GetVertexSources() { return vertexSources; }
00123     inline const FCDGeometrySourceList& GetVertexSources() const { return vertexSources; } 
00129     inline size_t GetVertexSourceCount() const { return vertexSources.size(); }
00130 
00136     inline FCDGeometrySource* GetVertexSource(size_t index) { FUAssert(index < GetVertexSourceCount(), return NULL); return vertexSources.at(index); }
00137     inline const FCDGeometrySource* GetVertexSource(size_t index) const { FUAssert(index < GetVertexSourceCount(), return NULL); return vertexSources.at(index); } 
00143     FCDGeometrySource* AddVertexSource();
00144 
00148     FCDGeometrySource* FindSourceById(const string& id);
00149     const FCDGeometrySource* FindSourceById(const string& id) const; 
00155     FCDGeometrySource* GetPositionSource();
00156     const FCDGeometrySource* GetPositionSource() const; 
00160     inline size_t GetSourceCount() const { return sources.size(); }
00161 
00166     inline FCDGeometrySource* GetSource(size_t index) { FUAssert(index < GetSourceCount(), return NULL); return sources.at(index); }
00167     inline const FCDGeometrySource* GetSource(size_t index) const { FUAssert(index < GetSourceCount(), return NULL); return sources.at(index); } 
00172     FCDGeometrySource* AddSource();
00173 
00176     void Triangulate();
00177 
00181     void Recalculate();
00182     
00197     FCDGeometryMesh* Clone(FloatList& newPositions, uint32 newPositionsStride, FloatList& newNormals, uint32 newNormalsStride);
00198 
00203     FUStatus LoadFromXML(xmlNode* meshNode);
00204 
00208     xmlNode* WriteToXML(xmlNode* parentNode) const;
00209 };
00210 
00211 #endif // _FCD_GEOMETRY_MESH_H_

Generated on Fri May 12 16:44:38 2006 for FCollada by  doxygen 1.4.6-NO