Ocean
Loading...
Searching...
No Matches
TouchSensor.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_X3D_TOUCH_SENSOR_NODE_H
9#define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_TOUCH_SENSOR_NODE_H
10
14
15namespace Ocean
16{
17
18namespace SceneDescription
19{
20
21namespace SDX
22{
23
24namespace X3D
25{
26
27/**
28 * This class implements a touch sensor node.
29 * @ingroup scenedescriptionsdxx3d
30 */
31class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT TouchSensor : virtual public X3DTouchSensorNode
32{
33 public:
34
35 /**
36 * Creates an abstract touch sensor node.
37 * @param environment Node environment
38 */
39 explicit TouchSensor(const SDXEnvironment* environment);
40
41 protected:
42
43 /**
44 * Specifies the node type and the fields of this node.
45 * @return Unique node specification of this node
46 */
48
49 /**
50 * Mouse event function.
51 * @see SDXEventNode().
52 */
53 void onMouse(const ButtonType button, const ButtonEvent buttonEvent, const Vector2& screenPosition, const Vector3& objectPosition, const Rendering::ObjectId objectId, const Timestamp timestamp) override;
54
55 /**
56 * Key event function.
57 * @see SDXEventNode().
58 */
59 void onKey(const int key, const ButtonEvent buttonEvent, const Rendering::ObjectId objectId, const Timestamp timestamp) override;
60
61 /**
62 * Returns whether the selected rendering object is an object of the sibling nodes.
63 * @param objectId Rendering object id to check
64 * @return True, if so
65 */
66 bool isSiblingNode(const Rendering::ObjectId objectId) const;
67
68 /**
69 * Returns whether a specified group object holds a specific rendering object id.
70 * @param group X3D grouping node
71 * @param objectId Rendering object id to check
72 * @return True, if so
73 */
75
76 /**
77 * Returns the address of the most derived object.
78 * @see Node::objectAddress().
79 */
80 size_t objectAddress() const override;
81
82 protected:
83
84 /// HitNormal_changed field.
86
87 /// HitPoint_changed field.
89
90 /// HitTexCoord_changed field.
92
93 /// Last object hit position.
95};
96
97}
98
99}
100
101}
102
103}
104
105#endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_TOUCH_SENSOR_NODE_H
This class implements a node specification object.
Definition scenedescription/Node.h:77
This class implements a touch sensor node.
Definition TouchSensor.h:32
void onMouse(const ButtonType button, const ButtonEvent buttonEvent, const Vector2 &screenPosition, const Vector3 &objectPosition, const Rendering::ObjectId objectId, const Timestamp timestamp) override
Mouse event function.
static bool hasRenderingObject(const SmartObjectRef< X3DGroupingNode, Node > &group, const Rendering::ObjectId objectId)
Returns whether a specified group object holds a specific rendering object id.
bool isSiblingNode(const Rendering::ObjectId objectId) const
Returns whether the selected rendering object is an object of the sibling nodes.
SingleVector3 hitPointChanged_
HitPoint_changed field.
Definition TouchSensor.h:88
Vector3 lastObjectPosition_
Last object hit position.
Definition TouchSensor.h:94
NodeSpecification specifyNode()
Specifies the node type and the fields of this node.
TouchSensor(const SDXEnvironment *environment)
Creates an abstract touch sensor node.
void onKey(const int key, const ButtonEvent buttonEvent, const Rendering::ObjectId objectId, const Timestamp timestamp) override
Key event function.
SingleVector3 hitNormalChanged_
HitNormal_changed field.
Definition TouchSensor.h:85
SingleVector2 hitTexCoordChanged_
HitTexCoord_changed field.
Definition TouchSensor.h:91
size_t objectAddress() const override
Returns the address of the most derived object.
This class implements an abstract x3d touch sensor node.
Definition X3DTouchSensorNode.h:31
This class implements a node environment container.
Definition SDXNode.h:62
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition SmartObjectRef.h:90
This class implements a timestamp.
Definition Timestamp.h:36
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