00001 /* 00002 * Material node header 00003 * 00004 * This file is part of the "SoftPixel Engine" (Copyright (c) 2008 by Lukas Hermanns) 00005 * See "SoftPixelEngine.hpp" for license information. 00006 */ 00007 00008 #ifndef __SP_SCENE_MATERIALNODE_H__ 00009 #define __SP_SCENE_MATERIALNODE_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 #include "Base/spInputOutputString.hpp" 00014 #include "Base/spMaterialStates.hpp" 00015 #include "SceneGraph/spRenderNode.hpp" 00016 00017 00018 namespace sp 00019 { 00020 namespace scene 00021 { 00022 00023 00028 class SP_EXPORT MaterialNode : public RenderNode 00029 { 00030 00031 public: 00032 00033 virtual ~MaterialNode(); 00034 00035 /* === Functions === */ 00036 00037 virtual void render() = 0; 00038 00039 virtual bool compare(const MaterialNode* Other) const; 00040 00050 void setMaterial(const video::MaterialStates* Material); 00051 00053 inline video::MaterialStates* getMaterial() 00054 { 00055 return &Material_; 00056 } 00058 inline const video::MaterialStates* getMaterial() const 00059 { 00060 return &Material_; 00061 } 00062 00068 inline void setShader(video::Shader* ShaderObject) 00069 { 00070 ShaderClass_ = (ShaderObject ? ShaderObject->getShaderClass() : 0); 00071 } 00072 00074 inline void setShaderClass(video::ShaderClass* ShaderObject) 00075 { 00076 ShaderClass_ = ShaderObject; 00077 } 00079 inline video::ShaderClass* getShaderClass() const 00080 { 00081 return ShaderClass_; 00082 } 00083 00085 inline void setMaterialEnable(bool Enable) 00086 { 00087 EnableMaterial_ = Enable; 00088 } 00090 inline bool getMaterialEnable() const 00091 { 00092 return EnableMaterial_; 00093 } 00094 00095 protected: 00096 00097 friend class SceneGraph; 00098 friend bool cmpMeshesDefault(Mesh* &obj1, Mesh* &obj2); 00099 friend bool cmpMeshesFast(Mesh* &obj1, Mesh* &obj2); 00100 00101 /* Functions */ 00102 00103 MaterialNode(const ENodeTypes Type); 00104 00105 /* Members */ 00106 00107 video::MaterialStates Material_; 00108 video::ShaderClass* ShaderClass_; 00109 bool EnableMaterial_; 00110 00111 }; 00112 00113 00114 } // /namespace scene 00115 00116 } // /namespace sp 00117 00118 00119 #endif 00120 00121 00122 00123 // ================================================================================