• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

CEGUIOgreGeometryBuffer.h

00001 /***********************************************************************
00002     filename:   CEGUIOgreGeometryBuffer.h
00003     created:    Tue Feb 17 2009
00004     author:     Paul D Turner
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2010 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 _CEGUIOgreGeometryBuffer_h_
00029 #define _CEGUIOgreGeometryBuffer_h_
00030 
00031 #include "../../CEGUIGeometryBuffer.h"
00032 #include "CEGUIOgreRenderer.h"
00033 #include "../../CEGUIRect.h"
00034 
00035 #include <OgreMatrix4.h>
00036 #include <OgreColourValue.h>
00037 #include <OgreRenderOperation.h>
00038 
00039 #include <utility>
00040 #include <vector>
00041 
00042 // Ogre forward refs
00043 namespace Ogre
00044 {
00045 class RenderSystem;
00046 }
00047 
00048 // Start of CEGUI namespace section
00049 namespace CEGUI
00050 {
00052 class OGRE_GUIRENDERER_API OgreGeometryBuffer : public GeometryBuffer
00053 {
00054 public:
00056     OgreGeometryBuffer(OgreRenderer& owner, Ogre::RenderSystem& rs);
00058     virtual ~OgreGeometryBuffer();
00059 
00061     const Ogre::Matrix4& getMatrix() const;
00062 
00063     // implement CEGUI::GeometryBuffer interface.
00064     void draw() const;
00065     void setTranslation(const Vector3& v);
00066     void setRotation(const Vector3& r);
00067     void setPivot(const Vector3& p);
00068     void setClippingRegion(const Rect& region);
00069     void appendVertex(const Vertex& vertex);
00070     void appendGeometry(const Vertex* const vbuff, uint vertex_count);
00071     void setActiveTexture(Texture* texture);
00072     void reset();
00073     Texture* getActiveTexture() const;
00074     uint getVertexCount() const;
00075     uint getBatchCount() const;
00076     void setRenderEffect(RenderEffect* effect);
00077     RenderEffect* getRenderEffect();
00078 
00079 protected:
00081     Ogre::RGBA colourToOgre(const colour& col) const;
00083     void updateMatrix() const;
00085     void syncHardwareBuffer() const;
00087     void initialiseTextureStates() const;
00088 
00090     struct OgreVertex
00091     {
00092         float x, y, z;
00093         Ogre::RGBA diffuse;
00094         float u, v;
00095     };
00096 
00098     OgreRenderer& d_owner;
00100     Ogre::RenderSystem& d_renderSystem;
00102     OgreTexture* d_activeTexture;
00104     Rect d_clipRect;
00106     Vector3 d_translation;
00108     Vector3 d_rotation;
00110     Vector3 d_pivot;
00112     RenderEffect* d_effect;
00114     Vector2 d_texelOffset;
00116     mutable Ogre::Matrix4 d_matrix;
00118     mutable bool d_matrixValid;
00120     mutable Ogre::RenderOperation d_renderOp;
00122     mutable Ogre::HardwareVertexBufferSharedPtr d_hwBuffer;
00124     mutable bool d_sync;
00126     typedef std::pair<Ogre::TexturePtr, uint> BatchInfo;
00128     typedef std::vector<BatchInfo> BatchList;
00130     BatchList d_batches;
00132     typedef std::vector<OgreVertex> VertexList;
00134     VertexList d_vertices;
00135 };
00136 
00137 
00138 } // End of  CEGUI namespace section
00139 
00140 #endif  // end of guard _CEGUIOgreGeometryBuffer_h_

Generated on Sat Sep 25 2010 02:10:34 for Crazy Eddies GUI System by  doxygen 1.7.1