40 #ifndef _graphicslightproxy_cpp
41 #define _graphicslightproxy_cpp
47 #include "Graphics/scenemanager.h"
51 #include "stringtool.h"
84 return Ogre::Light::LT_POINT;
117 this->
GraphicsLight->setUserAny( Ogre::Any( static_cast<RenderableProxy*>(
this ) ) );
134 {
return Mezzanine::PT_Graphics_LightProxy; }
161 {
return ConvertLightType( this->
GraphicsLight->getType() ); }
164 { this->
GraphicsLight->setAttenuation(Range,Constant,Linear,Quadratic); }
185 { this->
GraphicsLight->setSpotlightRange(Ogre::Radian(InnerAngle),Ogre::Radian(OuterAngle),Falloff); }
188 { this->
GraphicsLight->setSpotlightInnerAngle(Ogre::Radian(Angle)); }
191 {
return this->
GraphicsLight->getSpotlightInnerAngle().valueRadians(); }
194 { this->
GraphicsLight->setSpotlightOuterAngle(Ogre::Radian(Angle)); }
197 {
return this->
GraphicsLight->getSpotlightOuterAngle().valueRadians(); }
206 { this->
GraphicsLight->setSpotlightNearClipDistance(NearClip); }
209 {
return this->
GraphicsLight->getSpotlightNearClipDistance(); }
250 if( !PropertiesNode.
Empty() ) {
252 Real AttenRange = 100000.0, AttenConstant = 1.0, AttenLinear = 0.0, AttenQuadratic = 0.0;
255 if( !CurrAttrib.
Empty() )
256 this->
SetType( static_cast<Graphics::LightType>( CurrAttrib.
AsWhole() ) );
259 if( !CurrAttrib.
Empty() )
260 AttenRange = CurrAttrib.
AsReal();
262 CurrAttrib = PropertiesNode.
GetAttribute(
"AttenConstant");
263 if( !CurrAttrib.
Empty() )
264 AttenConstant = CurrAttrib.
AsReal();
266 CurrAttrib = PropertiesNode.
GetAttribute(
"AttenLinear");
267 if( !CurrAttrib.
Empty() )
268 AttenLinear = CurrAttrib.
AsReal();
270 CurrAttrib = PropertiesNode.
GetAttribute(
"AttenQuadratic");
271 if( !CurrAttrib.
Empty() )
272 AttenQuadratic = CurrAttrib.
AsReal();
275 if( !CurrAttrib.
Empty() )
278 CurrAttrib = PropertiesNode.
GetAttribute(
"SpotlightInnerAngle");
279 if( !CurrAttrib.
Empty() )
282 CurrAttrib = PropertiesNode.
GetAttribute(
"SpotlightOuterAngle");
283 if( !CurrAttrib.
Empty() )
286 CurrAttrib = PropertiesNode.
GetAttribute(
"SpotlightFalloff");
287 if( !CurrAttrib.
Empty() )
290 CurrAttrib = PropertiesNode.
GetAttribute(
"SpotlightNearClipDistance");
291 if( !CurrAttrib.
Empty() )
294 this->
SetAttenuation(AttenRange,AttenConstant,AttenLinear,AttenQuadratic);
297 if( !DiffuseColourNode.
Empty() ) {
303 if( !SpecularColourNode.
Empty() ) {
319 {
return "LightProxy"; }
virtual Real GetAttenuationQuadratic() const
Gets the quadric factor of the attenuation.
virtual Real GetSpotlightOuterAngle() const
Gets the Outer angle of the cone of light emitted by this spotlight.
LightType
This is used by LightProxies to describe how light is emitted from the proxy source.
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
A light-weight handle for manipulating attributes in DOM tree.
virtual Graphics::LightType GetType() const
Gets the type of light that this light is.
virtual void SetSpotlightOuterAngle(const Real Angle)
Sets the Outer angle of the cone of light emitted by a spotlight.
This class contains utilities and functions to allow the manipulation of the Graphical scene...
virtual void SetOrientation(const Quaternion &Ori)
Sets the orientation of this object in parent space.
virtual Real GetSpotlightInnerAngle() const
Gets the Inner angle of the cone of light emitted by this spotlight.
virtual Real GetAttenuationLinear() const
Gets the linear factor of the attentuation.
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 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 void SetPowerScale(const Real Scale)
Sets the power scale of this light, which indicates it's relative power.
virtual Real GetAttenuationConstant() const
Gets the constant factor of the attenuation.
virtual Vector3 GetDirection() const
Gets the direction the light from this source is being emitted.
This is the base proxy class for world proxies wrapping functionality of the graphics subsystem...
virtual void SetSpotlightRange(const Real InnerAngle, const Real OuterAngle, const Real Falloff=1.0)
Defines the cone of light emitted by a spotlight.
This file contains the declaration for the World proxy wrapping light functionality.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
bool Empty() const
Is this storing anything at all?
This implements the exception hiearchy for Mezzanine.
virtual void SetSpecularColour(const ColourValue &Specular)
Sets the colour for the Specular light from this source.
virtual ColourValue GetDiffuseColour() const
Gets the current colour of Diffuse light being emitted by this proxy.
virtual void SetSpotlightFalloff(const Real Falloff)
Sets the rate of falloff of the cone of light emitted by a spotlight.
virtual void SetAttenuation(const Real Range, const Real Constant, const Real Linear, const Real Quadratic)
Sets the factors for the attenuation formula applied to this light.
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.
The interface for serialization.
bool SetValue(const Char8 *rhs)
Set the value of this.
virtual Real GetSpotlightFalloff() const
Gets the rate of falloff of the cone of light emitted by this spotlight.
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.
virtual Quaternion GetOrientation() const
Gets this objects current orientation.
virtual ~LightProxy()
Class destructor.
virtual void SetType(const Graphics::LightType Type)
Sets the type of light this light is.
A light-weight handle for manipulating nodes in DOM tree.
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.
bool Empty() const
Is this storing anything at all?
From a point in space, like a Torch, campfire, muzzle flash, Mutant Fireflies, bonfires, light bulbs, non-hooded lantern, the DnD D20 Light spell, explosions, and scotch tape separating from the roll in a unlit vacuum. There may be other uses, be creative.
static String GetSerializableName()
Get the name of the the XML tag the proxy class will leave behind as its instances are serialized...
virtual void SetDirection(const Vector3 &Dir)
Sets the direction the light will be emitted from this source.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
virtual Mezzanine::ProxyType GetProxyType() const
Accessor for the type of proxy.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this WorldProxy.
virtual void SetSpotlightInnerAngle(const Real Angle)
Sets the Inner angle of the cone of light emitted by a spotlight.
Ogre::Light * GraphicsLight
A pointer to the internal Light this proxy is based on.
From one direction, like sunlight.
static Vector3 Unit_Z()
Gets a vector representing the Z unit of a Vector3.
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.
From a point emanating in a cone, like a flashlight, hooded lantern, really bright computer screens...
The bulk of the engine components go in this namspace.
LightProxy(const UInt32 ID, SceneManager *Creator)
Blank constructor.
void ProtoSerialize(XML::Node &CurrentRoot) const
Convert this class to an XML::Node ready for serialization.
virtual Real GetPowerScale() const
Gets the power scale of this light, which indicates it's relative power.
virtual Ogre::Light * _GetGraphicsObject() const
Accessor for the internal light.
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 Ogre::MovableObject * _GetBaseGraphicsObject() const
Accessor for the internal graphics object.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual void SetDiffuseColour(const ColourValue &Diffuse)
Sets the colour for the Diffuse light from this source.
virtual Real GetSpotlightNearClipDistance() const
Gets the near clip plane distance to be used by spotlights that use light clipping.
Ogre::ColourValue GetOgreColourValue() const
Creates and returns an Ogre ColourValue class with values equal to this one.
virtual Real GetAttenuationRange() const
Gets the absolute range of attenuation in world units.
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.
std::string String
A datatype used to a series of characters.
virtual void CreateLight()
Creates an internal light to be used by the calling instance.
virtual ColourValue GetSpecularColour() const
Gets the current colour of Specular light being emitted by this proxy.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
virtual void SetSpotlightNearClipDistance(const Real NearClip)
Sets the near clip plane distance to be used by spotlights that use light clipping.
virtual void DestroyLight()
Destroys the internal light in use by this proxy.
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.