License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / dali / internal / event / actor-attachments / light-attachment-impl.h
1 #ifndef __DALI_INTERNAL_LIGHT_ATTACHMENT_H__
2 #define __DALI_INTERNAL_LIGHT_ATTACHMENT_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/actor-attachments/actor-attachment-impl.h>
23 #include <dali/internal/event/actor-attachments/actor-attachment-declarations.h>
24 #include <dali/internal/event/modeling/light-impl.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class Light;
33
34 namespace SceneGraph
35 {
36 class LightAttachment;
37 class Node;
38 }
39
40 /**
41  * An attachment for managing the properties of a light in the scene
42  */
43 class LightAttachment : public ActorAttachment
44 {
45 public:
46   /**
47    * Create an initialised LightAttachment.
48    * @return A handle to a newly allocated Dali resource.
49    */
50   static LightAttachmentPtr New( const SceneGraph::Node& parentNode );
51
52   /**
53    * Set the local properties of the light
54    * The light properties are copied into this attachment
55    * @param[in] light The light properties
56    */
57   void SetLight(Internal::LightPtr light);
58
59   /**
60    * Get the local properties of the light
61    * @return A copy of the light properties
62    */
63   Internal::LightPtr GetLight() const;
64
65   /**
66    * @copydoc Dali::Light::SetName
67    */
68   void SetName(const std::string& name);
69
70   /**
71    * @copydoc Dali::Light::GetName
72    */
73   const std::string& GetName() const;
74
75   /**
76    * @copydoc Dali::Light::SetType
77    */
78   void SetType(Dali::LightType type);
79
80   /**
81    * @copydoc Dali::Light::GetType
82    */
83   Dali::LightType GetType() const;
84
85   /**
86    * @copydoc Dali::Light::SetFallOff
87    */
88   void SetFallOff(const Vector2& fallOff);
89
90   /**
91    * @copydoc Dali::Light::GetFallOff
92    */
93   const Vector2& GetFallOff() const;
94
95   /**
96    * @copydoc Dali::Light::SetSpotAngle
97    */
98   void SetSpotAngle(const Vector2& angle);
99
100   /**
101    * @copydoc Dali::Light::GetSpotAngle
102    */
103   const Vector2& GetSpotAngle() const;
104
105   /**
106    * @copydoc Dali::Light::SetAmbientColor
107    */
108   void SetAmbientColor(const Vector3& color);
109
110   /**
111    * @copydoc Dali::Light::GetAmbientColor
112    */
113   const Vector3& GetAmbientColor() const;
114
115   /**
116    * @copydoc Dali::Light::SetDiffuseColor
117    */
118   void SetDiffuseColor(const Vector3& color);
119
120   /**
121    * @copydoc Dali::Light::GetDiffuseColor
122    */
123   const Vector3& GetDiffuseColor() const;
124
125   /**
126    * @copydoc Dali::Light::SetSpecularColor
127    */
128   void SetSpecularColor(const Vector3& color);
129
130   /**
131    * @copydoc Dali::Light::GetSpecularColor
132    */
133   const Vector3& GetSpecularColor() const;
134
135   /**
136    * @copydoc Dali::Light::SetDirection
137    */
138   void SetDirection(const Vector3& direction);
139
140   /**
141    * @copydoc Dali::Light::GetDirection
142    */
143   const Vector3& GetDirection() const;
144
145   /**
146    * @copydoc Dali::LightActor::SetActive
147    */
148   void SetActive(bool active);
149
150 private:
151
152   /**
153    * First stage construction of a LightAttachment.
154    * @param[in] stage Used to send messages to scene-graph.
155    */
156   LightAttachment( Stage& stage );
157
158   /**
159    * @copydoc Dali::Internal::ActorAttachment::OnStageConnection()
160    */
161   virtual void OnStageConnection();
162
163   /**
164    * @copydoc Dali::Internal::ActorAttachment::OnStageDisconnection()
165    */
166   virtual void OnStageDisconnection();
167
168 protected:
169
170   /**
171    * A reference counted object may only be deleted by calling Unreference()
172    */
173   virtual ~LightAttachment();
174
175 private:
176
177   const SceneGraph::LightAttachment* mSceneObject; ///< Not owned
178
179   Internal::LightPtr mCachedLight;              ///< A local cache of the light properties
180 };
181
182 } // namespace Internal
183
184 } // namespace Dali
185
186 #endif // __DALI_INTERNAL_LIGHT_ATTACHMENT_H__