Ocean
Loading...
Searching...
No Matches
GLESMaterial.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_RENDERING_GLES_MATERIAL_H
9#define META_OCEAN_RENDERING_GLES_MATERIAL_H
10
13
15
16namespace Ocean
17{
18
19namespace Rendering
20{
21
22namespace GLESceneGraph
23{
24
25/**
26 * This class implements a GLESceneGraph material object.
27 * @see Material
28 * @ingroup renderingles
29 */
30class OCEAN_RENDERING_GLES_EXPORT GLESMaterial :
31 virtual public GLESAttribute,
32 virtual public Material
33{
34 friend class GLESFactory;
35
36 public:
37
38 /**
39 * Returns the ambient color of this material.
40 * @see Material::ambientColor().
41 */
42 RGBAColor ambientColor() const override;
43
44 /**
45 * Returns the diffuse color of this material.
46 * @see Material::diffuseColor().
47 */
48 RGBAColor diffuseColor() const override;
49
50 /**
51 * Returns the emissive color of this material.
52 * @see Material::emissiveColor().
53 */
54 RGBAColor emissiveColor() const override;
55
56 /**
57 * Returns the specular color of this material.
58 * @see Material::specularColor().
59 */
60 RGBAColor specularColor() const override;
61
62 /**
63 * Returns the specular exponent of this material.
64 * @see Material::specularExponent().
65 */
66 float specularExponent() const override;
67
68 /**
69 * Returns the transparency factor of this material with range [0.0, 1.0]
70 * @see Material::transparency().
71 */
72 float transparency() const override;
73
74 /**
75 * Gets all color values of the material at once.
76 * @see Material::get().
77 */
78 void get(RGBAColor& ambient, RGBAColor& diffuse, RGBAColor& emissive, RGBAColor& specular, float& specularExponent, float& transparency) override;
79
80 /**
81 * Sets the ambient color of the material.
82 * @see Material::setAmbientColor().
83 */
84 bool setAmbientColor(const RGBAColor& color) override;
85
86 /**
87 * Sets the diffuse color of the material.
88 * @see Material::setDiffuseColor().
89 */
90 bool setDiffuseColor(const RGBAColor& color) override;
91
92 /**
93 * Sets the emissive color of the material.
94 * @see Material::setEmissiveColor().
95 */
96 bool setEmissiveColor(const RGBAColor& color) override;
97
98 /**
99 * Sets the specular color of the material.
100 * @see Material::setSpecularColor().
101 */
102 bool setSpecularColor(const RGBAColor& color) override;
103
104 /**
105 * Sets the specular exponent of this material.
106 * @see Material::setSpecularExponent().
107 */
108 bool setSpecularExponent(const float specularExponent) override;
109
110 /**
111 * Sets the specular exponent of this material.
112 * @see Material::setTransparency().
113 */
114 bool setTransparency(const float transparency) override;
115
116 /**
117 * Sets the transparency of the meterial.
118 * @see Material::set().
119 */
120 bool set(const RGBAColor& ambient, const RGBAColor& diffuse, const RGBAColor& emissive, const RGBAColor& specular, const float specularExponent, const float transparency) override;
121
122 /**
123 * Binds this attribute.
124 * @see GLESAttribute::bindAttribute().
125 */
126 void bindAttribute(const GLESFramebuffer& framebuffer, GLESShaderProgram& shaderProgram) override;
127
128 /**
129 * Binds this material attribute.
130 * @param framebuffer Framebuffer initiated the rendering process
131 * @param shaderProgram Shader program to be applied
132 * @param materialName The name of the material uniform, must be valid
133 */
134 void bindMaterial(const GLESFramebuffer& framebuffer, GLESShaderProgram& shaderProgram, const std::string& materialName);
135
136 /**
137 * Returns the shader type necessary to render an object with this attribute.
138 * @see GLESAttribute::necessaryShader().
139 */
141
142 protected:
143
144 /**
145 * Creates a new GLESceneGraph material object.
146 */
148
149 /**
150 * Destructs a GLESceneGraph material object.
151 */
152 ~GLESMaterial() override;
153
154 protected:
155
156 /// Ambient color.
158
159 /// Diffuse color.
161
162 /// Emissive color.
164
165 /// Specular color.
167
168 /// Specular exponent.
170
171 /// Transparency value, with range [0, 1]
173};
174
175}
176
177}
178
179}
180
181#endif // META_OCEAN_RENDERING_GLES_MATERIAL_H
This class implements a color defined by red, green, blue and alpha parameters.
Definition RGBAColor.h:41
This class wraps a GLESceneGraph attribute object.
Definition GLESAttribute.h:36
ProgramType
Definition of different shader functionalities.
Definition GLESAttribute.h:43
This class implements a class factory for all GLESceneGraph objects.
Definition GLESFactory.h:30
This class implements a base for all GLESceneGraph framebuffers.
Definition rendering/glescenegraph/GLESFramebuffer.h:34
This class implements a GLESceneGraph material object.
Definition GLESMaterial.h:33
void bindMaterial(const GLESFramebuffer &framebuffer, GLESShaderProgram &shaderProgram, const std::string &materialName)
Binds this material attribute.
bool setAmbientColor(const RGBAColor &color) override
Sets the ambient color of the material.
void bindAttribute(const GLESFramebuffer &framebuffer, GLESShaderProgram &shaderProgram) override
Binds this attribute.
bool setSpecularColor(const RGBAColor &color) override
Sets the specular color of the material.
RGBAColor specularColor_
Specular color.
Definition GLESMaterial.h:166
RGBAColor specularColor() const override
Returns the specular color of this material.
bool setTransparency(const float transparency) override
Sets the specular exponent of this material.
GLESMaterial()
Creates a new GLESceneGraph material object.
float specularExponent_
Specular exponent.
Definition GLESMaterial.h:169
~GLESMaterial() override
Destructs a GLESceneGraph material object.
RGBAColor ambientColor() const override
Returns the ambient color of this material.
RGBAColor emissiveColor_
Emissive color.
Definition GLESMaterial.h:163
float transparency() const override
Returns the transparency factor of this material with range [0.0, 1.0].
bool setEmissiveColor(const RGBAColor &color) override
Sets the emissive color of the material.
RGBAColor emissiveColor() const override
Returns the emissive color of this material.
bool setSpecularExponent(const float specularExponent) override
Sets the specular exponent of this material.
float specularExponent() const override
Returns the specular exponent of this material.
RGBAColor ambientColor_
Ambient color.
Definition GLESMaterial.h:157
RGBAColor diffuseColor() const override
Returns the diffuse color of this material.
bool setDiffuseColor(const RGBAColor &color) override
Sets the diffuse color of the material.
RGBAColor diffuseColor_
Diffuse color.
Definition GLESMaterial.h:160
bool set(const RGBAColor &ambient, const RGBAColor &diffuse, const RGBAColor &emissive, const RGBAColor &specular, const float specularExponent, const float transparency) override
Sets the transparency of the meterial.
float transparency_
Transparency value, with range [0, 1].
Definition GLESMaterial.h:172
GLESAttribute::ProgramType necessaryShader() const override
Returns the shader type necessary to render an object with this attribute.
void get(RGBAColor &ambient, RGBAColor &diffuse, RGBAColor &emissive, RGBAColor &specular, float &specularExponent, float &transparency) override
Gets all color values of the material at once.
This class implements a container for an OpenGL ES shader program.
Definition GLESShaderProgram.h:53
This class is the base class for all materials.
Definition rendering/Material.h:49
The namespace covering the entire Ocean framework.
Definition Accessor.h:15