FCDocument/FCDEffectPassShader.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 
00011 #ifndef _FCD_EFFECT_PASS_SHADER_H_
00012 #define _FCD_EFFECT_PASS_SHADER_H_
00013 
00014 #include "FCDocument/FCDObject.h"
00015 
00016 class FCDocument;
00017 class FCDEffectCode;
00018 
00026 class FCOLLADA_EXPORT FCDEffectPassBind
00027 {
00028 public:
00029     string reference; 
00030     string symbol; 
00031 };
00032 
00033 typedef vector<FCDEffectPassBind> FCDEffectPassBindList; 
00046 class FCOLLADA_EXPORT FCDEffectPassShader : public FCDObject
00047 {
00048 private:
00049     DeclareObjectType;
00050     FCDEffectPass* parent;
00051 
00052     FCDEffectPassBindList bindings;
00053     fstring compilerTarget;
00054     fstring compilerOptions;
00055     string name;
00056     bool isFragment;
00057     FCDEffectCode* code;
00058 
00059 public:
00064     FCDEffectPassShader(FCDocument* document, FCDEffectPass* parent);
00065 
00068     virtual ~FCDEffectPassShader();
00069 
00072     inline FCDEffectPass* GetParent() { return parent; }
00073     inline const FCDEffectPass* GetParent() const { return parent; } 
00077     inline void AffectsVertices() { isFragment = false; }
00078 
00081     inline void AffectsFragments() { isFragment = true; }
00082 
00085     inline bool IsFragmentShader() const { return isFragment; }
00086 
00089     inline bool IsVertexShader() const { return !isFragment; }
00090 
00093     inline FCDEffectPassBindList& GetBindings() { return bindings; }
00094     inline const FCDEffectPassBindList& GetBindings() const { return bindings; } 
00098     inline size_t GetBindingCount() const { return bindings.size(); }
00099     
00103     inline FCDEffectPassBind* GetBinding(size_t index) { FUAssert(index < GetBindingCount(), return NULL); return &bindings.at(index); }
00104     inline const FCDEffectPassBind* GetBinding(size_t index) const { FUAssert(index < GetBindingCount(), return NULL); return &bindings.at(index); } 
00108     FCDEffectPassBind* AddBinding();
00109 
00112     void ReleaseBinding(FCDEffectPassBind* binding);
00113 
00117     inline const fstring& GetCompilerTarget() const { return compilerTarget; }
00118 
00122     inline void SetCompilerTarget(const fstring& _compilerTarget) { compilerTarget = _compilerTarget; }
00123 
00127     inline const fstring& GetCompilerOptions() const { return compilerOptions; }
00128 
00132     inline void SetCompilerOptions(const fstring& _compilerOptions) { compilerOptions = _compilerOptions; }
00133 
00136     inline const string& GetName() const { return name; }
00137 
00140     inline void SetName(const string& _name) { name = _name; }
00141 
00145     inline FCDEffectCode* GetCode() { return code; }
00146     inline const FCDEffectCode* GetCode() const { return code; } 
00151     inline void SetCode(FCDEffectCode* _code) { code = _code; }
00152 
00156     FCDEffectPassShader* Clone(FCDEffectPass* newParent) const;
00157 
00162     FUStatus LoadFromXML(xmlNode* shaderNode);
00163 
00167     xmlNode* WriteToXML(xmlNode* parentNode) const;
00168 };
00169 
00170 #endif // _FCD_EFFECT_PASS_SHADER_H_

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