OgreBorderPanelOverlayElement.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __BorderPanelOverlayElement_H__
30 #define __BorderPanelOverlayElement_H__
31 
33 
34 namespace Ogre {
42  class BorderRenderable;
43 
58  {
59  friend class BorderRenderable;
60  public:
62  BorderPanelOverlayElement(const String& name);
63  virtual ~BorderPanelOverlayElement();
64 
65  virtual void initialise(void);
66 
67  const String& getTypeName(void) const;
79  void setBorderSize(Real size);
80 
92  void setBorderSize(Real sides, Real topAndBottom);
93 
107  void setBorderSize(Real left, Real right, Real top, Real bottom);
108 
110  Real getLeftBorderSize(void) const;
112  Real getRightBorderSize(void) const;
114  Real getTopBorderSize(void) const;
116  Real getBottomBorderSize(void) const;
117 
128  void setLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
132  void setRightBorderUV(Real u1, Real v1, Real u2, Real v2);
136  void setTopBorderUV(Real u1, Real v1, Real u2, Real v2);
140  void setBottomBorderUV(Real u1, Real v1, Real u2, Real v2);
144  void setTopLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
148  void setTopRightBorderUV(Real u1, Real v1, Real u2, Real v2);
152  void setBottomLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
156  void setBottomRightBorderUV(Real u1, Real v1, Real u2, Real v2);
157 
158  String getLeftBorderUVString() const;
159  String getRightBorderUVString() const;
160  String getTopBorderUVString() const;
161  String getBottomBorderUVString() const;
162  String getTopLeftBorderUVString() const;
163  String getTopRightBorderUVString() const;
164  String getBottomLeftBorderUVString() const;
165  String getBottomRightBorderUVString() const;
166 
167 
168 
169 
171  void setBorderMaterialName(const String& name);
173  const String& getBorderMaterialName(void) const;
174 
176  void _updateRenderQueue(RenderQueue* queue);
178  void visitRenderables(Renderable::Visitor* visitor,
179  bool debugRenderables = false);
180 
182  void setMetricsMode(GuiMetricsMode gmm);
183 
185  void _update(void);
186 
187 
190  {
191  public:
192  String doGet(const void* target) const;
193  void doSet(void* target, const String& val);
194  };
197  {
198  public:
199  String doGet(const void* target) const;
200  void doSet(void* target, const String& val);
201  };
204  {
205  public:
206  String doGet(const void* target) const;
207  void doSet(void* target, const String& val);
208  };
211  {
212  public:
213  String doGet(const void* target) const;
214  void doSet(void* target, const String& val);
215  };
218  {
219  public:
220  String doGet(const void* target) const;
221  void doSet(void* target, const String& val);
222  };
225  {
226  public:
227  String doGet(const void* target) const;
228  void doSet(void* target, const String& val);
229  };
232  {
233  public:
234  String doGet(const void* target) const;
235  void doSet(void* target, const String& val);
236  };
239  {
240  public:
241  String doGet(const void* target) const;
242  void doSet(void* target, const String& val);
243  };
246  {
247  public:
248  String doGet(const void* target) const;
249  void doSet(void* target, const String& val);
250  };
253  {
254  public:
255  String doGet(const void* target) const;
256  void doSet(void* target, const String& val);
257  };
258  protected:
263  struct CellUV {
264  Real u1, v1, u2, v2;
265  };
266  CellUV mBorderUV[8];
267 
272 
275 
278 
280 
282  void updatePositionGeometry(void);
284  void updateTextureGeometry(void);
286  void addBaseParameters(void);
287 
289  BCELL_TOP_LEFT = 0,
290  BCELL_TOP = 1,
291  BCELL_TOP_RIGHT = 2,
292  BCELL_LEFT = 3,
293  BCELL_RIGHT = 4,
294  BCELL_BOTTOM_LEFT = 5,
295  BCELL_BOTTOM = 6,
296  BCELL_BOTTOM_RIGHT = 7
297  };
298  String getCellUVString(BorderCellIndex idx) const;
299 
300  // Command objects
311 
313  };
314 
321  {
322  protected:
324  public:
326  BorderRenderable(BorderPanelOverlayElement* parent) : mParent(parent)
327  {
328  mUseIdentityProjection = true;
329  mUseIdentityView = true;
330  }
331  const MaterialPtr& getMaterial(void) const { return mParent->mBorderMaterial; }
332  void getRenderOperation(RenderOperation& op) { op = mParent->mRenderOp2; }
333  void getWorldTransforms(Matrix4* xform) const { mParent->getWorldTransforms(xform); }
334  unsigned short getNumWorldTransforms(void) const { return 1; }
335  Real getSquaredViewDepth(const Camera* cam) const { return mParent->getSquaredViewDepth(cam); }
336  const LightList& getLights(void) const
337  {
338  // N/A, panels are not lit
339  static LightList ll;
340  return ll;
341  }
342  bool getPolygonModeOverrideable(void) const
343  {
344  return mParent->getPolygonModeOverrideable();
345  }
346  };
350 } // namespace Ogre
351 
352 #endif // __BorderPanelOverlayElement_H__

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Oct 23 2013 06:57:23