AGX Dynamics  2.37.3.2
EmbeddedGLWindow.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXOSG_EMBEDDEDGLWINDOW_H
18 #define AGXOSG_EMBEDDEDGLWINDOW_H
19 
20 
21 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
22 
23 #include <osgViewer/Viewer>
24 #include <osg/Version>
25 #include <osgGA/TrackballManipulator>
26 #include <osgViewer/GraphicsWindow>
27 
28 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
29 
30 #include <agxOSG/export.h>
31 #include <agx/Integer.h>
32 #include <agxSDK/Simulation.h>
33 #include <agxOSG/RenderProxy.h>
34 
35 namespace agxOSG
36 {
41  {
42  public:
43 
46 
53  bool init(int x, int y, int width, int height);
54 
60  void resize(int x, int y, int width, int height);
61  osgGA::EventQueue* getEventQueue() const;
62 
67  void mouseMoveEvent(int x, int y);
68 
74  void mousePressEvent(int x, int y, int button);
75 
81  void mouseReleaseEvent(int x, int y, int button);
82 
88  void keyPressEvent(int key, int mod_mask);
89 
95  void keyReleaseEvent(int key, int mod_mask);
96 
101  void wheelEvent(int motion);
102 
106  void frame();
107 
111  osg::Camera *getCamera();
112 
116  const osg::Camera *getCamera() const;
117 
122  void setSimulation( agxSDK::Simulation *simulation );
123 
127  agxSDK::Simulation *getSimulation() const;
128 
132  void removeSimulation( );
133 
137  osg::Group* getRoot();
138 
142  const osg::Group* getRoot() const;
143 
147  agxOSG::SceneDecorator* getSceneDecorator();
148 
152  void fitSceneIntoView();
153 
155  ~EmbeddedGLWindow();
156 
161  void clear();
162 
163  private:
164 
165  osg::ref_ptr<osgViewer::Viewer> m_viewer;
166  agxSDK::SimulationRef m_simulation;
167  osg::ref_ptr<osg::Group> m_root;
168  osg::ref_ptr<agxOSG::SceneDecorator> m_decorator;
169  osgGA::StandardManipulator *m_manipulator;
170 
171  osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> m_embeddedWindow;
172  };
173 }
174 
175 #endif
AGXTERRAIN_EXPORT void clear()
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
#define AGXOSG_EXPORT
Decorates a scene with a specific AGX Rendering Style.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
This class is for embedding an OSG based window inside another OpenGL contex, for example in QT...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126