This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Interactor.h
58 lines (39 loc) · 1.57 KB
/
Interactor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SOFA_Interactor_H
#define SOFA_Interactor_H
#include <SofaSimpleGUI/config.h>
#include <sofa/simulation/Node.h>
#include "PickedPoint.h"
namespace sofa::simplegui
{
class SofaScene;
using simulation::Node;
/** @brief Base class for all interactors.
* Interactors are sofa subgraphs used to apply actions to the scene, typically through user interaction.
*
* Note that they are not necessarily moved using the mouse, since there is no mouse or window coordinates in the API.
* @author Francois Faure, 2014
*/
class SOFA_SOFASIMPLEGUI_API Interactor
{
protected:
Node::SPtr _interactionNode; ///< Scene node used to implement this
PickedPoint _pickedPoint; ///< The point attached to this
public:
typedef type::Vec3 Vec3;
Interactor( const PickedPoint& picked );
virtual ~Interactor();
/// Insert this in the scene as a child of the given node. If overloaded, this function should be called at the beginning of the overloaded function.
virtual void attach( SofaScene* );
/// Remove this from the scene, without destroying it. If overloaded, this function should be called at the end of the overloaded function.
virtual void detach();
/// Current interaction point
virtual Vec3 getPoint()=0;
/// Displace the interaction to the given point
virtual void setPoint( const Vec3& p ) = 0;
/// Root of the interactor graph
Node::SPtr getNode() { return _interactionNode; }
/// Simulated point attached to this
const PickedPoint& getPickedPoint() const { return _pickedPoint; }
};
}
#endif // SOFA_Interactor_H