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-2005 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 __BorderPanelOverlayElement_H__ 00027 #define __BorderPanelOverlayElement_H__ 00028 00029 #include "OgrePanelOverlayElement.h" 00030 00031 namespace Ogre { 00032 00033 class BorderRenderable; 00034 00048 class _OgreExport BorderPanelOverlayElement : public PanelOverlayElement 00049 { 00050 friend class BorderRenderable; 00051 public: 00053 BorderPanelOverlayElement(const String& name); 00054 virtual ~BorderPanelOverlayElement(); 00055 00056 virtual void initialise(void); 00057 00058 const String& getTypeName(void) const; 00070 void setBorderSize(Real size); 00071 00083 void setBorderSize(Real sides, Real topAndBottom); 00084 00098 void setBorderSize(Real left, Real right, Real top, Real bottom); 00099 00101 Real getLeftBorderSize(void) const; 00103 Real getRightBorderSize(void) const; 00105 Real getTopBorderSize(void) const; 00107 Real getBottomBorderSize(void) const; 00108 00119 void setLeftBorderUV(Real u1, Real v1, Real u2, Real v2); 00123 void setRightBorderUV(Real u1, Real v1, Real u2, Real v2); 00127 void setTopBorderUV(Real u1, Real v1, Real u2, Real v2); 00131 void setBottomBorderUV(Real u1, Real v1, Real u2, Real v2); 00135 void setTopLeftBorderUV(Real u1, Real v1, Real u2, Real v2); 00139 void setTopRightBorderUV(Real u1, Real v1, Real u2, Real v2); 00143 void setBottomLeftBorderUV(Real u1, Real v1, Real u2, Real v2); 00147 void setBottomRightBorderUV(Real u1, Real v1, Real u2, Real v2); 00148 00149 String getLeftBorderUVString() const; 00150 String getRightBorderUVString() const; 00151 String getTopBorderUVString() const; 00152 String getBottomBorderUVString() const; 00153 String getTopLeftBorderUVString() const; 00154 String getTopRightBorderUVString() const; 00155 String getBottomLeftBorderUVString() const; 00156 String getBottomRightBorderUVString() const; 00157 00158 00159 00160 00162 void setBorderMaterialName(const String& name); 00164 const String& getBorderMaterialName(void) const; 00165 00167 void _updateRenderQueue(RenderQueue* queue); 00168 00170 void setMetricsMode(GuiMetricsMode gmm); 00171 00173 void _update(void); 00174 00175 00177 class _OgrePrivate CmdBorderSize : public ParamCommand 00178 { 00179 public: 00180 String doGet(const void* target) const; 00181 void doSet(void* target, const String& val); 00182 }; 00184 class _OgrePrivate CmdBorderMaterial : public ParamCommand 00185 { 00186 public: 00187 String doGet(const void* target) const; 00188 void doSet(void* target, const String& val); 00189 }; 00191 class _OgrePrivate CmdBorderLeftUV : public ParamCommand 00192 { 00193 public: 00194 String doGet(const void* target) const; 00195 void doSet(void* target, const String& val); 00196 }; 00198 class _OgrePrivate CmdBorderTopUV : public ParamCommand 00199 { 00200 public: 00201 String doGet(const void* target) const; 00202 void doSet(void* target, const String& val); 00203 }; 00205 class _OgrePrivate CmdBorderRightUV : public ParamCommand 00206 { 00207 public: 00208 String doGet(const void* target) const; 00209 void doSet(void* target, const String& val); 00210 }; 00212 class _OgrePrivate CmdBorderBottomUV : public ParamCommand 00213 { 00214 public: 00215 String doGet(const void* target) const; 00216 void doSet(void* target, const String& val); 00217 }; 00219 class _OgrePrivate CmdBorderTopLeftUV : public ParamCommand 00220 { 00221 public: 00222 String doGet(const void* target) const; 00223 void doSet(void* target, const String& val); 00224 }; 00226 class _OgrePrivate CmdBorderBottomLeftUV : public ParamCommand 00227 { 00228 public: 00229 String doGet(const void* target) const; 00230 void doSet(void* target, const String& val); 00231 }; 00233 class _OgrePrivate CmdBorderBottomRightUV : public ParamCommand 00234 { 00235 public: 00236 String doGet(const void* target) const; 00237 void doSet(void* target, const String& val); 00238 }; 00240 class _OgrePrivate CmdBorderTopRightUV : public ParamCommand 00241 { 00242 public: 00243 String doGet(const void* target) const; 00244 void doSet(void* target, const String& val); 00245 }; 00246 protected: 00247 Real mLeftBorderSize; 00248 Real mRightBorderSize; 00249 Real mTopBorderSize; 00250 Real mBottomBorderSize; 00251 struct CellUV { 00252 Real u1, v1, u2, v2; 00253 }; 00254 CellUV mBorderUV[8]; 00255 00256 ushort mPixelLeftBorderSize; 00257 ushort mPixelRightBorderSize; 00258 ushort mPixelTopBorderSize; 00259 ushort mPixelBottomBorderSize; 00260 00261 String mBorderMaterialName; 00262 MaterialPtr mpBorderMaterial; 00263 00264 // Render operation for the border area 00265 RenderOperation mRenderOp2; 00266 00267 static String msTypeName; 00268 00270 void updatePositionGeometry(void); 00272 void updateTextureGeometry(void); 00274 void addBaseParameters(void); 00275 00276 enum BorderCellIndex { 00277 BCELL_TOP_LEFT = 0, 00278 BCELL_TOP = 1, 00279 BCELL_TOP_RIGHT = 2, 00280 BCELL_LEFT = 3, 00281 BCELL_RIGHT = 4, 00282 BCELL_BOTTOM_LEFT = 5, 00283 BCELL_BOTTOM = 6, 00284 BCELL_BOTTOM_RIGHT = 7 00285 }; 00286 String getCellUVString(BorderCellIndex idx) const; 00287 00288 // Command objects 00289 static CmdBorderSize msCmdBorderSize; 00290 static CmdBorderMaterial msCmdBorderMaterial; 00291 static CmdBorderLeftUV msCmdBorderLeftUV; 00292 static CmdBorderTopUV msCmdBorderTopUV; 00293 static CmdBorderBottomUV msCmdBorderBottomUV; 00294 static CmdBorderRightUV msCmdBorderRightUV; 00295 static CmdBorderTopLeftUV msCmdBorderTopLeftUV; 00296 static CmdBorderBottomLeftUV msCmdBorderBottomLeftUV; 00297 static CmdBorderTopRightUV msCmdBorderTopRightUV; 00298 static CmdBorderBottomRightUV msCmdBorderBottomRightUV; 00299 00300 BorderRenderable* mBorderRenderable; 00301 }; 00302 00308 class _OgreExport BorderRenderable : public Renderable 00309 { 00310 protected: 00311 BorderPanelOverlayElement* mParent; 00312 public: 00314 BorderRenderable(BorderPanelOverlayElement* parent) : mParent(parent) {} 00315 const MaterialPtr& getMaterial(void) const { return mParent->mpBorderMaterial; } 00316 void getRenderOperation(RenderOperation& op) { op = mParent->mRenderOp2; } 00317 void getWorldTransforms(Matrix4* xform) const { mParent->getWorldTransforms(xform); } 00318 const Quaternion& getWorldOrientation(void) const { return Quaternion::IDENTITY; } 00319 const Vector3& getWorldPosition(void) const { return Vector3::ZERO; } 00320 unsigned short getNumWorldTransforms(void) const { return 1; } 00321 bool useIdentityProjection(void) const { return true; } 00322 bool useIdentityView(void) const { return true; } 00323 Real getSquaredViewDepth(const Camera* cam) const { return mParent->getSquaredViewDepth(cam); } 00324 const LightList& getLights(void) const 00325 { 00326 // N/A, panels are not lit 00327 static LightList ll; 00328 return ll; 00329 } 00330 bool getPolygonModeOverrideable(void) const 00331 { 00332 return mParent->getPolygonModeOverrideable(); 00333 } 00334 }; 00335 00336 } 00337 00338 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:37 2006