Ocean
Loading...
Searching...
No Matches
PackagedShader.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_PACKAGED_SHADER_H
9#define META_OCEAN_SCENEDESCRIPTION_SDX_X3D_PACKAGED_SHADER_H
10
15
17
19
20namespace Ocean
21{
22
23namespace SceneDescription
24{
25
26namespace SDX
27{
28
29namespace X3D
30{
31
32/**
33 * This class implements a x3d packaged shader node.
34 * @ingroup scenedescriptionsdxx3d
35 */
36class OCEAN_SCENEDESCRIPTION_SDX_X3D_EXPORT PackagedShader :
37 virtual public X3DProgrammableShaderObject,
38 virtual public X3DShaderNode,
39 virtual public X3DUrlObject,
40 virtual public SDXDynamicNode
41{
42 public:
43
44 /**
45 * Creates a new packaged shader node.
46 * @param environment Node environment
47 */
48 PackagedShader(const SDXEnvironment* environment);
49
50 protected:
51
52 /**
53 * Specifies the node type and the fields of this node.
54 * @return Unique node specification of this node
55 */
57
58 /**
59 * Event function to inform the node that it has been initialized and can apply all internal values to corresponding rendering objects.
60 * @see SDXNode::onInitialize().
61 */
62 void onInitialize(const Rendering::SceneRef& scene, const Timestamp timestamp) override;
63
64 /**
65 * Event function to inform the node about a changed field.
66 * @see SDXNode::onFieldChanged().
67 */
68 void onFieldChanged(const std::string& fieldName) override;
69
70 /**
71 * Applies a given parameter to the shader.
72 * @param shaderProgram Shader program holding the parameter to be updated
73 * @param fieldName Name of the field to apply
74 * @return True, if succeeded
75 */
76 bool applyParameter(const Rendering::ShaderProgramRef& shaderProgram, const std::string& fieldName);
77
78 /**
79 * Returns the address of the most derived object.
80 * @see Node::objectAddress().
81 */
82 size_t objectAddress() const override;
83};
84
85}
86
87}
88
89}
90
91}
92
93#endif // META_OCEAN_SCENEDESCRIPTION_SDL_X3D_PACKAGED_SHADER_H
This class implements a node specification object.
Definition scenedescription/Node.h:77
This class implements a x3d packaged shader node.
Definition PackagedShader.h:41
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 onFieldChanged(const std::string &fieldName) override
Event function to inform the node about a changed field.
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...
PackagedShader(const SDXEnvironment *environment)
Creates a new packaged shader node.
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 an abstract x3d url object.
Definition X3DUrlObject.h:35
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