Ocean
SkyBackground.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_SKY_BACKGROUND_H
9 #define META_OCEAN_RENDERING_SKY_BACKGROUND_H
10 
14 
15 #include "ocean/math/RGBAColor.h"
16 
17 namespace Ocean
18 {
19 
20 namespace Rendering
21 {
22 
23 // Forward declaration
24 class SkyBackground;
25 
26 /**
27  * Definition of a smart object reference holding a sky background.
28  * @see SmartObjectRef, SkyBackground.
29  * @ingroup rendering
30  */
32 
33 /**
34  * This class is the base class for all sky backgrounds.
35  * @ingroup rendering
36  */
37 class OCEAN_RENDERING_EXPORT SkyBackground : virtual public Background
38 {
39  public:
40 
41  /**
42  * Definition of a pair holding an angle and a color value.
43  * All angles must be defined as radian.
44  */
45  typedef std::pair<Scalar, RGBAColor> ColorPair;
46 
47  /**
48  * Definition of a vector holding color values.
49  */
50  typedef std::vector<ColorPair> ColorPairs;
51 
52  public:
53 
54  /**
55  * Returns the type of this object.
56  * @see Object::type().
57  */
58  ObjectType type() const override;
59 
60  /**
61  * Returns the sky angle and color pairs.
62  * If any color values are defined the first pair must specified the color for the zenith (angle 0).<br>
63  * The angle values are defined as radian with range [0, PI], 0 for the zenith, PI/2 for the standard horizon and PI for the nadir
64  * @return Color pairs
65  * @exception NotSupportedException Is thrown if this function is not supported
66  */
67  virtual ColorPairs skyColors() const;
68 
69  /**
70  * Returns the ground angle and color pairs.
71  * If any color values are defined the first pair must specified the color for the nadir (angle 0).<br>
72  * The angle values are defined as radian with range [0, PI/2], 0 for the nadir and PI/2 for the standard horizon
73  * @return Color pairs
74  * @exception NotSupportedException Is thrown if this function is not supported
75  */
76  virtual ColorPairs groundColors() const;
77 
78  /**
79  * Returns the front textures.
80  * @return Textures object used for the front plane
81  * @exception NotSupportedException Is thrown if this function is not supported
82  */
83  virtual TexturesRef frontTextures() const;
84 
85  /**
86  * Returns the back textures.
87  * @return Textures object used for the back plane
88  * @exception NotSupportedException Is thrown if this function is not supported
89  */
90  virtual TexturesRef backTextures() const;
91 
92  /**
93  * Returns the left textures.
94  * @return Textures object used for the left plane
95  * @exception NotSupportedException Is thrown if this function is not supported
96  */
97  virtual TexturesRef leftTextures() const;
98 
99  /**
100  * Returns the right textures.
101  * @return Textures object used for the right plane
102  * @exception NotSupportedException Is thrown if this function is not supported
103  */
104  virtual TexturesRef rightTextures() const;
105 
106  /**
107  * Returns the top textures.
108  * @return Textures object used for the top plane
109  * @exception NotSupportedException Is thrown if this function is not supported
110  */
111  virtual TexturesRef topTextures() const;
112 
113  /**
114  * Returns the bottom textures.
115  * @return Textures object used for the bottom plane
116  * @exception NotSupportedException Is thrown if this function is not supported
117  */
118  virtual TexturesRef bottomTextures() const;
119 
120  /**
121  * Sets the sky angle and color pairs for the sky background.
122  * If any color values are defined the first pair must specified the color for the zenith (angle 0).<br>
123  * The angle values are defined as radian with range [0, PI], 0 for the zenith, PI/2 for the standard horizon and PI for the nadir
124  * @param colors Sky color pairs to set
125  * @return True, if succeeded
126  * @exception NotSupportedException Is thrown if this function is not supported
127  */
128  virtual bool setSkyColors(const ColorPairs& colors);
129 
130  /**
131  * Returns the ground angle and color pairs.
132  * If any color values are defined the first pair must specified the color for the nadir (angle 0).<br>
133  * The angle values are defined as radian with range [0, PI/2], 0 for the nadir and PI/2 for the standard horizon
134  * @param colors Ground color pairs to set
135  * @return True, if succeeded
136  * @exception NotSupportedException Is thrown if this function is not supported
137  */
138  virtual bool setGroundColors(const ColorPairs& colors);
139 
140  /**
141  * Sets the textures for the front plane.
142  * @param textures Textures object to be used for the front plane
143  * @return True, if succeeded
144  * @exception NotSupportedException Is thrown if this function is not supported
145  */
146  virtual bool setFrontTextures(const TexturesRef& textures);
147 
148  /**
149  * Sets the textures for the back plane.
150  * @param textures Textures object to be used for the back plane
151  * @return True, if succeeded
152  * @exception NotSupportedException Is thrown if this function is not supported
153  */
154  virtual bool setBackTextures(const TexturesRef& textures);
155 
156  /**
157  * Sets the textures for the left plane.
158  * @param textures Textures object to be used for the left plane
159  * @return True, if succeeded
160  * @exception NotSupportedException Is thrown if this function is not supported
161  */
162  virtual bool setLeftTextures(const TexturesRef& textures);
163 
164  /**
165  * Sets the textures for the right plane.
166  * @param textures Textures object to be uesed for the right plane
167  * @return True, if succeeded
168  * @exception NotSupportedException Is thrown if this function is not supported
169  */
170  virtual bool setRightTextures(const TexturesRef& textures);
171 
172  /**
173  * Sets the textures for the top plane.
174  * @param textures Textures object to be used for the top plane
175  * @return True, if succeeded
176  * @exception NotSupportedException Is thrown if this function is not supported
177  */
178  virtual bool setTopTextures(const TexturesRef& textures);
179 
180  /**
181  * Sets the textures for the bottom plane.
182  * @param textures Textures object to be used for the bottom plane
183  * @return True, if succeeded
184  * @exception NotSupportedException Is thrown if this function is not supported
185  */
186  virtual bool setBottomTextures(const TexturesRef& textures);
187 
188  protected:
189 
190  /**
191  * Creates a new sky background object.
192  */
194 
195  /**
196  * Destructs a Sky background object.
197  */
198  ~SkyBackground() override;
199 };
200 
201 }
202 
203 }
204 
205 #endif // META_OCEAN_RENDERING_SKY_BACKGROUND_H
This class is the base class for all backgrounds.
Definition: rendering/Background.h:37
ObjectType
Definition of different object type.
Definition: Object.h:63
This class is the base class for all sky backgrounds.
Definition: SkyBackground.h:38
virtual ColorPairs groundColors() const
Returns the ground angle and color pairs.
virtual TexturesRef backTextures() const
Returns the back textures.
virtual bool setSkyColors(const ColorPairs &colors)
Sets the sky angle and color pairs for the sky background.
virtual bool setRightTextures(const TexturesRef &textures)
Sets the textures for the right plane.
ObjectType type() const override
Returns the type of this object.
virtual TexturesRef bottomTextures() const
Returns the bottom textures.
std::pair< Scalar, RGBAColor > ColorPair
Definition of a pair holding an angle and a color value.
Definition: SkyBackground.h:45
virtual bool setLeftTextures(const TexturesRef &textures)
Sets the textures for the left plane.
virtual ColorPairs skyColors() const
Returns the sky angle and color pairs.
virtual TexturesRef frontTextures() const
Returns the front textures.
virtual bool setGroundColors(const ColorPairs &colors)
Returns the ground angle and color pairs.
SkyBackground()
Creates a new sky background object.
virtual TexturesRef topTextures() const
Returns the top textures.
std::vector< ColorPair > ColorPairs
Definition of a vector holding color values.
Definition: SkyBackground.h:50
virtual bool setTopTextures(const TexturesRef &textures)
Sets the textures for the top plane.
virtual TexturesRef leftTextures() const
Returns the left textures.
~SkyBackground() override
Destructs a Sky background object.
virtual bool setBackTextures(const TexturesRef &textures)
Sets the textures for the back plane.
virtual bool setFrontTextures(const TexturesRef &textures)
Sets the textures for the front plane.
virtual TexturesRef rightTextures() const
Returns the right textures.
virtual bool setBottomTextures(const TexturesRef &textures)
Sets the textures for the bottom plane.
This class implements a smart rendering object reference.
Definition: rendering/ObjectRef.h:34
SmartObjectRef< SkyBackground > SkyBackgroundRef
Definition of a smart object reference holding a sky background.
Definition: SkyBackground.h:24
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15