lugre_BorderColourClipPaneOverlay.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_BorderColourClipPaneOVERLAY_H
00025 #define LUGRE_BorderColourClipPaneOVERLAY_H
00026 #include "lugre_ColourClipPaneOverlay.h"
00027 #include "lugre_robrenderable.h"
00028 #include <OgrePrerequisites.h>
00029 
00030 
00031 namespace Lugre {
00032     
00033 // temporary name
00034 // see also OgrePanelOverlayElement.cpp
00035 // OgreOverlayElementFactory.h
00036 // ./include/OgreOverlayElementFactory.h
00037 class CCPBorderRenderable;
00038 
00039 class cBorderColourClipPaneOverlay : public cColourClipPaneOverlay { public :
00040     Ogre::RenderOperation   mRenderOpBorder; 
00041     static Ogre::String     msTypeName;
00042 
00043     cBorderColourClipPaneOverlay(const Ogre::String& name);
00044     virtual ~cBorderColourClipPaneOverlay();
00045     
00047     static void RegisterFactory ();
00048     
00049     enum {
00050         kBCCPOPart_LT=0,
00051         kBCCPOPart_T,
00052         kBCCPOPart_RT,
00053         kBCCPOPart_L,
00054         kBCCPOPart_R,
00055         kBCCPOPart_LB,
00056         kBCCPOPart_B,
00057         kBCCPOPart_RB,
00058         kBCCPOPart_M,
00059     };
00060     
00061     
00062     CCPBorderRenderable*    mBorderRenderable;
00063     VertexRect              mFormParts[9];
00064     Ogre::Rectangle         mBorder; 
00065     Ogre::String            mBorderMaterialName;
00066     Ogre::MaterialPtr       mpBorderMaterial;
00067     cRobRenderOp            mpRobRenderOpBorder;
00068     
00070     virtual void setColour      (const Ogre::ColourValue& col);
00071     virtual void SetColours     (const Ogre::ColourValue colLT,const Ogre::ColourValue colRT,const Ogre::ColourValue colLB,const Ogre::ColourValue colRB);
00072     virtual void SetColours     (const int iPart,const Ogre::ColourValue colLT,const Ogre::ColourValue colRT,const Ogre::ColourValue colLB,const Ogre::ColourValue colRB);
00073     virtual void SetTexCoords   (const Ogre::Real fU1,const Ogre::Real fV1,const Ogre::Real fU2,const Ogre::Real fV2);
00074     virtual void SetTexCoords   (const int iPart,const Ogre::Real fU1,const Ogre::Real fV1,const Ogre::Real fU2,const Ogre::Real fV2);
00075     virtual void SetBorder      (const Ogre::Real l,const Ogre::Real t,const Ogre::Real r,const Ogre::Real b);
00076     
00078     virtual const Ogre::String& getTypeName(void) const;
00079     
00080     void setBorderMaterialName(const Ogre::String& name);
00081     
00082     virtual void initialise     (void);
00083     
00085     virtual void _updateRenderQueue(Ogre::RenderQueue* queue);
00086 
00088     virtual void updatePositionGeometry(void);
00089 };
00090 
00091 
00097 class CCPBorderRenderable : public Ogre::Renderable
00098 {
00099 protected:
00100     cBorderColourClipPaneOverlay* mParent;
00101 public:
00103     CCPBorderRenderable(cBorderColourClipPaneOverlay* parent) : mParent(parent) {
00104         mUseIdentityProjection = true;
00105         mUseIdentityView = true;
00106     }
00107     const Ogre::MaterialPtr& getMaterial(void) const { return mParent->mpBorderMaterial; }
00108     void getRenderOperation(Ogre::RenderOperation& op) { op = mParent->mRenderOpBorder; }
00109     void getWorldTransforms(Ogre::Matrix4* xform) const { mParent->getWorldTransforms(xform); }
00110     const Ogre::Quaternion& getWorldOrientation(void) const { return Ogre::Quaternion::IDENTITY; }
00111     const Ogre::Vector3& getWorldPosition(void) const { return Ogre::Vector3::ZERO; }
00112     unsigned short getNumWorldTransforms(void) const { return 1; }
00113     bool useIdentityProjection(void) const { return true; }
00114     bool useIdentityView(void) const { return true; }
00115     Ogre::Real getSquaredViewDepth(const Ogre::Camera* cam) const { return mParent->getSquaredViewDepth(cam); }
00116     const Ogre::LightList& getLights(void) const
00117     {
00118         // N/A, panels are not lit
00119         static Ogre::LightList ll;
00120         return ll;
00121     }
00122     bool getPolygonModeOverrideable(void) const
00123     {
00124         return mParent->getPolygonModeOverrideable();
00125     }
00126 };
00127 
00128 };
00129 
00130 #endif

Generated on Wed May 23 06:00:13 2012 for cpp by  doxygen 1.5.6