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); 00173 void visitRenderables(Renderable::Visitor* visitor, 00174 bool debugRenderables = false); 00175 00177 void setMetricsMode(GuiMetricsMode gmm); 00178 00180 void _update(void); 00181 00182 00184 class _OgrePrivate CmdBorderSize : public ParamCommand 00185 { 00186 public: 00187 String doGet(const void* target) const; 00188 void doSet(void* target, const String& val); 00189 }; 00191 class _OgrePrivate CmdBorderMaterial : public ParamCommand 00192 { 00193 public: 00194 String doGet(const void* target) const; 00195 void doSet(void* target, const String& val); 00196 }; 00198 class _OgrePrivate CmdBorderLeftUV : public ParamCommand 00199 { 00200 public: 00201 String doGet(const void* target) const; 00202 void doSet(void* target, const String& val); 00203 }; 00205 class _OgrePrivate CmdBorderTopUV : public ParamCommand 00206 { 00207 public: 00208 String doGet(const void* target) const; 00209 void doSet(void* target, const String& val); 00210 }; 00212 class _OgrePrivate CmdBorderRightUV : public ParamCommand 00213 { 00214 public: 00215 String doGet(const void* target) const; 00216 void doSet(void* target, const String& val); 00217 }; 00219 class _OgrePrivate CmdBorderBottomUV : public ParamCommand 00220 { 00221 public: 00222 String doGet(const void* target) const; 00223 void doSet(void* target, const String& val); 00224 }; 00226 class _OgrePrivate CmdBorderTopLeftUV : public ParamCommand 00227 { 00228 public: 00229 String doGet(const void* target) const; 00230 void doSet(void* target, const String& val); 00231 }; 00233 class _OgrePrivate CmdBorderBottomLeftUV : public ParamCommand 00234 { 00235 public: 00236 String doGet(const void* target) const; 00237 void doSet(void* target, const String& val); 00238 }; 00240 class _OgrePrivate CmdBorderBottomRightUV : public ParamCommand 00241 { 00242 public: 00243 String doGet(const void* target) const; 00244 void doSet(void* target, const String& val); 00245 }; 00247 class _OgrePrivate CmdBorderTopRightUV : public ParamCommand 00248 { 00249 public: 00250 String doGet(const void* target) const; 00251 void doSet(void* target, const String& val); 00252 }; 00253 protected: 00254 Real mLeftBorderSize; 00255 Real mRightBorderSize; 00256 Real mTopBorderSize; 00257 Real mBottomBorderSize; 00258 struct CellUV { 00259 Real u1, v1, u2, v2; 00260 }; 00261 CellUV mBorderUV[8]; 00262 00263 ushort mPixelLeftBorderSize; 00264 ushort mPixelRightBorderSize; 00265 ushort mPixelTopBorderSize; 00266 ushort mPixelBottomBorderSize; 00267 00268 String mBorderMaterialName; 00269 MaterialPtr mpBorderMaterial; 00270 00271 // Render operation for the border area 00272 RenderOperation mRenderOp2; 00273 00274 static String msTypeName; 00275 00277 void updatePositionGeometry(void); 00279 void updateTextureGeometry(void); 00281 void addBaseParameters(void); 00282 00283 enum BorderCellIndex { 00284 BCELL_TOP_LEFT = 0, 00285 BCELL_TOP = 1, 00286 BCELL_TOP_RIGHT = 2, 00287 BCELL_LEFT = 3, 00288 BCELL_RIGHT = 4, 00289 BCELL_BOTTOM_LEFT = 5, 00290 BCELL_BOTTOM = 6, 00291 BCELL_BOTTOM_RIGHT = 7 00292 }; 00293 String getCellUVString(BorderCellIndex idx) const; 00294 00295 // Command objects 00296 static CmdBorderSize msCmdBorderSize; 00297 static CmdBorderMaterial msCmdBorderMaterial; 00298 static CmdBorderLeftUV msCmdBorderLeftUV; 00299 static CmdBorderTopUV msCmdBorderTopUV; 00300 static CmdBorderBottomUV msCmdBorderBottomUV; 00301 static CmdBorderRightUV msCmdBorderRightUV; 00302 static CmdBorderTopLeftUV msCmdBorderTopLeftUV; 00303 static CmdBorderBottomLeftUV msCmdBorderBottomLeftUV; 00304 static CmdBorderTopRightUV msCmdBorderTopRightUV; 00305 static CmdBorderBottomRightUV msCmdBorderBottomRightUV; 00306 00307 BorderRenderable* mBorderRenderable; 00308 }; 00309 00315 class _OgreExport BorderRenderable : public Renderable, public OverlayAlloc 00316 { 00317 protected: 00318 BorderPanelOverlayElement* mParent; 00319 public: 00321 BorderRenderable(BorderPanelOverlayElement* parent) : mParent(parent) 00322 { 00323 mUseIdentityProjection = true; 00324 mUseIdentityView = true; 00325 } 00326 const MaterialPtr& getMaterial(void) const { return mParent->mpBorderMaterial; } 00327 void getRenderOperation(RenderOperation& op) { op = mParent->mRenderOp2; } 00328 void getWorldTransforms(Matrix4* xform) const { mParent->getWorldTransforms(xform); } 00329 unsigned short getNumWorldTransforms(void) const { return 1; } 00330 Real getSquaredViewDepth(const Camera* cam) const { return mParent->getSquaredViewDepth(cam); } 00331 const LightList& getLights(void) const 00332 { 00333 // N/A, panels are not lit 00334 static LightList ll; 00335 return ll; 00336 } 00337 bool getPolygonModeOverrideable(void) const 00338 { 00339 return mParent->getPolygonModeOverrideable(); 00340 } 00341 }; 00342 00343 } 00344 00345 #endif
Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:22 2009