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_MATERIAL_H_ 00018 #define _FCD_MATERIAL_H_ 00019 00020 #include "FCDocument/FCDEntity.h" 00021 00022 class FCDocument; 00023 class FCDEffect; 00024 class FCDEffectParameter; 00025 class FCDEffectParameterList; 00026 00033 class FCOLLADA_EXPORT FCDMaterialTechniqueHint 00034 { 00035 public: 00036 fstring platform; 00037 string technique; 00038 }; 00039 00041 typedef vector<FCDMaterialTechniqueHint> FCDMaterialTechniqueHintList; 00042 00055 class FCOLLADA_EXPORT FCDMaterial : public FCDEntity 00056 { 00057 private: 00058 DeclareObjectType; 00059 bool ownsEffect; 00060 FCDEffect* effect; 00061 FCDEffectParameterList* parameters; 00062 FCDMaterialTechniqueHintList techniqueHints; 00063 00064 public: 00068 FCDMaterial(FCDocument* document); 00069 00074 virtual ~FCDMaterial(); 00075 00079 virtual Type GetType() const { return FCDEntity::MATERIAL; } 00080 00086 FCDEffect* GetEffect() { return effect; } 00087 const FCDEffect* GetEffect() const { return effect; } 00091 void SetEffect(FCDEffect* _effect) { effect = _effect; } 00092 00095 FCDMaterialTechniqueHintList& GetTechniqueHints() { return techniqueHints; } 00096 const FCDMaterialTechniqueHintList& GetTechniqueHints() const { return techniqueHints; } 00100 FCDEffectParameterList* GetParameters() { return parameters; } 00101 const FCDEffectParameterList* GetParameters() const { return parameters; } 00110 FCDEffectParameter* FindParameterBySemantic(const string& semantic); 00111 00117 void FindParametersBySemantic(const string& semantic, FCDEffectParameterList& parameters); 00118 00125 void FindParametersByReference(const string& reference, FCDEffectParameterList& parameters); 00126 00130 FCDMaterial* Clone(); 00131 00136 void Flatten(); 00137 00142 virtual FUStatus LoadFromXML(xmlNode* materialNode); 00143 00147 virtual xmlNode* WriteToXML(xmlNode* parentNode) const; 00148 00149 private: 00150 void AddParameter(FCDEffectParameter* parameter); 00151 }; 00152 00153 #endif // _FCD_MATERIAL_H_