CheckEnumerationProperty< DepthFunction::Type >( renderer, Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS, DepthFunction::ALWAYS, DepthFunction::GREATER, "GREATER" );
CheckEnumerationProperty< DepthTestMode::Type >( renderer, Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO, DepthTestMode::OFF, DepthTestMode::ON, "ON" );
CheckEnumerationProperty< StencilFunction::Type >( renderer, Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS, StencilFunction::LESS, StencilFunction::EQUAL, "EQUAL" );
- CheckEnumerationProperty< StencilMode::Type >( renderer, Renderer::Property::STENCIL_MODE, StencilMode::AUTO, StencilMode::OFF, StencilMode::ON, "ON" );
+ CheckEnumerationProperty< RenderMode::Type >( renderer, Renderer::Property::RENDER_MODE, RenderMode::AUTO, RenderMode::NONE, RenderMode::STENCIL, "STENCIL" );
CheckEnumerationProperty< StencilOperation::Type >( renderer, Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
CheckEnumerationProperty< StencilOperation::Type >( renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
CheckEnumerationProperty< StencilOperation::Type >( renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
END_TEST;
}
-int UtcDaliRendererSetStencilMode(void)
+int UtcDaliRendererSetRenderModeToUseStencilBuffer(void)
{
TestApplication application;
- tet_infoline("Test setting the StencilMode");
+ tet_infoline("Test setting the RenderMode to use the stencil buffer");
Renderer renderer = RendererTestFixture( application );
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
+ // Set the StencilFunction to something other than the default, to confirm it is set as a property,
+ // but NO GL call has been made while the RenderMode is set to not use the stencil buffer.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::NONE );
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
- // Set the StencilFunction to something other than the default, to confirm it is set as a property,
- // but NO GL call has been made while the StencilMode is set to OFF.
renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::NEVER );
DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION ).Get<int>() ), static_cast<int>( StencilFunction::NEVER ), TEST_LOCATION );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
std::string methodString( "StencilFunc" );
DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) );
- // Now set the StencilMode to ON and check the StencilFunction has changed.
- renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
+ // Test the other RenderModes that will not enable the stencil buffer.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::AUTO );
+ ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) );
+
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
+ ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) );
+
+ // Now set the RenderMode to modes that will use the stencil buffer, and check the StencilFunction has changed.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
+ ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+
+ DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetStencilTestString() ) );
+ DALI_TEST_CHECK( glStencilFunctionStack.FindMethod( methodString ) );
+
+ // Test the COLOR_STENCIL RenderMode as it also enables the stencil buffer.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL );
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetStencilTestString() ) );
END_TEST;
}
+// Helper function for the SetRenderModeToUseColorBuffer test.
+void CheckRenderModeColorMask( TestApplication& application, Renderer& renderer, RenderMode::Type renderMode, bool expectedValue )
+{
+ // Set the RenderMode property to a value that should not allow color buffer writes.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, renderMode );
+ application.SendNotification();
+ application.Render();
+
+ // Check if ColorMask has been called, and that the values are correct.
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ const TestGlAbstraction::ColorMaskParams& colorMaskParams( glAbstraction.GetColorMaskParams() );
+
+ DALI_TEST_EQUALS<bool>( colorMaskParams.red, expectedValue, TEST_LOCATION );
+ DALI_TEST_EQUALS<bool>( colorMaskParams.green, expectedValue, TEST_LOCATION );
+ DALI_TEST_EQUALS<bool>( colorMaskParams.blue, expectedValue, TEST_LOCATION );
+ DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, expectedValue, TEST_LOCATION );
+}
+
+int UtcDaliRendererSetRenderModeToUseColorBuffer(void)
+{
+ TestApplication application;
+ tet_infoline("Test setting the RenderMode to use the color buffer");
+
+ Renderer renderer = RendererTestFixture( application );
+
+ // Set the RenderMode property to a value that should not allow color buffer writes.
+ // Then check if ColorMask has been called, and that the values are correct.
+ CheckRenderModeColorMask( application, renderer, RenderMode::AUTO, true );
+ CheckRenderModeColorMask( application, renderer, RenderMode::NONE, false );
+ CheckRenderModeColorMask( application, renderer, RenderMode::COLOR, true );
+ CheckRenderModeColorMask( application, renderer, RenderMode::STENCIL, false );
+ CheckRenderModeColorMask( application, renderer, RenderMode::COLOR_STENCIL, true );
+
+ END_TEST;
+}
+
int UtcDaliRendererSetStencilFunction(void)
{
TestApplication application;
TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
- // StencilMode must be ON for StencilFunction to operate.
- renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
+ // RenderMode must use the stencil for StencilFunction to operate.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
/*
TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
- // StencilMode must be ON for StencilOperation to operate.
- renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
+ // RenderMode must use the stencil for StencilOperation to operate.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
/*
* Lookup table for testing StencilOperation.
TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
- // StencilMode must be ON for StencilMask to operate.
- renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
+ // RenderMode must use the stencil for StencilMask to operate.
+ renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
// Set the StencilMask property to a value.
renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0x00 );
END_TEST;
}
-
-int UtcDaliRendererSetWriteToColorBuffer(void)
-{
- TestApplication application;
- tet_infoline("Test setting the WriteToColorBuffer flag");
-
- Renderer renderer = RendererTestFixture( application );
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-
- // Set the StencilMask property to a value.
- renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, false );
-
- // Check GetProperty returns the same value.
- DALI_TEST_CHECK( !renderer.GetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER ).Get<bool>() );
-
- application.SendNotification();
- application.Render();
-
- // Check if ColorMask has been called, and that the values are correct.
- const TestGlAbstraction::ColorMaskParams& colorMaskParams( glAbstraction.GetColorMaskParams() );
-
- DALI_TEST_EQUALS<bool>( colorMaskParams.red, false, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.green, false, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.blue, false, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, false, TEST_LOCATION );
-
- // Set the StencilMask property to true.
- renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true );
-
- // Check GetProperty returns the same value.
- DALI_TEST_CHECK( renderer.GetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER ).Get<bool>() );
-
- application.SendNotification();
- application.Render();
-
- // Check if ColorMask has been called, and that the values are correct.
- const TestGlAbstraction::ColorMaskParams& colorMaskParamsChanged( glAbstraction.GetColorMaskParams() );
-
- DALI_TEST_EQUALS<bool>( colorMaskParamsChanged.red, true, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParamsChanged.green, true, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParamsChanged.blue, true, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParamsChanged.alpha, true, TEST_LOCATION );
-
- END_TEST;
-}
template <> struct ParameterType< Dali::DepthWriteMode::Type > : public BasicType< Dali::DepthWriteMode::Type > {};
template <> struct ParameterType< Dali::DepthTestMode::Type > : public BasicType< Dali::DepthTestMode::Type > {};
template <> struct ParameterType< Dali::DepthFunction::Type > : public BasicType< Dali::DepthFunction::Type > {};
-template <> struct ParameterType< Dali::StencilMode::Type > : public BasicType< Dali::StencilMode::Type > {};
+template <> struct ParameterType< Dali::RenderMode::Type > : public BasicType< Dali::RenderMode::Type > {};
template <> struct ParameterType< Dali::StencilFunction::Type > : public BasicType< Dali::StencilFunction::Type > {};
template <> struct ParameterType< Dali::StencilOperation::Type > : public BasicType< Dali::StencilOperation::Type > {};
DALI_PROPERTY( "depthWriteMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
DALI_PROPERTY( "depthFunction", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_FUNCTION )
DALI_PROPERTY( "depthTestMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_TEST_MODE )
+DALI_PROPERTY( "renderMode", INTEGER, true, false, false, Dali::Renderer::Property::RENDER_MODE )
DALI_PROPERTY( "stencilFunction", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION )
DALI_PROPERTY( "stencilFunctionMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
DALI_PROPERTY( "stencilFunctionReference", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
DALI_PROPERTY( "stencilMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MASK )
-DALI_PROPERTY( "stencilMode", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MODE )
DALI_PROPERTY( "stencilOperationOnFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
DALI_PROPERTY( "stencilOperationOnZFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
DALI_PROPERTY( "stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
-DALI_PROPERTY( "writeToColorBuffer", BOOLEAN, true, false, false, Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER )
DALI_PROPERTY( "batchingEnabled", BOOLEAN, true, false, false, Dali::Renderer::Property::BATCHING_ENABLED )
DALI_PROPERTY_TABLE_END( DEFAULT_RENDERER_PROPERTY_START_INDEX )
DALI_ENUM_TO_STRING_WITH_SCOPE( StencilFunction, ALWAYS )
DALI_ENUM_TO_STRING_TABLE_END( STENCIL_FUNCTION )
-DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_MODE )
-DALI_ENUM_TO_STRING_WITH_SCOPE( StencilMode, OFF )
-DALI_ENUM_TO_STRING_WITH_SCOPE( StencilMode, AUTO )
-DALI_ENUM_TO_STRING_WITH_SCOPE( StencilMode, ON )
-DALI_ENUM_TO_STRING_TABLE_END( STENCIL_MODE )
+DALI_ENUM_TO_STRING_TABLE_BEGIN( RENDER_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, NONE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, AUTO )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, STENCIL )
+DALI_ENUM_TO_STRING_WITH_SCOPE( RenderMode, COLOR_STENCIL )
+DALI_ENUM_TO_STRING_TABLE_END( RENDER_MODE )
DALI_ENUM_TO_STRING_TABLE_BEGIN( STENCIL_OPERATION )
DALI_ENUM_TO_STRING_WITH_SCOPE( StencilOperation, ZERO )
}
break;
}
- case Dali::Renderer::Property::STENCIL_MODE:
+ case Dali::Renderer::Property::RENDER_MODE:
{
- StencilMode::Type convertedValue = mStencilParameters.stencilMode;
- if( Scripting::GetEnumerationProperty< StencilMode::Type >( propertyValue, STENCIL_MODE_TABLE, STENCIL_MODE_TABLE_COUNT, convertedValue ) )
+ RenderMode::Type convertedValue = mStencilParameters.renderMode;
+ if( Scripting::GetEnumerationProperty< RenderMode::Type >( propertyValue, RENDER_MODE_TABLE, RENDER_MODE_TABLE_COUNT, convertedValue ) )
{
- mStencilParameters.stencilMode = convertedValue;
- SetStencilModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
+ mStencilParameters.renderMode = convertedValue;
+ SetRenderModeMessage( GetEventThreadServices(), *mSceneObject, convertedValue );
}
break;
}
}
break;
}
- case Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER:
- {
- bool writeToColorBuffer;
- if( propertyValue.Get( writeToColorBuffer ) )
- {
- if( mWriteToColorBuffer != writeToColorBuffer )
- {
- mWriteToColorBuffer = writeToColorBuffer;
- SetWriteToColorBufferMessage( GetEventThreadServices(), *mSceneObject, writeToColorBuffer );
- }
- }
- break;
- }
case Dali::Renderer::Property::BATCHING_ENABLED:
{
bool enabled;
value = mStencilParameters.stencilMask;
break;
}
- case Dali::Renderer::Property::STENCIL_MODE:
+ case Dali::Renderer::Property::RENDER_MODE:
{
- value = mStencilParameters.stencilMode;
+ value = mStencilParameters.renderMode;
break;
}
case Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL:
value = mStencilParameters.stencilOperationOnZPass;
break;
}
- case Dali::Renderer::Property::WRITE_TO_COLOR_BUFFER:
- {
- value = mWriteToColorBuffer;
- break;
- }
}
return value;
}
mOnStageCount( 0 ),
mIndexedDrawFirstElement( 0 ),
mIndexedDrawElementCount( 0 ),
- mStencilParameters( StencilMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
+ mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
mBlendingOptions(),
mDepthFunction( DepthFunction::LESS ),
mFaceCullingMode( FaceCullingMode::NONE ),
mBlendMode( BlendMode::AUTO ),
mDepthWriteMode( DepthWriteMode::AUTO ),
mDepthTestMode( DepthTestMode::AUTO ),
- mWriteToColorBuffer( true ),
mPremultipledAlphaEnabled( false ),
mBatchingEnabled( false )
{
BlendMode::Type mBlendMode:2; ///< Local copy of the mode of blending
DepthWriteMode::Type mDepthWriteMode:2; ///< Local copy of the depth write mode
DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode
- bool mWriteToColorBuffer:1; ///< Local copy of the write to color buffer flag
bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
bool mBatchingEnabled : 1; ///< Flag indicating whether render is batchable or not
};
// Setup the color buffer based on the renderers properties.
Renderer *renderer = item.mRenderer;
- context.ColorMask( renderer->GetWriteToColorBuffer() );
+ RenderMode::Type renderMode = renderer->GetRenderMode();
+ const bool writeToColorBuffer = ( renderMode == RenderMode::AUTO ) || ( renderMode == RenderMode::COLOR ) || ( renderMode == RenderMode::COLOR_STENCIL );
+ context.ColorMask( writeToColorBuffer );
// If the stencil buffer is disabled for this renderer, exit now to save unnecessary value setting.
- if( renderer->GetStencilMode() != StencilMode::ON )
+ if( ( renderMode != RenderMode::STENCIL ) && ( renderMode != RenderMode::COLOR_STENCIL ) )
{
// No per-renderer stencil setup, exit.
context.EnableStencilBuffer( false );
DepthWriteMode::Type depthWriteMode,
DepthTestMode::Type depthTestMode,
DepthFunction::Type depthFunction,
- StencilParameters& stencilParameters,
- bool writeToColorBuffer )
+ StencilParameters& stencilParameters )
{
return new Renderer( dataProvider, geometry, blendingBitmask, blendColor,
faceCullingMode, preMultipliedAlphaEnabled, depthWriteMode, depthTestMode,
- depthFunction, stencilParameters, writeToColorBuffer );
+ depthFunction, stencilParameters );
}
Renderer::Renderer( SceneGraph::RenderDataProvider* dataProvider,
DepthWriteMode::Type depthWriteMode,
DepthTestMode::Type depthTestMode,
DepthFunction::Type depthFunction,
- StencilParameters& stencilParameters,
- bool writeToColorBuffer )
+ StencilParameters& stencilParameters )
: mRenderDataProvider( dataProvider ),
mContext( NULL),
mTextureCache( NULL ),
mFaceCullingMode( faceCullingMode ),
mDepthWriteMode( depthWriteMode ),
mDepthTestMode( depthTestMode ),
- mWriteToColorBuffer( writeToColorBuffer ),
mUpdateAttributesLocation( true ),
mPremultipledAlphaEnabled( preMultipliedAlphaEnabled ),
mBatchingEnabled( false )
return mDepthFunction;
}
-void Renderer::SetStencilMode( StencilMode::Type stencilMode )
+void Renderer::SetRenderMode( RenderMode::Type renderMode )
{
- mStencilParameters.stencilMode = stencilMode;
+ mStencilParameters.renderMode = renderMode;
}
-StencilMode::Type Renderer::GetStencilMode() const
+RenderMode::Type Renderer::GetRenderMode() const
{
- return mStencilParameters.stencilMode;
+ return mStencilParameters.renderMode;
}
void Renderer::SetStencilFunction( StencilFunction::Type stencilFunction )
return mStencilParameters.stencilOperationOnZPass;
}
-void Renderer::SetWriteToColorBuffer( bool writeToColorBuffer )
-{
- mWriteToColorBuffer = writeToColorBuffer;
-}
-
-bool Renderer::GetWriteToColorBuffer() const
-{
- return mWriteToColorBuffer;
-}
-
void Renderer::SetBatchingEnabled( bool batchingEnabled )
{
mBatchingEnabled = batchingEnabled;
*/
struct StencilParameters
{
- StencilParameters( StencilMode::Type stencilMode, StencilFunction::Type stencilFunction, int stencilFunctionMask,
+ StencilParameters( RenderMode::Type renderMode, StencilFunction::Type stencilFunction, int stencilFunctionMask,
int stencilFunctionReference, int stencilMask, StencilOperation::Type stencilOperationOnFail,
StencilOperation::Type stencilOperationOnZFail, StencilOperation::Type stencilOperationOnZPass )
: stencilFunctionMask ( stencilFunctionMask ),
stencilFunctionReference ( stencilFunctionReference ),
stencilMask ( stencilMask ),
+ renderMode ( renderMode ),
stencilFunction ( stencilFunction ),
stencilOperationOnFail ( stencilOperationOnFail ),
stencilOperationOnZFail ( stencilOperationOnZFail ),
- stencilOperationOnZPass ( stencilOperationOnZPass ),
- stencilMode ( stencilMode )
+ stencilOperationOnZPass ( stencilOperationOnZPass )
{
}
int stencilFunctionMask; ///< The stencil function mask
int stencilFunctionReference; ///< The stencil function reference
int stencilMask; ///< The stencil mask
- StencilFunction::Type stencilFunction:3; ///< The stencil function
+ RenderMode::Type renderMode:3; ///< The render mode
+ StencilFunction::Type stencilFunction:3; ///< The stencil function
StencilOperation::Type stencilOperationOnFail:3; ///< The stencil operation for stencil test fail
StencilOperation::Type stencilOperationOnZFail:3; ///< The stencil operation for depth test fail
StencilOperation::Type stencilOperationOnZPass:3; ///< The stencil operation for depth test pass
- StencilMode::Type stencilMode:2; ///< The stencil mode
};
/**
* @param[in] depthTestMode Depth buffer test mode
* @param[in] depthFunction Depth function
* @param[in] stencilParameters Struct containing all stencil related options
- * @param[in] writeToColorBuffer Set to True to write to the color buffer
*/
static Renderer* New( SceneGraph::RenderDataProvider* dataProviders,
Render::Geometry* geometry,
DepthWriteMode::Type depthWriteMode,
DepthTestMode::Type depthTestMode,
DepthFunction::Type depthFunction,
- StencilParameters& stencilParameters,
- bool writeToColorBuffer );
+ StencilParameters& stencilParameters );
/**
* Constructor.
* @param[in] depthTestMode Depth buffer test mode
* @param[in] depthFunction Depth function
* @param[in] stencilParameters Struct containing all stencil related options
- * @param[in] writeToColorBuffer Set to True to write to the color buffer
*/
Renderer( SceneGraph::RenderDataProvider* dataProviders,
Render::Geometry* geometry,
DepthWriteMode::Type depthWriteMode,
DepthTestMode::Type depthTestMode,
DepthFunction::Type depthFunction,
- StencilParameters& stencilParameters,
- bool writeToColorBuffer );
+ StencilParameters& stencilParameters );
/**
* Change the data providers of the renderer
DepthFunction::Type GetDepthFunction() const;
/**
- * Sets the stencil mode
- * @param[in] stencilMode The stencil function
+ * Sets the render mode
+ * @param[in] renderMode The render mode
*/
- void SetStencilMode( StencilMode::Type stencilMode );
+ void SetRenderMode( RenderMode::Type mode );
/**
- * Gets the stencil mode
- * @return The stencil function
+ * Gets the render mode
+ * @return The render mode
*/
- StencilMode::Type GetStencilMode() const;
+ RenderMode::Type GetRenderMode() const;
/**
* Sets the stencil function
StencilOperation::Type GetStencilOperationOnZPass() const;
/**
- * Sets whether or not to write to the color buffer
- * @param[in] writeToColorBuffer True to write to the color buffer
- */
- void SetWriteToColorBuffer( bool writeToColorBuffer );
-
- /**
- * Gets whether or not to write to the color buffer
- * @return True to write to the color buffer
- */
- bool GetWriteToColorBuffer() const;
-
- /**
* Sets batching mode on the renderer
* @param[in] batchingEnabled batching state
*/
BlendMode::Type mBlendMode:2; ///< The mode of blending
DepthWriteMode::Type mDepthWriteMode:2; ///< The depth write mode
DepthTestMode::Type mDepthTestMode:2; ///< The depth test mode
- bool mWriteToColorBuffer:1; ///< True if we are writing to the color buffer
bool mUpdateAttributesLocation:1; ///< Indicates attribute locations have changed
bool mPremultipledAlphaEnabled:1; ///< Flag indicating whether the Pre-multiplied Alpha Blending is required
bool mBatchingEnabled:1; ///< Flag indicating if the renderer is batchable
RESEND_DEPTH_WRITE_MODE = 1 << 8,
RESEND_DEPTH_TEST_MODE = 1 << 9,
RESEND_DEPTH_FUNCTION = 1 << 10,
- RESEND_STENCIL_MODE = 1 << 11,
+ RESEND_RENDER_MODE = 1 << 11,
RESEND_STENCIL_FUNCTION = 1 << 12,
RESEND_STENCIL_FUNCTION_MASK = 1 << 13,
RESEND_STENCIL_FUNCTION_REFERENCE = 1 << 14,
mGeometry( NULL ),
mShader( NULL ),
mBlendColor( NULL ),
- mStencilParameters( StencilMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
+ mStencilParameters( RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP ),
mIndexedDrawFirstElement( 0u ),
mIndexedDrawElementsCount( 0u ),
mBlendBitmask( 0u ),
mBlendMode( BlendMode::AUTO ),
mDepthWriteMode( DepthWriteMode::AUTO ),
mDepthTestMode( DepthTestMode::AUTO ),
- mWriteToColorBuffer( true ),
mResourcesReady( false ),
mFinishedResourceAcquisition( false ),
mPremultipledAlphaEnabled( false ),
new (slot) DerivedType( mRenderer, &Render::Renderer::SetDepthFunction, mDepthFunction );
}
- if( mResendFlag & RESEND_STENCIL_MODE )
+ if( mResendFlag & RESEND_RENDER_MODE )
{
- typedef MessageValue1< Render::Renderer, StencilMode::Type > DerivedType;
+ typedef MessageValue1< Render::Renderer, RenderMode::Type > DerivedType;
unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
- new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilMode, mStencilParameters.stencilMode );
+ new (slot) DerivedType( mRenderer, &Render::Renderer::SetRenderMode, mStencilParameters.renderMode );
}
if( mResendFlag & RESEND_STENCIL_FUNCTION )
new (slot) DerivedType( mRenderer, &Render::Renderer::SetStencilOperationOnZPass, mStencilParameters.stencilOperationOnZPass );
}
- if( mResendFlag & RESEND_WRITE_TO_COLOR_BUFFER )
- {
- typedef MessageValue1< Render::Renderer, bool > DerivedType;
- unsigned int* slot = mSceneController->GetRenderQueue().ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
- new (slot) DerivedType( mRenderer, &Render::Renderer::SetWriteToColorBuffer, mWriteToColorBuffer );
- }
-
if( mResendFlag & RESEND_BATCHING_MODE )
{
typedef MessageValue1< Render::Renderer, bool > DerivedType;
mResendFlag |= RESEND_DEPTH_FUNCTION;
}
-void Renderer::SetStencilMode( StencilMode::Type mode )
+void Renderer::SetRenderMode( RenderMode::Type mode )
{
- mStencilParameters.stencilMode = mode;
- mResendFlag |= RESEND_STENCIL_MODE;
+ mStencilParameters.renderMode = mode;
+ mResendFlag |= RESEND_RENDER_MODE;
}
void Renderer::SetStencilFunction( StencilFunction::Type stencilFunction )
mResendFlag |= RESEND_STENCIL_OPERATION_ON_Z_PASS;
}
-void Renderer::SetWriteToColorBuffer( bool writeToColorBuffer )
-{
- mWriteToColorBuffer = writeToColorBuffer;
- mResendFlag |= RESEND_WRITE_TO_COLOR_BUFFER;
-}
-
void Renderer::SetBatchingEnabled( bool batchingEnabled )
{
mBatchingEnabled = batchingEnabled;
RenderDataProvider* dataProvider = NewRenderDataProvider();
mRenderer = Render::Renderer::New( dataProvider, mGeometry, mBlendBitmask, mBlendColor, static_cast< FaceCullingMode::Type >( mFaceCullingMode ),
- mPremultipledAlphaEnabled, mDepthWriteMode, mDepthTestMode, mDepthFunction, mStencilParameters, mWriteToColorBuffer );
+ mPremultipledAlphaEnabled, mDepthWriteMode, mDepthTestMode, mDepthFunction, mStencilParameters );
mSceneController->GetRenderMessageDispatcher().AddRenderer( *mRenderer );
}
void SetDepthFunction( DepthFunction::Type depthFunction );
/**
- * Sets the stencil mode
- * @param[in] mode The stencil function
+ * Sets the render mode
+ * @param[in] mode The render mode
*/
- void SetStencilMode( StencilMode::Type mode );
+ void SetRenderMode( RenderMode::Type mode );
/**
* Sets the stencil function
void SetStencilOperationOnZPass( StencilOperation::Type stencilOperationOnZPass );
/**
- * Sets whether or not to write to the color buffer
- * @param[in] writeToColorBuffer True to write to the color buffer
- */
- void SetWriteToColorBuffer( bool writeToColorBuffer );
-
- /**
* Turns on batching feature for the renderer
* @param[in] batchingEnabled if true, enables the batching mode for the renderer
*/
BlendMode::Type mBlendMode:2; ///< Local copy of the mode of blending
DepthWriteMode::Type mDepthWriteMode:2; ///< Local copy of the depth write mode
DepthTestMode::Type mDepthTestMode:2; ///< Local copy of the depth test mode
- bool mWriteToColorBuffer:1; ///< Local copy of the write to color buffer flag
bool mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
bool mResourcesReady; ///< Set during the Update algorithm; true if the renderer has resources ready for the current frame.
new (slot) LocalType( &renderer, &Renderer::SetDepthFunction, depthFunction );
}
-inline void SetStencilModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilMode::Type mode )
+inline void SetRenderModeMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, RenderMode::Type mode )
{
- typedef MessageValue1< Renderer, StencilMode::Type > LocalType;
+ typedef MessageValue1< Renderer, RenderMode::Type > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
- new (slot) LocalType( &renderer, &Renderer::SetStencilMode, mode );
+ new (slot) LocalType( &renderer, &Renderer::SetRenderMode, mode );
}
inline void SetStencilFunctionMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, StencilFunction::Type stencilFunction )
new (slot) LocalType( &renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation );
}
-inline void SetWriteToColorBufferMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, bool writeToColorBuffer )
-{
- typedef MessageValue1< Renderer, bool > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
- new (slot) LocalType( &renderer, &Renderer::SetWriteToColorBuffer, writeToColorBuffer );
-}
-
inline void SetBatchingEnabledMessage( EventThreadServices& eventThreadServices, const Renderer& renderer, bool batchable )
{
typedef MessageValue1< Renderer, bool > LocalType;
} // namespace DepthFunction
+namespace RenderMode
+{
+
+/**
+ * @brief Controls how this renderer uses its stencil properties and writes to the color buffer.
+ * @SINCE_1_2.5
+ */
+enum Type
+{
+ NONE, ///< Don’t write to either color or stencil buffer (But will potentially render to depth buffer). @SINCE_1_2.5
+ AUTO, ///< Managed by the Actor Clipping API. This is the default. @SINCE_1_2.5
+ COLOR, ///< Ingore stencil properties. Write to the color buffer. @SINCE_1_2.5
+ STENCIL, ///< Use the stencil properties. Do not write to the color buffer. @SINCE_1_2.5
+ COLOR_STENCIL ///< Use the stencil properties AND Write to the color buffer. @SINCE_1_2.5
+};
+
+} // namespace RenderMode
+
namespace StencilFunction
{
} // namespace StencilFunction
-namespace StencilMode
-{
-
-/**
- * @brief How the stencil buffer will be managed.
- * @SINCE_1_1.43
- */
-enum Type
-{
- OFF, ///< Off for this renderer @SINCE_1_1.43
- AUTO, ///< Managed by the Actor clipping API. This is the default @SINCE_1_1.43
- ON ///< On for this renderer. Select this to use the Renderer stencil properties to manage behavior. Note that Actor clipping management is bypassed for this renderer @SINCE_1_1.43
-};
-
-} // namespace StencilMode
-
namespace StencilOperation
{
DEPTH_TEST_MODE,
/**
+ * @brief name "renderMode", type INTEGER
+ * @see RenderMode
+ * @note The default value is RenderMode::AUTO
+ * @SINCE_1_2.5
+ */
+ RENDER_MODE,
+
+ /**
* @brief name "stencilFunction", type INTEGER
* @see StencilFunction
* @note The default value is StencilFunction::ALWAYS
STENCIL_MASK,
/**
- * @brief name "stencilMode", type INTEGER
- * @see StencilMode
- * @note The default value is StencilMode::AUTO
- * @SINCE_1_1.43
- */
- STENCIL_MODE,
-
- /**
* @brief name "stencilOperationOnFail", type INTEGER
* @see StencilOperation
* @note The default value is StencilOperation::KEEP
STENCIL_OPERATION_ON_Z_PASS,
/**
- * @brief name "writeToColorBuffer", type BOOLEAN
- * This allows per-renderer control of writing to the color buffer.
- * For example: This can be turned off to write to the stencil or depth buffers only.
- * @note The default value is True
- * @SINCE_1_1.43
- */
- WRITE_TO_COLOR_BUFFER,
-
- /**
* @brief name "batchingEnabled", type BOOLEAN
* @SINCE_1_2.0
* @see Batching