Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# OgreBorderPanelGuiElement.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright © 2000-2002 The OGRE Team
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023 -----------------------------------------------------------------------------
    00024 */
    00025
    00026 #ifndef __BorderPanelGuiElement_H__
    00027 #define __BorderPanelGuiElement_H__
    00028
    00029 #include "OgreGuiElementPrerequisites.h"
    00030 #include "OgrePanelGuiElement.h"
    00031
    00032 namespace Ogre {
    00033
    00034
    00035
    00049     class _OgreGuiElementExport BorderPanelGuiElement : public PanelGuiElement
    00050     {
    00051         friend class BorderRenderable;
    00052     public:
    00054         BorderPanelGuiElement(const String& name);
    00055         virtual ~BorderPanelGuiElement();
    00056
    00057         virtual void initialise(void);
    00058
    00059         const String& getTypeName(void) const;
    00071         void setBorderSize(Real size);
    00072
    00084         void setBorderSize(Real sides, Real topAndBottom);
    00085
    00099         void setBorderSize(Real left, Real right, Real top, Real bottom);
    00100
    00102         Real getLeftBorderSize(void) const;
    00104         Real getRightBorderSize(void) const;
    00106         Real getTopBorderSize(void) const;
    00108         Real getBottomBorderSize(void) const;
    00109
    00120         void setLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
    00124         void setRightBorderUV(Real u1, Real v1, Real u2, Real v2);
    00128         void setTopBorderUV(Real u1, Real v1, Real u2, Real v2);
    00132         void setBottomBorderUV(Real u1, Real v1, Real u2, Real v2);
    00136         void setTopLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
    00140         void setTopRightBorderUV(Real u1, Real v1, Real u2, Real v2);
    00144         void setBottomLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
    00148         void setBottomRightBorderUV(Real u1, Real v1, Real u2, Real v2);
    00149
    00150         String getLeftBorderUVString() const;
    00151         String getRightBorderUVString() const;
    00152         String getTopBorderUVString() const;
    00153         String getBottomBorderUVString() const;
    00154         String getTopLeftBorderUVString() const;
    00155         String getTopRightBorderUVString() const;
    00156         String getBottomLeftBorderUVString() const;
    00157         String getBottomRightBorderUVString() const;
    00158
    00159
    00160
    00161
    00163         void setBorderMaterialName(const String& name);
    00165         const String& getBorderMaterialName(void) const;
    00166
    00168         void _updateRenderQueue(RenderQueue* queue);
    00169
    00171         void setMetricsMode(GuiMetricsMode gmm);
    00172
    00174         void _update(void);
    00175
    00176
    00178         class CmdBorderSize : public ParamCommand
    00179         {
    00180         public:
    00181             String doGet(const void* target) const;
    00182             void doSet(void* target, const String& val);
    00183         };
    00185         class CmdBorderMaterial : public ParamCommand
    00186         {
    00187         public:
    00188             String doGet(const void* target) const;
    00189             void doSet(void* target, const String& val);
    00190         };
    00192         class CmdBorderLeftUV : public ParamCommand
    00193         {
    00194         public:
    00195             String doGet(const void* target) const;
    00196             void doSet(void* target, const String& val);
    00197         };
    00199         class CmdBorderTopUV : public ParamCommand
    00200         {
    00201         public:
    00202             String doGet(const void* target) const;
    00203             void doSet(void* target, const String& val);
    00204         };
    00206         class CmdBorderRightUV : public ParamCommand
    00207         {
    00208         public:
    00209             String doGet(const void* target) const;
    00210             void doSet(void* target, const String& val);
    00211         };
    00213         class CmdBorderBottomUV : public ParamCommand
    00214         {
    00215         public:
    00216             String doGet(const void* target) const;
    00217             void doSet(void* target, const String& val);
    00218         };
    00220         class CmdBorderTopLeftUV : public ParamCommand
    00221         {
    00222         public:
    00223             String doGet(const void* target) const;
    00224             void doSet(void* target, const String& val);
    00225         };
    00227         class CmdBorderBottomLeftUV : public ParamCommand
    00228         {
    00229         public:
    00230             String doGet(const void* target) const;
    00231             void doSet(void* target, const String& val);
    00232         };
    00234         class CmdBorderBottomRightUV : public ParamCommand
    00235         {
    00236         public:
    00237             String doGet(const void* target) const;
    00238             void doSet(void* target, const String& val);
    00239         };
    00241         class CmdBorderTopRightUV : public ParamCommand
    00242         {
    00243         public:
    00244             String doGet(const void* target) const;
    00245             void doSet(void* target, const String& val);
    00246         };
    00247     protected:
    00248         Real mLeftBorderSize;
    00249         Real mRightBorderSize;
    00250         Real mTopBorderSize;
    00251         Real mBottomBorderSize;
    00252
    00253         ushort mPixelLeftBorderSize;
    00254         ushort mPixelRightBorderSize;
    00255         ushort mPixelTopBorderSize;
    00256         ushort mPixelBottomBorderSize;
    00257
    00258         String mBorderMaterialName;
    00259         Material* mpBorderMaterial;
    00260
    00261         // Render operation for the border area
    00262         RenderOperation mRenderOp2;
    00263
    00264         static String msTypeName;
    00265
    00267         void updatePositionGeometry(void);
    00268
    00270         void addBaseParameters(void);
    00271
    00272         enum BorderCellIndex {
    00273             BCELL_TOP_LEFT = 0,
    00274             BCELL_TOP = 1,
    00275             BCELL_TOP_RIGHT = 2,
    00276             BCELL_LEFT = 3,
    00277             BCELL_RIGHT = 4,
    00278             BCELL_BOTTOM_LEFT = 5,
    00279             BCELL_BOTTOM = 6,
    00280             BCELL_BOTTOM_RIGHT = 7
    00281         };
    00283         void setCellUV(BorderCellIndex idx, Real& u1, Real& v1, Real& u2, Real& v2);
    00284         String getCellUVString(BorderCellIndex idx) const;
    00285
    00286         // Command objects
    00287         static CmdBorderSize msCmdBorderSize;
    00288         static CmdBorderMaterial msCmdBorderMaterial;
    00289         static CmdBorderLeftUV msCmdBorderLeftUV;
    00290         static CmdBorderTopUV msCmdBorderTopUV;
    00291         static CmdBorderBottomUV msCmdBorderBottomUV;
    00292         static CmdBorderRightUV msCmdBorderRightUV;
    00293         static CmdBorderTopLeftUV msCmdBorderTopLeftUV;
    00294         static CmdBorderBottomLeftUV msCmdBorderBottomLeftUV;
    00295         static CmdBorderTopRightUV msCmdBorderTopRightUV;
    00296         static CmdBorderBottomRightUV msCmdBorderBottomRightUV;
    00297
    00298         BorderRenderable* mBorderRenderable;
    00299     };
    00300
    00306     class _OgreGuiElementExport BorderRenderable : public Renderable
    00307     {
    00308     protected:
    00309         BorderPanelGuiElement* mParent;
    00310     public:
    00312         BorderRenderable(BorderPanelGuiElement* parent) : mParent(parent) {}
    00313         Material* getMaterial(void) const { return mParent->mpBorderMaterial; }
    00314         void getRenderOperation(RenderOperation& op) { op = mParent->mRenderOp2; }
    00315         void getWorldTransforms(Matrix4* xform) const { mParent->getWorldTransforms(xform); }
    00316         const Quaternion& getWorldOrientation(void) const { return Quaternion::IDENTITY; }
    00317         const Vector3& getWorldPosition(void) const { return Vector3::ZERO; }
    00318         unsigned short getNumWorldTransforms(void) const { return 1; }
    00319         bool useIdentityProjection(void) const { return true; }
    00320         bool useIdentityView(void) const { return true; }
    00321         Real getSquaredViewDepth(const Camera* cam) const { return mParent->getSquaredViewDepth(cam); }
    00322         const LightList& getLights(void) const
    00323         {
    00324             // N/A, panels are not lit
    00325             static LightList ll;
    00326             return ll;
    00327         }
    00328     };
    00329
    00330 }
    00331
    00332 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:16 2004