From: Heeyong Song Date: Tue, 3 Dec 2013 02:41:05 +0000 (+0900) Subject: Add default material values X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dda783624637e03dbe377417547581cca516159e;p=framework%2Fosp%2Fuifw.git Add default material values Change-Id: I379b14198a72bfb71b73115a38d061bea1d7567f --- diff --git a/src/ui/animations/FUiAnim_GlRenderManager.cpp b/src/ui/animations/FUiAnim_GlRenderManager.cpp index 71bf003..17548b9 100644 --- a/src/ui/animations/FUiAnim_GlRenderManager.cpp +++ b/src/ui/animations/FUiAnim_GlRenderManager.cpp @@ -66,8 +66,8 @@ using namespace Tizen::Base; using namespace Tizen::Graphics; using namespace Tizen::Ui::Animations; -#define PRINT(...) fprintf(stderr, __VA_ARGS__) -//#define PRINT(...) +//#define PRINT(...) fprintf(stderr, __VA_ARGS__) +#define PRINT(...) //#define ELAPSE(_STR) unique_ptr<_ElapsedTime> ptr(new _ElapsedTime(_STR)); @@ -559,6 +559,7 @@ _GlRenderManager::_GlRenderManager(void) , __queueCount(0) , __needClear(false) , __globalLightCount(0) + , __materialShininess(0.0f) , __pAnimationManager(0) { memset(&__threadInfo, 0x00, sizeof(pthread_t)); @@ -571,6 +572,11 @@ _GlRenderManager::_GlRenderManager(void) __eyePosition[1] = 0.0f; __eyePosition[2] = 0.0f; + __materialAmbient[0] = 0.2f; __materialAmbient[1] = 0.2f; __materialAmbient[2] = 0.2f; __materialAmbient[3] = 1.0f; + __materialDiffuse[0] = 0.8f; __materialDiffuse[1] = 0.8f; __materialDiffuse[2] = 0.8f; __materialDiffuse[3] = 1.0f; + __materialSpecular[0] = 0.0f; __materialSpecular[1] = 0.0f; __materialSpecular[2] = 0.0f; __materialSpecular[3] = 1.0f; + __materialEmissive[0] = 0.0f; __materialEmissive[1] = 0.0f; __materialEmissive[2] = 0.0f; __materialEmissive[3] = 1.0f; + ClearLastResult(); __pRenderQueue = new (std::nothrow) _RenderObject[VE_RENDER_QUEUE_COUNT_MAX]; @@ -879,6 +885,14 @@ _GlRenderManager::FlushRenderQueue(void) glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_MATERIAL_EMISSIVE], 1, pMaterialImpl->GetEmissive()); glUniform1f(pProgramImpl->__uniformLocation[UNIFORM_FLOAT_MATERIAL_SHININESS], pMaterialImpl->GetShininess()); } + else if (__pRenderQueue[i].__activeLightCount > 0) + { + glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_MATERIAL_AMBIENT], 1, __materialAmbient); + glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_MATERIAL_DIFFUSE], 1, __materialDiffuse); + glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_MATERIAL_SPECULAR], 1, __materialSpecular); + glUniform4fv(pProgramImpl->__uniformLocation[UNIFORM_VEC4_MATERIAL_EMISSIVE], 1, __materialEmissive); + glUniform1f(pProgramImpl->__uniformLocation[UNIFORM_FLOAT_MATERIAL_SHININESS], __materialShininess); + } // Custom shader if (pProgramImpl->__customUniformMap.GetCount() > 0) @@ -1340,9 +1354,6 @@ _GlRenderManager::CommandHandlerComposite(_GlLayer* pGlLayer) CHECK_GL_CONTEXT(); #endif - PRINT("CommandHandlerComposite::begin (0x%x)\n",(unsigned int)pGlLayer); - - _DisplayManager* pDisplayManager = _DisplayManager::GetInstance(); _AutoMutex treeLock(*_VisualElementEnvironment::GetTreeLock()); diff --git a/src/ui/animations/FUiAnim_GlRenderManager.h b/src/ui/animations/FUiAnim_GlRenderManager.h index 5f45403..0e47972 100644 --- a/src/ui/animations/FUiAnim_GlRenderManager.h +++ b/src/ui/animations/FUiAnim_GlRenderManager.h @@ -239,8 +239,16 @@ private: _RenderObject* __pRenderQueue; int __queueCount; bool __needClear; + unsigned int __globalLightCount; Light* __globalLight[MAX_LIGHT_COUNT]; + + float __materialAmbient[4]; + float __materialDiffuse[4]; + float __materialSpecular[4]; + float __materialEmissive[4]; + float __materialShininess; + _AnimationManager* __pAnimationManager; friend class _RenderObject;