void SetType(LightType lightType);
/**
+ * Get light ambient.
+ *
+ * @since 3.0
+ *
+ * @return Ambient of the light.
+ * @see SetAmbient().
+ *
+ */
+ Tizen::Graphics::FloatVector4 GetAmbient(void) const;
+
+ /**
+ * Sets light ambient.
+ *
+ * @since 3.0
+ *
+ * @param[] ambient Ambient of the light.
+ * @see GetAmbient().
+ */
+ void SetAmbient(const Tizen::Graphics::FloatVector4& ambient);
+
+ /**
* Get light diffuse.
*
* @since 3.0
*
*/
Tizen::Graphics::FloatVector4 GetDiffuse(void) const;
+
/**
* Sets light diffuse color.
*
void SetSpecular(const Tizen::Graphics::FloatVector4& specular);
/**
- * Get light ambient.
- *
- * @since 3.0
- *
- * @return Ambient of the light.
- * @see SetAmbient().
- *
- */
- Tizen::Graphics::FloatVector4 GetAmbient(void) const;
-
- /**
- * Sets light ambient.
- *
- * @since 3.0
- *
- * @param[] ambient Ambient of the light.
- * @see GetAmbient().
- */
- void SetAmbient(const Tizen::Graphics::FloatVector4& ambient);
-
- /**
* Get light position.
*
* @since 3.0
* @see SetPosition().
*
*/
- Tizen::Graphics::FloatPoint3 GetPosition(void) const;
+ Tizen::Graphics::FloatVector4 GetPosition(void) const;
/**
* Sets light position.
* @param[] position Position of the light.
* @see GetPosition().
*/
- void SetPosition(const Tizen::Graphics::FloatPoint3& position);
+ void SetPosition(const Tizen::Graphics::FloatVector4& position);
/**
* Get light direction.
*
*/
float GetQuadraticAttenuation(void) const;
+
/**
* Sets light quadratic attenuation.
*
*/
void SetEnabled(bool enabled);
+
+/////
+
/**
* Sets light color.
*
* @see GetColor().
*/
void SetColor(const Tizen::Graphics::FloatPoint3& color);
+
/**
* Get light color.
*
float GetSpotlightRaduis(void) const;
private:
-
class _LightImpl* __pLightImpl;
+
friend class _LightImpl;
};
namespace Tizen { namespace Ui { namespace Animations
{
-
Light::Light(void)
: __pLightImpl(null)
{
__pLightImpl = light.__pLightImpl;
- if(__pLightImpl != null)
+ if (__pLightImpl != null)
{
__pLightImpl->AddRef();
}
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- return __pLightImpl->GetLightType();
+ return __pLightImpl->GetType();
}
void
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- __pLightImpl->SetLightType(lightType);
+ __pLightImpl->SetType(lightType);
}
Tizen::Graphics::FloatVector4
-Light::GetDiffuse(void) const
+Light::GetAmbient(void) const
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector4 coroEx = __pLightImpl->GetDiffuse().GetVector4();
- Tizen::Graphics::FloatVector4 floatVec4(coroEx.x, coroEx.y, coroEx.z, coroEx.w);
- return floatVec4;
+ float* pAmbient = __pLightImpl->GetAmbient();
+
+ return Tizen::Graphics::FloatVector4(pAmbient[0], pAmbient[1], pAmbient[2], pAmbient[3]);
}
void
-Light::SetDiffuse(const Tizen::Graphics::FloatVector4& diffuse)
+Light::SetAmbient(const Tizen::Graphics::FloatVector4& ambient)
{
+ float color[4];
+
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector4 colorEx(diffuse.x, diffuse.y, diffuse.z, diffuse.w);
- __pLightImpl->SetDiffuse(colorEx);
+ color[0] = ambient.x;
+ color[1] = ambient.y;
+ color[2] = ambient.z;
+ color[3] = ambient.w;
+
+ __pLightImpl->SetAmbient(color);
}
Tizen::Graphics::FloatVector4
-Light::GetSpecular(void) const
+Light::GetDiffuse(void) const
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector4 coroEx = __pLightImpl->GetSpecular().GetVector4();
- Tizen::Graphics::FloatVector4 floatVec4(coroEx.x, coroEx.y, coroEx.z, coroEx.w);
- return floatVec4;
+ float* pDiffuse = __pLightImpl->GetDiffuse();
+
+ return Tizen::Graphics::FloatVector4(pDiffuse[0], pDiffuse[1], pDiffuse[2], pDiffuse[3]);
}
void
-Light::SetSpecular(const Tizen::Graphics::FloatVector4& specular)
+Light::SetDiffuse(const Tizen::Graphics::FloatVector4& diffuse)
{
+ float color[4];
+
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector4 colorEx(specular.x, specular.y, specular.z, specular.w);
- __pLightImpl->SetSpecular(colorEx);
+ color[0] = diffuse.x;
+ color[1] = diffuse.y;
+ color[2] = diffuse.z;
+ color[3] = diffuse.w;
+ __pLightImpl->SetDiffuse(color);
}
Tizen::Graphics::FloatVector4
-Light::GetAmbient(void) const
+Light::GetSpecular(void) const
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector4 coroEx = __pLightImpl->GetAmbient().GetVector4();
- Tizen::Graphics::FloatVector4 floatVec4(coroEx.x, coroEx.y, coroEx.z, coroEx.w);
- return floatVec4;
+ float* pSpecular = __pLightImpl->GetSpecular();
+
+ return Tizen::Graphics::FloatVector4(pSpecular[0], pSpecular[1], pSpecular[2], pSpecular[3]);
}
void
-Light::SetAmbient(const Tizen::Graphics::FloatVector4& ambient)
+Light::SetSpecular(const Tizen::Graphics::FloatVector4& specular)
{
+ float color[4];
+
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector4 colorEx(ambient.x, ambient.y, ambient.z, ambient.w);
- __pLightImpl->SetAmbient(colorEx);
+ color[0] = specular.x;
+ color[1] = specular.y;
+ color[2] = specular.z;
+ color[3] = specular.w;
+ __pLightImpl->SetSpecular(color);
}
-Tizen::Graphics::FloatPoint3
+Tizen::Graphics::FloatVector4
Light::GetPosition(void) const
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector3 position = __pLightImpl->GetPosition();
- Tizen::Graphics::FloatPoint3 floatPointPos(position.x, position.y, position.z);
- return floatPointPos;
+ float* pPosition = __pLightImpl->GetPosition();
+
+ return Tizen::Graphics::FloatVector4(pPosition[0], pPosition[1], pPosition[2], pPosition[3]);
}
void
-Light::SetPosition(const Tizen::Graphics::FloatPoint3& position)
+Light::SetPosition(const Tizen::Graphics::FloatVector4& position)
{
+ float newPosition[4];
+
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector3 positionVec3(position.x, position.y, position.z);
- __pLightImpl->SetPosition(positionVec3);
+ newPosition[0] = position.x;
+ newPosition[1] = position.y;
+ newPosition[2] = position.z;
+ newPosition[3] = position.w;
+
+ __pLightImpl->SetPosition(newPosition);
}
Tizen::Graphics::FloatPoint3
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector3 direction = __pLightImpl->GetDirection();
- Tizen::Graphics::FloatPoint3 floatPointDirection(direction.x, direction.y, direction.z);
+ float* pDirection = __pLightImpl->GetDirection();
- return floatPointDirection;//__pLightImpl->GetDirection();
+ return Tizen::Graphics::FloatPoint3(pDirection[0], pDirection[1], pDirection[2]);
}
void
Light::SetDirection(const Tizen::Graphics::FloatPoint3& direction)
{
+ float newDirection[3];
+
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- Vector3 directionVec3(direction.x, direction.y, direction.z);
- __pLightImpl->SetDirection(directionVec3);
+ newDirection[0] = direction.x;
+ newDirection[1] = direction.y;
+ newDirection[2] = direction.z;
+
+ __pLightImpl->SetDirection(newDirection);
}
-//TODO SpotExponent == Exponent?
float
Light::GetExponent(void) const
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- return __pLightImpl->GetSpotExponent();
+ return __pLightImpl->GetExponent();
}
-//TODO SpotExponent == Exponent?
void
Light::SetExponent(float exponent)
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- __pLightImpl->SetSpotExponent(exponent);
+ __pLightImpl->SetExponent(exponent);
}
float
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- return Tizen::Base::String(__pLightImpl->GetName().c_str());
+ return __pLightImpl->GetName();
}
result
{
SysAssertf(__pLightImpl != null, "Not yet constructed.");
- std::wstring wName(name.GetPointer());
- std::string sName(wName.begin(), wName.end());
- __pLightImpl->SetName(sName);
-
- //TODO result
- return E_SUCCESS;
+ return __pLightImpl->SetName(name);
}
bool
__pLightImpl->SetEnabled(enabled);
}
+//////
void
Light::SetColor(const Tizen::Graphics::FloatPoint3& color)
VisualElementSurface::~VisualElementSurface(void)
{
- CHECK_CONSTRUCTED;
-
- if (__pVisualElementSurfaceImpl->Release())
+ if (__pVisualElementSurfaceImpl && __pVisualElementSurfaceImpl->Release())
{
__pVisualElementSurfaceImpl = null;
}
}
}
- if (pNode->__pLight || pNode->__pMaterial)
+ // TODO: check
+ if (pNode->__pLight && pNode->__pLight->IsEnabled())
{
__pLight = pNode->__pLight;
- __pMaterial = pNode->__pMaterial;
__pProgram = _GlRenderManager::GetInstance()->__pLightShader;
}
+ if (pNode->__pMaterial)
+ {
+ __pMaterial = pNode->__pMaterial;
+ }
+
if (pNode->__pShaderProgram != null)
{
__pProgram = pNode->__pShaderProgram;
__pGlContext->UseShaderProgram(__pRenderQueue[i].__pProgram);
// Set uniform
- // TODO: need to check location -1?
glUniformMatrix4fv(__pRenderQueue[i].__uMVP, 1, GL_FALSE, __pRenderQueue[i].__mvp.GetItems());
glUniform1f(__pRenderQueue[i].__uOpacity, __pRenderQueue[i].__opacity);
glUniform4f(__pRenderQueue[i].__uColor, __pRenderQueue[i].__objectColor.Red(), __pRenderQueue[i].__objectColor.Green(),
glUniformMatrix4fv(pProgramImpl->__uniformLocation[UNIFORM_MAT4_INV_MODEL_VIEW], 1, GL_FALSE, __pRenderQueue[i].__invModelview.GetItems());
// Set attribute
- // TODO: need to check location -1?
glVertexAttribPointer(__pRenderQueue[i].__aPosition, 3, GL_FLOAT, GL_FALSE, VERTEX_BUFFER_STRIDE * sizeof(float), __pRenderQueue[i].__pVertices);
glVertexAttribPointer(__pRenderQueue[i].__aTexCoord, 2, GL_FLOAT, GL_FALSE, TEX_COORD_BUFFER_STRIDE * sizeof(float), __pRenderQueue[i].__pTexCoords);
glVertexAttribPointer(__pRenderQueue[i].__aColor, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), __pRenderQueue[i].__pColors);
{
_LightImpl* pLightImpl = _LightImpl::GetInstance(*__pRenderQueue[i].__pLight);
- _Math::Vector3 attenuation;
- attenuation.x = pLightImpl->GetConstantAttenuation();
- attenuation.y = pLightImpl->GetLinearAttenuation();
- attenuation.z = pLightImpl->GetQuadraticAttenuation();
-
- // TODO: light & material class data type
- glUniform1i(pProgramImpl->__uniformLocation[UNIFORM_INT_LIGHT_TYPE], pLightImpl->GetLightType());
- glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_AMBIENT], 1, pLightImpl->GetAmbient().GetVector4().GetPointer());
- glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_DIFFUSE], 1, pLightImpl->GetDiffuse().GetVector4().GetPointer());
- glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_SPECULAR], 1, pLightImpl->GetSpecular().GetVector4().GetPointer());
- glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_POSITION], 1, pLightImpl->GetPosition().GetPointer());
- glUniform3fv(pProgramImpl->__uniformLocation[UNIFORM_VEC3_LIGHT_DIRECTION], 1, pLightImpl->GetDirection().GetPointer());
- glUniform1f(pProgramImpl->__uniformLocation[UNIFORM_FLOAT_LIGHT_EXPONENT], pLightImpl->GetSpotExponent());
+ glUniform1i(pProgramImpl->__uniformLocation[UNIFORM_INT_LIGHT_TYPE], pLightImpl->GetType());
+ glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_AMBIENT], 1, pLightImpl->GetAmbient());
+ glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_DIFFUSE], 1, pLightImpl->GetDiffuse());
+ glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_SPECULAR], 1, pLightImpl->GetSpecular());
+ glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_LIGHT_POSITION], 1, pLightImpl->GetPosition());
+ glUniform3fv(pProgramImpl->__uniformLocation[UNIFORM_VEC3_LIGHT_DIRECTION], 1, pLightImpl->GetDirection());
+ glUniform1f(pProgramImpl->__uniformLocation[UNIFORM_FLOAT_LIGHT_EXPONENT], pLightImpl->GetExponent());
glUniform1f(pProgramImpl->__uniformLocation[UNIFORM_FLOAT_LIGHT_CUTOFF], pLightImpl->GetCutOff());
- glUniform3fv(pProgramImpl->__uniformLocation[UNIFORM_VEC3_LIGHT_ATTENUATION], 1, attenuation.GetPointer());
+ glUniform3fv(pProgramImpl->__uniformLocation[UNIFORM_VEC3_LIGHT_ATTENUATION], 1, pLightImpl->GetAttenuations());
}
if (__pRenderQueue[i].__pMaterial)
////////////////////////////////////////////////////////////////////////////////////////////////////
_LightImpl::_LightImpl(void)
-// : Attachable(name)
- : __name("")
- , __lightType(Light::LIGHT_TYPE_DIRECTIONAL)
+ : __lightType(Light::LIGHT_TYPE_DIRECTIONAL)
+ , __exponent(0.0f)
+ , __cutOff(180.f)
+ , __enabled(true)
+ , __name("")
, __color(ColorEx(255,255,255,255))
- , __ambient(ColorEx(150,150,150,255))
- , __diffuse(ColorEx(255,255,255,255))
- , __specular(ColorEx(100,100,100,255))
-
, __intensity(1.0f)
- , __spotExponent(20.0f)
- , __cutOff(0.f)
- , __constantAttenuation(0.1f)
- , __linearAttenuation(0.05f)
- , __quadraticAttenuation(0.025f)
-
, __radius(5.0f)
, __spotlightRadius(5.0f)
- , __position(Vector3())
- , __direction(Vector3())
- , __enabled(true)
{
+ __ambient[0] = 0.0f; __ambient[1] = 0.0f; __ambient[2] = 0.0f; __ambient[3] = 1.0f;
+ __diffuse[0] = 1.0f; __diffuse[1] = 1.0f; __diffuse[2] = 1.0f; __diffuse[3] = 1.0f;
+ __specular[0] = 1.0f; __specular[1] = 1.0f; __specular[2] = 1.0f; __specular[3] = 1.0f;
+ __position[0] = 0.0f; __position[1] = 0.0f; __position[2] = 1.0f; __position[3] = 0.0f;
+ __direction[0] = 0.0f; __direction[1] = 0.0f; __direction[2] = -1.0f;
+
+ __attenuation[0] = 1.0f; __attenuation[1] = 0.0f; __attenuation[2] = 0.0f;
}
_LightImpl::_LightImpl(const _LightImpl& src)
- : __name(src.__name)
- , __lightType(src.__lightType)
+ : __lightType(src.__lightType)
+ , __exponent(src.__exponent)
+ , __cutOff(src.__cutOff)
+ , __enabled(src.__enabled)
+ , __name(src.__name)
, __color(src.__color)
- , __ambient(src.__ambient)
- , __diffuse(src.__diffuse)
- , __specular(src.__specular)
-
, __intensity(src.__intensity)
- , __spotExponent(src.__spotExponent)
- , __cutOff(src.__cutOff)
- , __constantAttenuation(src.__constantAttenuation)
- , __linearAttenuation(src.__linearAttenuation)
- , __quadraticAttenuation(src.__quadraticAttenuation)
-
, __radius(src.__radius)
, __spotlightRadius(src.__spotlightRadius)
- , __position(src.__position)
- , __direction(src.__direction)
- , __enabled(src.__enabled)
{
+ memcpy(__ambient, src.__ambient, sizeof(__ambient));
+ memcpy(__diffuse, src.__diffuse, sizeof(__diffuse));
+ memcpy(__specular, src.__specular, sizeof(__specular));
+
+ memcpy(__position, src.__position, sizeof(__position));
+ memcpy(__direction, src.__direction, sizeof(__direction));
+
+ memcpy(__attenuation, src.__attenuation, sizeof(__attenuation));
}
_LightImpl::~_LightImpl(void)
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-void _LightImpl::SetLightType(Light::LightType lightType)
+void _LightImpl::SetType(Light::LightType lightType)
{
__lightType = lightType;
}
-//const AxisAlignedBox& _LightImpl::GetAABB()
-//{
-// static AxisAlignedBox box;
-// return box;
-//}
-
Light::LightType
-_LightImpl::GetLightType() const
+_LightImpl::GetType() const
{
return __lightType;
}
void
-_LightImpl::SetColor(const ColorEx& color)
+_LightImpl::SetAmbient(const float ambient[4])
{
- __color = color;
+ __ambient[0] = ambient[0];
+ __ambient[1] = ambient[1];
+ __ambient[2] = ambient[2];
+ __ambient[3] = ambient[3];
}
-void
-_LightImpl::SetColor(float r, float g, float b)
+float*
+_LightImpl::GetAmbient(void) const
{
- //TODO
- /*__Colour.setRGBA(r, g, b);*/
+ return (float*)__ambient;
}
-/**
- * Sets light color.
- *
- * @since 2.0
- *
- * @param[in] colour New light color.
- * @see GetColour().
- */
void
-_LightImpl::SetColor(unsigned int colour)
+_LightImpl::SetDiffuse(const float diffuse[4])
{
- //TODO
- /*__Colour.setRGBA(colour);*/
+ __diffuse[0] = diffuse[0];
+ __diffuse[1] = diffuse[1];
+ __diffuse[2] = diffuse[2];
+ __diffuse[3] = diffuse[3];
}
-ColorEx
-_LightImpl::GetColor(void) const
+float*
+_LightImpl::GetDiffuse(void) const
{
- return __color;
+ return (float*)__diffuse;
}
void
-_LightImpl::SetAmbient(const ColorEx& color)
+_LightImpl::SetSpecular(const float specular[4])
{
- __ambient = color;
+ __specular[0] = specular[0];
+ __specular[1] = specular[1];
+ __specular[2] = specular[2];
+ __specular[3] = specular[3];
}
-ColorEx
-_LightImpl::GetAmbient(void) const
+float*
+_LightImpl::GetSpecular(void) const
{
- return __ambient;
+ return (float*)__specular;
}
void
-_LightImpl::SetDiffuse(const ColorEx& color)
+_LightImpl::SetPosition(const float position[4])
{
- __diffuse = color;
+ __position[0] = position[0];
+ __position[1] = position[1];
+ __position[2] = position[2];
+ __position[3] = position[3];
}
-ColorEx
-_LightImpl::GetDiffuse(void) const
+float*
+_LightImpl::GetPosition(void) const
{
- return __diffuse;
+ return (float*)__position;
}
void
-_LightImpl::SetSpecular(const ColorEx& color)
+_LightImpl::SetDirection(const float direction[3])
{
- __specular = color;
+ __direction[0] = direction[0];
+ __direction[1] = direction[1];
+ __direction[2] = direction[2];
}
-ColorEx
-_LightImpl::GetSpecular(void) const
+float*
+_LightImpl::GetDirection(void) const
{
- return __specular;
+ return (float*)__direction;
}
void
-_LightImpl::SetIntensity(float intensity)
+_LightImpl::SetExponent(float exponent)
{
- __intensity = intensity;
+ __exponent = exponent;
}
float
-_LightImpl::GetIntensity(void) const
+_LightImpl::GetExponent(void) const
{
- return __intensity;
+ return __exponent;
}
void
-_LightImpl::SetSpotExponent(float exponent)
+_LightImpl::SetCutOff(float cutOff)
{
- __spotExponent = exponent;
+ __cutOff = cutOff;
}
float
-_LightImpl::GetSpotExponent(void) const
+_LightImpl::GetCutOff(void) const
{
- return __spotExponent;
+ return __cutOff;
}
void
_LightImpl::SetConstantAttenuation(float attenuation)
{
- __constantAttenuation = attenuation;
+ __attenuation[0] = attenuation;
}
float
_LightImpl::GetConstantAttenuation(void) const
{
- return __constantAttenuation;
+ return __attenuation[0];
}
void
_LightImpl::SetLinearAttenuation(float attenuation)
{
- __linearAttenuation = attenuation;
+ __attenuation[1] = attenuation;
}
float
_LightImpl::GetLinearAttenuation(void) const
{
- return __linearAttenuation;
+ return __attenuation[1];
}
void
_LightImpl::SetQuadraticAttenuation(float attenuation)
{
- __quadraticAttenuation = attenuation;
+ __attenuation[2] = attenuation;
}
float
_LightImpl::GetQuadraticAttenuation(void) const
{
- return __quadraticAttenuation;
+ return __attenuation[2];
}
-void
-_LightImpl::SetDirection(const Vector3& direction)
+float*
+_LightImpl::GetAttenuations(void) const
{
- __direction = direction;
+ return (float*)__attenuation;
}
-void
-_LightImpl::SetDirection(float x, float y, float z)
-{
- __direction = Vector3(x, y, z);
-}
-
-Vector3
-_LightImpl::GetDirection(void) const
+bool
+_LightImpl::IsEnabled(void) const
{
- return __direction;
+ return __enabled;
}
void
-_LightImpl::SetRadius(float radius)
+_LightImpl::SetEnabled(bool enabled)
{
- __radius = radius;
+ __enabled = enabled;
}
-float
-_LightImpl::GetRadius(void) const
+result
+_LightImpl::SetName(const Tizen::Base::String& name)
{
- return __radius;
+ __name = name;
+
+ return E_SUCCESS;
}
-void
-_LightImpl::SetPosition(const Vector3& pos)
+Base::String _LightImpl::GetName(void) const
{
- __position = pos;
+ return __name;
}
-void
-_LightImpl::SetPosition(float x, float y, float z)
+_LightImpl*
+_LightImpl::GetInstance(Light& light)
{
- __position = Vector3(x, y, z);
+ return light.__pLightImpl;
}
-Vector3
-_LightImpl::GetPosition(void)
+const _LightImpl*
+_LightImpl::GetInstance(const Light& light)
{
- return __position;
+ return light.__pLightImpl;
}
-float
-_LightImpl::GetCutOff(void) const
+
+//////
+
+void
+_LightImpl::SetColor(const ColorEx& color)
{
- return __cutOff;
+ __color = color;
}
void
-_LightImpl::SetCutOff(float cutOff)
+_LightImpl::SetColor(float r, float g, float b)
{
- __cutOff = cutOff;
+ //TODO
+ /*__Colour.setRGBA(r, g, b);*/
}
-
-_LightImpl*
-_LightImpl::GetInstance(Light& light)
+void
+_LightImpl::SetColor(unsigned int colour)
{
- return light.__pLightImpl;
+ //TODO
+ /*__Colour.setRGBA(colour);*/
}
-const _LightImpl*
-_LightImpl::GetInstance(const Light& light)
+ColorEx
+_LightImpl::GetColor(void) const
{
- return light.__pLightImpl;
+ return __color;
}
-bool
-_LightImpl::IsEnabled(void) const
+void
+_LightImpl::SetIntensity(float intensity)
{
- return __enabled;
+ __intensity = intensity;
}
-void
-_LightImpl::SetEnabled(bool enabled)
+float
+_LightImpl::GetIntensity(void) const
{
- __enabled = enabled;
+ return __intensity;
}
void
-_LightImpl::SetSpotlightRadius(float spotlightRadius)
+_LightImpl::SetRadius(float radius)
{
- __spotlightRadius = spotlightRadius;
+ __radius = radius;
}
float
-_LightImpl::GetSpotlightRaduis(void) const
+_LightImpl::GetRadius(void) const
{
- return __spotlightRadius;
+ return __radius;
}
void
-_LightImpl::SetName(const std::string& name)
+_LightImpl::SetSpotlightRadius(float spotlightRadius)
{
- __name = name;
+ __spotlightRadius = spotlightRadius;
}
-std::string
-_LightImpl::GetName(void) const
+float
+_LightImpl::GetSpotlightRaduis(void) const
{
- return __name;
+ return __spotlightRadius;
}
}}} // Tizen::Ui::Animations
//
/**
- * @file Light.h
- * @brief This is the header file for the %Light class.
- * @author Sergei Melikhov (s.melikhov@samsung.com)
+ * @file FUiAnim_LightImpl.h
+ * @brief This is the header file for the _LightImpl class.
*
- * This header file contains the declarations of the %Light class.
+ * This header file contains the declarations of the _LightImpl class.
*/
-#ifndef _LIGHTIMPL_H_
-#define _LIGHTIMPL_H_
+#ifndef _FUI_ANIM_INTERNAL_LIGHT_IMPL_H_
+#define _FUI_ANIM_INTERNAL_LIGHT_IMPL_H_
-#include <string>
-#include "math/FUiAnim_MathColor.h"
-#include "FUiAnim_MathVector3.h"
-//#include "scene/Attachable.h"
-//#include "scene/Renderable.h"
+#include <FBaseString.h>
#include "FUiAnimLight.h"
#include "FUiAnim_RefObject.h"
+
+#include "math/FUiAnim_MathColor.h"
+#include "FUiAnim_MathVector3.h"
+
+
namespace Tizen { namespace Ui { namespace Animations
{
-///
+
class _LightImpl
: public RefObject
-// : public Tizen::Ui::Animations::VisualScenes::_Scene::Attachable
{
public:
* @param[in] lightType New light type.
* @see GetLightType().
*/
- virtual void SetLightType(Tizen::Ui::Animations::Light::LightType lightType);
+ void SetType(Light::LightType lightType);
/**
* Gets light type.
* @return Light type.
* @see SetLightType().
*/
- Tizen::Ui::Animations::Light::LightType GetLightType() const;
-
- /**
- * Sets light color.
- *
- * @since 3.0
- *
- * @param[in] color New light color.
- * @see GetColor().
- */
- //TODO Do we need coloEx for light color?
- void SetColor(const _Math::ColorEx& color);
-
- /**
- * Sets light color.
- *
- * @since 3.0
- *
- * @param[in] r Color red component.
- * @param[in] g Color green component.
- * @param[in] b Color blue component.
- * @see GetColor().
- */
- void SetColor(float r, float g, float b);
-
- /**
- * Sets light color.
- *
- * @since 3.0
- *
- * @param[in] colour New light color.
- * @see GetColour().
- */
- void SetColor(unsigned int color);
-
- /**
- * Gets light color.
- *
- * @since 3.0
- *
- * @return Light color.
- * @see SetColour().
- */
- _Math::ColorEx GetColor(void) const;
+ Light::LightType GetType() const;
/**
* Sets light ambient color.
*
* @since 3.0
*
- * @param[in] color New light ambient color.
+ * @param[in] ambient New light ambient color.
* @see GetAmbient().
*/
- void SetAmbient(const _Math::ColorEx& color);
+ void SetAmbient(const float ambient[4]);
/**
* Gets light ambient.
* @return Light ambient.
* @see SetAmbient().
*/
- _Math::ColorEx GetAmbient(void) const;
+ float* GetAmbient(void) const;
/**
* Sets light diffuse color.
*
* @since 3.0
*
- * @param[in] color New light diffuse color.
+ * @param[in] diffuse New light diffuse color.
* @see GetDiffuse().
*/
- void SetDiffuse(const _Math::ColorEx& color);
+ void SetDiffuse(const float diffuse[4]);
/**
* Gets light diffuse.
* @return Light diffuse.
* @see SetDiffuse().
*/
- _Math::ColorEx GetDiffuse(void) const;
+ float* GetDiffuse(void) const;
/**
* Sets light specular color.
*
* @since 3.0
*
- * @param[in] color New light specular color.
+ * @param[in] specular New light specular color.
* @see GetSpecular().
*/
- void SetSpecular(const _Math::ColorEx& color);
+ void SetSpecular(const float specular[4]);
/**
* Gets light specular.
*
- * @since 2.0
+ * @since 3.0
*
* @return Light specular.
* @see SetSpecular().
*/
- _Math::ColorEx GetSpecular(void) const;
+ float* GetSpecular(void) const;
/**
- * Sets light intensity color.
+ * Sets light position.
*
* @since 3.0
*
- * @param[in] color New light intensity color.
- * @see GetIntensity().
+ * @param[in] position New light position.
+ * @see GetPosition().
*/
- void SetIntensity(float intensity);
+ void SetPosition(const float position[4]);
/**
- * Gets light intensity.
+ * Gets light position.
*
* @since 3.0
*
- * @return Light intensity.
- * @see SetIntensity().
+ * @return Light position.
+ * @see SetPosition().
*/
- float GetIntensity(void) const;
+ float* GetPosition(void) const;
+
+ /**
+ * Sets light direction.
+ *
+ * @since 3.0
+ *
+ * @param[in] direction New light direction.
+ * @see GetDirection().
+ */
+ void SetDirection(const float direction[3]);
+
+ /**
+ * Gets light direction.
+ *
+ * @since 3.0
+ *
+ * @return light direction.
+ * @see SetDirection().
+ */
+ float* GetDirection(void) const;
/**
* Sets light spot exponent.
* @since 3.0
*
* @param[in] exponent New light spot exponent.
- * @see GetSpotExponent().
+ * @see GetExponent().
*/
- void SetSpotExponent(float exponent);
+ void SetExponent(float exponent);
/**
* Gets light spot exponent.
* @since 3.0
*
* @return Light spot exponent.
- * @see SetSpotExponent().
+ * @see SetExponent().
*/
- float GetSpotExponent(void) const;
+ float GetExponent(void) const;
+
+ void SetCutOff(float cutOff);
+ float GetCutOff(void) const;
/**
* Sets light constant attenuation.
*/
float GetQuadraticAttenuation(void) const;
+ float* GetAttenuations(void) const;
+
+ bool IsEnabled(void) const;
+ void SetEnabled(bool enabled);
+
+ result SetName(const Tizen::Base::String& name);
+ Tizen::Base::String GetName(void) const;
+
+ static _LightImpl* GetInstance(Light& light);
+ static const _LightImpl* GetInstance(const Light& light);
+
+
+///////////
+
/**
- * Sets light direction.
+ * Sets light color.
*
* @since 3.0
*
- * @param[in] direction New light direction.
- * @see GetDirection().
+ * @param[in] color New light color.
+ * @see GetColor().
*/
- void SetDirection(const _Math::Vector3& direction);
+ //TODO Do we need coloEx for light color?
+ void SetColor(const _Math::ColorEx& color);
/**
- * Sets light direction.
+ * Sets light color.
*
* @since 3.0
*
- * @param[in] x Direction x component.
- * @param[in] y Direction y component.
- * @param[in] z Direction z component.
- * @see GetDirection().
+ * @param[in] r Color red component.
+ * @param[in] g Color green component.
+ * @param[in] b Color blue component.
+ * @see GetColor().
*/
- void SetDirection(float x, float y, float z);
+ void SetColor(float r, float g, float b);
/**
- * Gets light direction.
+ * Sets light color.
*
* @since 3.0
*
- * @return light direction.
- * @see SetDirection().
+ * @param[in] colour New light color.
+ * @see GetColour().
*/
- _Math::Vector3 GetDirection(void) const;
+ void SetColor(unsigned int color);
/**
- * Sets light radius.
+ * Gets light color.
*
* @since 3.0
*
- * @param[in] radius New light radius.
- * @see GetRadius().
+ * @return Light color.
+ * @see SetColour().
*/
- void SetRadius(float radius);
-
+ _Math::ColorEx GetColor(void) const;
/**
- * Gets light radius.
+ * Sets light intensity color.
*
* @since 3.0
*
- * @return Light radius.
- * @see SetQuadraticAttenuation().
+ * @param[in] color New light intensity color.
+ * @see GetIntensity().
*/
- float GetRadius(void) const;
+ void SetIntensity(float intensity);
/**
- * Sets light position.
+ * Gets light intensity.
*
* @since 3.0
*
- * @param[in] pos New light position.
- * @see GetPosition().
+ * @return Light intensity.
+ * @see SetIntensity().
*/
- void SetPosition(const _Math::Vector3& pos);
+ float GetIntensity(void) const;
/**
- * Sets light position.
+ * Sets light radius.
*
* @since 3.0
*
- * @param[in] x Light position x component.
- * @param[in] y Light position y component.
- * @param[in] z Light position z component.
- * @see GetPosition().
+ * @param[in] radius New light radius.
+ * @see GetRadius().
*/
- void SetPosition(float x, float y, float z);
+ void SetRadius(float radius);
+
/**
- * Gets light position.
+ * Gets light radius.
*
* @since 3.0
*
- * @return Light position.
- * @see SetPosition().
+ * @return Light radius.
+ * @see SetQuadraticAttenuation().
*/
- _Math::Vector3 GetPosition(void);
+ float GetRadius(void) const;
- float GetCutOff(void) const;
- void SetCutOff(float cutOff);
- //Attachable
-// virtual void UpdateRender(Tizen::Ui::Renderer::RenderSystem* render);
-// virtual const Tizen::Ui::Animations::VisualScenes::_Scene::AxisAlignedBox& GetAABB(void);
-// virtual void VisitRenderables(Tizen::Ui::Animations::VisualScenes::_Scene::Renderable::Visitor* visitor);
- //Attachable
+ void SetSpotlightRadius(float spotlightRadius);
+ float GetSpotlightRaduis(void) const;
- static _LightImpl* GetInstance(Light& light);
- static const _LightImpl* GetInstance(const Light& light);
+private:
+ Light::LightType __lightType;
+ float __ambient[4];
+ float __diffuse[4];
+ float __specular[4];
- bool IsEnabled(void) const;
- void SetEnabled(bool enabled);
+ float __position[4];
+ float __direction[3];
- void SetSpotlightRadius(float spotlightRadius);
- float GetSpotlightRaduis(void) const;
+ float __exponent;
+ float __cutOff;
- void SetName(const std::string& name);
- std::string GetName(void) const;
-private:
+ float __attenuation[3];
+
+ bool __enabled;
- std::string __name;
- Tizen::Ui::Animations::Light::LightType __lightType;
+ Tizen::Base::String __name;
+/////
_Math::ColorEx __color;
- _Math::ColorEx __ambient;
- _Math::ColorEx __diffuse;
- _Math::ColorEx __specular;
float __intensity;
- float __spotExponent;
- float __cutOff;
- float __constantAttenuation;
- float __linearAttenuation;
- float __quadraticAttenuation;
float __radius;
float __spotlightRadius;
- _Math::Vector3 __position; // The light position from the scene.
- _Math::Vector3 __direction; // The light direction from the scene.
- bool __enabled;
-
};
-
-
}}} // Tizen::Ui::Animations
-#endif //_LIGHTIMPL_H_
+#endif //_FUI_ANIM_INTERNAL_LIGHT_IMPL_H_