AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
EmbeddedGLWindow.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
35namespace 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
123
128
133
137 osg::Group* getRoot();
138
142 const osg::Group* getRoot() const;
143
148
153
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
#define AGXOSG_EXPORT
This class is for embedding an OSG based window inside another OpenGL contex, for example in QT.
void fitSceneIntoView()
Will move the camera so that the whole scene is visible.
agxSDK::Simulation * getSimulation() const
void mouseMoveEvent(int x, int y)
Called upon mouse event.
void frame()
Should be called to update the rendering frame.
void mousePressEvent(int x, int y, int button)
Called upon pressing a mouse button.
osgGA::EventQueue * getEventQueue() const
const osg::Group * getRoot() const
void resize(int x, int y, int width, int height)
Called at resize of the window.
bool init(int x, int y, int width, int height)
Will initialize the scenegraph, camera, viewer A valid OpenGL context should be initialized and activ...
EmbeddedGLWindow()
Constructor.
void keyPressEvent(int key, int mod_mask)
Called upon a keypress event.
const osg::Camera * getCamera() const
void mouseReleaseEvent(int x, int y, int button)
Called upon releasing a mouse button.
void clear()
Will remove simulation, deallocate all scene graph elements After call to this method,...
void setSimulation(agxSDK::Simulation *simulation)
Associate a Simulation to this window.
agxOSG::SceneDecorator * getSceneDecorator()
void removeSimulation()
Deassociates any registered simulation.
void wheelEvent(int motion)
Called when the mouse wheel is used.
void keyReleaseEvent(int key, int mod_mask)
Called upon a keyrelease event.
osg::Group * getRoot()
osg::Camera * getCamera()
~EmbeddedGLWindow()
Destructor.
Decorates a scene with a specific AGX Rendering Style.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.