- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FCDocument/FCDGeometryPolygons.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008 /*
    00009     Based on the FS Import classes:
    00010     Copyright (C) 2005-2006 Feeling Software Inc
    00011     Copyright (C) 2005-2006 Autodesk Media Entertainment
    00012     MIT License: http://www.opensource.org/licenses/mit-license.php
    00013 */
    00014
    00020 #ifndef _FCD_GEOMETRY_POLYGONS_H_
    00021 #define _FCD_GEOMETRY_POLYGONS_H_
    00022
    00023 #ifndef __FCD_OBJECT_H_
    00024 #include "FCDocument/FCDObject.h"
    00025 #endif // __FCD_OBJECT_H_
    00026 #ifndef _FU_DAE_ENUM_H_
    00027 #include "FUtils/FUDaeEnum.h"
    00028 #endif // _FU_DAE_ENUM_H_
    00029 #ifndef _FU_PARAMETER_H_
    00030 #include "FUtils/FUParameter.h"
    00031 #endif // _FU_PARAMETER_H_
    00032
    00033 class FCDocument;
    00034 class FCDExtra;
    00035 class FCDMaterial;
    00036 class FCDGeometryMesh;
    00037 class FCDGeometrySource;
    00038 class FCDGeometryPolygonsInput;
    00039
    00040 typedef fm::pvector<FCDGeometryPolygonsInput> FCDGeometryPolygonsInputList;
    00041 typedef fm::pvector<const FCDGeometryPolygonsInput> FCDGeometryPolygonsInputConstList;
    00042 typedef fm::map<const FCDGeometrySource*, FCDGeometrySource*> FCDGeometrySourceCloneMap;
    00054 class FCOLLADA_EXPORT FCDGeometryPolygons : public FCDObject
    00055 {
    00056 public:
    00058     enum PrimitiveType
    00059     {
    00060         LINES,
    00063         LINE_STRIPS,
    00065         POLYGONS,
    00068         TRIANGLE_FANS,
    00072         TRIANGLE_STRIPS,
    00078         POINTS
    00081     };
    00082
    00083 private:
    00084     DeclareObjectType(FCDObject);
    00085
    00086     FCDGeometryMesh* parent;
    00087     DeclareParameterContainer(FCDGeometryPolygonsInput, inputs, FC("Data Inputs"));
    00088     DeclareParameterList(UInt32, faceVertexCounts, FC("Per-face Vertex counts"));
    00089     DeclareParameterList(UInt32, holeFaces, FC("Hole face indices"));
    00090     DeclareParameter(uint32, FUParameterQualifiers::SIMPLE, primitiveType, FC("Primitive Type")); // PrimitiveType
    00091
    00092     // Buffered statistics
    00093     size_t faceVertexCount;
    00094     size_t faceOffset;
    00095     size_t faceVertexOffset;
    00096     size_t holeOffset;
    00097
    00098     // Material for this set of polygons
    00099     DeclareParameter(fstring, FUParameterQualifiers::SIMPLE, materialSemantic, FC("Material Semantic"));
    00100
    00101     // Extra information tree
    00102     DeclareParameterRef(FCDExtra, extra, FC("Extra Tree"));
    00103
    00104 public:
    00109     FCDGeometryPolygons(FCDocument* document, FCDGeometryMesh* parent);
    00110
    00112     virtual ~FCDGeometryPolygons();
    00113
    00116     inline FCDGeometryMesh* GetParent() { return parent; }
    00117     inline const FCDGeometryMesh* GetParent() const { return parent; }
    00124     FCDExtra* GetExtra();
    00125     inline const FCDExtra* GetExtra() const { return const_cast<FCDGeometryPolygons*>(this)->GetExtra(); }
    00129     inline PrimitiveType GetPrimitiveType() const { return (PrimitiveType) *primitiveType; }
    00130
    00135     inline void SetPrimitiveType(PrimitiveType type) { primitiveType = type; SetDirtyFlag(); }
    00136
    00146     inline const uint32* GetFaceVertexCounts() const { return faceVertexCounts.begin(); }
    00152     void AddFaceVertexCount(uint32 count);
    00153
    00157     inline size_t GetFaceVertexCountCount() const { return faceVertexCounts.size(); }
    00158
    00164     void SetFaceVertexCountCount(size_t count);
    00165
    00170     DEPRECATED(3.05, TestPolyType) bool IsTriangles() const;
    00171
    00174     int32 TestPolyType() const;
    00175
    00178     inline size_t GetHoleCount() const { return holeFaces.size(); }
    00179
    00182     inline size_t GetFaceCount() const { return faceVertexCounts.size() - GetHoleCount(); }
    00183
    00187     inline size_t GetFaceOffset() const { return faceOffset; }
    00188
    00193     inline size_t GetFaceVertexCount() const { return faceVertexCount; }
    00194
    00199     size_t GetFaceVertexCount(size_t index) const;
    00200
    00205     inline size_t GetFaceVertexOffset() const { return faceVertexOffset; }
    00206
    00209     inline size_t GetHoleOffset() const { return holeOffset; }
    00210
    00216     size_t GetFaceVertexOffset(size_t index) const;
    00217
    00221     inline void SetFaceOffset(size_t offset) { faceOffset = offset; SetDirtyFlag(); }
    00222
    00226     inline void SetFaceVertexOffset(size_t offset) { faceVertexOffset = offset; SetDirtyFlag(); }
    00227
    00231     inline void SetHoleOffset(size_t offset) { holeOffset = offset; SetDirtyFlag(); }
    00232
    00238     virtual void AddFace(uint32 degree);
    00239
    00243     virtual void RemoveFace(size_t index);
    00244
    00248     DEPRECATED(3.05A, GetInputCount and GetInput(index)) void GetInputs() {}
    00249
    00252     inline size_t GetInputCount() const { return inputs.size(); }
    00253
    00258     inline FCDGeometryPolygonsInput* GetInput(size_t index) { FUAssert(index < GetInputCount(), return NULL); return inputs.at(index); }
    00259     inline const FCDGeometryPolygonsInput* GetInput(size_t index) const { FUAssert(index < GetInputCount(), return NULL); return inputs.at(index); }
    00268     FCDGeometryPolygonsInput* AddInput(FCDGeometrySource* source, uint32 offset);
    00269
    00272     inline size_t GetHoleFaceCount() const { return holeFaces.size(); }
    00273
    00279     void SetHoleFaceCount(size_t count);
    00280
    00284     bool IsHoleFaceHole(size_t index);
    00285
    00291     inline const uint32* GetHoleFaces() const { return holeFaces.begin(); }
    00297     void AddHole(uint32 index);
    00298
    00306     size_t GetHoleCountBefore(size_t index) const;
    00307
    00311     size_t GetHoleCount(size_t index) const;
    00312
    00317     FCDGeometryPolygonsInput* FindInput(FUDaeGeometryInput::Semantic semantic) { return const_cast<FCDGeometryPolygonsInput*>(const_cast<const FCDGeometryPolygons*>(this)->FindInput(semantic)); }
    00318     const FCDGeometryPolygonsInput* FindInput(FUDaeGeometryInput::Semantic semantic) const;
    00324     FCDGeometryPolygonsInput* FindInput(const FCDGeometrySource* source) { return const_cast<FCDGeometryPolygonsInput*>(const_cast<const FCDGeometryPolygons*>(this)->FindInput(source)); }
    00325     const FCDGeometryPolygonsInput* FindInput(const FCDGeometrySource* source) const;
    00331     FCDGeometryPolygonsInput* FindInput(const fm::string& sourceId);
    00332
    00337     inline void FindInputs(FUDaeGeometryInput::Semantic semantic, FCDGeometryPolygonsInputList& inputs) { const_cast<FCDGeometryPolygons*>(this)->FindInputs(semantic, *(FCDGeometryPolygonsInputConstList*)&inputs); }
    00338     void FindInputs(FUDaeGeometryInput::Semantic semantic, FCDGeometryPolygonsInputConstList& inputs) const;
    00344     inline const fstring& GetMaterialSemantic() const { return materialSemantic; }
    00345
    00350     inline void SetMaterialSemantic(const fchar* semantic) { materialSemantic = semantic; SetDirtyFlag(); }
    00351     inline void SetMaterialSemantic(const fstring& semantic) { materialSemantic = semantic; SetDirtyFlag(); }
    00354     virtual void Recalculate();
    00355
    00361     virtual FCDGeometryPolygons* Clone(FCDGeometryPolygons* clone, const FCDGeometrySourceCloneMap& cloneMap) const;
    00362 };
    00363
    00364 #endif // _FCD_GEOMETRY_POLYGONS_H_