AnimatLab  2
Test
MovableItem.h
1 
7 #pragma once
8 
9 namespace AnimatSim
10 {
11  namespace Environment
12  {
19  class ANIMAT_PORT MovableItem
20  {
21  protected:
24 
28 
32  CStdFPoint m_oAbsPosition;
33 
35  // If this item is a structure then this is the world coordinates.
36  CStdFPoint m_oPosition;
37 
39  CStdFPoint m_oReportPosition;
40 
43 
46  CStdFPoint m_oRotation;
47 
50  CStdFPoint m_oReportRotation;
51 
55 
56  //Used to report back if visible.
57  float m_fltReportIsVisible;
58 
59  //Transparencies
62 
65 
68 
71 
74 
76  float m_fltAlpha; //Current alpha
77 
79  CStdColor m_vAmbient;
80 
82  CStdColor m_vDiffuse;
83 
85  CStdColor m_vSpecular;
86 
89 
91  std::string m_strTexture;
92 
94  CStdFPoint m_vSelectedVertex;
95 
99 
104 
107 
110 
111  virtual void LoadPosition(CStdXml &oXml);
112  virtual void LoadRotation(CStdXml &oXml);
113 
114  public:
115  MovableItem(void);
116  virtual ~MovableItem(void);
117 
118 #pragma region AccessorMutators
119 
120  RigidBody *Parent();
121  void Parent(RigidBody *lpValue);
122 
123  virtual int VisualSelectionType() ;
124  virtual bool AllowMouseManipulation();
125 
126  virtual CStdFPoint Position();
127  virtual void Position(CStdFPoint &oPoint, bool bUseScaling = true, bool bFireChangeEvent = false, bool bUpdateMatrix = true);
128  virtual void Position(float fltX, float fltY, float fltZ, bool bUseScaling = true, bool bFireChangeEvent = false, bool bUpdateMatrix = true);
129  virtual void Position(std::string strXml, bool bUseScaling = true, bool bFireChangeEvent = false, bool bUpdateMatrix = true);
130 
131  virtual CStdFPoint AbsolutePosition();
132  virtual void AbsolutePosition(CStdFPoint &oPoint);
133  virtual void AbsolutePosition(float fltX, float fltY, float fltZ);
134 
135  virtual CStdFPoint ReportPosition();
136  virtual void ReportPosition(CStdFPoint &oPoint);
137  virtual void ReportPosition(float fltX, float fltY, float fltZ);
138 
139  virtual CStdFPoint ReportWorldPosition();
140  virtual void ReportWorldPosition(CStdFPoint &oPoint);
141  virtual void ReportWorldPosition(float fltX, float fltY, float fltZ);
142 
143  virtual CStdFPoint UpdateAbsolutePosition();
144  virtual CStdFPoint GetCurrentPosition();
145 
146  virtual CStdFPoint Rotation();
147  virtual void Rotation(CStdFPoint &oPoint, bool bFireChangeEvent = false, bool bUpdateMatrix = true);
148  virtual void Rotation(float fltX, float fltY, float fltZ, bool bFireChangeEvent = false, bool bUpdateMatrix = true);
149  virtual void Rotation(std::string strXml, bool bFireChangeEvent = false, bool bUpdateMatrix = true);
150 
151  virtual CStdFPoint ReportRotation();
152  virtual void ReportRotation(CStdFPoint &oPoint);
153  virtual void ReportRotation(float fltX, float fltY, float fltZ);
154 
155  virtual std::string LocalTransformationMatrixString();
156 
157  virtual bool IsVisible();
158  virtual void IsVisible(bool bVal);
159 
160  virtual float GraphicsAlpha();
161  virtual void GraphicsAlpha(float fltVal);
162 
163  virtual float CollisionsAlpha();
164  virtual void CollisionsAlpha(float fltVal);
165 
166  virtual float JointsAlpha();
167  virtual void JointsAlpha(float fltVal);
168 
169  virtual float ReceptiveFieldsAlpha();
170  virtual void ReceptiveFieldsAlpha(float fltVal);
171 
172  virtual float SimulationAlpha();
173  virtual void SimulationAlpha(float fltVal);
174 
175  virtual float Alpha();
176  virtual void Alpha(float fltAlpha);
177 
178  virtual CStdColor *Ambient();
179  virtual void Ambient(CStdColor &aryColor);
180  virtual void Ambient(float *aryColor);
181  virtual void Ambient(std::string strXml);
182 
183  virtual CStdColor *Diffuse();
184  virtual void Diffuse(CStdColor &aryColor);
185  virtual void Diffuse(float *aryColor);
186  virtual void Diffuse(std::string strXml);
187 
188  virtual CStdColor *Specular();
189  virtual void Specular(CStdColor &aryColor);
190  virtual void Specular(float *aryColor);
191  virtual void Specular(std::string strXml);
192 
193  virtual float Shininess();
194  virtual void Shininess(float fltVal);
195 
196  virtual std::string Texture();
197  virtual void Texture(std::string strValue);
198 
199  virtual CStdFPoint SelectedVertex();
200  virtual void SelectedVertex(CStdFPoint &vPoint, bool bFireChangeEvent = false, bool bUpdatePhysics = true);
201  virtual void SelectedVertex(float fltX, float fltY, float fltZ, bool bFireChangeEvent = false, bool bUpdatePhysics = true);
202 
203  virtual IMovableItemCallback *Callback();
204  virtual void Callback(IMovableItemCallback *lpCallback);
205 
206  virtual IPhysicsMovableItem *PhysicsMovableItem();
207  virtual void PhysicsMovableItem(IPhysicsMovableItem *lpBase);
208 
209  virtual float GetBoundingRadius();
210  virtual BoundingBox GetBoundingBox();
211  virtual void SetBoundingBox(int iIdx, float fltVal);
212 
213  virtual bool AllowTranslateDragX();
214  virtual bool AllowTranslateDragY();
215  virtual bool AllowTranslateDragZ();
216 
217  virtual bool AllowRotateDragX();
218  virtual bool AllowRotateDragY();
219  virtual bool AllowRotateDragZ();
220 
221  virtual void UserDefinedDraggerRadius(float fltRadius);
222  virtual float UserDefinedDraggerRadius();
223 
224  virtual bool IsSelected();
225 
226 #pragma endregion
227 
228 #pragma region DataAccesMethods
229 
230  virtual float *GetDataPointer(const std::string &strDataType);
231  virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError = true);
232  virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
233 
234 #pragma endregion
235 
236  virtual void AddBodyClicked(float fltPosX, float fltPosY, float fltPosZ, float fltNormX, float fltNormY, float fltNormZ);
237  virtual void Selected(bool bValue, bool bSelectMultiple);
238  virtual void VisualSelectionModeChanged(int iNewMode);
239  virtual void OrientNewPart(float fltXPos, float fltYPos, float fltZPos, float fltXNorm, float fltYNorm, float fltZNorm);
240  virtual bool CalculateLocalPosForWorldPos(float fltWorldX, float fltWorldY, float fltWorldZ, CStdFPoint &vLocalPos);
241 
242  virtual void Load(CStdXml &oXml);
243  };
244 
245  } // Environment
246 } //AnimatSim
Movable Item callback to the GUI.
Simulates the entire environment.
Definition: Simulator.h:31
float m_fltSimulationAlpha
The alpha transparency used in the Simulation VisualSelectionMode.
Definition: MovableItem.h:73
Simulator * m_lpMovableSim
The pointer to a Simulation.
Definition: MovableItem.h:23
Root namespace for the base simulation library for AnimatLab.
CStdFPoint m_oReportWorldPosition
This is used for reporting the position back to the GUI. It is the world position scaled for distance...
Definition: MovableItem.h:42
float m_fltReceptiveFieldsAlpha
The alpha transparency used in the Receptive Fields VisualSelectionMode.
Definition: MovableItem.h:70
CStdColor m_vAmbient
The ambient color to apply to this part. It is specified as red, green, blue, and alpha...
Definition: MovableItem.h:79
float m_fltJointsAlpha
The alpha transparency used in the Joints VisualSelectionMode.
Definition: MovableItem.h:67
IMovableItemCallback * m_lpCallback
Definition: MovableItem.h:98
Baes class for all items that can be moved/roated within the environment.
Definition: MovableItem.h:19
IPhysicsMovableItem * m_lpPhysicsMovableItem
Definition: MovableItem.h:103
float m_fltShininess
The shininess of the part. A value between 0 and 128.
Definition: MovableItem.h:88
Bounding box class for geometric objects.
Definition: BoundingBox.h:17
CStdColor m_vDiffuse
The diffuse color to apply to this part. It is specified as red, green, blue, and alpha...
Definition: MovableItem.h:82
float m_fltUserDefinedDraggerRadius
User defined drag handle radius. If this is -1 then the user has not set the value and the default is...
Definition: MovableItem.h:106
float m_fltGraphicsAlpha
The alpha transparency used in the Graphics VisualSelectionMode.
Definition: MovableItem.h:61
CStdColor m_vSpecular
The specular color to apply to this part. It is specified as red, green, blue, and alpha...
Definition: MovableItem.h:85
bool m_bIsSelected
Keeps track of whether this movable item has been selected or not.
Definition: MovableItem.h:109
float m_fltCollisionsAlpha
The alpha transparency used in the Collisions VisualSelectionMode.
Definition: MovableItem.h:64
CStdFPoint m_oPosition
These are rotation and position coords relative to the parent if this is a body part.
Definition: MovableItem.h:36
float m_fltAlpha
The current alpha transparency for this body part.
Definition: MovableItem.h:76
CStdFPoint m_vSelectedVertex
The relative position of the selected vertex.
Definition: MovableItem.h:94
CStdFPoint m_oReportPosition
This is used for reporting the position back to the GUI. It is the position scaled for distance units...
Definition: MovableItem.h:39
The base class for all of the basic rigid body type of objects.
Definition: RigidBody.h:66
std::string m_strTexture
An optional texture to apply to the rigid body.
Definition: MovableItem.h:91