17 #ifndef AGXQT_QTAGXWRAPPER_H 18 #define AGXQT_QTAGXWRAPPER_H 20 #include <agx/config/AGX_USE_LUA.h> 21 #include <agx/config/AGX_USE_PYTHON.h> 28 #include <QElapsedTimer> 29 #include <osgGA/TrackballManipulator> 30 #include <osgGA/StateSetManipulator> 31 #include <osgViewer/ViewerEventHandlers> 32 #include <osgViewer/Renderer> 42 #include <agxCFG/ConfigScript.h> 66 class QtAgxWrapperStepCallback;
75 friend class QtAgxWrapperStepCallback;
98 bool loadFile(
const std::string& filename);
101 void reloadActiveScene();
104 void setViewer(osgViewer::Viewer* viewer);
105 osgViewer::Viewer* getViewer();
108 void setScene(osg::Group* scene);
109 osg::Group* getScene();
127 void setTimeStep(
float dt);
133 static agxSDK::SimulationController* getActiveSimulation();
143 void takeScreenShot();
146 bool saveSimulationState(
const std::string& filename);
149 bool writeCameraViewsToFile(
const std::string& filename);
157 bool isSimulationRunning()
const;
164 bool journalContainsImpactData();
166 bool attachScripts(osg::Group*
root);
168 void finalizeAndResetVideoCapture();
174 void signalSimulationUpdate(
float timeStamp);
175 void signalNewPlayback(
float timeStart,
float timeEnd, uint numFrames);
176 void signalNewSimulation();
177 void signalSimulationPause();
178 void signalJournalTrackReachedEnd();
179 void signalJournalContainsImpactData(
bool hasData);
181 void signalUpdateSimulationStructure();
183 void signalActiveCameraViewChanged();
186 void signalRenderUpdate();
188 void signalNewSimulationLoaded();
192 void slotUpdateLoop();
195 void slotPauseSimulation();
196 void slotPlaySimulation();
197 void slotStepForwardSimulation();
198 void slotStepBackSimulation();
199 void slotStopSimulation();
200 void slotChangeSimulationTime(
float);
201 void slotJumpToEnd();
202 void slotJumpToStart();
203 void slotSetJournalStride(uint stride);
204 void slotEnableJournalLooping(
bool enable);
207 void slotEnableDebugRenderMode(
bool);
208 void slotEnableOSGRenderMode(
bool);
209 void slotEnbleDrawStatistics(
bool);
210 void slotChangeDrawMode(
int mode);
211 void slotCenterScene();
212 void slotChangeParticleShaderMode(
int mode);
214 void slotSetEnableShaders(
bool enable);
215 void slotChangeBackgroundColor(
int mode );
216 void slotSetEnableRenderDataRendering(
bool enable);
217 void slotSetEnableCollisionDataRendering(
bool enable);
218 void slotMoveLightToLookAt();
219 void slotUpdateAnalysisBoxDrawable();
220 void slotUpdateClipplingPlaneDrawable();
221 void slotHandleStopSimulation();
224 void slotIncrementCamera();
225 void slotDecrementCamera();
226 void slotStoreCurrentViewInCameraSet();
227 void slotSetViewFromActiveCameraDescription();
228 void slotIncrementClipPlane();
229 void slotDecrementClipPlane();
232 void stepSimulation();
233 void slotClearSimulation();
234 void slotReloadSimulation();
235 void slotUpdateSpace();
238 osg::Group* getRoot() {
return m_root; }
242 void loadDefaultCameraConfig(
const agx::String& filename);
244 void lockSimulationAndTriggerEvents();
247 void journalPlayback(
const std::string& journalPlaybackPath,
const std::string asessionName =
"");
248 void clearJournalSessionData();
251 bool restoreFromFile(
const std::string& file);
255 void initSimulationController();
257 void fitSceneIntoView();
258 void clearSimulation();
260 bool loadActiveScene();
263 void setupUpdateLoop();
264 void handleJournalLooping();
265 bool playbackIsAtEnd();
266 void setupPostProcessor();
268 void updateAnalysisBox();
269 void triggetStopInScripts();
272 static void setActiveSimulationController(agxSDK::SimulationController* controller);
331 osg::ref_ptr<osgGA::StateSetManipulator>
m_ssm;
agxOSG::SceneDescription m_sceneDescription
ParticleSystemRenderUtilityRef m_particleRenderUtil
void AGXPHYSICS_EXPORT init()
Initialize agx.
agxOSG::SceneDescription getSceneDescription() const
Returns the description of the active scene.
agxQt::ClipPlaneControllerRef m_clipPlaneController
osg::ref_ptr< osg::Switch > m_sceneSwitch
agxOSG::SceneDecorator * getSceneDecorator()
Get Scene decorator.
This utility class is used for post processing of the particle system drawable representation, such as alpha rendering and velocity color.
agxCFG::ConfigScriptRef m_settings
agxOSG::PickHandlerRef m_pickHandler
void setScene(osg::Group *scene)
Returns pointer to osg structure of the scene.
std::string m_luaFilePath
Contains classes/utility functions for connecting AGX to QT with OSG.
agx::AnalysisBox * getAnalysisBox()
Implementation of the abstract class from the agxRender namespace, this class is responsible for crea...
This class wraps the ClipPlane functionality of osg together with a clip node and a clip plane...
osg::ref_ptr< osg::Group > m_sceneRoot
osgViewer::Viewer * getViewer()
agxQt::OsgCameraViewManager * getCameraViewManager()
Get the camera view manager.
Block synchronization primitive.
OsgCameraViewManagerRef m_cameraManager
A small argument parser class.
Decorates a scene with a specific AGX Rendering Style.
Base class providing referencing counted objects.
std::string m_journalSessionName
agxQt::TrajectoryRenderer * getTrajectoryRenderer()
osg::ref_ptr< osgViewer::Viewer > m_viewer
std::string m_currentCaptureFolder
void startCapture()
Starts or resumes the video capture.
void stopCapture()
Pauses the video capture, if active.
agxSDK::Simulation * getSimulation()
std::string m_cfgFileName
osg::ref_ptr< osgGA::StateSetManipulator > m_ssm
agxGL::CameraRef m_GlCamera
std::string m_pythonFilePath
Manager class that acts as a wrapper container for the CameravViewset class for OSG based view system...
osg::ref_ptr< agxOSG::GuiEventAdapter > m_eventAdapter
osg::ref_ptr< osg::Group > m_root
agxOSG::RenderProxyFactory * m_renderProxyFactory
osg::ref_ptr< osg::Group > m_scene
Class that can be used to extract data from elements in a simulation within a specified bound...
agxQt::VideoCaptureRef m_videoCapture
agx::AnalysisBoxRef m_analysisBox
agxGL::LightsRef m_GlLights
bool isSimulationRunning() const
osg::ref_ptr< agxOSG::ClipPlane > m_clipPlane
static agxSDK::SimulationController * getActiveSimulation()
Returns the active simulation in the wrapper. This is kind of a "hack" to let the renderer get a simu...
osg::ref_ptr< osg::Group > m_clipPlaneDrawable
static void setActiveSimulationController(agxSDK::SimulationController *controller)
Static helper function to get active simulation controller so that other classes can lock the active ...
TrajectoryRendererRef m_trajectoryRenderer
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Class that is used to manipulate the clip plane in the scene.
A pod-struct for holding information about scenes to load by the application.
AGXCORE_EXPORT Component * root()
osg::ref_ptr< agxOSG::SceneDecorator > m_decorator
static agxSDK::SimulationController * s_activeController
void setSceneDescription(const agxOSG::SceneDescription &desc)
agxQt::ParticleSystemRenderUtility * getParticleRenderUtillity()
osg::ref_ptr< osg::Group > m_analysisBoxDrawable
void setViewer(osgViewer::Viewer *viewer)
Set the viewer to sync the simulation content to.
Class that wraps SimulationController with an interface that enables QT Gui signals to control the si...
agxSDK::SimulationControllerRef m_simulationController
agx::UInt m_journalStride
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints, geometries.
osg::ref_ptr< osg::Group > m_postProcessRoot
void setTimeStep(float dt)
Set the time step used in the simulation.
agx::StringVector m_attachedScripts