Ocean
X3DLightNode.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_LIGHT_NODE_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_X3D_LIGHT_NODE_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace SceneDescription
20 {
21 
22 namespace SDX
23 {
24 
25 namespace X3D
26 {
27 
28 /**
29  * This class implements an abstract x3d light node.
30  * @ingroup scenedescriptionsdxx3d
31  */
32 class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT X3DLightNode :
33  virtual public X3DChildNode,
34  virtual public SDXUpdateNode
35 {
36  protected:
37 
38  /**
39  * Creates an abstract x3d light node.
40  * @param environment Node environment
41  */
42  explicit X3DLightNode(const SDXEnvironment* environment);
43 
44  /**
45  * Destructs a light node.
46  */
47  ~X3DLightNode() override;
48 
49  /**
50  * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
51  * @see SDXNode::onInitialize().
52  */
53  void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
54 
55  /**
56  * Event function to inform the node about a changed field.
57  * @see SDXNode::onFieldChanged().
58  */
59  void onFieldChanged(const std::string& fieldName) override;
60 
61  /**
62  * Update event function.
63  * @see SDXUpdateNode::onUpdate().
64  */
65  void onUpdate(const Rendering::ViewRef& view, const Timestamp timestamp) override;
66 
67  /**
68  * Event function to update the position or direction of a light source with global state.
69  * @param world_T_light The global light transformation, must be valid
70  */
71  virtual void onGlobalLight(const HomogenousMatrix4& world_T_light) = 0;
72 
73  /**
74  * Registers the fields of this node.
75  * @param specification Node specification receiving the field informations
76  */
77  void registerFields(NodeSpecification& specification);
78 
79  /**
80  * Registers this light at the renering objects.
81  * @param willBeGlobal True, if the light will be a global light; False, if the light will be a local light
82  */
83  void registerLight(const bool willBeGlobal);
84 
85  /**
86  * Unregisters this light at the renering objects.
87  * @param wasGlobal True, if the light was a global light; False, if the light was a local light
88  */
89  void unregisterLight(const bool wasGlobal);
90 
91  protected:
92 
93  /// AmbientIntensity field.
95 
96  /// Color field.
98 
99  /// Global field.
101 
102  /// Intensity field.
104 
105  /// On field.
107 };
108 
109 }
110 
111 }
112 
113 }
114 
115 }
116 
117 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_X3D_LIGHT_NODE_H
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 light node.
Definition: X3DLightNode.h:35
X3DLightNode(const SDXEnvironment *environment)
Creates an abstract x3d light node.
~X3DLightNode() override
Destructs a light node.
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...
void unregisterLight(const bool wasGlobal)
Unregisters this light at the renering objects.
SingleFloat ambientIntensity_
AmbientIntensity field.
Definition: X3DLightNode.h:94
void registerLight(const bool willBeGlobal)
Registers this light at the renering objects.
SingleColor color_
Color field.
Definition: X3DLightNode.h:97
SingleBool on_
On field.
Definition: X3DLightNode.h:106
void onUpdate(const Rendering::ViewRef &view, const Timestamp timestamp) override
Update event function.
SingleBool global_
Global field.
Definition: X3DLightNode.h:100
SingleFloat intensity_
Intensity field.
Definition: X3DLightNode.h:103
void onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
void registerFields(NodeSpecification &specification)
Registers the fields of this node.
virtual void onGlobalLight(const HomogenousMatrix4 &world_T_light)=0
Event function to update the position or direction of a light source with global state.
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