40 #ifndef _graphicscameraproxy_cpp
41 #define _graphicscameraproxy_cpp
47 #include "Graphics/scenemanager.h"
48 #include "Graphics/viewport.h"
52 #include "stringtool.h"
84 return Ogre::PM_SOLID;
111 return Ogre::PT_PERSPECTIVE;
122 case Ogre::OR_DEGREE_0:
return Mezzanine::Graphics::OM_Degree_0;
break;
123 case Ogre::OR_DEGREE_90:
return Mezzanine::Graphics::OM_Degree_90;
break;
124 case Ogre::OR_DEGREE_180:
return Mezzanine::Graphics::OM_Degree_180;
break;
125 case Ogre::OR_DEGREE_270:
return Mezzanine::Graphics::OM_Degree_270;
break;
127 return Mezzanine::Graphics::OM_Degree_0;
137 case Mezzanine::Graphics::OM_Degree_0:
return Ogre::OR_DEGREE_0;
break;
138 case Mezzanine::Graphics::OM_Degree_90:
return Ogre::OR_DEGREE_90;
break;
139 case Mezzanine::Graphics::OM_Degree_180:
return Ogre::OR_DEGREE_180;
break;
140 case Mezzanine::Graphics::OM_Degree_270:
return Ogre::OR_DEGREE_270;
break;
142 return Ogre::OR_DEGREE_0;
152 GraphicsCamera(NULL),
159 GraphicsCamera(NULL),
174 this->
GraphicsCamera->MovableObject::setUserAny( Ogre::Any( static_cast<RenderableProxy*>(
this ) ) );
193 static UInt32 NameCounter = 0;
195 NameStream <<
"Camera" << ++NameCounter;
196 return NameStream.str();
203 {
return Mezzanine::PT_Graphics_CameraProxy; }
230 { this->
GraphicsCamera->setPolygonMode( ConvertPolygonMode(PolyMode) ); }
233 {
return ConvertPolygonMode( this->
GraphicsCamera->getPolygonMode() ); }
236 { this->
GraphicsCamera->setProjectionType( ConvertProjectionType(ProjType) ); }
239 {
return ConvertProjectionType( this->
GraphicsCamera->getProjectionType() ); }
242 { this->
GraphicsCamera->setOrientationMode( ConvertOrientationMode(OriMode) ); }
245 {
return ConvertOrientationMode( this->
GraphicsCamera->getOrientationMode() ); }
333 if( !PropertiesNode.
Empty() ) {
335 Boole UseFixed =
true;
337 Real OrthoWidth = 0, OrthoHeight = 0;
339 CurrAttrib = PropertiesNode.
GetAttribute(
"PolygonMode");
340 if( !CurrAttrib.
Empty() )
343 CurrAttrib = PropertiesNode.
GetAttribute(
"ProjectionType");
344 if( !CurrAttrib.
Empty() )
347 CurrAttrib = PropertiesNode.
GetAttribute(
"OrientationMode");
348 if( !CurrAttrib.
Empty() )
352 if( !CurrAttrib.
Empty() )
353 OrthoWidth = CurrAttrib.
AsReal();
355 CurrAttrib = PropertiesNode.
GetAttribute(
"OrthoHeight");
356 if( !CurrAttrib.
Empty() )
357 OrthoHeight = CurrAttrib.
AsReal();
361 CurrAttrib = PropertiesNode.
GetAttribute(
"NearClipDistance");
362 if( !CurrAttrib.
Empty() )
365 CurrAttrib = PropertiesNode.
GetAttribute(
"FarClipDistance");
366 if( !CurrAttrib.
Empty() )
369 CurrAttrib = PropertiesNode.
GetAttribute(
"FieldOfView");
370 if( !CurrAttrib.
Empty() )
373 CurrAttrib = PropertiesNode.
GetAttribute(
"AspectRatio");
374 if( !CurrAttrib.
Empty() )
377 CurrAttrib = PropertiesNode.
GetAttribute(
"UseFixedYaw");
378 if( !CurrAttrib.
Empty() )
382 if( !FixedYawAxisNode.
Empty() ) {
399 {
return "CameraProxy"; }
void SetCamera(CameraProxy *ViewportCamera)
Sets which CameraProxy is bound to this viewport.
virtual void SetDirection(const Vector3 &Dir)
Sets the direction the light will be emitted from this source.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
Ogre::Camera * GraphicsCamera
A pointer to the internal Camera this proxy is based on.
A light-weight handle for manipulating attributes in DOM tree.
No projection is used, objects appear to be flat.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
bool Boole
Generally acts a single bit, true or false.
virtual void SetFarClipDistance(const Real FarDist)
Sets the distance in world units at which objects are considered too far to render.
ProjectionType
Values for storing how perspective should be interpretted.
static String GetSerializableName()
Get the name of the the XML tag the proxy class will leave behind as its instances are serialized...
This class contains utilities and functions to allow the manipulation of the Graphical scene...
Vector3 FixedYawAxis
A vector3 representing the fixed axis on which this camera will always Yaw/rotate.
virtual Ray GetCameraToViewportRay(const Real ScreenX, const Real ScreenY) const
Gets a Ray from the camera to the viewport.
virtual void SetOrientation(const Quaternion &Ori)
Sets the orientation of this object in parent space.
virtual void DestroyCamera()
Destroys the internal Camera in use by this proxy.
virtual Real GetOrthoWindowWidth() const
Gets the current width of the Orthographic projection window in world units.
virtual void SetOrthoWindowWidth(const Real Width)
Defines the size of the Orthographic projection window in world units.
static String GenerateName()
Generates a name for this Camera to placate the internal system.
Thrown when the requested identity could not be found.
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.
SceneManager * Manager
This is a pointer to the scene manager that created and owns this proxy.
virtual Mezzanine::ProxyType GetProxyType() const
Accessor for the type of proxy.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
virtual ~CameraProxy()
Class destructor.
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
virtual Real GetOrthoWindowHeight() const
Gets the current height of the Orthographic projection window in world units.
virtual void SetAspectRatio(const Real Ratio)
Sets the aspect ratio of the cameras veiw.
virtual void CreateCamera()
Creates an internal Camera to be used by the calling instance.
virtual void SetProjectionType(const Graphics::ProjectionType ProjType)
Sets the type of projection to be used with this camera.
This is the base proxy class for world proxies wrapping functionality of the graphics subsystem...
virtual void SetNearClipDistance(const Real NearDist)
Sets the distance in world units at which objects are considered too close to render.
virtual void SetOrientationMode(const Graphics::OrientationMode OriMode)
Sets the orientation mode of this cameras frustrum.
bool Empty() const
Is this storing anything at all?
This implements the exception hiearchy for Mezzanine.
virtual void SetOrthoWindow(const Real Width, const Real Height)
Defines the size of the Orthographic projection window in world units.
virtual void LookAt(const Vector3 &TargetLoc)
Sets the direction the camera faces based on a 3D point.
std::stringstream StringStream
A Datatype used for streaming operations with strings.
virtual Real GetFieldOfViewY() const
Gets the vertical field of view of the camera frustrum.
Ogre::SceneNode * GraphicsNode
A pointer to the internal object storing the proxy transform.
Only points for each of the vertices are rendered.
float Real
A Datatype used to represent a real floating point number.
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...
Whole AsWhole(Whole def=0) const
Attempts to convert the value of the attribute to a Whole and returns the results.
This class is for creating and managing viewports within a game window.
virtual Quaternion GetOrientation() const
Gets this objects current orientation.
This file contains the declaration for the World proxy wrapping camera functionality.
A light-weight handle for manipulating nodes in DOM tree.
virtual void SetOrthoWindowHeight(const Real Height)
Defines the size of the Orthographic projection window in world units.
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.
uint32_t UInt32
An 32-bit unsigned integer.
virtual Viewport * GetViewport() const
Gets the Viewport this camera is attached to, if any.
static Vector3 Unit_Y()
Gets a vector representing the Y unit of a Vector3.
bool Empty() const
Is this storing anything at all?
Ogre::Vector3 GetOgreVector3() const
Gets a Ogre vector3.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
virtual Real GetFarClipDistance() const
Gets the distance in world units at which objects are considered too far to render.
Boole UseFixedYaw
A Boole storing whether or not the FixedYawAxis is being used.
virtual void SetPolygonMode(const Graphics::CameraPolyMode PolyMode)
Sets the debug rendering mode for this camera.
virtual Graphics::OrientationMode GetOrientationMode() const
Gets the orientation mode of this cameras frustrum.
virtual Ogre::MovableObject * _GetBaseGraphicsObject() const
Accessor for the internal graphics object.
void ProtoDeSerialize(const XML::Node &OneNode)
Take the data stored in an XML and overwrite this instance of this object with it.
CameraProxy(const UInt32 ID, SceneManager *Creator)
Class constructor.
Viewport * CameraVP
This is a pointer to the Viewport this camera is attached to, if any.
virtual void SetFixedYawAxis(const Boole UseFixed, const Vector3 &Axis=Vector3::Unit_Y())
Sets whether or not to lock rotation around the Y axis.
CameraPolyMode
This is used by CameraProxies to quickly set a different render mode that is useful for debugging gra...
Ogre::SceneManager * _GetGraphicsWorldPointer() const
Gets the internal Ogre Scene Manager pointer.
This is used to represent a point in space, or a vector through space.
virtual Vector3 GetDirection() const
Gets the direction the light from this source is being emitted.
The bulk of the engine components go in this namspace.
virtual Graphics::ProjectionType GetProjectionType() const
Get the type of projection used by the camera.
OrientationMode
Simple enum for communicating the orientation the UI and Camera have relative to the world it is rend...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
Normal (realistic) perspective.
virtual Ogre::Camera * _GetGraphicsObject() const
Accessor for the internal camera.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this WorldProxy.
virtual void SetFieldOfViewY(const Real FOV)
Sets the vertical field of view of the camera frustrum.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
Wireframes for all the meshes and geometry are rendered.
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
static Vector3 Neg_Unit_Z()
Gets a vector representing the negative Z unit of a Vector3.
virtual void MoveRelative(const Vector3 &ToMove)
Moves the camera through local space.
virtual Graphics::CameraPolyMode GetPolygonMode() const
Gets the debug rendering mode for this camera.
std::string String
A datatype used to a series of characters.
virtual Boole IsFixedYawEnabled() const
Gets whether this cameras Yaw rotation is based on a fixed axis.
virtual Real GetAspectRatio() const
Gets the aspect ratio of the cameras veiw.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual Real GetNearClipDistance() const
Gets the distance in world units at which objects are considered too close to render.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
This represents a line placed in 3D space and is used with spacial queries.
virtual Vector3 GetFixedYawAxis() const
If fixed yaw is enabled, on which axis is yawing disabled.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
OrientationMode
This is used by CameraProxies to determine the orientation of the camera frustrum.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.