Ocean
SDXEventNode.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SCENEDESCRIPTION_SDX_EVENT_NODE_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_EVENT_NODE_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace SceneDescription
18 {
19 
20 /**
21  * This class implements the base class for all nodes receiving event calls regularly.
22  * @ingroup scenedescription
23  */
24 class OCEAN_SCENEDESCRIPTION_EXPORT SDXEventNode : virtual public SDXNode
25 {
26  friend class Manager;
27 
28  public:
29 
30  /**
31  * Creates a new event node and registers it at the scene description manager.
32  * @param environment Node environment
33  */
34  SDXEventNode(const SDXEnvironment* environment);
35 
36  /**
37  * Destructs an event node and unregisters it from the scene description manager.
38  */
39  ~SDXEventNode() override;
40 
41  protected:
42 
43  /**
44  * Mouse event function.
45  * @param button Device type
46  * @param buttonEvent Type of the event
47  * @param screenPosition 2D screen position
48  * @param objectPosition 3D object position
49  * @param objectId Id of a rendering object associated with the event
50  * @param timestamp Event timestamp
51  */
52  virtual void onMouse(const ButtonType button, const ButtonEvent buttonEvent, const Vector2& screenPosition, const Vector3& objectPosition, const Rendering::ObjectId objectId, const Timestamp timestamp) = 0;
53 
54  /**
55  * Key event function.
56  * @param key Key type
57  * @param buttonEvent Type of the event
58  * @param objectId Id of a rendering object associated with the event
59  * @param timestamp Event timestamp
60  */
61  virtual void onKey(const int key, const ButtonEvent buttonEvent, const Rendering::ObjectId objectId, const Timestamp timestamp) = 0;
62 };
63 
64 }
65 
66 }
67 
68 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_EVENT_NODE_H
This class implements the manager for all scene descriptions.
Definition: scenedescription/Manager.h:101
This class implements the base class for all nodes receiving event calls regularly.
Definition: SDXEventNode.h:25
virtual void onKey(const int key, const ButtonEvent buttonEvent, const Rendering::ObjectId objectId, const Timestamp timestamp)=0
Key event function.
~SDXEventNode() override
Destructs an event node and unregisters it from the scene description manager.
virtual void onMouse(const ButtonType button, const ButtonEvent buttonEvent, const Vector2 &screenPosition, const Vector3 &objectPosition, const Rendering::ObjectId objectId, const Timestamp timestamp)=0
Mouse event function.
SDXEventNode(const SDXEnvironment *environment)
Creates a new event node and registers it at the scene description manager.
This class implements a node environment container.
Definition: SDXNode.h:62
This class implements the base class for all SDX scene description nodes.
Definition: SDXNode.h:50
This class implements a timestamp.
Definition: Timestamp.h:36
size_t ObjectId
Definition of a object id.
Definition: rendering/Rendering.h:59
ButtonEvent
Definition of different device events.
Definition: SceneDescription.h:92
ButtonType
Definition of different button types.
Definition: SceneDescription.h:76
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15