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

- File List
- File Members

# FCDocument/FCDGeometryInstance.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
    00019 #ifndef _FCD_GEOMETRY_ENTITY_H_
    00020 #define _FCD_GEOMETRY_ENTITY_H_
    00021
    00022 #ifndef _FCD_ENTITY_INSTANCE_H_
    00023 #include "FCDocument/FCDEntityInstance.h"
    00024 #endif // _FCD_ENTITY_INSTANCE_H_
    00025
    00026 class FCDocument;
    00027 class FCDMaterial;
    00028 class FCDMaterialInstance;
    00029 class FCDGeometryPolygons;
    00030 class FCDEffectParameter;
    00031
    00037 class FCOLLADA_EXPORT FCDGeometryInstance : public FCDEntityInstance
    00038 {
    00039 private:
    00040     DeclareObjectType(FCDEntityInstance);
    00041     DeclareParameterContainer(FCDMaterialInstance, materials, FC("Materials Bound"));
    00042     DeclareParameterContainer(FCDEffectParameter, parameters, FC("Effect Parameters"));
    00043
    00044     friend class FCDEntityInstanceFactory;
    00045
    00046 protected:
    00052     FCDGeometryInstance(FCDocument* document, FCDSceneNode* parent, FCDEntity::Type entityType = FCDEntity::GEOMETRY);
    00053
    00054 public:
    00056     virtual ~FCDGeometryInstance();
    00057
    00062     virtual Type GetType() const { return GEOMETRY; }
    00063
    00066     inline size_t GetEffectParameterCount() const { return parameters.size(); }
    00067
    00071     inline FCDEffectParameter* GetEffectParameter(size_t index) { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); }
    00072     inline const FCDEffectParameter* GetEffectParameter(size_t index) const { FUAssert(index < parameters.size(), return NULL); return parameters.at(index); }
    00073
    00078     FCDEffectParameter* AddEffectParameter(uint32 type);
    00079
    00085     inline FCDMaterialInstance* FindMaterialInstance(const fchar* semantic) { return const_cast<FCDMaterialInstance*>(const_cast<const FCDGeometryInstance*>(this)->FindMaterialInstance(semantic)); }
    00086     inline FCDMaterialInstance* FindMaterialInstance(const fstring& semantic) { return FindMaterialInstance(semantic.c_str()); }
    00087     const FCDMaterialInstance* FindMaterialInstance(const fchar* semantic) const;
    00088     inline const FCDMaterialInstance* FindMaterialInstance(const fstring& semantic) const { return FindMaterialInstance(semantic.c_str()); }
    00092     inline size_t GetMaterialInstanceCount() const { return materials.size(); }
    00093
    00097     inline FCDMaterialInstance* GetMaterialInstance(size_t index) { FUAssert(index < materials.size(), return NULL); return materials.at(index); }
    00098     inline const FCDMaterialInstance* GetMaterialInstance(size_t index) const { FUAssert(index < materials.size(), return NULL); return materials.at(index); }
    00102     DEPRECATED(3.05A, GetMaterialInstance) inline FCDMaterialInstance** GetMaterialInstances() { return const_cast<FCDMaterialInstance**>(materials.begin()); }
    00103     DEPRECATED(3.05A, GetMaterialInstance) inline const FCDMaterialInstance** GetMaterialInstances() const { return materials.begin(); }
    00108     FCDMaterialInstance* AddMaterialInstance();
    00109
    00116     FCDMaterialInstance* AddMaterialInstance(FCDMaterial* material, FCDGeometryPolygons* polygons);
    00117
    00118
    00126     FCDMaterialInstance* AddMaterialInstance(FCDMaterial* material, const fchar* semantic);
    00127     inline FCDMaterialInstance* AddMaterialInstance(FCDMaterial* material, const fstring& semantic) { return AddMaterialInstance(material, semantic.c_str()); }
    00133     virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const;
    00134
    00138     virtual void CleanSubId(FUSUniqueStringMap* parentStringMap);
    00139 };
    00140
    00141 #endif // _FCD_GEOMETRY_ENTITY_H_