 |
AGX Dynamics
2.38.0.2
|
Go to the documentation of this file.
17 #ifndef AGXQT_QTAGXWRAPPER_H
18 #define AGXQT_QTAGXWRAPPER_H
20 #include <agx/config/AGX_USE_PYTHON.h>
27 #include <QElapsedTimer>
28 #include <osgGA/TrackballManipulator>
29 #include <osgGA/StateSetManipulator>
30 #include <osgViewer/ViewerEventHandlers>
31 #include <osgViewer/Renderer>
41 #include <agxCFG/ConfigScript.h>
65 class QtAgxWrapperStepCallback;
74 friend class QtAgxWrapperStepCallback;
97 bool loadFile(
const std::string& filename);
100 void reloadActiveScene();
103 void setViewer(osgViewer::Viewer* viewer);
104 osgViewer::Viewer* getViewer();
107 void setScene(osg::Group* scene);
108 osg::Group* getScene();
126 void setTimeStep(
float dt);
132 static agxSDK::SimulationController* getActiveSimulation();
142 void takeScreenShot();
145 bool saveSimulationState(
const std::string& filename);
148 bool writeCameraViewsToFile(
const std::string& filename);
156 bool isSimulationRunning()
const;
165 bool journalContainsImpactData();
167 bool attachScripts(osg::Group*
root);
169 void finalizeAndResetVideoCapture();
177 void setCameraViewDirection(
const agx::Vec3& direction );
179 void incrementOrthographicProjection(
agx::Real increment );
181 void addGLCameraSynchronizationtoPreCallback(osg::Camera* camera);
185 void signalSimulationUpdate(
float timeStamp);
186 void signalNewPlayback(
float timeStart,
float timeEnd, uint numFrames);
187 void signalNewSimulation();
188 void signalSimulationPause();
189 void signalJournalTrackReachedEnd();
190 void signalJournalContainsImpactData(
bool hasData);
192 void signalUpdateSimulationStructure();
194 void signalActiveCameraViewChanged();
197 void signalRenderUpdate();
199 void signalNewSimulationLoaded();
203 void slotUpdateLoop();
206 void slotPauseSimulation();
207 void slotPlaySimulation();
208 void slotStepForwardSimulation();
209 void slotStepBackSimulation();
210 void slotStopSimulation();
211 void slotChangeSimulationTime(
float);
212 void slotJumpToEnd();
213 void slotJumpToStart();
214 void slotSetJournalStride(uint stride);
215 void slotEnableJournalLooping(
bool enable);
218 void slotEnableDebugRenderMode(
bool);
219 void slotEnableOSGRenderMode(
bool);
220 void slotEnbleDrawStatistics(
bool);
221 void slotChangeDrawMode(
int mode);
222 void slotCenterScene();
223 void slotChangeParticleShaderMode(
int mode);
225 void slotSetEnableShaders(
bool enable);
226 void slotChangeBackgroundColor(
int mode );
227 void slotSetEnableRenderDataRendering(
bool enable);
228 void slotSetEnableCollisionDataRendering(
bool enable);
229 void slotMoveLightToLookAt();
230 void slotUpdateAnalysisBoxDrawable();
231 void slotUpdateClipplingPlaneDrawable();
232 void slotUpdateAxesDrawable();
233 void slotHandleStopSimulation();
236 void slotIncrementCamera();
237 void slotDecrementCamera();
238 void slotStoreCurrentViewInCameraSet();
239 void slotSetViewFromActiveCameraDescription();
240 void slotIncrementClipPlane();
241 void slotDecrementClipPlane();
242 void setEnableOrthographicCamera(
bool enable);
243 void slotIncrementOrthographicZoom();
244 void slotDecrementOrthographicZoom();
247 void stepSimulation();
248 void slotClearSimulation();
249 void slotReloadSimulation();
250 void slotUpdateSpace();
253 bool initPythonContext(agxPython::ScriptManager* scriptManager, osg::Group*
root);
257 void loadDefaultCameraConfig(
const agx::String& filename);
259 void lockSimulationAndTriggerEvents();
262 void journalPlayback(
const std::string& journalPlaybackPath,
const std::string asessionName =
"");
263 void clearJournalSessionData();
266 bool restoreFromFile(
const std::string& file);
269 void initSimulationController();
271 void fitSceneIntoView();
272 void clearSimulation();
274 bool loadActiveScene();
277 void setupUpdateLoop();
278 void handleJournalLooping();
279 bool playbackIsAtEnd();
280 void setupPostProcessor();
282 void updateAnalysisBox();
283 void triggetStopInScripts();
286 static void setActiveSimulationController(agxSDK::SimulationController* controller);
347 osg::ref_ptr<osgGA::StateSetManipulator>
m_ssm;
osg::ref_ptr< osgViewer::Viewer > m_viewer
agxGL::LightsRef m_GlLights
std::string m_currentCaptureFolder
Contains classes/utility functions for connecting AGX to QT with OSG.
Class that wraps SimulationController with an interface that enables QT Gui signals to control the si...
Manager class that acts as a wrapper container for the CameravViewset class for OSG based view system...
osg::ref_ptr< osg::Group > m_axesDrawable
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
osgViewer::Viewer * getViewer()
osg::ref_ptr< osg::Group > m_sceneRoot
osg::ref_ptr< agxOSG::ClipPlane > m_clipPlane
agxOSG::RenderProxyFactory * m_renderProxyFactory
osg::ref_ptr< agxOSG::SceneDecorator > m_decorator
Class that can be used to extract data from elements in a simulation within a specified bound.
agxQt::ClipPlaneControllerRef m_clipPlaneController
agx::AnalysisBox * getAnalysisBox()
Class that is used to manipulate the clip plane in the scene.
This utility class is used for post processing of the particle system drawable representation,...
void setViewer(osgViewer::Viewer *viewer)
Set the viewer to sync the simulation content to.
osg::ref_ptr< osg::Group > m_scene
Block synchronization primitive.
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints,...
agxQt::OsgCameraViewManager * getCameraViewManager()
Get the camera view manager.
Decorates a scene with a specific AGX Rendering Style.
agxOSG::RigidBodyRenderCacheRef m_renderBodyCache
std::string m_journalSessionName
void setTimeStep(float dt)
Set the time step used in the simulation.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
agxQt::VideoCaptureRef m_videoCapture
agx::UInt m_journalStride
void startCapture()
Starts or resumes the video capture.
osg::ref_ptr< osg::Switch > m_sceneSwitch
agxSDK::Simulation * getSimulation()
osg::ref_ptr< osgGA::StateSetManipulator > m_ssm
std::string m_pythonFilePath
OsgCameraViewManagerRef m_cameraManager
agxOSG::SceneDescription getSceneDescription() const
Returns the description of the active scene.
This class wraps the ClipPlane functionality of osg together with a clip node and a clip plane.
AGXCORE_EXPORT Component * root()
static agxSDK::SimulationController * s_activeController
void setScene(osg::Group *scene)
Returns pointer to osg structure of the scene.
agxQt::ParticleSystemRenderUtility * getParticleRenderUtillity()
void stopCapture()
Pauses the video capture, if active.
Base class providing referencing counted objects.
RigidBodyRenderCache is used to cache generated visuals and lookup mappings of RigidBodies cloned fro...
agx::AnalysisBoxRef m_analysisBox
agxSDK::SimulationControllerRef m_simulationController
agxOSG::SceneDecorator * getSceneDecorator()
Get Scene decorator.
std::string m_cfgFileName
agxGL::CameraRef m_GlCamera
static agxSDK::SimulationController * getActiveSimulation()
Returns the active simulation in the wrapper. This is kind of a "hack" to let the renderer get a simu...
agxOSG::SceneDescription m_sceneDescription
osg::ref_ptr< osg::Group > m_clipPlaneDrawable
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.
agxQt::MeasurementAxesControllerRef m_axesController
Class that is used to manipulate the axes in the scene.
agxQt::TrajectoryRenderer * getTrajectoryRenderer()
A class holding 3 dimensional vectors and providing basic arithmetic.
agxCFG::ConfigScriptRef m_settings
void setSceneDescription(const agxOSG::SceneDescription &desc)
osg::ref_ptr< osg::Group > m_analysisBoxDrawable
Implementation of the abstract class from the agxRender namespace, this class is responsible for crea...
osg::ref_ptr< agxOSG::GuiEventAdapter > m_eventAdapter
A pod-struct for holding information about scenes to load by the application.
osg::ref_ptr< osg::Group > m_postProcessRoot
bool isSimulationRunning() const
osg::ref_ptr< osg::Group > m_root
agx::StringVector m_attachedScripts
agxOSG::PickHandlerRef m_pickHandler
A small argument parser class.
ParticleSystemRenderUtilityRef m_particleRenderUtil