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

- File List
- File Members

# FCDocument/FCDMaterialInstance.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_MATERIAL_BIND_H_
    00021 #define _FCD_MATERIAL_BIND_H_
    00022
    00023 #ifndef _FCD_ENTITY_INSTANCE_H_
    00024 #include "FCDocument/FCDEntityInstance.h"
    00025 #endif // _FCD_ENTITY_INSTANCE_H_
    00026 #ifndef _FU_DAE_ENUM_H_
    00027 #include "FUtils/FUDaeEnum.h"
    00028 #endif // _FU_DAE_ENUM_H_
    00029
    00030 class FCDocument;
    00031 class FCDGeometryPolygons;
    00032
    00041 class FCDMaterialInstanceBind : public FUParameterizable
    00042 {
    00043 private:
    00044     DeclareObjectType(FUParameterizable);
    00045
    00046 public:
    00048     DeclareParameter(fm::string, FUParameterQualifiers::SIMPLE, semantic, FC("Semantic"));
    00049
    00051     DeclareParameter(fm::string, FUParameterQualifiers::SIMPLE, target, FC("Target"));
    00052
    00054     FCDMaterialInstanceBind();
    00055
    00057     virtual ~FCDMaterialInstanceBind();
    00058 };
    00059
    00069 class FCDMaterialInstanceBindVertexInput : public FUParameterizable
    00070 {
    00071 private:
    00072     DeclareObjectType(FUParameterizable);
    00073
    00074 public:
    00076     DeclareParameter(fm::string, FUParameterQualifiers::SIMPLE, semantic, FC("Bind Semantic"));
    00077
    00080     DeclareParameter(uint32, FUParameterQualifiers::SIMPLE, inputSemantic, FC("Input Semantic"));
    00081
    00084     DeclareParameter(int32, FUParameterQualifiers::SIMPLE, inputSet, FC("Input Set"));
    00085
    00087     FCDMaterialInstanceBindVertexInput();
    00088
    00090     virtual ~FCDMaterialInstanceBindVertexInput();
    00091
    00094     FUDaeGeometryInput::Semantic GetInputSemantic() const { return (FUDaeGeometryInput::Semantic) *inputSemantic; }
    00095 };
    00096
    00104 class FCOLLADA_EXPORT FCDMaterialInstance : public FCDEntityInstance
    00105 {
    00106 private:
    00107     DeclareObjectType(FCDEntityInstance);
    00108     FCDEntityInstance* parent;
    00109
    00110     DeclareParameter(fstring, FUParameterQualifiers::SIMPLE, semantic, FC("Material Token"));
    00111     DeclareParameterContainer(FCDMaterialInstanceBind, bindings, FC("Effect Bindings"));
    00112     DeclareParameterContainer(FCDMaterialInstanceBindVertexInput, vertexBindings, FC("Vertex Input Bindings"));
    00113
    00114 public:
    00117     FCDMaterialInstance(FCDocument* document, FCDEntityInstance* parent);
    00118
    00120     virtual ~FCDMaterialInstance();
    00121
    00126     DEPRECATED(3.05A, HasType(FCDMaterialInstance::GetClassType())) virtual Type GetType() const { return MATERIAL; }
    00127
    00130     inline FCDEntityInstance* GetParent() { return parent; }
    00131     inline const FCDEntityInstance* GetParent() const { return parent; }
    00135     inline const fstring& GetSemantic() const { return semantic; }
    00136
    00141     inline void SetSemantic(const fchar* _semantic) { semantic = _semantic; SetDirtyFlag(); }
    00142     inline void SetSemantic(const fstring& _semantic) { semantic = _semantic; SetDirtyFlag(); }
    00146     inline FCDMaterial* GetMaterial() { return (FCDMaterial*) GetEntity(); }
    00147     inline const FCDMaterial* GetMaterial() const { return (const FCDMaterial*) GetEntity(); }
    00151     inline void SetMaterial(FCDMaterial* _material) { SetEntity((FCDEntity*) _material); }
    00152
    00156     DEPRECATED(3.05A, GetBindingCount and GetBinding(index)) inline void GetBindings() const {}
    00157
    00161     const FCDMaterialInstanceBind* FindBinding(const char* semantic);
    00162
    00165     inline size_t GetBindingCount() const { return bindings.size(); }
    00166
    00170     inline FCDMaterialInstanceBind* GetBinding(size_t index) { FUAssert(index < bindings.size(), return NULL); return bindings.at(index); }
    00171     inline const FCDMaterialInstanceBind* GetBinding(size_t index) const { FUAssert(index < bindings.size(), return NULL); return bindings.at(index); }
    00176     FCDObject* GetGeometryTarget();
    00177
    00180     FCDMaterialInstanceBind* AddBinding();
    00181
    00186     FCDMaterialInstanceBind* AddBinding(const char* semantic, const char* target);
    00187
    00190     void RemoveBinding(size_t index);
    00191
    00194     DEPRECATED(3.05A, GetVertexInputBindingCount and GetVertexInputBinding(index)) inline void GetVertexInputBindings() {}
    00195
    00198     inline size_t GetVertexInputBindingCount() const { return vertexBindings.size(); }
    00199
    00203     inline FCDMaterialInstanceBindVertexInput* GetVertexInputBinding(size_t index) { FUAssert(index < vertexBindings.size(), return NULL); return vertexBindings.at(index); }
    00204     inline const FCDMaterialInstanceBindVertexInput* GetVertexInputBinding(size_t index) const { FUAssert(index < vertexBindings.size(), return NULL); return vertexBindings.at(index); }
    00211     inline FCDMaterialInstanceBindVertexInput* FindVertexInputBinding(const char* semantic) { return const_cast<FCDMaterialInstanceBindVertexInput*>(const_cast<const FCDMaterialInstance*>(this)->FindVertexInputBinding(semantic)); }
    00212     const FCDMaterialInstanceBindVertexInput* FindVertexInputBinding(const char* semantic) const;
    00216     FCDMaterialInstanceBindVertexInput* AddVertexInputBinding();
    00217
    00224     FCDMaterialInstanceBindVertexInput* AddVertexInputBinding(const char* semantic, FUDaeGeometryInput::Semantic inputSemantic, int32 inputSet);
    00225
    00226
    00232     DEPRECATED(3.05A, not recommended) FCDMaterial* FlattenMaterial() { return NULL; }
    00233
    00237     virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const;
    00238 };
    00239
    00240 #endif // _FCD_MATERIAL_BIND_H_