AnimatLab  2
Test
OsgSimulator.h
1 
2 #pragma once
3 
4 #include "OsgMovableItem.h"
5 #include "OsgMeshMgr.h"
6 #include "OsgHud.h"
7 #include "OsgMouseSpring.h"
8 #include "OsgCameraManipulator.h"
9 #include "OsgSimulationWindowMgr.h"
10 
16 namespace OsgAnimatSim
17 {
18 
19  class ANIMAT_OSG_PORT OsgSimulator : public AnimatSim::Simulator
20  {
21  protected:
22  OsgSimulationWindowMgr *m_vsWinMgr;
23 
24  //osg group node for the main scene
25  osg::ref_ptr<osg::MatrixTransform> m_grpScene;
26 
27  //Command manager for gripper manipulators in the scene.
28  osg::ref_ptr<osgManipulator::CommandManager> m_osgCmdMgr;
29 
30  osg::AlphaFunc *m_osgAlphafunc;
31 
32  double m_dblTotalStepTime;
33  long m_lStepTimeCount;
34 
35  OsgMeshMgr *m_lpMeshMgr;
36 
37  virtual void SnapshotStopFrame();
38 
39  virtual void UpdateSimulationWindows();
40 
41  osg::NotifySeverity ConvertTraceLevelToOSG();
42 
43  osg::ref_ptr<osg::Node> m_Spline;
44 
45  OsgMouseSpring *m_lpMouseSpring;
46 
47  OsgMatrixUtil *m_lpMatrixUtil;
48 
49  public:
50  OsgSimulator();
51  virtual ~OsgSimulator();
52 
53  OsgMovableItem *TrackBody();
54  osg::MatrixTransform *OSGRoot() {return m_grpScene.get();};
55  osgManipulator::CommandManager *OsgCmdMgr() {return m_osgCmdMgr.get();};
56  OsgMeshMgr *MeshMgr()
57  {
58  if(!m_lpMeshMgr)
59  m_lpMeshMgr = new OsgMeshMgr();
60 
61  return m_lpMeshMgr;
62  };
63  OsgMouseSpring *MouseSpring() {return m_lpMouseSpring;};
64 
65 #pragma region HelperMethods
66 
67  //Timer Methods
68  virtual unsigned long long GetTimerTick();
69  virtual double TimerDiff_n(unsigned long long lStart, unsigned long long lEnd);
70  virtual double TimerDiff_u(unsigned long long lStart, unsigned long long lEnd);
71  virtual double TimerDiff_m(unsigned long long lStart, unsigned long long lEnd);
72  virtual double TimerDiff_s(unsigned long long lStart, unsigned long long lEnd);
73  virtual void MicroSleep(unsigned int iMicroTime);
74 
75  virtual void WriteToConsole(std::string strMessage);
76 
77 #pragma endregion
78 
79  virtual void AlphaThreshold(float fltValue);
80 
81  virtual float *GetDataPointer(const std::string &strDataType);
82 
83  virtual void Reset(); //Resets the entire application back to the default state
84 
85  virtual void Initialize(int argc, const char **argv);
86  virtual void ShutdownSimulation();
87  virtual void ToggleSimulation();
88  virtual void StopSimulation();
89  virtual bool StartSimulation();
90  virtual bool PauseSimulation();
91  virtual void Save(std::string strFile);
92 
93  static OsgSimulator *ConvertSimulator(Simulator *lpSim);
94  };
95 
96 } //OsgAnimatSim
Simulates the entire environment.
Definition: Simulator.h:31
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
Vortex physical structure implementation.
Definition: OsgMeshMgr.h:18
Declares the vortex MeshMgr class.
Declares the vortex heads-up display class.