X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-renderer.cpp;h=cbad8bb8ebd4b4c362ee1424d842b5030c40b4fc;hb=2b10280985738c74efa2aa0fb956a837c69acee6;hp=ab653044db32cf2a0940500a2625ecaf85fd264c;hpb=13c3e0a4cb02ff7de53f4555cd0da8945677bc23;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/renderers/render-renderer.cpp b/dali/internal/render/renderers/render-renderer.cpp index ab65304..cbad8bb 100644 --- a/dali/internal/render/renderers/render-renderer.cpp +++ b/dali/internal/render/renderers/render-renderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ // CLASS HEADER #include - // INTERNAL INCLUDES #include #include @@ -118,9 +117,13 @@ Renderer* Renderer::New( SceneGraph::RenderDataProvider* dataProvider, bool preMultipliedAlphaEnabled, DepthWriteMode::Type depthWriteMode, DepthTestMode::Type depthTestMode, - DepthFunction::Type depthFunction ) + DepthFunction::Type depthFunction, + StencilParameters& stencilParameters, + bool writeToColorBuffer ) { - return new Renderer( dataProvider, geometry, blendingBitmask, blendColor, faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode, depthFunction ); + return new Renderer( dataProvider, geometry, blendingBitmask, blendColor, + faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode, + depthFunction, stencilParameters, writeToColorBuffer ); } Renderer::Renderer( SceneGraph::RenderDataProvider* dataProvider, @@ -131,21 +134,25 @@ Renderer::Renderer( SceneGraph::RenderDataProvider* dataProvider, bool preMultipliedAlphaEnabled, DepthWriteMode::Type depthWriteMode, DepthTestMode::Type depthTestMode, - DepthFunction::Type depthFunction ) + DepthFunction::Type depthFunction, + StencilParameters& stencilParameters, + bool writeToColorBuffer ) : mRenderDataProvider( dataProvider ), - mContext(NULL), + mContext( NULL), mTextureCache( NULL ), mUniformNameCache( NULL ), mGeometry( geometry ), mUniformIndexMap(), mAttributesLocation(), + mStencilParameters( stencilParameters ), mBlendingOptions(), - mFaceCullingMode( faceCullingMode ), - mDepthFunction( depthFunction ), mIndexedDrawFirstElement( 0 ), mIndexedDrawElementsCount( 0 ), + mDepthFunction( depthFunction ), + mFaceCullingMode( faceCullingMode ), mDepthWriteMode( depthWriteMode ), mDepthTestMode( depthTestMode ), + mWriteToColorBuffer( writeToColorBuffer ), mUpdateAttributesLocation( true ), mPremultipledAlphaEnabled( preMultipliedAlphaEnabled ) { @@ -362,6 +369,7 @@ bool Renderer::BindTextures( Context& context, SceneGraph::TextureCache& texture std::vector& samplers( mRenderDataProvider->GetSamplers() ); std::vector& textures( mRenderDataProvider->GetTextures() ); + GLint uniformLocation(-1); for( size_t i(0); result && i& newTextures( mRenderDataProvider->GetNewTextures() ); - GLint uniformLocation(0); for( size_t i(0); result && iBind(context, textureUnit, samplers[i] ); + if( result ) { - newTextures[i]->Bind(context, textureUnit, samplers[i] ); program.SetUniform1i( uniformLocation, textureUnit ); ++textureUnit; } @@ -473,6 +482,96 @@ DepthFunction::Type Renderer::GetDepthFunction() const return mDepthFunction; } +void Renderer::SetStencilMode( StencilMode::Type stencilMode ) +{ + mStencilParameters.stencilMode = stencilMode; +} + +StencilMode::Type Renderer::GetStencilMode() const +{ + return mStencilParameters.stencilMode; +} + +void Renderer::SetStencilFunction( StencilFunction::Type stencilFunction ) +{ + mStencilParameters.stencilFunction = stencilFunction; +} + +StencilFunction::Type Renderer::GetStencilFunction() const +{ + return mStencilParameters.stencilFunction; +} + +void Renderer::SetStencilFunctionMask( int stencilFunctionMask ) +{ + mStencilParameters.stencilFunctionMask = stencilFunctionMask; +} + +int Renderer::GetStencilFunctionMask() const +{ + return mStencilParameters.stencilFunctionMask; +} + +void Renderer::SetStencilFunctionReference( int stencilFunctionReference ) +{ + mStencilParameters.stencilFunctionReference = stencilFunctionReference; +} + +int Renderer::GetStencilFunctionReference() const +{ + return mStencilParameters.stencilFunctionReference; +} + +void Renderer::SetStencilMask( int stencilMask ) +{ + mStencilParameters.stencilMask = stencilMask; +} + +int Renderer::GetStencilMask() const +{ + return mStencilParameters.stencilMask; +} + +void Renderer::SetStencilOperationOnFail( StencilOperation::Type stencilOperationOnFail ) +{ + mStencilParameters.stencilOperationOnFail = stencilOperationOnFail; +} + +StencilOperation::Type Renderer::GetStencilOperationOnFail() const +{ + return mStencilParameters.stencilOperationOnFail; +} + +void Renderer::SetStencilOperationOnZFail( StencilOperation::Type stencilOperationOnZFail ) +{ + mStencilParameters.stencilOperationOnZFail = stencilOperationOnZFail; +} + +StencilOperation::Type Renderer::GetStencilOperationOnZFail() const +{ + return mStencilParameters.stencilOperationOnZFail; +} + +void Renderer::SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass ) +{ + mStencilParameters.stencilOperationOnZPass = stencilOperationOnZPass; +} + +StencilOperation::Type Renderer::GetStencilOperationOnZPass() const +{ + return mStencilParameters.stencilOperationOnZPass; +} + +void Renderer::SetWriteToColorBuffer( bool writeToColorBuffer ) +{ + mWriteToColorBuffer = writeToColorBuffer; +} + +bool Renderer::GetWriteToColorBuffer() const +{ + return mWriteToColorBuffer; +} + void Renderer::Render( Context& context, SceneGraph::TextureCache& textureCache, BufferIndex bufferIndex, @@ -494,7 +593,7 @@ void Renderer::Render( Context& context, DALI_ASSERT_DEBUG( program && "Default shader should always have a program available." ); if( !program ) { - DALI_LOG_ERROR( "Failed to get program for shader at address %p.", (void*)&mRenderDataProvider->GetShader() ); + DALI_LOG_ERROR( "Failed to get program for shader at address %p.\n", (void*)&mRenderDataProvider->GetShader() ); return; } }