Ocean
Loading...
Searching...
No Matches
X3DTimeDependentNode.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_X3D_TIME_DEPENDENT_NODE_H
9#define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_X3D_TIME_DEPENDENT_NODE_H
10
13
15
16namespace Ocean
17{
18
19namespace SceneDescription
20{
21
22namespace SDX
23{
24
25namespace X3D
26{
27
28/**
29 * This class implements an abstract x3d time dependent node.
30 * @ingroup scenedescriptionsdxx3d
31 */
32class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT X3DTimeDependentNode :
33 virtual public X3DChildNode,
34 virtual public SDXUpdateNode
35{
36 protected:
37
38 /**
39 * Creates an abstract x3d time dependent node.
40 * @param environment Node environment
41 */
42 explicit X3DTimeDependentNode(const SDXEnvironment* environment);
43
44 /**
45 * Registers the fields of this node.
46 * @param specification Node specification receiving the field informations
47 */
48 void registerFields(NodeSpecification& specification);
49
50 /**
51 * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
52 * @see SDXNode::onInitialize().
53 */
54 void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
55
56 /**
57 * Explicit changing event function for node fields.
58 * @see X3DNode::onFieldChanging().
59 */
60 bool onFieldChanging(const std::string& fieldName, const Field& field) override;
61
62 /**
63 * Event function to inform the node about a changed field.
64 * @see SDXNode::onFieldChanged().
65 */
66 void onFieldChanged(const std::string& fieldName)override;
67
68 /**
69 * Update event function.
70 * @see SDXUpdateNode::onUpdate().
71 */
72 void onUpdate(const Rendering::ViewRef& view, const Timestamp timestamp) override;
73
74 /**
75 * Starts the node explicitly.
76 * The node must not be active before this call.<br>
77 * All necessary events will be generated.<br>
78 * @param valueTimestamp Timestamp value of optional time fields
79 * @param eventTimestamp Timestamp of the event causing the start
80 */
81 virtual void startNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp);
82
83 /**
84 * Pauses the node explicitly.
85 * The node must be active at the moment of this call.<br>
86 * All necessary events will be generated.<br>
87 * @param valueTimestamp Timestamp value of optional time fields
88 * @param eventTimestamp Timestamp of the event causing the start
89 */
90 virtual void pauseNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp);
91
92 /**
93 * Resumes the node explicitly.
94 * The node must be active but paused at the moment of this call.<br>
95 * All necessary events will be generated.<br>
96 * @param valueTimestamp Timestamp value of optional time fields
97 * @param eventTimestamp Timestamp of the event causing the start
98 */
99 virtual void resumeNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp);
100
101 /**
102 * Stops the node explicitly.
103 * The node must be active before this call.<br>
104 * All necessary events will be generated.<br>
105 * @param valueTimestamp Timestamp value of optional time fields
106 * @param eventTimestamp Timestamp of the event causing the start
107 */
108 virtual void stopNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp);
109
110 /**
111 * Event function for node start events.
112 * This function can be used in derivated classes.
113 * @param eventTimestamp Event timestamp causing the starting
114 */
115 virtual void onStarted(const Timestamp eventTimestamp) = 0;
116
117 /**
118 * Event function for node pause events.
119 * This function can be used in derivated classes.
120 * @param eventTimestamp Event timestamp causing the pausing
121 */
122 virtual void onPaused(const Timestamp eventTimestamp) = 0;
123
124 /**
125 * Event function for node resume events.
126 * This function can be used in derivated classes.
127 * @param eventTimestamp Event timestamp causing the resuming
128 */
129 virtual void onResumed(const Timestamp eventTimestamp) = 0;
130
131 /**
132 * Event function for node stop events.
133 * This function can be used in derivated classes.
134 * @param eventTimestamp Event timestamp causing the stopping
135 */
136 virtual void onStopped(const Timestamp eventTimestamp) = 0;
137
138 /**
139 * Event function for node update events.
140 * This function must be used in derivated classes.
141 * @param timestamp Update timestamp
142 */
143 virtual void onUpdated(const Timestamp timestamp) = 0;
144
145 protected:
146
147 /// Loop field.
149
150 /// PauseTime field.
152
153 /// ResumeTime field.
155
156 /// StartTime field.
158
159 /// StopTime field.
161
162 /// ElapsedTime field.
164
165 /// IsActive field.
167
168 /// IsPaused field.
170
171 /// The time this sensor was paused, with range [0, infinity)
173};
174
175}
176
177}
178
179}
180
181}
182
183#endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_X3D_TIME_DEPENDENT_NODE_H
This class is the base class for all scene description fields.
Definition Field.h:36
This class implements a node specification object.
Definition scenedescription/Node.h:77
This class implements an abstract x3d child node.
Definition X3DChildNode.h:31
This class implements an abstract x3d time dependent node.
Definition X3DTimeDependentNode.h:35
SingleTime pauseTime_
PauseTime field.
Definition X3DTimeDependentNode.h:151
SingleTime elapsedTime_
ElapsedTime field.
Definition X3DTimeDependentNode.h:163
X3DTimeDependentNode(const SDXEnvironment *environment)
Creates an abstract x3d time dependent node.
SingleBool isPaused_
IsPaused field.
Definition X3DTimeDependentNode.h:169
bool onFieldChanging(const std::string &fieldName, const Field &field) override
Explicit changing event function for node fields.
SingleTime startTime_
StartTime field.
Definition X3DTimeDependentNode.h:157
virtual void onResumed(const Timestamp eventTimestamp)=0
Event function for node resume events.
virtual void pauseNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp)
Pauses the node explicitly.
virtual void onStarted(const Timestamp eventTimestamp)=0
Event function for node start events.
void onInitialize(const Rendering::SceneRef &scene, const Timestamp timestamp) override
Event function to inform the node that it has been initialized and can apply all internal values to c...
double pausedTime_
The time this sensor was paused, with range [0, infinity)
Definition X3DTimeDependentNode.h:172
SingleTime stopTime_
StopTime field.
Definition X3DTimeDependentNode.h:160
void onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
SingleBool loop_
Loop field.
Definition X3DTimeDependentNode.h:148
SingleBool isActive_
IsActive field.
Definition X3DTimeDependentNode.h:166
virtual void onPaused(const Timestamp eventTimestamp)=0
Event function for node pause events.
void registerFields(NodeSpecification &specification)
Registers the fields of this node.
virtual void resumeNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp)
Resumes the node explicitly.
virtual void onUpdated(const Timestamp timestamp)=0
Event function for node update events.
virtual void startNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp)
Starts the node explicitly.
virtual void stopNode(const Timestamp valueTimestamp, const Timestamp eventTimestamp)
Stops the node explicitly.
SingleTime resumeTime_
ResumeTime field.
Definition X3DTimeDependentNode.h:154
virtual void onStopped(const Timestamp eventTimestamp)=0
Event function for node stop events.
void onUpdate(const Rendering::ViewRef &view, const Timestamp timestamp) override
Update event function.
This class implements a node environment container.
Definition SDXNode.h:62
This class implements the base class for all nodes needing update calls regularly.
Definition SDXUpdateNode.h:25
This class implements a timestamp.
Definition Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition Accessor.h:15