AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EmbeddedGLWindow.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 #if defined(_MSC_VER)
24 #include <Winsock2.h>
25 #include <agx/Windows.h>
26 #endif
27 
28 
29 #include <osgViewer/Viewer>
30 #include <osg/Version>
31 
32 #include <osgGA/TrackballManipulator>
33 #include <osgViewer/GraphicsWindow>
34 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
35 
36 #include <agxOSG/export.h>
37 #include <agx/Integer.h>
38 #include <agxSDK/Simulation.h>
39 #include <agxOSG/RenderProxy.h>
40 
41 namespace agxOSG
42 {
47  {
48  public:
49 
52 
59  bool init(int x, int y, int width, int height);
60 
66  void resize(int x, int y, int width, int height);
67  osgGA::EventQueue* getEventQueue() const;
68 
73  void mouseMoveEvent(int x, int y);
74 
80  void mousePressEvent(int x, int y, int button);
81 
87  void mouseReleaseEvent(int x, int y, int button);
88 
94  void keyPressEvent(int key, int mod_mask);
95 
101  void keyReleaseEvent(int key, int mod_mask);
102 
107  void wheelEvent(int motion);
108 
112  void frame();
113 
117  osg::Camera *getCamera();
118 
122  const osg::Camera *getCamera() const;
123 
128  void setSimulation( agxSDK::Simulation *simulation );
129 
133  agxSDK::Simulation *getSimulation() const;
134 
138  void removeSimulation( );
139 
143  osg::Group* getRoot();
144 
148  const osg::Group* getRoot() const;
149 
153  agxOSG::SceneDecorator* getSceneDecorator();
154 
158  void fitSceneIntoView();
159 
161  ~EmbeddedGLWindow();
162 
167  void clear();
168 
169  private:
170 
171  osg::ref_ptr<osgViewer::Viewer> m_viewer;
172  agxSDK::SimulationRef m_simulation;
173  osg::ref_ptr<osg::Group> m_root;
174  osg::ref_ptr<agxOSG::SceneDecorator> m_decorator;
175  osgGA::StandardManipulator *m_manipulator;
176 
177  osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> m_embeddedWindow;
178  };
179 }
180 
181 #endif
AGXTERRAIN_EXPORT void clear()
void AGXPHYSICS_EXPORT init()
Initialize agx.
#define AGXOSG_EXPORT
Decorates a scene with a specific AGX Rendering Style.
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:121