Crazy Eddies GUI System 0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIIrrlichtGeometryBuffer.h 00003 created: Tue Mar 3 2009 00004 author: Paul D Turner (parts based on original code by Thomas Suter) 00005 *************************************************************************/ 00006 /*************************************************************************** 00007 * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team 00008 * 00009 * Permission is hereby granted, free of charge, to any person obtaining 00010 * a copy of this software and associated documentation files (the 00011 * "Software"), to deal in the Software without restriction, including 00012 * without limitation the rights to use, copy, modify, merge, publish, 00013 * distribute, sublicense, and/or sell copies of the Software, and to 00014 * permit persons to whom the Software is furnished to do so, subject to 00015 * the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be 00018 * included in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00021 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00022 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00023 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00024 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00025 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00026 * OTHER DEALINGS IN THE SOFTWARE. 00027 ***************************************************************************/ 00028 #ifndef _CEGUIIrrlichtGeometryBuffer_h_ 00029 #define _CEGUIIrrlichtGeometryBuffer_h_ 00030 00031 #include "CEGUIIrrlichtRendererDef.h" 00032 #include "../../CEGUIGeometryBuffer.h" 00033 #include "../../CEGUIRect.h" 00034 #include "../../CEGUIVector.h" 00035 #include <irrlicht.h> 00036 #include <vector> 00037 00038 #if defined(_MSC_VER) 00039 # pragma warning(push) 00040 # pragma warning(disable : 4251) 00041 #endif 00042 00043 // Start of CEGUI namespace section 00044 namespace CEGUI 00045 { 00046 class IrrlichtTexture; 00047 00049 class IRR_GUIRENDERER_API IrrlichtGeometryBuffer : public GeometryBuffer 00050 { 00051 public: 00053 IrrlichtGeometryBuffer(irr::video::IVideoDriver& driver); 00054 00056 const irr::core::matrix4& getMatrix() const; 00057 00059 irr::video::SMaterial& getMaterial(); 00061 const irr::video::SMaterial& getMaterial() const; 00062 00063 00064 // implement GeometryBuffer interface 00065 void draw() const; 00066 void setTranslation(const Vector3& v); 00067 void setRotation(const Vector3& r); 00068 void setPivot(const Vector3& p); 00069 void setClippingRegion(const Rect& region); 00070 void appendVertex(const Vertex& vertex); 00071 void appendGeometry(const Vertex* const vbuff, uint vertex_count); 00072 void setActiveTexture(Texture* texture); 00073 void reset(); 00074 Texture* getActiveTexture() const; 00075 uint getVertexCount() const; 00076 uint getBatchCount() const; 00077 void setRenderEffect(RenderEffect* effect); 00078 RenderEffect* getRenderEffect(); 00079 00080 protected: 00082 void updateMatrix() const; 00083 00085 irr::video::IVideoDriver& d_driver; 00087 IrrlichtTexture* d_activeTexture; 00089 mutable irr::video::SMaterial d_material; 00091 Rect d_clipRect; 00093 irr::core::vector3d<irr::f32> d_translation; 00095 irr::core::vector3d<irr::f32> d_rotation; 00097 irr::core::vector3d<irr::f32> d_pivot; 00099 RenderEffect* d_effect; 00101 mutable irr::core::matrix4 d_matrix; 00103 mutable bool d_matrixValid; 00105 typedef std::pair<irr::video::ITexture*, uint> BatchInfo; 00107 typedef std::vector<BatchInfo> BatchList; 00109 typedef std::vector<irr::video::S3DVertex> VertexList; 00111 typedef std::vector<irr::u16> IndexList; 00113 BatchList d_batches; 00115 VertexList d_vertices; 00117 IndexList d_indices; 00119 const float d_xViewDir; 00121 const float d_texelOffset; 00122 }; 00123 00124 00125 } // End of CEGUI namespace section 00126 00127 #if defined(_MSC_VER) 00128 # pragma warning(pop) 00129 #endif 00130 00131 #endif // end of guard _CEGUIIrrlichtGeometryBuffer_h_