Ocean
ComposedShader.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_COMPOSED_SHADER_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_COMPOSED_SHADER_H
10 
14 
16 
18 
19 namespace Ocean
20 {
21 
22 namespace SceneDescription
23 {
24 
25 namespace SDX
26 {
27 
28 namespace X3D
29 {
30 
31 /**
32  * This class implements a x3d composed shader node.
33  * @ingroup scenedescriptionsdxx3d
34  */
35 class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT ComposedShader :
36  virtual public X3DProgrammableShaderObject,
37  virtual public X3DShaderNode,
38  virtual public SDXDynamicNode
39 {
40  public:
41 
42  /**
43  * Creates a new packaged shader node.
44  * @param environment Node environment
45  */
46  ComposedShader(const SDXEnvironment* environment);
47 
48  protected:
49 
50  /**
51  * Specifies the node type and the fields of this node.
52  * @return Unique node specification of this node
53  */
55 
56  /**
57  * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
58  * @see SDXNode::onInitialize().
59  */
60  void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) 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  * Applies a given parameter to the shader.
70  * @param shaderProgram Shader program holding the parameter to be updated
71  * @param fieldName Name of the field to apply
72  * @return True, if succeeded
73  */
74  bool applyParameter(const Rendering::ShaderProgramRef& shaderProgram, const std::string& fieldName);
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  /// The parts field.
86 };
87 
88 }
89 
90 }
91 
92 }
93 
94 }
95 
96 #endif // META_OCEAN_SCENEDESCRIPTION_SDX_X3D_COMPOSED_SHADER_H
This class implements a node specification object.
Definition: scenedescription/Node.h:77
This class implements a x3d composed shader node.
Definition: ComposedShader.h:39
MultiNode parts_
The parts field.
Definition: ComposedShader.h:85
ComposedShader(const SDXEnvironment *environment)
Creates a new packaged shader node.
NodeSpecification specifyNode()
Specifies the node type and the fields of this node.
size_t objectAddress() const override
Returns the address of the most derived object.
bool applyParameter(const Rendering::ShaderProgramRef &shaderProgram, const std::string &fieldName)
Applies a given parameter to the shader.
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 onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
This class implements an abstract x3d programmable shader object.
Definition: X3DProgrammableShaderObject.h:32
This class implements an abstract x3d shader node.
Definition: X3DShaderNode.h:31
This class implements the base class for all dynamic SDX scene description nodes.
Definition: SDXDynamicNode.h:38
This class implements a node environment container.
Definition: SDXNode.h:62
This class implements a timestamp.
Definition: Timestamp.h:36
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15