Spinning Topp Logo BlackTopp Studios
inc
billboardsetproxy.cpp
Go to the documentation of this file.
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _graphicsbillboardsetproxy_cpp
41 #define _graphicsbillboardsetproxy_cpp
42 
43 /// @file
44 /// @brief This file contains the implementation for the World proxy wrapping billboard functionality.
45 
47 #include "Graphics/scenemanager.h"
48 #include "Graphics/billboard.h"
49 
50 #include "exception.h"
51 #include "serialization.h"
52 #include "stringtool.h"
53 
54 #include <Ogre.h>
55 
56 namespace
57 {
58  /// @internal
59  /// @brief Converts an Ogre BillboardOrigin enum value to it's corresponding Mezzanine value.
60  /// @param Origin The Ogre value to be converted.
61  /// @return Returns the Mezzanine BillboardOrigin corresponding to the provided Ogre value.
62  Mezzanine::Graphics::BillboardOrigin ConvertBillboardOrigin(const Ogre::BillboardOrigin Origin)
63  {
64  switch(Origin)
65  {
66  case Ogre::BBO_TOP_LEFT: return Mezzanine::Graphics::BBO_Top_Left; break;
67  case Ogre::BBO_TOP_CENTER: return Mezzanine::Graphics::BBO_Top_Center; break;
68  case Ogre::BBO_TOP_RIGHT: return Mezzanine::Graphics::BBO_Top_Right; break;
69  case Ogre::BBO_CENTER_LEFT: return Mezzanine::Graphics::BBO_Center_Left; break;
70  case Ogre::BBO_CENTER: return Mezzanine::Graphics::BBO_Center; break;
71  case Ogre::BBO_CENTER_RIGHT: return Mezzanine::Graphics::BBO_Center_Right; break;
72  case Ogre::BBO_BOTTOM_LEFT: return Mezzanine::Graphics::BBO_Bottom_Left; break;
73  case Ogre::BBO_BOTTOM_CENTER: return Mezzanine::Graphics::BBO_Bottom_Center; break;
74  case Ogre::BBO_BOTTOM_RIGHT: return Mezzanine::Graphics::BBO_Bottom_Right; break;
75  }
77  }
78  /// @internal
79  /// @brief Converts a Mezzanine BillboardOrigin enum value to it's corresponding Ogre value.
80  /// @param Origin The Mezzanine value to be converted.
81  /// @return Returns the Ogre BillboardOrigin corresponding to the provided Mezzanine value.
82  Ogre::BillboardOrigin ConvertBillboardOrigin(const Mezzanine::Graphics::BillboardOrigin Origin)
83  {
84  switch(Origin)
85  {
86  case Mezzanine::Graphics::BBO_Top_Left: return Ogre::BBO_TOP_LEFT; break;
87  case Mezzanine::Graphics::BBO_Top_Center: return Ogre::BBO_TOP_CENTER; break;
88  case Mezzanine::Graphics::BBO_Top_Right: return Ogre::BBO_TOP_RIGHT; break;
89  case Mezzanine::Graphics::BBO_Center_Left: return Ogre::BBO_CENTER_LEFT; break;
90  case Mezzanine::Graphics::BBO_Center: return Ogre::BBO_CENTER; break;
91  case Mezzanine::Graphics::BBO_Center_Right: return Ogre::BBO_CENTER_RIGHT; break;
92  case Mezzanine::Graphics::BBO_Bottom_Left: return Ogre::BBO_BOTTOM_LEFT; break;
93  case Mezzanine::Graphics::BBO_Bottom_Center: return Ogre::BBO_BOTTOM_CENTER; break;
94  case Mezzanine::Graphics::BBO_Bottom_Right: return Ogre::BBO_BOTTOM_RIGHT; break;
95  }
96  return Ogre::BBO_CENTER;
97  }
98 
99  /// @internal
100  /// @brief Converts an Ogre BillboardRotation enum value to it's corresponding Mezzanine type.
101  /// @param Rotation The Ogre type to be converted.
102  /// @return Returns the Mezzanine BillboardRotation corresponding to the provided Ogre type.
103  Mezzanine::Graphics::BillboardRotation ConvertBillboardRotation(const Ogre::BillboardRotationType Rotation)
104  {
105  switch(Rotation)
106  {
107  case Ogre::BBR_VERTEX: return Mezzanine::Graphics::BBR_Vertex; break;
108  case Ogre::BBR_TEXCOORD: return Mezzanine::Graphics::BBR_TexureCoord; break;
109  }
111  }
112  /// @internal
113  /// @brief Converts a Mezzanine BillboardRotation enum value to it's corresponding Ogre type.
114  /// @param Rotation The Mezzanine type to be converted.
115  /// @return Returns the Ogre BillboardRotation corresponding to the provided Mezzanine type.
116  Ogre::BillboardRotationType ConvertBillboardRotation(const Mezzanine::Graphics::BillboardRotation Rotation)
117  {
118  switch(Rotation)
119  {
120  case Mezzanine::Graphics::BBR_Vertex: return Ogre::BBR_VERTEX; break;
121  case Mezzanine::Graphics::BBR_TexureCoord: return Ogre::BBR_TEXCOORD; break;
122  }
123  return Ogre::BBR_TEXCOORD;
124  }
125 
126  /// @internal
127  /// @brief Converts an Ogre BillboardType enum value to it's corresponding Mezzanine type.
128  /// @param Type The Ogre type to be converted.
129  /// @return Returns the Mezzanine BillboardType corresponding to the provided Ogre type.
130  Mezzanine::Graphics::BillboardType ConvertBillboardType(const Ogre::BillboardType Type)
131  {
132  switch(Type)
133  {
134  case Ogre::BBT_POINT: return Mezzanine::Graphics::BBT_Point; break;
135  case Ogre::BBT_ORIENTED_COMMON: return Mezzanine::Graphics::BBT_Oriented_Common; break;
136  case Ogre::BBT_ORIENTED_SELF: return Mezzanine::Graphics::BBT_Oriented_Self; break;
137  case Ogre::BBT_PERPENDICULAR_COMMON: return Mezzanine::Graphics::BBT_Perpendicular_Common; break;
138  case Ogre::BBT_PERPENDICULAR_SELF: return Mezzanine::Graphics::BBT_Perpendicular_Self; break;
139  }
141  }
142  /// @internal
143  /// @brief Converts a Mezzanine BillboardType enum value to it's corresponding Ogre type.
144  /// @param Type The Mezzanine type to be converted.
145  /// @return Returns the Ogre BillboardType corresponding to the provided Mezzanine type.
146  Ogre::BillboardType ConvertBillboardType(const Mezzanine::Graphics::BillboardType Type)
147  {
148  switch(Type)
149  {
150  case Mezzanine::Graphics::BBT_Point: return Ogre::BBT_POINT; break;
151  case Mezzanine::Graphics::BBT_Oriented_Common: return Ogre::BBT_ORIENTED_COMMON; break;
152  case Mezzanine::Graphics::BBT_Oriented_Self: return Ogre::BBT_ORIENTED_SELF; break;
153  case Mezzanine::Graphics::BBT_Perpendicular_Common: return Ogre::BBT_PERPENDICULAR_COMMON; break;
154  case Mezzanine::Graphics::BBT_Perpendicular_Self: return Ogre::BBT_PERPENDICULAR_SELF; break;
155  }
156  return Ogre::BBT_POINT;
157  }
158 }
159 
160 namespace Mezzanine
161 {
162  namespace Graphics
163  {
164  BillboardSetProxy::BillboardSetProxy(const UInt32 ID, const UInt32 InitialPoolSize, SceneManager* Creator) :
165  RenderableProxy(ID,Creator)
166  { this->CreateBillboardSet(InitialPoolSize); }
167 
169  RenderableProxy(Creator)
170  {
171  this->CreateBillboardSet(20);
172  this->ProtoDeSerialize(SelfRoot);
173  }
174 
176  { this->DestroyBillboardSet(); }
177 
179  {
180  this->WorldProxy::ProtoSerializeImpl(SelfRoot);
181  this->ProtoSerializeBillboards(SelfRoot);
182  }
183 
185  {
186  this->WorldProxy::ProtoDeSerializeImpl(SelfRoot);
187  this->ProtoDeSerializeBillboards(SelfRoot);
188  }
189 
190  void BillboardSetProxy::CreateBillboardSet(const UInt32 InitialPoolSize)
191  {
192  this->GraphicsBillboardSet = this->Manager->_GetGraphicsWorldPointer()->createBillboardSet(InitialPoolSize);
193  this->GraphicsNode->attachObject( this->GraphicsBillboardSet );
194  this->GraphicsBillboardSet->MovableObject::setUserAny( Ogre::Any( static_cast<RenderableProxy*>( this ) ) );
195  this->GraphicsBillboardSet->setVisibilityFlags(0);
196  this->GraphicsBillboardSet->setQueryFlags(0);
197  }
198 
200  {
201  if( this->GraphicsBillboardSet ) {
202  this->GraphicsNode->detachObject( this->GraphicsBillboardSet );
203  this->Manager->_GetGraphicsWorldPointer()->destroyBillboardSet( this->GraphicsBillboardSet );
204  }
205  }
206 
207  ///////////////////////////////////////////////////////////////////////////////
208  // Utility
209 
211  {
212  return Mezzanine::PT_Graphics_BillboardSetProxy;
213  }
214 
215  ///////////////////////////////////////////////////////////////////////////////
216  // Billboard Management
217 
219  {
220  Billboard* NewBB = new Billboard( this->GraphicsBillboardSet->createBillboard(Location.GetOgreVector3(),Colour.GetOgreColourValue()) );
221  this->Billboards.push_back(NewBB);
222  return NewBB;
223  }
224 
226  {
227  BillboardIterator Ret = this->Billboards.begin();
228  if( Index == 0 )
229  return *Ret;
230 
231  while( Index-- )
232  ++Ret;
233 
234  return *Ret;
235  }
236 
238  {
239  return this->Billboards.size();
240  }
241 
243  {
244  this->GraphicsBillboardSet->removeBillboard( ToBeDestroyed->_GetGraphicsObject() );
245  for( BillboardIterator BillIt = this->Billboards.begin() ; BillIt != this->Billboards.end() ; ++BillIt )
246  {
247  if( (*BillIt) == ToBeDestroyed )
248  {
249  delete (*BillIt);
250  this->Billboards.erase(BillIt);
251  return;
252  }
253  }
254  }
255 
257  {
258  for( BillboardIterator BillIt = this->Billboards.begin() ; BillIt != this->Billboards.end() ; ++BillIt )
259  {
260  delete (*BillIt);
261  }
262  this->Billboards.clear();
263  this->GraphicsBillboardSet->clear();
264  }
265 
266  ///////////////////////////////////////////////////////////////////////////////
267  // BillboardSet Properties
268 
270  { this->GraphicsBillboardSet->setAutoextend(AutoExtend); }
271 
273  { return this->GraphicsBillboardSet->getAutoextend(); }
274 
276  { this->GraphicsBillboardSet->setUseAccurateFacing(AccFace); }
277 
279  { return this->GraphicsBillboardSet->getUseAccurateFacing(); }
280 
282  { this->GraphicsBillboardSet->setPoolSize(Size); }
283 
285  { return this->GraphicsBillboardSet->getPoolSize(); }
286 
288  { this->GraphicsBillboardSet->setBillboardOrigin( ConvertBillboardOrigin(Origin) ); }
289 
291  { return ConvertBillboardOrigin( this->GraphicsBillboardSet->getBillboardOrigin() ); }
292 
294  { this->GraphicsBillboardSet->setBillboardRotationType( ConvertBillboardRotation(Rotation) ); }
295 
297  { return ConvertBillboardRotation( this->GraphicsBillboardSet->getBillboardRotationType() ); }
298 
300  { this->GraphicsBillboardSet->setBillboardType( ConvertBillboardType(Type) ); }
301 
303  { return ConvertBillboardType( this->GraphicsBillboardSet->getBillboardType() ); }
304 
305  void BillboardSetProxy::SetDefaultDimensions(const Real Width, const Real Height)
306  { this->GraphicsBillboardSet->setDefaultDimensions(Width,Height); }
307 
309  { this->GraphicsBillboardSet->setDefaultWidth(Width); }
310 
312  { return this->GraphicsBillboardSet->getDefaultWidth(); }
313 
315  { this->GraphicsBillboardSet->setDefaultHeight(Height); }
316 
318  { return this->GraphicsBillboardSet->getDefaultHeight(); }
319 
321  { this->GraphicsBillboardSet->setCommonDirection( Dir.GetOgreVector3() ); }
322 
324  { return Vector3( this->GraphicsBillboardSet->getCommonDirection() ); }
325 
327  { this->GraphicsBillboardSet->setCommonUpVector( UpDir.GetOgreVector3() ); }
328 
330  { return Vector3( this->GraphicsBillboardSet->getCommonUpVector() ); }
331 
333  { this->GraphicsBillboardSet->setMaterialName(MatName); }
334 
336  { return this->GraphicsBillboardSet->getMaterialName(); }
337 
338  ///////////////////////////////////////////////////////////////////////////////
339  // Serialization
340 
342  {
344 
345  XML::Node PropertiesNode = SelfRoot.AppendChild( BillboardSetProxy::GetSerializableName() + "Properties" );
346 
347  if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
348  PropertiesNode.AppendAttribute("AutoExtend").SetValue( this->GetAutoExtend() ? "true" : "false" ) &&
349  PropertiesNode.AppendAttribute("AccurateFacing").SetValue( this->GetAccurateFacing() ? "true" : "false" ) &&
350  PropertiesNode.AppendAttribute("PoolSize").SetValue( this->GetPoolSize() ) &&
351  PropertiesNode.AppendAttribute("BillboardOrigin").SetValue( static_cast<Whole>( this->GetBillboardOrigin() ) ) &&
352  PropertiesNode.AppendAttribute("BillboardRotation").SetValue( static_cast<Whole>( this->GetBillboardRotation() ) ) &&
353  PropertiesNode.AppendAttribute("BillboardType").SetValue( static_cast<Whole>( this->GetBillboardType() ) ) &&
354  PropertiesNode.AppendAttribute("DefaultWidth").SetValue( this->GetDefaultWidth() ) &&
355  PropertiesNode.AppendAttribute("DefaultHeight").SetValue( this->GetDefaultHeight() ) &&
356  PropertiesNode.AppendAttribute("MaterialName").SetValue( this->GetMaterialName() ) )
357  {
358  XML::Node CommonDirectionNode = PropertiesNode.AppendChild("CommonDirection");
359  this->GetCommonDirection().ProtoSerialize( CommonDirectionNode );
360  XML::Node CommonUpVectorNode = PropertiesNode.AppendChild("CommonUpVector");
361  this->GetCommonUpVector().ProtoSerialize( CommonUpVectorNode );
362 
363  return;
364  }else{
365  SerializeError("Create XML Attribute Values",BillboardSetProxy::GetSerializableName() + "Properties",true);
366  }
367  }
368 
370  {
371  XML::Node BillboardsNode = SelfRoot.AppendChild( BillboardSetProxy::GetSerializableName() + "Billboards" );
372 
373  if( BillboardsNode.AppendAttribute("Version").SetValue("1") ) {
374  for( ConstBillboardIterator BillIt = this->Billboards.begin() ; BillIt != this->Billboards.end() ; ++BillIt )
375  {
376  (*BillIt)->ProtoSerialize( BillboardsNode );
377  }
378  }else{
379  SerializeError("Create XML Attribute Values",BillboardSetProxy::GetSerializableName() + "Billboards",true);
380  }
381  }
382 
384  {
386 
387  XML::Attribute CurrAttrib;
388  XML::Node PropertiesNode = SelfRoot.GetChild( BillboardSetProxy::GetSerializableName() + "Properties" );
389 
390  if( !PropertiesNode.Empty() ) {
391  if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
392  CurrAttrib = PropertiesNode.GetAttribute("AutoExtend");
393  if( !CurrAttrib.Empty() )
394  this->SetAutoExtend( StringTools::ConvertToBool( CurrAttrib.AsString() ) );
395 
396  CurrAttrib = PropertiesNode.GetAttribute("AccurateFacing");
397  if( !CurrAttrib.Empty() )
398  this->SetAccurateFacing( StringTools::ConvertToBool( CurrAttrib.AsString() ) );
399 
400  CurrAttrib = PropertiesNode.GetAttribute("PoolSize");
401  if( !CurrAttrib.Empty() )
402  this->SetPoolSize( CurrAttrib.AsReal() );
403 
404  CurrAttrib = PropertiesNode.GetAttribute("BillboardOrigin");
405  if( !CurrAttrib.Empty() )
406  this->SetBillboardOrigin( static_cast<Graphics::BillboardOrigin>( CurrAttrib.AsWhole() ) );
407 
408  CurrAttrib = PropertiesNode.GetAttribute("BillboardRotation");
409  if( !CurrAttrib.Empty() )
410  this->SetBillboardRotation( static_cast<Graphics::BillboardRotation>( CurrAttrib.AsWhole() ) );
411 
412  CurrAttrib = PropertiesNode.GetAttribute("BillboardType");
413  if( !CurrAttrib.Empty() )
414  this->SetBillboardType( static_cast<Graphics::BillboardType>( CurrAttrib.AsWhole() ) );
415 
416  CurrAttrib = PropertiesNode.GetAttribute("DefaultWidth");
417  if( !CurrAttrib.Empty() )
418  this->SetDefaultWidth( CurrAttrib.AsReal() );
419 
420  CurrAttrib = PropertiesNode.GetAttribute("DefaultHeight");
421  if( !CurrAttrib.Empty() )
422  this->SetDefaultHeight( CurrAttrib.AsReal() );
423 
424  CurrAttrib = PropertiesNode.GetAttribute("MaterialName");
425  if( !CurrAttrib.Empty() )
426  this->SetMaterialName( CurrAttrib.AsString() );
427 
428  XML::Node CommonDirectionNode = PropertiesNode.GetChild("CommonDirection").GetFirstChild();
429  if( !CommonDirectionNode.Empty() ) {
430  Vector3 CommonDir(CommonDirectionNode);
431  this->SetCommonDirection(CommonDir);
432  }
433 
434  XML::Node CommonUpVectorNode = PropertiesNode.GetChild("CommonUpVector").GetFirstChild();
435  if( !CommonUpVectorNode.Empty() ) {
436  Vector3 CommonUpVec(CommonUpVectorNode);
437  this->SetCommonUpVector(CommonUpVec);
438  }
439  }else{
440  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (BillboardSetProxy::GetSerializableName() + "Properties" ) + ": Not Version 1.");
441  }
442  }else{
443  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,BillboardSetProxy::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
444  }
445  }
446 
448  {
449  this->DestroyAllBillboards();
450 
451  XML::Node BillboardsNode = SelfRoot.GetChild( BillboardSetProxy::GetSerializableName() + "Billboards" );
452 
453  if( !BillboardsNode.Empty() ) {
454  if(BillboardsNode.GetAttribute("Version").AsInt() == 1) {
455  for( XML::NodeIterator BillIt = BillboardsNode.begin() ; BillIt != BillboardsNode.end() ; ++BillIt )
456  {
457  Billboard* NewBB = this->CreateBillboard( Vector3() );
458  NewBB->ProtoDeSerialize( (*BillIt) );
459  }
460  }
461  }
462  }
463 
466 
468  { return "BillboardSetProxy"; }
469 
470  ///////////////////////////////////////////////////////////////////////////////
471  // Internal Methods
472 
473  Ogre::BillboardSet* BillboardSetProxy::_GetGraphicsObject() const
474  { return this->GraphicsBillboardSet; }
475 
476  Ogre::MovableObject* BillboardSetProxy::_GetBaseGraphicsObject() const
477  { return this->GraphicsBillboardSet; }
478  }//Graphics
479 }//Mezzanine
480 
481 #endif
Billboards are oriented around their own individually set direction axis, which will act as their loc...
Position/Rotate around the Top-Right corner of the billboard.
virtual Graphics::BillboardType GetBillboardType() const
Gets the type of BillboardSetProxy this is.
virtual void SetBillboardRotation(const Graphics::BillboardRotation Rotation)
Sets the type of rotation to apply when a rotation is made to a billboard.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
virtual void DestroyBillboard(Billboard *ToBeDestroyed)
Deletes a Billboard.
virtual Graphics::BillboardOrigin GetBillboardOrigin() const
Gets the part of the billboard that is currently being treated as the origin for all children of this...
A light-weight handle for manipulating attributes in DOM tree.
Definition: attribute.h:74
virtual void ProtoSerializeImpl(XML::Node &SelfRoot) const
Implementation method for serializing additional sets of data.
virtual void DestroyAllBillboards()
Deletes all stored Billboard instances.
BillboardContainer::const_iterator ConstBillboardIterator
Const Iterator type for Billboard instances stored by this class.
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Definition: billboard.cpp:169
This class contains utilities and functions to allow the manipulation of the Graphical scene...
Definition: scenemanager.h:85
This is the proxy class for placing and manipulating a set of 2D billboards in the scene...
Definition: billboard.h:62
virtual Vector3 GetCommonDirection() const
Gets the common facing direction for all billboards in this set.
virtual Vector3 GetCommonUpVector() const
Gets the common up direction for all billboards in this set.
virtual Ogre::MovableObject * _GetBaseGraphicsObject() const
Accessor for the internal graphics object.
Billboards are oriented around a common axis provided to the BillboardSetProxy, which will act as the...
virtual void SetDefaultWidth(const Real Width)
Sets the default width all billboards in this set are to be configured with when constructed.
Thrown when the requested identity could not be found.
Definition: exception.h:94
virtual void ProtoSerializeImpl(XML::Node &SelfRoot) const
Implementation method for serializing additional sets of data.
Definition: worldproxy.cpp:66
Node GetFirstChild() const
Get the first child Node of this Node.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
Definition: exception.h:3048
virtual void SetCommonDirection(const Vector3 &Dir)
Sets the common facing direction for all billboards in this set.
SceneManager * Manager
This is a pointer to the scene manager that created and owns this proxy.
virtual void SetBillboardType(const Graphics::BillboardType Type)
Sets the type of BillboardSetProxy this is.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Definition: worldproxy.cpp:114
virtual void ProtoSerializeBillboards(XML::Node &SelfRoot) const
Convert the Billboards of this class to an XML::Node ready for serialization.
Billboards are oriented around a common axis provided to the BillboardSetProxy, which will act as the...
Rotates the texture coordinates of the billboard when rotated, preserving the vertex positions...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Definition: exception.h:112
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
virtual Ogre::BillboardSet * _GetGraphicsObject() const
Accessor for the internal billboard set.
BillboardContainer::iterator BillboardIterator
Iterator type for Billboard instances stored by this class.
Ogre::BillboardSet * GraphicsBillboardSet
A pointer to the internal BillboardSet this proxy is based on.
Default setting. Billboard direction always faces the camera and is always oriented to be upright...
This is the base proxy class for world proxies wrapping functionality of the graphics subsystem...
virtual void SetPoolSize(const UInt32 Size)
Sets a new size of the billboard pool in this set.
This file contains the declaration for the World proxy wrapping billboard functionality.
virtual ~BillboardSetProxy()
Class destructor.
BillboardContainer Billboards
Container storing all of the Billboard instances created by this proxy.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
Definition: colourvalue.h:64
virtual Boole GetAccurateFacing() const
Gets whether direction vectors are being calculated using a more expensive but more accurate algorith...
bool Empty() const
Is this storing anything at all?
This implements the exception hiearchy for Mezzanine.
virtual void SetDefaultHeight(const Real Height)
Sets the default height all billboards in this set are to be configured with when constructed...
virtual void SetAccurateFacing(const Boole AccFace)
Sets whether direction vectors will be calculated using a more expensive but more accurate algorithm...
virtual void ProtoDeSerializeBillboards(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the Billboards of this object with it...
Rotates the vertices of the billboard when rotated.
BillboardOrigin
This is used by the BillboardSetProxy to describe which part of the billboard will be treated as the ...
Ogre::SceneNode * GraphicsNode
A pointer to the internal object storing the proxy transform.
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
The interface for serialization.
bool SetValue(const Char8 *rhs)
Set the value of this.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
Whole AsWhole(Whole def=0) const
Attempts to convert the value of the attribute to a Whole and returns the results.
Boole ConvertToBool(const String &ToConvert, const Boole Default)
Converts a string into a Boole.
Definition: stringtool.cpp:379
Child node iterator (a bidirectional iterator over a collection of Node)
Definition: nodeiterator.h:77
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
iterator begin() const
Get a Child node iterator that references the first child Node.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
ProxyType
Used by all World proxies to describe what their derived types are.
Definition: enumerations.h:91
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
iterator end() const
Get a Child node iterator that references one past the last child Node.
virtual Boole GetAutoExtend() const
Gets whether or not this BillboardSetProxy will increase the size of it's billboard pool automaticall...
bool Empty() const
Is this storing anything at all?
Position/Rotate around the Top-Left corner of the billboard.
Ogre::Vector3 GetOgreVector3() const
Gets a Ogre vector3.
Definition: vector3.cpp:572
virtual void CreateBillboardSet(const UInt32 InitialPoolSize)
Creates an internal BillboardSet to be used by the calling instance.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
virtual Real GetDefaultHeight() const
Gets the default height all billboards in this set are constructed with.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this WorldProxy.
virtual void SetDefaultDimensions(const Real Width, const Real Height)
Sets the default width and height all billboards in this set are to be configured with when construct...
Position/Rotate around the Center of the billboard.
virtual Billboard * GetBillboard(UInt32 Index)
Gets a Billboard instance by index.
BillboardSetProxy(const UInt32 ID, const UInt32 InitialPoolSize, SceneManager *Creator)
Class constructor.
Position/Rotate around the Center-Left side of the billboard.
virtual void SetBillboardOrigin(const Graphics::BillboardOrigin Origin)
Sets the part of the billboard that will be treated as the origin for all children of this set...
virtual Mezzanine::ProxyType GetProxyType() const
Accessor for the type of proxy.
virtual Billboard * CreateBillboard(const Vector3 &Location, const ColourValue &Colour=ColourValue::White())
Creates a new Billboard for this set.
virtual void ProtoDeSerializeImpl(const XML::Node &SelfRoot)
Implementation method for deseriailizing additional sets of data.
virtual UInt32 GetPoolSize() const
Gets the current size of the billboard pool in this set.
This file contains the declaration for the Billboard class used by BillboardSetProxy.
Ogre::SceneManager * _GetGraphicsWorldPointer() const
Gets the internal Ogre Scene Manager pointer.
virtual void SetCommonUpVector(const Vector3 &UpDir)
Sets the common up direction for all billboards in this set.
This is used to represent a point in space, or a vector through space.
Definition: vector3.h:77
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
Position/Rotate around the Bottom-Center of the billboard.
Ogre::Billboard * _GetGraphicsObject() const
Accessor for the internal billboard.
Definition: billboard.cpp:245
Position/Rotate around the Bottom-Right corner of the billboard.
static String GetSerializableName()
Get the name of the the XML tag the proxy class will leave behind as its instances are serialized...
virtual String GetMaterialName() const
Gets the name of the material being used by this set.
virtual void SetAutoExtend(const Boole AutoExtend)
Sets whether or not this BillboardSetProxy will increase the size of it's billboard pool automaticall...
virtual void SetMaterialName(const String &MatName)
Sets a material for this set by name.
virtual Real GetDefaultWidth() const
Gets the default width all billboards in this set are constructed with.
Ogre::ColourValue GetOgreColourValue() const
Creates and returns an Ogre ColourValue class with values equal to this one.
Definition: colourvalue.cpp:86
Position/Rotate around the Center-Right side of the billboard.
BillboardType
This is used by BillboardSetProxies to describe how the billboards are to be oriented.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
virtual UInt32 GetNumBillboards() const
Gets the number of Billboard instances in this set.
virtual void DestroyBillboardSet()
Destroys the internal BillboardSet in use by this proxy.
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
BillboardRotation
This is used by the BillboardSetProxy to decide how billboards should be rotated when they are reques...
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
Definition: vector3.cpp:588
Position/Rotate around the Bottom-Left corner of the billboard.
Position/Rotate around the Top-Center of the billboard.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual void ProtoDeSerializeImpl(const XML::Node &SelfRoot)
Implementation method for deseriailizing additional sets of data.
Definition: worldproxy.cpp:69
virtual Graphics::BillboardRotation GetBillboardRotation() const
Gets the type of rotation to apply when a rotation is made to a billboard.
Billboards are oriented around their own individually set direction axis, which will act as their loc...