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:
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;
114  Real getTopBorderSize(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 
166 
167 
168 
169 
171  void setBorderMaterialName(const String& name);
173  const String& getBorderMaterialName(void) const;
174 
179  bool debugRenderables = false);
180 
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 
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  };
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__
#define _OgreOverlayExport
#define _OgrePrivate
Definition: OgrePlatform.h:258
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Command object for specifying texture coordinates for the border (see ParamCommand).
void doSet(void *target, const String &val)
Command object for specifying texture coordinates for the border (see ParamCommand).
void doSet(void *target, const String &val)
Command object for specifying texture coordinates for the border (see ParamCommand).
void doSet(void *target, const String &val)
String doGet(const void *target) const
Command object for specifying texture coordinates for the border (see ParamCommand).
String doGet(const void *target) const
void doSet(void *target, const String &val)
Command object for specifying the Material for the border (see ParamCommand).
String doGet(const void *target) const
void doSet(void *target, const String &val)
Command object for specifying texture coordinates for the border (see ParamCommand).
void doSet(void *target, const String &val)
String doGet(const void *target) const
Command object for specifying border sizes (see ParamCommand).
void doSet(void *target, const String &val)
String doGet(const void *target) const
Command object for specifying texture coordinates for the border (see ParamCommand).
void doSet(void *target, const String &val)
Command object for specifying texture coordinates for the border (see ParamCommand).
void doSet(void *target, const String &val)
Command object for specifying texture coordinates for the border (see ParamCommand).
void doSet(void *target, const String &val)
String doGet(const void *target) const
A specialisation of the PanelOverlayElement to provide a panel with a border.
String getTopRightBorderUVString() const
const String & getBorderMaterialName(void) const
Gets the name of the material to use for the borders.
static CmdBorderBottomLeftUV msCmdBorderBottomLeftUV
void setBottomBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the bottom edge of the border.
String getRightBorderUVString() const
void setTopLeftBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the top-left corner of the border.
void updateTextureGeometry(void)
internal method for setting up geometry, called by OverlayElement::update
Real getBottomBorderSize(void) const
Gets the size of the bottom border.
void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false)
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject ...
void setLeftBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the left edge of the border.
virtual void initialise(void)
Initialise.
void setMetricsMode(GuiMetricsMode gmm)
Tells this element how to interpret the position and dimension values it is given.
void addBaseParameters(void)
Internal method for setting up parameters.
RenderOperation mRenderOp2
Render operation for the border area.
void setRightBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the right edge of the border.
void setBorderSize(Real size)
Sets the size of the border.
void setBottomRightBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the bottom-right corner of the border.
void updatePositionGeometry(void)
internal method for setting up geometry, called by OverlayElement::update
BorderPanelOverlayElement(const String &name)
Constructor.
static CmdBorderBottomRightUV msCmdBorderBottomRightUV
Real getRightBorderSize(void) const
Gets the size of the right border.
String getCellUVString(BorderCellIndex idx) const
String getBottomBorderUVString() const
void _update(void)
Internal method to update the element based on transforms applied.
const String & getTypeName(void) const
See OverlayElement.
void setBorderMaterialName(const String &name)
Sets the name of the material to use for the borders.
String getLeftBorderUVString() const
static CmdBorderTopRightUV msCmdBorderTopRightUV
void _updateRenderQueue(RenderQueue *queue)
Overridden from OverlayElement.
void setTopBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the top edge of the border.
Real getLeftBorderSize(void) const
Gets the size of the left border.
void setBorderSize(Real sides, Real topAndBottom)
Sets the size of the border, with different sizes for vertical and horizontal borders.
void setTopRightBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the top-right corner of the border.
void setBottomLeftBorderUV(Real u1, Real v1, Real u2, Real v2)
Sets the texture coordinates for the bottom-left corner of the border.
String getTopLeftBorderUVString() const
void setBorderSize(Real left, Real right, Real top, Real bottom)
Sets the size of the border separately for all borders.
Real getTopBorderSize(void) const
Gets the size of the top border.
String getBottomLeftBorderUVString() const
String getBottomRightBorderUVString() const
Class for rendering the border of a BorderPanelOverlayElement.
bool getPolygonModeOverrideable(void) const
Gets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setti...
const LightList & getLights(void) const
Gets a list of lights, ordered relative to how close they are to this renderable.
unsigned short getNumWorldTransforms(void) const
Returns the number of world transform matrices this renderable requires.
BorderRenderable(BorderPanelOverlayElement *parent)
Constructed with pointers to parent.
const MaterialPtr & getMaterial(void) const
Retrieves a weak reference to the material this renderable object uses.
Real getSquaredViewDepth(const Camera *cam) const
Returns the camera-relative squared depth of this renderable.
void getWorldTransforms(Matrix4 *xform) const
Gets the world transform matrix / matrices for this renderable object.
BorderPanelOverlayElement * mParent
void getRenderOperation(RenderOperation &op)
Gets the render operation required to send this object to the frame buffer.
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
void getWorldTransforms(Matrix4 *xform) const
See Renderable.
Real getSquaredViewDepth(const Camera *cam) const
Overridden from Renderable.
OverlayElement representing a flat, single-material (or transparent) panel which can contain other el...
Abstract class which is command object which gets/sets parameters.
'New' rendering operation using vertex buffers.
Class to manage the scene object rendering queue.
Visitor object that can be used to iterate over a collection of Renderable instances abstractly.
Abstract class defining the interface all renderable objects must implement.
virtual bool getPolygonModeOverrideable(void) const
Gets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setti...
GuiMetricsMode
Enum describing how the position / size of an element is to be recorded.
float Real
Software floating point type.
_StringBase String
unsigned short ushort

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.