Updated non-capi public API documentation to new style.
[platform/core/uifw/dali-core.git] / dali / public-api / common / light.h
1 #ifndef __DALI_LIGHT_H__
2 #define __DALI_LIGHT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // EXTERNAL INCLUDES
21 #include <string>
22
23 // INTERNAL INCLUDES
24 #include <dali/public-api/object/base-handle.h>
25
26
27 /**
28  * The top level DALi namespace
29  */
30 namespace Dali DALI_IMPORT_API
31 {
32
33 namespace Internal DALI_INTERNAL
34 {
35 class Light;
36 }
37
38 class Light;
39
40 /**
41  * @brief Light source types.
42  */
43 enum LightType
44 {
45   AMBIENT,        ///< Lights everything evenly
46   DIRECTIONAL,    ///< Casts light evenly in a specific direction.
47   SPOT,           ///< Casts light from a single point in the shape of a cone. Objects outside the cone are unlit. (EG: a search light)
48   POINT           ///< Casts light outward from a single point in all directions. (EG: a light bulb)
49 };
50
51 /**
52  * @brief Encapsulates the data describing a light source.
53  */
54 class Light : public BaseHandle
55 {
56 public:
57   /**
58    * @brief Create an initialized Light.
59    *
60    * @param[in] name The light's name
61    * @return A handle to a newly allocated Dali resource.
62    */
63   static Light New(const std::string& name);
64
65   /**
66    * @brief Downcast an Object handle to Light handle.
67    *
68    * If handle points to a Light object the downcast produces valid
69    * handle. If not the returned handle is left uninitialized.
70    * @param[in] handle to An object
71    * @return handle to a Light object or an uninitialized handle
72    */
73   static Light DownCast( BaseHandle handle );
74
75   /**
76    * @brief Create an uninitialized light; this can be initialized with Light::New().
77    *
78    * Calling member functions with an uninitialized Dali::Object is not allowed.
79    */
80   Light()
81   {
82   }
83
84   /**
85    * @brief Virtual destructor.
86    */
87   virtual ~Light();
88
89   /**
90    * @copydoc Dali::BaseHandle::operator=
91    */
92   using BaseHandle::operator=;
93
94   /**
95    * @brief Set the light's name.
96    *
97    * @param[in] name The light's name
98    */
99   void SetName(const std::string& name);
100
101   /**
102    * @brief Get the light's name.
103    *
104    * @return The light's name
105    */
106   const std::string& GetName() const;
107
108   /**
109    * @brief Set the light's type.
110    *
111    * @param[in] type The type of light
112    */
113   void SetType(LightType type);
114
115   /**
116    * @brief Get the lights type.
117    *
118    * @return The light's type
119    */
120   LightType GetType() const;
121
122   /**
123    * @brief Set the distances at which the light's intensity starts to fall off and reaches zero.
124    *
125    * @param[in] fallOff The fall off start and end. The start is in the x component and end is in the y component.
126    */
127   void SetFallOff(const Vector2& fallOff);
128
129   /**
130    * @brief Get the distances at which the light's intensity starts to fall off and reaches zero.
131    *
132    * @return The distances at which the light's intensity starts to fall off, and reaches zero.
133    * See @ref SetFallOff
134    */
135   const Vector2& GetFallOff() const;
136
137   /**
138    * @brief Set the spotlight's inner and outer cone angles.
139    *
140    * @param[in] angle The spotlight's inner and outer cone angles.
141    *                  The inner is in the x component and outer is in the y component.
142    */
143   void SetSpotAngle(const Vector2& angle);
144
145   /**
146    * @brief Get the spotlight's inner and outer cone angles.
147    *
148    * @return The spotlight's inner and outer cone angles
149    */
150   const Vector2& GetSpotAngle() const;
151
152   /**
153    * @brief Set the ambient color for the light.
154    *
155    * The color is composed of rgb
156    * @param[in] color The color to set.
157    */
158   void SetAmbientColor(const Vector3& color);
159
160   /**
161    * @brief Get the light's ambient color.
162    *
163    * @return the light's color as rgb
164    */
165   const Vector3& GetAmbientColor() const;
166
167   /**
168    * @brief Set the diffuse color for the light.
169    *
170    * The color is composed of rgb
171    * @param[in] color The color to set.
172    */
173   void SetDiffuseColor(const Vector3& color);
174
175   /**
176    * @brief Get the light's ambient color.
177    *
178    * @return the light's color as rgb
179    */
180   const Vector3& GetDiffuseColor() const;
181
182   /**
183    * @brief Set the specular color for the light.
184    *
185    * The color is composed of rgb
186    * @param[in] color The color to set.
187    */
188   void SetSpecularColor(const Vector3& color);
189
190   /**
191    * @brief Get the light's specular color.
192    *
193    * @return the light's specular color as rgb
194    */
195   const Vector3& GetSpecularColor() const;
196
197   /**
198    * @brief Set the direction in which the light's rays are cast.
199    *
200    * Valid when the light's type is DIRECTIONAL (see @ref Dali::LightType).
201    * @param [in] direction The direction in which the light's rays are cast.
202    */
203   void SetDirection(const Vector3& direction);
204
205   /**
206    * @brief Get the direction in which the light's rays are cast.
207    *
208    * Valid when the light's type is DIRECTIONAL (see @ref LightType).
209    * @return The direction in which the light's rays are cast.
210    */
211   const Vector3& GetDirection() const;
212
213 public: // Not intended for application developers
214
215   /**
216    * @brief This constructor is used by Dali New() methods.
217    *
218    * @param [in] light A pointer to a newly allocated Dali resource
219    */
220   explicit DALI_INTERNAL Light(Internal::Light* light);
221 };
222
223 } // namespace Dali
224
225 #endif // __DALI_LIGHT_H__