20#include <osgText/Text>
21#include <osg/Geometry>
22#include <osgViewer/Viewer>
50 virtual bool match(
const void* obj )
const = 0;
80 PickHandler( osgViewer::Viewer *viewer, osg::Group *scene=
nullptr);
108 virtual bool keyboard(
int key,
unsigned int modKeyMask,
float x,
float y,
bool keydown);
126 unsigned int m_modKeyMask;
128 osg::Matrix m_cameraMatrix;
129 osg::observer_ptr< osgViewer::Viewer > m_viewer;
130 osg::observer_ptr< osg::Group > m_scene;
131 osg::observer_ptr< osg::Camera > m_camera;
133 unsigned int m_activateModKeyMask;
134 unsigned int m_activateMouseKey;
149 bool isInitialized()
const {
return m_initialized; }
150 void updateClickedGeometry(MouseState state,
float x,
float y);
154 void startPick(
float x,
float y);
155 void updatePanels(
float x,
float y);
159 void traverseParticles();
162 bool mouseDown(MouseButtonMask button,
float x,
float y);
163 bool mouseDownLeftButton(
float x,
float y);
164 bool mouseDownMiddleButton(
float x,
float y);
165 bool mouseDownRightButton(
float x,
float y);
175 bool m_moveUnphysically;
186 osg::PositionAttitudeTransform *m_mouseAttachTransform;
187 osg::PositionAttitudeTransform *m_mousePositionTransform;
188 osg::Geometry *m_mouseSpringLine;
189 osg::observer_ptr< osg::Switch > m_mouseMarkerSwitch;
192 osg::observer_ptr< osg::Switch > m_sphereSwitch;
194 float m_mousePickingGraphicsScale;
#define AGX_DECLARE_POINTER_TYPES(type)
void setColor(const agx::Vec4 &color)
osg::ref_ptr< osg::Vec4Array > m_color
void setPosition(const agx::Vec2 &position)
virtual void uninitialize(osg::Group *sceneData)=0
const agx::Vec2 & getPosition() const
virtual bool match(const void *obj) const =0
const agx::Vec2 & getSize() const
osg::ref_ptr< osg::Vec3Array > m_normals
virtual bool isValid() const =0
osg::ref_ptr< osg::Vec3Array > m_vertices
void setSize(const agx::Vec2 &size)
Panel(const agx::Vec2 &position, const agx::Vec2 &size, const agx::Vec4 &color)
osg::ref_ptr< osg::Geometry > m_geometry
agx::Vec4 getColor() const
osg::ref_ptr< osg::DrawElementsUInt > m_indices
unsigned int getActivateMouseButton() const
void setCamera(osg::Camera *camera)
void setActivateMouseButton(unsigned int mouse)
Specify the mousekey that will activate the PickHandler, for example RIGHT_MOUSE_BUTTON.
virtual agxSDK::PickResult pick(float screenX, float screenY)
unsigned int getActivateModKeyMask() const
void setActivateModKeyMask(unsigned int modKey)
Specify the modkeymask that will activate the PickHandler, for example MODKEY_LEFT_SHIFT.
virtual bool mouseDragged(MouseButtonMask buttonMask, float x, float y)
Called when one or more mouse buttons are pressed and moved.
void getNearFarPoints(const osg::Camera *camera, agx::Vec3 &near, agx::Vec3 &far, float x, float y, bool useOldMatrix=false) const
Get the near and far points based on the current camera pose.
virtual bool keyboard(int key, unsigned int modKeyMask, float x, float y, bool keydown)
virtual bool mouse(MouseButtonMask button, MouseState state, float x, float y)
const osg::Camera * getCamera() const
virtual void update(float x, float y)
Called once per simulation frame.
void createMouseSpringRendering(float scale)
void setSimulation(agxSDK::Simulation *simulation)
agxSDK::PickResult intersect(float screenX, float screenY, bool onlyDynamics)
PickHandler(osgViewer::Viewer *viewer, osg::Group *scene=nullptr)
void reset()
Will detach any constrained rigidbody.
void setSimulation(Simulation *simulation)
Set the associated simulation for this EventListener.
agxSDK::PickResult intersect(const agx::Vec3 &start, const agx::Vec3 &end, bool onlyDynamics)
Shoot a ray from start to end into the space and calculate the closest geometry.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
A class holding 4 dimensional vectors and providing basic arithmetic.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agx::Vector< PanelRef > PanelContainer
osg::ref_ptr< Panel > PanelRef