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;
163 bool journalContainsImpactData();
165 bool attachScripts(osg::Group*
root);
167 void finalizeAndResetVideoCapture();
175 void setCameraViewDirection(
const agx::Vec3& direction );
177 void incrementOrthographicProjection(
agx::Real increment );
181 void signalSimulationUpdate(
float timeStamp);
182 void signalNewPlayback(
float timeStart,
float timeEnd, uint numFrames);
183 void signalNewSimulation();
184 void signalSimulationPause();
185 void signalJournalTrackReachedEnd();
186 void signalJournalContainsImpactData(
bool hasData);
188 void signalUpdateSimulationStructure();
190 void signalActiveCameraViewChanged();
193 void signalRenderUpdate();
195 void signalNewSimulationLoaded();
199 void slotUpdateLoop();
202 void slotPauseSimulation();
203 void slotPlaySimulation();
204 void slotStepForwardSimulation();
205 void slotStepBackSimulation();
206 void slotStopSimulation();
207 void slotChangeSimulationTime(
float);
208 void slotJumpToEnd();
209 void slotJumpToStart();
210 void slotSetJournalStride(uint stride);
211 void slotEnableJournalLooping(
bool enable);
214 void slotEnableDebugRenderMode(
bool);
215 void slotEnableOSGRenderMode(
bool);
216 void slotEnbleDrawStatistics(
bool);
217 void slotChangeDrawMode(
int mode);
218 void slotCenterScene();
219 void slotChangeParticleShaderMode(
int mode);
221 void slotSetEnableShaders(
bool enable);
222 void slotChangeBackgroundColor(
int mode );
223 void slotSetEnableRenderDataRendering(
bool enable);
224 void slotSetEnableCollisionDataRendering(
bool enable);
225 void slotMoveLightToLookAt();
226 void slotUpdateAnalysisBoxDrawable();
227 void slotUpdateClipplingPlaneDrawable();
228 void slotHandleStopSimulation();
231 void slotIncrementCamera();
232 void slotDecrementCamera();
233 void slotStoreCurrentViewInCameraSet();
234 void slotSetViewFromActiveCameraDescription();
235 void slotIncrementClipPlane();
236 void slotDecrementClipPlane();
237 void setEnableOrthographicCamera(
bool enable);
238 void slotIncrementOrthographicZoom();
239 void slotDecrementOrthographicZoom();
242 void stepSimulation();
243 void slotClearSimulation();
244 void slotReloadSimulation();
245 void slotUpdateSpace();
248 bool initPythonContext(agxPython::ScriptManager* scriptManager, osg::Group* root);
252 void loadDefaultCameraConfig(
const agx::String& filename);
254 void lockSimulationAndTriggerEvents();
257 void journalPlayback(
const std::string& journalPlaybackPath,
const std::string asessionName =
"");
258 void clearJournalSessionData();
261 bool restoreFromFile(
const std::string& file);
263 bool executeMPyScript(
const agx::String& file, osg::Group *root);
264 void initSimulationController();
266 void fitSceneIntoView();
267 void clearSimulation();
269 bool loadActiveScene();
272 void setupUpdateLoop();
273 void handleJournalLooping();
274 bool playbackIsAtEnd();
275 void setupPostProcessor();
277 void updateAnalysisBox();
278 void triggetStopInScripts();
281 static void setActiveSimulationController(agxSDK::SimulationController* controller);
339 osg::ref_ptr<osgGA::StateSetManipulator>
m_ssm;
agxOSG::SceneDescription m_sceneDescription
ParticleSystemRenderUtilityRef m_particleRenderUtil
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
agxOSG::SceneDescription getSceneDescription() const
Returns the description of the active scene.
agxQt::ClipPlaneControllerRef m_clipPlaneController
osg::ref_ptr< osg::Switch > m_sceneSwitch
agxOSG::RigidBodyRenderCacheRef m_renderBodyCache
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.
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...
RigidBodyRenderCache is used to cache generated visuals and lookup mappings of RigidBodies cloned fro...
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