Merge "Print line numbers with shader source."
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / light-actor-impl.h
1 #ifndef __DALI_INTERNAL_LIGHT_ACTOR_H__
2 #define __DALI_INTERNAL_LIGHT_ACTOR_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 // INTERNAL INCLUDES
21 #include <dali/public-api/actors/light-actor.h>
22 #include <dali/internal/event/actors/actor-impl.h>
23 #include <dali/internal/event/actor-attachments/light-attachment-impl.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 /**
32  * An actor with a conveniently pre-attached LightAttachment.
33  * This is the simplest way to add lighting.
34  */
35 class LightActor : public Actor
36 {
37 public:
38
39   /**
40    * Create an initialised light actor.
41    * @return A smart-pointer to a newly allocated light actor.
42    */
43   static LightActorPtr New();
44
45   /**
46    * @copydoc Dali::Internal::Actor::OnInitialize
47    */
48   void OnInitialize();
49
50   /**
51    * @copydoc Dali::LightActor::SetLight
52    */
53   void SetLight(Dali::Light light);
54
55   /**
56    * @copydoc Dali::LightActor::GetLight
57    */
58   Dali::Light GetLight() const;
59
60   /**
61    * @copydoc Dali::LightActor::SetActive
62    */
63   void SetActive(bool active);
64
65   /**
66    * @copydoc Dali::LightActor::GetActive
67    */
68   bool GetActive();
69
70 public: // Default property extensions from ProxyObject
71   /**
72    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
73    */
74   virtual unsigned int GetDefaultPropertyCount() const;
75
76   /**
77    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
78    */
79   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
80
81   /**
82    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
83    */
84   virtual const std::string& GetDefaultPropertyName(Property::Index index) const;
85
86   /**
87    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
88    */
89   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
90
91   /**
92    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
93    */
94   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
95
96   /**
97    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
98    */
99   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
100
101   /**
102    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
103    */
104   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
105
106   /**
107    * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
108    */
109   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
110
111   /**
112    * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
113    */
114   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
115
116 protected:
117
118   /**
119    * Protected constructor; see also LightActor::New()
120    */
121   LightActor();
122
123   /**
124    * A reference counted object may only be deleted by calling Unreference()
125    */
126   virtual ~LightActor();
127
128 private:
129
130   LightAttachmentPtr mLightAttachment;
131   bool mIsActive;
132   static bool mFirstInstance ;
133   static DefaultPropertyLookup* mDefaultLightActorPropertyLookup; ///< Default properties
134 };
135
136 } // namespace Internal
137
138 // Helpers for public-api forwarding methods
139
140 inline Internal::LightActor& GetImplementation(Dali::LightActor& light)
141 {
142   DALI_ASSERT_ALWAYS( light && "LightActor handle is empty" );
143
144   BaseObject& handle = light.GetBaseObject();
145
146   return static_cast<Internal::LightActor&>(handle);
147 }
148
149 inline const Internal::LightActor& GetImplementation(const Dali::LightActor& light)
150 {
151   DALI_ASSERT_ALWAYS( light && "LightActor handle is empty" );
152
153   const BaseObject& handle = light.GetBaseObject();
154
155   return static_cast<const Internal::LightActor&>(handle);
156 }
157
158 } // namespace Dali
159
160 #endif // __DALI_INTERNAL_LIGHT_ACTOR_H__