8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
13 #include "IPhysicsMovableItem.h"
14 #include "IPhysicsBody.h"
16 #include "MovableItem.h"
117 if(strUpType !=
"TRIANGULAR" && strUpType !=
"CONVEX" && strUpType !=
"TERRAIN")
198 void Mesh::Scale(
float fltX,
float fltY,
float fltZ,
bool bUpdateMatrix)
200 CStdFPoint vPos(fltX, fltY, fltZ);
233 if(iIdx >= 0 && iIdx <= 2 && fltVal > 0)
243 float fltConvert = fltNewDim / fltOldDim;
245 float fltNewX =
m_vScale.x*fltConvert;
246 float fltNewY =
m_vScale.y*fltConvert;
247 float fltNewZ =
m_vScale.z*fltConvert;
249 Scale(fltNewX, fltNewY, fltNewZ);
253 THROW_PARAM_ERROR(Al_Err_lInvalidMeshScaleParam, Al_Err_strInvalidMeshScaleParam,
"Data", fltVal);
257 void Mesh::SetMeshFile(std::string strXml)
269 float *Mesh::GetDataPointer(
const std::string &strDataType)
276 if(strType ==
"SCALE.X")
278 else if(strType ==
"SCALE.Y")
280 else if(strType ==
"SCALE.Z")
283 lpData = RigidBody::GetDataPointer(strDataType);
288 bool Mesh::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
292 if(RigidBody::SetData(strType, strValue,
false))
295 if(strType ==
"MESHFILE")
301 if(strType ==
"MESHTYPE")
307 if(strType ==
"CONVEXMESHFILE")
313 if(strType ==
"SETMESHFILE")
315 SetMeshFile(strValue);
319 if(strType ==
"SCALE")
325 if(strType ==
"SCALE.X")
331 if(strType ==
"SCALE.Y")
337 if(strType ==
"SCALE.Z")
345 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
350 void Mesh::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
352 RigidBody::QueryProperties(aryProperties);
354 aryProperties.Add(
new TypeProperty(
"MeshFile", AnimatPropertyType::String, AnimatPropertyDirection::Set));
355 aryProperties.Add(
new TypeProperty(
"MeshType", AnimatPropertyType::String, AnimatPropertyDirection::Set));
356 aryProperties.Add(
new TypeProperty(
"ConvexMeshFile", AnimatPropertyType::String, AnimatPropertyDirection::Set));
357 aryProperties.Add(
new TypeProperty(
"SetMeshFile", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
358 aryProperties.Add(
new TypeProperty(
"Scale", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
359 aryProperties.Add(
new TypeProperty(
"Scale.X", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
360 aryProperties.Add(
new TypeProperty(
"Scale.Y", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
361 aryProperties.Add(
new TypeProperty(
"Scale.Z", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
366 RigidBody::Load(oXml);
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
Base class file for all Animat simulation objects.
Declares the simulation recorder class.
virtual ~Mesh()
Destructor.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
Root namespace for the base simulation library for AnimatLab.
virtual CStdFPoint Scale()
Gets the local position. (m_oPosition)
std::string m_strConvexMeshFile
The collsion mesh file. If the type is convex then we load in this file instead of the graphical one...
Declares the body part class.
std::string m_strCollisionMeshType
Type of the collision mesh. Can be Convex or Triangular.
virtual void SetBoundingBox(int iIdx, float fltVal)
Sets one dimension of the bounding box. This does nothing for all parts except a mesh.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Simulator * m_lpSim
The pointer to a Simulation.
virtual std::string ConvexMeshFile()
Gets the convex mesh filename.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
Class that stores information about types for QueryProperty information.
CStdFPoint m_vReportScale
The scale factor that is used for reporting to the GUI.
Declares the key frame class.
Declares the joint class.
Declares the organism class.
virtual void Resize()
Called when this object has been resized.
Declares the activated item class.
Declares a light manager object.
IPhysicsMovableItem * m_lpPhysicsMovableItem
virtual BoundingBox GetBoundingBox()
Gets the bounding box for this part.
Declares the bounding box class.
Mesh()
Default constructor.
A standard xml manipulation class.
Bounding box class for geometric objects.
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
CStdFPoint m_vScale
The scale factor to use for this mesh.
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.
bool Std_LoadPoint(CStdXml &oXml, std::string strName, CStdIPoint &oPoint, bool bThrowError)
Standard load point.
Declares the structure class.
Declares the odor type class.
float GetDimensionSize(int iAxis)
Gets the size along the supplied dimension.
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 std::string CollisionMeshType()
Gets the collision mesh type.
virtual std::string MeshFile()
Gets the mesh filename.
std::string m_strMeshFile
The graphical mesh file to load.
Declares the receptive field class.
std::string m_strName
The name for this object.