00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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
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
00058
00059 void draw() const;
00060 void setTranslation(const Vector3& v);
00061 void setRotation(const Vector3& r);
00062 void setPivot(const Vector3& p);
00063 void setClippingRegion(const Rect& region);
00064 void appendVertex(const Vertex& vertex);
00065 void appendGeometry(const Vertex* const vbuff, uint vertex_count);
00066 void setActiveTexture(Texture* texture);
00067 void reset();
00068 Texture* getActiveTexture() const;
00069 uint getVertexCount() const;
00070 uint getBatchCount() const;
00071 void setRenderEffect(RenderEffect* effect);
00072 RenderEffect* getRenderEffect();
00073
00074 protected:
00076 void updateMatrix() const;
00077
00079 irr::video::IVideoDriver& d_driver;
00081 IrrlichtTexture* d_activeTexture;
00083 mutable irr::video::SMaterial d_material;
00085 Rect d_clipRect;
00087 irr::core::vector3d<irr::f32> d_translation;
00089 irr::core::vector3d<irr::f32> d_rotation;
00091 irr::core::vector3d<irr::f32> d_pivot;
00093 RenderEffect* d_effect;
00095 mutable irr::core::matrix4 d_matrix;
00097 mutable bool d_matrixValid;
00099 typedef std::pair<irr::video::ITexture*, uint> BatchInfo;
00101 typedef std::vector<BatchInfo> BatchList;
00103 typedef std::vector<irr::video::S3DVertex> VertexList;
00105 typedef std::vector<irr::u16> IndexList;
00107 BatchList d_batches;
00109 VertexList d_vertices;
00111 IndexList d_indices;
00113 const float d_xViewDir;
00115 const float d_texelOffset;
00116 };
00117
00118
00119 }
00120
00121 #if defined(_MSC_VER)
00122 # pragma warning(pop)
00123 #endif
00124
00125 #endif // end of guard _CEGUIIrrlichtGeometryBuffer_h_