2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUiEffects_RendererDirectionalLight.h
19 * @brief This is the header file for the DirectionalLight class
22 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_DIRECTIONALLIGHT_H_
23 #define _FUI_EFFECTS_INTERNAL_RENDERER_DIRECTIONALLIGHT_H_
25 #include <FBaseSysLog.h>
27 #include <renderer/engine-model/FUiEffects_RendererEngineModelIntPropertyHolder.h>
28 #include <renderer/engine-model/FUiEffects_RendererEngineModelVector3fPropertyHolder.h>
29 #include <utils/FUiEffects_Utils.h>
31 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer
35 * @class DirectionalLight
36 * @brief This class contains data for directional light in scene
39 class DirectionalLight
46 * @remark Sets default values for members
48 DirectionalLight(void)
50 result r = GetLastResult();
51 SysTryReturnVoidResult(NID_UI_EFFECT, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
53 __direction = EngineModel::Vector3fPropertyHolderPtr(new (std::nothrow) EngineModel::Vector3fPropertyHolder);
54 __colorI = EngineModel::Vector3fPropertyHolderPtr(new (std::nothrow) EngineModel::Vector3fPropertyHolder);
57 SysTryReturnVoidResult(NID_UI_EFFECT, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
58 SysTryReturnVoidResult(NID_UI_EFFECT, System::GetImpl(__direction) != null, E_OUT_OF_MEMORY, _UiEffectError::OUT_OF_MEMORY);
59 SysTryReturnVoidResult(NID_UI_EFFECT, System::GetImpl(__colorI) != null, E_OUT_OF_MEMORY, _UiEffectError::OUT_OF_MEMORY);
61 __direction->Set(Math::Vector3f(0.f, 0.f, -1.f));
62 __color.set(1.f, 0.f, 0.f);
70 * Sets direction vector property
72 * @param [in] direction New direction vector
76 void SetDirection(const Tizen::Ui::Effects::_Utils::Vec3f& direction)
78 __direction->Set(Math::Vector3f(direction.x, direction.y, direction.z).Normalize());
86 * @param [in] color New color value
90 void SetColor(const Tizen::Ui::Effects::_Utils::Vec3f& color)
99 * Sets intensity property
101 * @param [in] intensity New intensity value
105 void SetIntensity(float intensity)
107 __intensity = intensity;
116 * @param [in] enabled New enabled value
120 void SetEnabled(bool enabled)
128 * Gets direction vector property
130 * @return direction vector property
132 EngineModel::Vector3fPropertyHolderPtr GetDirectionHolder(void) const
138 * Gets color*intensity value property
140 * @return color*intensity value property
142 EngineModel::Vector3fPropertyHolderPtr GetColorIHolder(void) const
150 * @return enabled value
152 bool GetEnabled(void) const
160 * Hidden copy constructor
162 DirectionalLight(const DirectionalLight &rhs);
166 * Hidden assignment operator
168 DirectionalLight& operator=(const DirectionalLight &rhs);
171 * Sets colorI property which is premultiplied color x intensity for use in shader
175 void UpdateColorI(void)
177 __colorI->Set(__color.x * __intensity, __color.y * __intensity, __color.z * __intensity);
183 _Utils::Vec3f __color;
187 EngineModel::Vector3fPropertyHolderPtr __direction;
188 EngineModel::Vector3fPropertyHolderPtr __colorI; /**< __color x __intensity */
189 }; // DirectionalLight
191 typedef System::SmartPtr<DirectionalLight> DirectionalLightPtr;
193 } } } } // Tizen::Ui::Effects::_EffectRenderer
195 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_DIRECTIONALLIGHT_H_