Ocean
Loading...
Searching...
No Matches
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
19namespace Ocean
20{
21
22namespace SceneDescription
23{
24
25namespace SDX
26{
27
28namespace X3D
29{
30
31/**
32 * This class implements a x3d composed shader node.
33 * @ingroup scenedescriptionsdxx3d
34 */
35class 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
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.
X3DProgrammableShaderObject(const SDXEnvironment *environment)
Creates a new x3d programmable shader object.
X3DShaderNode(const SDXEnvironment *environment)
Creates a new abstract x3d shader node.
SDXDynamicNode(const SDXEnvironment *environment)
Creates a new dynamic SDX node object.
This class implements a node environment container.
Definition SDXNode.h:62
This class implements a timestamp.
Definition Timestamp.h:64
SmartObjectRef< Scene > SceneRef
Definition of a smart object reference holding a scene node.
Definition rendering/Scene.h:29
SmartObjectRef< ShaderProgram > ShaderProgramRef
Definition of a smart object reference holding a shader program object.
Definition rendering/ShaderProgram.h:37
Field1D< NodeRef > MultiNode
Definition of a multi field with node values.
Definition Field1D.h:54
Namespace of the S(scene)D(escription)X X3D SceneDescription library.
Definition Appearance.h:26
Definition Appearance.h:23
Namespace of the SceneDescription library.
Definition DynamicNode.h:21
The namespace covering the entire Ocean framework.
Definition Accessor.h:15