8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
13 #include "IPhysicsMovableItem.h"
14 #include "IPhysicsBody.h"
16 #include "MovableItem.h"
69 #pragma region AccessorMutators
145 Std_IsAboveMin((
int) 10, iVal,
true,
"Light.LatitudeSegments",
true);
170 Std_IsAboveMin((
int) 10, iVal,
true,
"Light.LongtitudeSegments",
true);
190 MovableItem::Selected(bValue, bSelectMultiple);
217 void Light::ConstantAttenRatio(
float fltVal)
219 Std_InValidRange((
float) 0, (
float) 1, fltVal,
true,
"Receptive Field Index");
226 void Light::LinearAttenDistance(
float fltVal,
bool bUseScaling)
228 Std_IsAboveMin((
float) 0, fltVal,
true,
"Light.LinearAttenDistance",
true);
239 void Light::QuadraticAttenDistance(
float fltVal,
bool bUseScaling)
241 Std_IsAboveMin((
float) 0, fltVal,
true,
"Light.QuadraticAttenDistance",
true);
270 #pragma region DataAccesMethods
278 bool Light::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
285 if(MovableItem::SetData(strType, strValue,
false))
288 if(strType ==
"ENABLED")
294 if(strType ==
"RADIUS")
296 Radius((
float) atof(strValue.c_str()));
300 if(strType ==
"LATITUDESEGMENTS")
306 if(strType ==
"LONGTITUDESEGMENTS")
312 if(strType ==
"CONSTANTATTENUATION")
314 ConstantAttenRatio((
float) atof(strValue.c_str()));
318 if(strType ==
"LINEARATTENUATIONDISTANCE")
320 LinearAttenDistance((
float) atof(strValue.c_str()));
324 if(strType ==
"QUADRATICATTENUATIONDISTANCE")
326 QuadraticAttenDistance((
float) atof(strValue.c_str()));
332 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
340 MovableItem::QueryProperties(aryProperties);
342 aryProperties.Add(
new TypeProperty(
"Enabled", AnimatPropertyType::Boolean, AnimatPropertyDirection::Both));
343 aryProperties.Add(
new TypeProperty(
"Radius", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
344 aryProperties.Add(
new TypeProperty(
"LatitudeSegments", AnimatPropertyType::Integer, AnimatPropertyDirection::Set));
345 aryProperties.Add(
new TypeProperty(
"LongtitudeSegments", AnimatPropertyType::Integer, AnimatPropertyDirection::Set));
346 aryProperties.Add(
new TypeProperty(
"ConstantAttenuation", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
347 aryProperties.Add(
new TypeProperty(
"LinearAttenuationDistance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
348 aryProperties.Add(
new TypeProperty(
"QuadraticAttenuationDistance", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
357 void Light::Load(
CStdXml &oXml)
360 MovableItem::Load(oXml);
virtual bool Enabled()
Tells whether this light is enabled.
Base class file for all Animat simulation objects.
Declares the simulation recorder class.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
Simulates the entire environment.
Simulator * m_lpMovableSim
The pointer to a Simulation.
Root namespace for the base simulation library for AnimatLab.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
Declares the body part class.
Simulator * m_lpSim
The pointer to a Simulation.
float m_fltQuadraticAttenDistance
The quadratic attenuation distance.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
float m_fltLinearAttenDistance
The linear attenuation distance.
Class that stores information about types for QueryProperty information.
Declares the key frame class.
bool Std_InValidRange(int iMinVal, int iMaxVal, int iVal, bool bThrowError, std::string strParamName)
Tests whether a number is within a valid range.
virtual int LightNumber()
Gets the light number.
Declares the joint class.
Declares the organism class.
virtual int GetChildInt(std::string strElementName)
Gets an integer value from the element with the specified name.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
Declares the activated item class.
virtual void VisualSelectionModeChanged(int iNewMode)
Called when the visual selection mode changed in GUI.
Declares a light manager object.
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
IPhysicsMovableItem * m_lpPhysicsMovableItem
int m_iLightNum
Zero-based index of the light number. OSG only allows 8 lights.
Declares the bounding box class.
virtual ~Light(void)
Destructor.
virtual float Radius()
Gets the radius.
A standard xml manipulation class.
virtual int LongtitudeSegments()
Gets the longtitude segments.
virtual bool Selected()
Tells if this items is selected or not.
A "static" structure in the simulation.
float m_fltRadius
The radius of the sphere.
virtual void UpdateData()
Called to collect any body data for this part.
virtual void QueryProperties(CStdPtrArray< TypeProperty > &aryProperties)
Queries this object for a list of properties that can be changed using SetData.
float m_fltConstantAttenRatio
The constant attenuation ratio.
bool Std_ToBool(int iVal)
Converts a value toa bool.
virtual void Load(StdUtils::CStdXml &oXml)
Loads the item using an XML data packet.
virtual bool GetChildBool(std::string strElementName)
Gets a bool value from the element with the specified name.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
int m_iLatitudeSegments
Number of segments along the latitude direction that are used to build the sphere.
virtual void VisualSelectionModeChanged(int iNewMode)
Called when the visual selection mode changed in GUI.
virtual int LatitudeSegments()
Gets the latitude segments.
Base class for body parts and neural network nodes.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
Declares the data chart manager class.
Declares the rigid body class.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual void Resize()
Called when this object has been resized.
Declares the structure class.
Light(void)
Default constructor.
Declares the odor type class.
int m_iLongtitudeSegments
Number of segments along the longtitude direction that are used to build the sphere.
virtual float InverseDistanceUnits()
Gets the inverse distance units.
Declares the simulator class.
Declares the activated item manager class.
Declares the external stimuli manager class.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
Declares the receptive field class.
virtual float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.