Ocean
Loading...
Searching...
No Matches
GIMaterial.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_GI_MATERIAL_H
9#define META_OCEAN_RENDERING_GI_MATERIAL_H
10
13
15
16namespace Ocean
17{
18
19namespace Rendering
20{
21
22namespace GlobalIllumination
23{
24
25/**
26 * This class implements a Global Illumination material object.
27 * @see Material
28 * @ingroup renderingi
29 */
30class OCEAN_RENDERING_GI_EXPORT GIMaterial :
31 virtual public GIAttribute,
32 virtual public Material
33{
34 friend class GIFactory;
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 * Returns the reflectivity factor of this material with range [0.0, 1.0].
76 * @see Material::reflectivity().
77 */
78 float reflectivity() const override;
79
80 /**
81 * Returns the index of refraction of this material with range [0.0, 1.0].
82 * @see Material::refractionIndex().
83 */
84 float refractionIndex() const override;
85
86 /**
87 * Gets all color values of the material at once.
88 * @see Material::get().
89 */
90 void get(RGBAColor& ambient, RGBAColor& diffuse, RGBAColor& emissive, RGBAColor& specular, float& specularExponent, float& transparency) override;
91
92 /**
93 * Returns the ambient color of this material.
94 * @see ambientColor().
95 */
96 inline const RGBAColor& ambientColorInline() const;
97
98 /**
99 * Returns the diffuse color of this material.
100 * @see diffuseColor().
101 */
102 inline const RGBAColor& diffuseColorInline() const;
103
104 /**
105 * Returns the emissive color of this material.
106 * @see emissiveColor().
107 */
108 inline const RGBAColor& emissiveColorInline() const;
109
110 /**
111 * Returns the specular color of this material.
112 * @see specularColor().
113 */
114 inline const RGBAColor& specularColorInline() const;
115
116 /**
117 * Returns the specular exponent of this material.
118 * @see specularExponent().
119 */
120 inline float specularExponentInline() const;
121
122 /**
123 * Returns the transparency factor of this material with range [0.0, 1.0]
124 * @see transparency().
125 */
126 inline float transparencyInline() const;
127
128 /**
129 * Returns the reflectivity factor of this material with range [0.0, 1.0].
130 * @see reflectivity().
131 */
132 inline float reflectivityInline() const;
133
134 /**
135 * Returns the index of refraction of this material with range [0.0, 1.0].
136 * @see refractionIndex().
137 */
138 inline float refractionIndexInline() const;
139
140 /**
141 * Sets the ambient color of the material.
142 * @see Material::setAmbientColor().
143 */
144 bool setAmbientColor(const RGBAColor& color) override;
145
146 /**
147 * Sets the diffuse color of the material.
148 * @see Material::setDiffuseColor().
149 */
150 bool setDiffuseColor(const RGBAColor& color) override;
151
152 /**
153 * Sets the emissive color of the material.
154 * @see Material::setEmissiveColor().
155 */
156 bool setEmissiveColor(const RGBAColor& color) override;
157
158 /**
159 * Sets the specular color of the material.
160 * @see Material::setSpecularColor().
161 */
162 bool setSpecularColor(const RGBAColor& color) override;
163
164 /**
165 * Sets the specular exponent of this material.
166 * @see Material::setSpecularExponent().
167 */
168 bool setSpecularExponent(const float specularExponent) override;
169
170 /**
171 * Sets the specular exponent of this material.
172 * @see Material::setTransparency().
173 */
174 bool setTransparency(const float transparency) override;
175
176 /**
177 * Sets the reflectivity of this material.
178 * @see Material::setReflectivity().
179 */
180 bool setReflectivity(const float reflectivity) override;
181
182 /**
183 * Sets the index of refraction of this material.
184 * @see Material::setRefractionIndex().
185 */
186 bool setRefractionIndex(const float index) override;
187
188 /**
189 * Sets the transparency of the material.
190 * @see Material::set().
191 */
192 bool set(const RGBAColor& ambient, const RGBAColor& diffuse, const RGBAColor& emissive, const RGBAColor& specular, const float specularExponent, const float transparency) override;
193
194 protected:
195
196 /**
197 * Creates a new Global Illumination material object.
198 */
200
201 /**
202 * Destructs a Global Illumination material object.
203 */
204 ~GIMaterial() override;
205
206 protected:
207
208 /// Ambient color.
210
211 /// Diffuse color.
213
214 /// Emissive color.
216
217 /// Specular color.
219
220 /// Specular exponent.
222
223 /// Transparency value.
225
226 /// Specular exponent.
228
229 /// Transparency value.
231};
232
234{
236}
237
239{
241}
242
244{
246}
247
249{
251}
252
254{
256}
257
259{
261}
262
264{
266}
267
269{
271}
272
273}
274
275}
276
277}
278
279#endif // META_OCEAN_RENDERING_GI_MATERIAL_H
This class implements a color defined by red, green, blue and alpha parameters.
Definition RGBAColor.h:41
This class wraps a Global Illumination attribute object.
Definition GIAttribute.h:35
This class implements a class factory for all Global Illumination objects.
Definition GIFactory.h:30
This class implements a Global Illumination material object.
Definition GIMaterial.h:33
GIMaterial()
Creates a new Global Illumination material object.
const RGBAColor & diffuseColorInline() const
Returns the diffuse color of this material.
Definition GIMaterial.h:238
float transparency() const override
Returns the transparency factor of this material with range [0.0, 1.0].
~GIMaterial() override
Destructs a Global Illumination material object.
float reflectivity() const override
Returns the reflectivity factor of this material with range [0.0, 1.0].
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 material.
RGBAColor emissiveColor() const override
Returns the emissive color of this material.
bool setAmbientColor(const RGBAColor &color) override
Sets the ambient color of the material.
float refractionIndexInline() const
Returns the index of refraction of this material with range [0.0, 1.0].
Definition GIMaterial.h:268
float materialReflectivity
Specular exponent.
Definition GIMaterial.h:227
bool setReflectivity(const float reflectivity) override
Sets the reflectivity of this material.
RGBAColor ambientColor() const override
Returns the ambient color of this material.
float specularExponentInline() const
Returns the specular exponent of this material.
Definition GIMaterial.h:253
float reflectivityInline() const
Returns the reflectivity factor of this material with range [0.0, 1.0].
Definition GIMaterial.h:263
float refractionIndex() const override
Returns the index of refraction of this material with range [0.0, 1.0].
float specularExponent() const override
Returns the specular exponent of this material.
float transparencyInline() const
Returns the transparency factor of this material with range [0.0, 1.0].
Definition GIMaterial.h:258
bool setRefractionIndex(const float index) override
Sets the index of refraction of this material.
bool setDiffuseColor(const RGBAColor &color) override
Sets the diffuse color of the material.
bool setTransparency(const float transparency) override
Sets the specular exponent of this material.
RGBAColor specularColor() const override
Returns the specular color of this material.
RGBAColor materialDiffuseColor
Diffuse color.
Definition GIMaterial.h:212
RGBAColor materialEmissiveColor
Emissive color.
Definition GIMaterial.h:215
float materialSpecularExponent
Specular exponent.
Definition GIMaterial.h:221
const RGBAColor & ambientColorInline() const
Returns the ambient color of this material.
Definition GIMaterial.h:233
float materialTransparency
Transparency value.
Definition GIMaterial.h:224
RGBAColor materialSpecularColor
Specular color.
Definition GIMaterial.h:218
RGBAColor diffuseColor() const override
Returns the diffuse color of this material.
RGBAColor materialAmbientColor
Ambient color.
Definition GIMaterial.h:209
bool setSpecularColor(const RGBAColor &color) override
Sets the specular color of the material.
bool setSpecularExponent(const float specularExponent) override
Sets the specular exponent of this material.
void get(RGBAColor &ambient, RGBAColor &diffuse, RGBAColor &emissive, RGBAColor &specular, float &specularExponent, float &transparency) override
Gets all color values of the material at once.
bool setEmissiveColor(const RGBAColor &color) override
Sets the emissive color of the material.
const RGBAColor & specularColorInline() const
Returns the specular color of this material.
Definition GIMaterial.h:248
float materialRefractionIndex
Transparency value.
Definition GIMaterial.h:230
const RGBAColor & emissiveColorInline() const
Returns the emissive color of this material.
Definition GIMaterial.h:243
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