Ocean
ColorInterpolator.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_COLOR_INTERPOLATOR_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_COLOR_INTERPOLATOR_H
10 
13 
14 #include "ocean/math/HSVAColor.h"
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 a color interpolator node.
30  * @ingroup scenedescriptionsdxx3d
31  */
32 class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT ColorInterpolator : virtual public X3DInterpolatorNode
33 {
34  public:
35 
36  /**
37  * Creates a new color interpolator node.
38  * @param environment Node environment
39  */
40  explicit ColorInterpolator(const SDXEnvironment* environment);
41 
42  protected:
43 
44  /**
45  * Specifies the node type and the fields of this node.
46  * @return Unique node specification of this node
47  */
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  * Event function to inform the node about a changed field.
58  * @see SDXNode::onFieldChanged().
59  */
60  void onFieldChanged(const std::string& fieldName) override;
61 
62  /**
63  * Event function for single value 'interpolates'.
64  * @see X3DInterpolationNode::onSingleValue().
65  */
66  void onSingleValue(const size_t index, const Timestamp eventTimestamp) override;
67 
68  /**
69  * Event function to interpolate between two values.
70  * @see X3DInterpolationNode::onInterpolate().
71  */
72  void onInterpolate(const size_t leftIndex, const size_t rightIndex, const Scalar interpolationFactor, const Timestamp eventTimestamp) override;
73 
74  /**
75  * Returns the address of the most derived object.
76  * @see Node::objectAddress().
77  */
78  size_t objectAddress() const override;
79 
80  protected:
81 
82  /// KeyValue field.
84 
85  /// Value_changed field.
87 
88  /// Vector holding the HSVA color values of the key values.
90 };
91 
92 }
93 
94 }
95 
96 }
97 
98 }
99 
100 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_COLOR_INTERPOLATOR_H
This class implements a node specification object.
Definition: scenedescription/Node.h:77
This class implements a color interpolator node.
Definition: ColorInterpolator.h:33
size_t objectAddress() const override
Returns the address of the most derived object.
void onInterpolate(const size_t leftIndex, const size_t rightIndex, const Scalar interpolationFactor, const Timestamp eventTimestamp) override
Event function to interpolate between two values.
SingleColor valueChanged_
Value_changed field.
Definition: ColorInterpolator.h:86
ColorInterpolator(const SDXEnvironment *environment)
Creates a new color interpolator node.
HSVAColors hsvaColors_
Vector holding the HSVA color values of the key values.
Definition: ColorInterpolator.h:89
void onSingleValue(const size_t index, const Timestamp eventTimestamp) override
Event function for single value 'interpolates'.
void onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
NodeSpecification specifyNode()
Specifies the node type and the fields of this 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...
MultiColor keyValue_
KeyValue field.
Definition: ColorInterpolator.h:83
This class implements an abstract x3d interpolator node object.
Definition: X3DInterpolatorNode.h:33
This class implements a node environment container.
Definition: SDXNode.h:62
This class implements a timestamp.
Definition: Timestamp.h:36
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< HSVAColor > HSVAColors
Definition of a vector holding rgba color objects.
Definition: HSVAColor.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15