00001 /* 00002 * Billboard scene 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_BILLBOARD_H__ 00009 #define __SP_SCENE_BILLBOARD_H__ 00010 00011 00012 #include "Base/spStandard.hpp" 00013 #include "Base/spMeshBuffer.hpp" 00014 #include "SceneGraph/spMaterialNode.hpp" 00015 #include "RenderSystem/spTextureBase.hpp" 00016 00017 00018 namespace sp 00019 { 00020 00021 class SoftPixelDevice; 00022 00023 namespace scene 00024 { 00025 00026 00027 /* Pre-declarations */ 00028 00029 class SceneGraph; 00030 00031 00039 class SP_EXPORT Billboard : public MaterialNode 00040 { 00041 00042 public: 00043 00044 Billboard(video::Texture* BaseTexture); 00045 virtual ~Billboard(); 00046 00047 virtual void updateTransformation(); 00048 00053 inline void setBasePosition(const dim::point2df &Position) 00054 { 00055 BasePosition_ = Position; 00056 } 00057 inline dim::point2df getBasePosition() const 00058 { 00059 return BasePosition_; 00060 } 00061 00063 inline void setTexture(video::Texture* BaseTexture) 00064 { 00065 BaseTexture_ = BaseTexture; 00066 } 00067 inline video::Texture* getTexture() const 00068 { 00069 return BaseTexture_; 00070 } 00071 00073 inline void setColor(const video::color &Color) 00074 { 00075 Color_ = Color; 00076 } 00077 inline video::color getColor() const 00078 { 00079 return Color_; 00080 } 00081 00083 inline void setHardwareInstancing(s32 InstanceCount) 00084 { 00085 InstanceCount_ = InstanceCount; 00086 } 00087 inline s32 getHardwareInstancing() const 00088 { 00089 return InstanceCount_; 00090 } 00091 00092 /* Rendering & copying */ 00093 00094 Billboard* copy() const; 00095 00096 virtual void render(); 00097 00098 protected: 00099 00100 //friend bool cmpObjectBillboards(Billboard* &obj1, Billboard* &obj2); 00101 friend class SceneGraph; 00102 friend class SimpleSceneManager; 00103 friend class sp::SoftPixelDevice; 00104 00105 /* Functions */ 00106 00107 static void createDefaultMeshBuffer(); 00108 static void deleteDefaultMeshBuffer(); 00109 00110 /* === Members === */ 00111 00112 video::Texture* BaseTexture_; 00113 dim::point2df BasePosition_; 00114 video::color Color_; 00115 00116 s32 InstanceCount_; 00117 00118 static video::MeshBuffer* MeshBuffer_; 00119 00120 }; 00121 00122 00123 } // /namespace scene 00124 00125 } // /namespace sp 00126 00127 00128 #endif 00129 00130 00131 00132 // ================================================================================