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_RendererLightingParameters.h
19 * @brief This is the header file for the LightingParameters class
22 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_LIGHTINGPARAMETERS_H_
23 #define _FUI_EFFECTS_INTERNAL_RENDERER_LIGHTINGPARAMETERS_H_
25 #include <FBaseSysLog.h>
26 #include <FUiEffects_EffectErrorMessages.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 LightingParameters
36 * @brief This class contains data for ambient light in scene
39 class LightingParameters
46 * @remark Sets default values for members
48 LightingParameters(void)
50 result r = GetLastResult();
51 SysTryReturnVoidResult(NID_UI_EFFECT, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
53 __ambientColorI = EngineModel::Vector3fPropertyHolderPtr(new (std::nothrow) EngineModel::Vector3fPropertyHolder);
54 __attenuation = System::FloatPtr(new (std::nothrow) float);
57 SysTryReturnVoidResult(NID_UI_EFFECT, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
58 SysTryReturnVoidResult(NID_UI_EFFECT, System::GetImpl(__ambientColorI) != null, E_OUT_OF_MEMORY, _UiEffectError::OUT_OF_MEMORY);
59 SysTryReturnVoidResult(NID_UI_EFFECT, System::GetImpl(__attenuation) != null, E_OUT_OF_MEMORY, _UiEffectError::OUT_OF_MEMORY);
61 __ambientColor.set(1.f, 0.f, 0.f);
62 __ambientIntensity = 1.f;
63 *__attenuation = 0.08f;
65 UpdateAmbientColorI();
69 * Sets ambient color value
71 * @param [in] color New color ambient color value
75 void SetAmbientColor(const Tizen::Ui::Effects::_Utils::Vec3f& ambientColor)
77 __ambientColor = ambientColor;
78 UpdateAmbientColorI();
84 * Sets ambient intensity value
86 * @param [in] intensity New ambient intensity value
90 void SetAmbientIntensity(float ambientIntensity)
92 __ambientIntensity = ambientIntensity;
93 UpdateAmbientColorI();
98 void SetAttenuation(float attenuation)
100 *__attenuation = attenuation;
106 * Gets ambient color*intensity value property
108 * @return ambient color*intensity value property
110 EngineModel::Vector3fPropertyHolderPtr GetAmbientColorIHolder(void) const
112 return __ambientColorI;
115 System::FloatPtr GetAttenuation(void) const
117 return __attenuation;
123 * Hidden copy constructor
125 LightingParameters(const LightingParameters &rhs);
129 * Hidden assignment operator
131 LightingParameters& operator=(const LightingParameters &rhs);
134 * Sets ambient colorI property which is premultiplied color x intensity for use in shader
138 void UpdateAmbientColorI(void)
140 __ambientColorI->Set(__ambientColor.x * __ambientIntensity, __ambientColor.y * __ambientIntensity, __ambientColor.z * __ambientIntensity);
146 _Utils::Vec3f __ambientColor;
147 float __ambientIntensity;
149 EngineModel::Vector3fPropertyHolderPtr __ambientColorI; /**< __ambientColor * __ambientIntensity */
150 System::FloatPtr __attenuation;
151 }; // LightingParameters
153 typedef System::SmartPtr<LightingParameters> LightingParametersPtr;
155 } } } } // Tizen::Ui::Effects::_EffectRenderer
157 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_LIGHTINGPARAMETERS_H_