OGRE: OgreBorderPanelOverlayElement.h Source File - OGRE Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

# OgreBorderPanelOverlayElement.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 (c) 2000-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029
    00030 #ifndef __BorderPanelOverlayElement_H__
    00031 #define __BorderPanelOverlayElement_H__
    00032
    00033 #include "OgrePanelOverlayElement.h"
    00034
    00035 namespace Ogre {
    00036
    00037     class BorderRenderable;
    00038
    00052     class _OgreExport BorderPanelOverlayElement : public PanelOverlayElement
    00053     {
    00054         friend class BorderRenderable;
    00055     public:
    00057         BorderPanelOverlayElement(const String& name);
    00058         virtual ~BorderPanelOverlayElement();
    00059
    00060         virtual void initialise(void);
    00061
    00062         const String& getTypeName(void) const;
    00074         void setBorderSize(Real size);
    00075
    00087         void setBorderSize(Real sides, Real topAndBottom);
    00088
    00102         void setBorderSize(Real left, Real right, Real top, Real bottom);
    00103
    00105         Real getLeftBorderSize(void) const;
    00107         Real getRightBorderSize(void) const;
    00109         Real getTopBorderSize(void) const;
    00111         Real getBottomBorderSize(void) const;
    00112
    00123         void setLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
    00127         void setRightBorderUV(Real u1, Real v1, Real u2, Real v2);
    00131         void setTopBorderUV(Real u1, Real v1, Real u2, Real v2);
    00135         void setBottomBorderUV(Real u1, Real v1, Real u2, Real v2);
    00139         void setTopLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
    00143         void setTopRightBorderUV(Real u1, Real v1, Real u2, Real v2);
    00147         void setBottomLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
    00151         void setBottomRightBorderUV(Real u1, Real v1, Real u2, Real v2);
    00152
    00153         String getLeftBorderUVString() const;
    00154         String getRightBorderUVString() const;
    00155         String getTopBorderUVString() const;
    00156         String getBottomBorderUVString() const;
    00157         String getTopLeftBorderUVString() const;
    00158         String getTopRightBorderUVString() const;
    00159         String getBottomLeftBorderUVString() const;
    00160         String getBottomRightBorderUVString() const;
    00161
    00162
    00163
    00164
    00166         void setBorderMaterialName(const String& name);
    00168         const String& getBorderMaterialName(void) const;
    00169
    00171         void _updateRenderQueue(RenderQueue* queue);
    00172
    00174         void setMetricsMode(GuiMetricsMode gmm);
    00175
    00177         void _update(void);
    00178
    00179
    00181         class _OgrePrivate CmdBorderSize : public ParamCommand
    00182         {
    00183         public:
    00184             String doGet(const void* target) const;
    00185             void doSet(void* target, const String& val);
    00186         };
    00188         class _OgrePrivate CmdBorderMaterial : public ParamCommand
    00189         {
    00190         public:
    00191             String doGet(const void* target) const;
    00192             void doSet(void* target, const String& val);
    00193         };
    00195         class _OgrePrivate CmdBorderLeftUV : public ParamCommand
    00196         {
    00197         public:
    00198             String doGet(const void* target) const;
    00199             void doSet(void* target, const String& val);
    00200         };
    00202         class _OgrePrivate CmdBorderTopUV : public ParamCommand
    00203         {
    00204         public:
    00205             String doGet(const void* target) const;
    00206             void doSet(void* target, const String& val);
    00207         };
    00209         class _OgrePrivate CmdBorderRightUV : public ParamCommand
    00210         {
    00211         public:
    00212             String doGet(const void* target) const;
    00213             void doSet(void* target, const String& val);
    00214         };
    00216         class _OgrePrivate CmdBorderBottomUV : public ParamCommand
    00217         {
    00218         public:
    00219             String doGet(const void* target) const;
    00220             void doSet(void* target, const String& val);
    00221         };
    00223         class _OgrePrivate CmdBorderTopLeftUV : public ParamCommand
    00224         {
    00225         public:
    00226             String doGet(const void* target) const;
    00227             void doSet(void* target, const String& val);
    00228         };
    00230         class _OgrePrivate CmdBorderBottomLeftUV : public ParamCommand
    00231         {
    00232         public:
    00233             String doGet(const void* target) const;
    00234             void doSet(void* target, const String& val);
    00235         };
    00237         class _OgrePrivate CmdBorderBottomRightUV : public ParamCommand
    00238         {
    00239         public:
    00240             String doGet(const void* target) const;
    00241             void doSet(void* target, const String& val);
    00242         };
    00244         class _OgrePrivate CmdBorderTopRightUV : public ParamCommand
    00245         {
    00246         public:
    00247             String doGet(const void* target) const;
    00248             void doSet(void* target, const String& val);
    00249         };
    00250     protected:
    00251         Real mLeftBorderSize;
    00252         Real mRightBorderSize;
    00253         Real mTopBorderSize;
    00254         Real mBottomBorderSize;
    00255         struct CellUV {
    00256             Real u1, v1, u2, v2;
    00257         };
    00258         CellUV mBorderUV[8];
    00259
    00260         ushort mPixelLeftBorderSize;
    00261         ushort mPixelRightBorderSize;
    00262         ushort mPixelTopBorderSize;
    00263         ushort mPixelBottomBorderSize;
    00264
    00265         String mBorderMaterialName;
    00266         MaterialPtr mpBorderMaterial;
    00267
    00268         // Render operation for the border area
    00269         RenderOperation mRenderOp2;
    00270
    00271         static String msTypeName;
    00272
    00274         void updatePositionGeometry(void);
    00276         void updateTextureGeometry(void);
    00278         void addBaseParameters(void);
    00279
    00280         enum BorderCellIndex {
    00281             BCELL_TOP_LEFT = 0,
    00282             BCELL_TOP = 1,
    00283             BCELL_TOP_RIGHT = 2,
    00284             BCELL_LEFT = 3,
    00285             BCELL_RIGHT = 4,
    00286             BCELL_BOTTOM_LEFT = 5,
    00287             BCELL_BOTTOM = 6,
    00288             BCELL_BOTTOM_RIGHT = 7
    00289         };
    00290         String getCellUVString(BorderCellIndex idx) const;
    00291
    00292         // Command objects
    00293         static CmdBorderSize msCmdBorderSize;
    00294         static CmdBorderMaterial msCmdBorderMaterial;
    00295         static CmdBorderLeftUV msCmdBorderLeftUV;
    00296         static CmdBorderTopUV msCmdBorderTopUV;
    00297         static CmdBorderBottomUV msCmdBorderBottomUV;
    00298         static CmdBorderRightUV msCmdBorderRightUV;
    00299         static CmdBorderTopLeftUV msCmdBorderTopLeftUV;
    00300         static CmdBorderBottomLeftUV msCmdBorderBottomLeftUV;
    00301         static CmdBorderTopRightUV msCmdBorderTopRightUV;
    00302         static CmdBorderBottomRightUV msCmdBorderBottomRightUV;
    00303
    00304         BorderRenderable* mBorderRenderable;
    00305     };
    00306
    00312     class _OgreExport BorderRenderable : public Renderable
    00313     {
    00314     protected:
    00315         BorderPanelOverlayElement* mParent;
    00316     public:
    00318         BorderRenderable(BorderPanelOverlayElement* parent) : mParent(parent)
    00319         {
    00320             mUseIdentityProjection = true;
    00321             mUseIdentityView = true;
    00322         }
    00323         const MaterialPtr& getMaterial(void) const { return mParent->mpBorderMaterial; }
    00324         void getRenderOperation(RenderOperation& op) { op = mParent->mRenderOp2; }
    00325         void getWorldTransforms(Matrix4* xform) const { mParent->getWorldTransforms(xform); }
    00326         const Quaternion& getWorldOrientation(void) const { return Quaternion::IDENTITY; }
    00327         const Vector3& getWorldPosition(void) const { return Vector3::ZERO; }
    00328         unsigned short getNumWorldTransforms(void) const { return 1; }
    00329         Real getSquaredViewDepth(const Camera* cam) const { return mParent->getSquaredViewDepth(cam); }
    00330         const LightList& getLights(void) const
    00331         {
    00332             // N/A, panels are not lit
    00333             static LightList ll;
    00334             return ll;
    00335         }
    00336         bool getPolygonModeOverrideable(void) const
    00337         {
    00338             return mParent->getPolygonModeOverrideable();
    00339         }
    00340     };
    00341
    00342 }
    00343
    00344 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Mar 6 09:46:25 2008