lugre_ColourClipPaneOverlay.h

Go to the documentation of this file.
00001 /*
00002 http://www.opensource.org/licenses/mit-license.php  (MIT-License)
00003 
00004 Copyright (c) 2007 Lugre-Team
00005 
00006 Permission is hereby granted, free of charge, to any person obtaining a copy
00007 of this software and associated documentation files (the "Software"), to deal
00008 in the Software without restriction, including without limitation the rights
00009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00010 copies of the Software, and to permit persons to whom the Software is
00011 furnished to do so, subject to the following conditions:
00012 
00013 The above copyright notice and this permission notice shall be included in
00014 all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00019 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00020 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00021 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00022 THE SOFTWARE.
00023 */
00024 #ifndef LUGRE_ColourClipPaneOVERLAY_H
00025 #define LUGRE_ColourClipPaneOVERLAY_H
00026 #include "lugre_robrenderable.h"
00027 #include <OgrePrerequisites.h>
00028 #include <OgreOverlayContainer.h>
00029 
00030 
00031 namespace Lugre {
00032     
00033 // temporary name
00034 // see also OgrePanelOverlayElement.cpp
00035 // OgreOverlayElementFactory.h
00036 // ./include/OgreOverlayElementFactory.h
00037 
00038 class cColourClipPaneOverlay : public cRobRenderOp, public Ogre::OverlayContainer { public :
00039     Ogre::RenderOperation   mRenderOp;
00040     static Ogre::String     msTypeName;
00041     
00042     struct Vertex {
00043         Ogre::Real          x,y;
00044         Ogre::Real          u,v; 
00045         Ogre::ColourValue   col;
00046         
00047         Vertex();
00048         Vertex(const Ogre::Real x,const Ogre::Real y,const Ogre::Real u,const Ogre::Real v,const Ogre::ColourValue& col);
00049         friend Vertex Interpolate   (const Vertex& a,const Vertex& b,const float t);
00050         void    Print               (); 
00051         void    Draw                (cRobRenderOp* pRobRenderOp,const Ogre::Real z); 
00052     };
00053     
00054     struct VertexRect {
00055         Vertex  lt,lb,rt,rb; 
00056         
00057         VertexRect ();
00058         VertexRect (const Vertex& lt,const Vertex& lb,const Vertex& rt,const Vertex& rb);
00059         void        SetLTWH     (const Ogre::Real l,const Ogre::Real t,const Ogre::Real w,const Ogre::Real h);
00060         void        SetLTRB     (const Ogre::Real l,const Ogre::Real t,const Ogre::Real r,const Ogre::Real b);
00061         void        SetCol      (const Ogre::ColourValue& col);
00062         void        SetUV       (const Ogre::Real u1,const Ogre::Real v1,const Ogre::Real u2,const Ogre::Real v2);
00063         Vertex      Pick        (const Ogre::Real x,const Ogre::Real y); 
00064         VertexRect  Intersect   (const Ogre::Rectangle& clippingRegion);
00065         void        DrawStrip   (cRobRenderOp* pRobRenderOp,const Ogre::Real z); 
00066         void        DrawList    (cRobRenderOp* pRobRenderOp,const Ogre::Real z); 
00067         void        Print       (); 
00068     };
00069 
00070     // Flag indicating if this panel should be visual or just a group
00071     bool mTransparent;
00072     bool mbClipInitialized;
00073     VertexRect          mForm;
00074     Ogre::Rectangle     mClip; 
00075     
00076     cColourClipPaneOverlay(const Ogre::String& name);
00077     virtual ~cColourClipPaneOverlay();
00078     
00080     static void RegisterFactory ();
00081     
00083     virtual void initialise     (void);
00084 
00085     virtual void setColour      (const Ogre::ColourValue& col);
00086     virtual void SetColours     (const Ogre::ColourValue colLT,const Ogre::ColourValue colRT,const Ogre::ColourValue colLB,const Ogre::ColourValue colRB);
00087     virtual void SetTexCoords   (const Ogre::Real fU1,const Ogre::Real fV1,const Ogre::Real fU2,const Ogre::Real fV2);
00088     virtual void SetClip        (const Ogre::Real fCL,const Ogre::Real fCT,const Ogre::Real fCW,const Ogre::Real fCH);
00089 
00091     void setTransparent(bool isTransparent);
00092 
00094     bool isTransparent(void) const;
00095 
00097     virtual const Ogre::String& getTypeName(void) const;
00099     void getRenderOperation(Ogre::RenderOperation& op);
00101     void setMaterialName(const Ogre::String& matName);
00103     void _updateRenderQueue(Ogre::RenderQueue* queue);
00104 
00106     virtual void updatePositionGeometry(void);
00107 
00109     virtual void updateTextureGeometry(void);
00110 
00112     void addBaseParameters(void);
00113 };
00114 
00115 };
00116 
00117 #endif

Generated on Thu Feb 9 06:00:12 2012 for cpp by  doxygen 1.5.6