{
//custom shader
const char * const CUSTOM_SHADER( "shader" );
-const char * const CUSTOM_VERTEX_SHADER( "vertex-shader" );
-const char * const CUSTOM_FRAGMENT_SHADER( "fragment-shader" );
-const char * const CUSTOM_SUBDIVIDE_GRID_X( "subdivide-grid-x" );
-const char * const CUSTOM_SUBDIVIDE_GRID_Y( "subdivide-grid-y" );
+const char * const CUSTOM_VERTEX_SHADER( "vertexShader" );
+const char * const CUSTOM_FRAGMENT_SHADER( "fragmentShader" );
+const char * const CUSTOM_SUBDIVIDE_GRID_X( "subdivideGridX" );
+const char * const CUSTOM_SUBDIVIDE_GRID_Y( "subdivideGridY" );
const char * const CUSTOM_SHADER_HINTS( "hints" ); ///< type STRING for a hint from the below hint strings or an ARRAY of of hint strings
/**
* where hints should be contain strings of the following shader hints:
- * "none" | corresponds to HINT_NONE
- * "requires-self-depth-test" | corresponds to HINT_REQUIRES_SELF_DEPTH_TEST
- * "output-is-transparent" | corresponds to HINT_OUTPUT_IS_TRANSPARENT
- * "output-is-opaque" | corresponds to HINT_OUTPUT_IS_OPAQUE
- * "modifies-geometry" | corresponds to HINT_MODIFIES_GEOMETRY
+ * "none" | corresponds to HINT_NONE
+ * "outputIsTransparent" | corresponds to HINT_OUTPUT_IS_TRANSPARENT
+ * "modifiesGeometry" | corresponds to HINT_MODIFIES_GEOMETRY
*/
Shader::ShaderHints HintFromString( std::string hintString )
{
return Shader::HINT_NONE;
}
- else if( hintString == "requires-self-depth-test" )
- {
- return Shader::HINT_REQUIRES_SELF_DEPTH_TEST;
- }
- else if( hintString == "output-is-transparent" )
+ else if( hintString == "outputIsTransparent" )
{
return Shader::HINT_OUTPUT_IS_TRANSPARENT;
}
- else if( hintString == "output-is-opaque" )
- {
- return Shader::HINT_OUTPUT_IS_OPAQUE;
- }
- else if( hintString == "modifies-geometry" )
+ else if( hintString == "modifiesGeometry" )
{
return Shader::HINT_MODIFIES_GEOMETRY;
}
SetPropertyMap( map );
}
-void Internal::ControlRenderer::Impl::CustomShader::SetPropertyMap( const Property::Map& propertyMap )
+void Internal::ControlRenderer::Impl::CustomShader::SetPropertyMap( const Property::Map& shaderMap )
{
- Property::Value* shaderValue = propertyMap.Find( CUSTOM_SHADER );
- if( shaderValue )
+ mVertexShader.clear();
+ mFragmentShader.clear();
+ mGridSize = ImageDimensions( 1, 1 );
+ mHints = Shader::HINT_NONE;
+
+ Property::Value* vertexShaderValue = shaderMap.Find( CUSTOM_VERTEX_SHADER );
+ if( vertexShaderValue )
{
- mVertexShader.clear();
- mFragmentShader.clear();
- mGridSize = ImageDimensions( 1, 1 );
- mHints = Shader::HINT_NONE;
+ if( !vertexShaderValue->Get( mVertexShader ) )
+ {
+ DALI_LOG_ERROR( "'%s' parameter does not correctly specify a string", CUSTOM_VERTEX_SHADER );
+ }
+ }
- Property::Map shaderMap;
- if( shaderValue->Get( shaderMap ) )
+ Property::Value* fragmentShaderValue = shaderMap.Find( CUSTOM_FRAGMENT_SHADER );
+ if( fragmentShaderValue )
+ {
+ if( !fragmentShaderValue->Get( mFragmentShader ) )
{
- Property::Value* vertexShaderValue = shaderMap.Find( CUSTOM_VERTEX_SHADER );
- if( vertexShaderValue )
- {
- if( !vertexShaderValue->Get( mVertexShader ) )
- {
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify a string", CUSTOM_VERTEX_SHADER );
- }
- }
+ DALI_LOG_ERROR( "'%s' parameter does not correctly specify a string", CUSTOM_FRAGMENT_SHADER );
+ }
+ }
- Property::Value* fragmentShaderValue = shaderMap.Find( CUSTOM_FRAGMENT_SHADER );
- if( fragmentShaderValue )
- {
- if( !fragmentShaderValue->Get( mFragmentShader ) )
- {
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify a string", CUSTOM_FRAGMENT_SHADER );
- }
- }
+ Property::Value* subdivideXValue = shaderMap.Find( CUSTOM_SUBDIVIDE_GRID_X );
+ if( subdivideXValue )
+ {
+ int subdivideX;
+ if( !subdivideXValue->Get( subdivideX ) || subdivideX < 1 )
+ {
+ DALI_LOG_ERROR( "'%s' parameter does not correctly specify a value greater than 1", CUSTOM_SUBDIVIDE_GRID_X );
+ }
+ else
+ {
+ mGridSize = ImageDimensions( subdivideX, mGridSize.GetY() );
+ }
+ }
- Property::Value* subdivideXValue = shaderMap.Find( CUSTOM_SUBDIVIDE_GRID_X );
- if( subdivideXValue )
- {
- int subdivideX;
- if( !subdivideXValue->Get( subdivideX ) || subdivideX < 1 )
- {
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify a value greater than 1", CUSTOM_SUBDIVIDE_GRID_X );
- }
- else
- {
- mGridSize = ImageDimensions( subdivideX, mGridSize.GetY() );
- }
- }
+ Property::Value* subdivideYValue = shaderMap.Find( CUSTOM_SUBDIVIDE_GRID_Y );
+ if( subdivideYValue )
+ {
+ int subdivideY;
+ if( !subdivideYValue->Get( subdivideY ) || subdivideY < 1 )
+ {
+ DALI_LOG_ERROR( "'%s' parameter does not correctly specify a value greater than 1", CUSTOM_SUBDIVIDE_GRID_Y );
+ }
+ else
+ {
+ mGridSize = ImageDimensions( mGridSize.GetX(), subdivideY );
+ }
+ }
- Property::Value* subdivideYValue = shaderMap.Find( CUSTOM_SUBDIVIDE_GRID_Y );
- if( subdivideYValue )
- {
- int subdivideY;
- if( !subdivideYValue->Get( subdivideY ) || subdivideY < 1 )
- {
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify a value greater than 1", CUSTOM_SUBDIVIDE_GRID_Y );
- }
- else
- {
- mGridSize = ImageDimensions( mGridSize.GetX(), subdivideY );
- }
- }
+ Property::Value* hintsValue = shaderMap.Find( CUSTOM_SHADER_HINTS );
+ if( hintsValue )
+ {
+ std::string hintString;
+ Property::Array hintsArray;
- Property::Value* hintsValue = shaderMap.Find( CUSTOM_SHADER_HINTS );
- if( hintsValue )
+ if( hintsValue->Get( hintString ) )
+ {
+ mHints = HintFromString( hintString );
+ }
+ else if( hintsValue->Get( hintsArray ) )
+ {
+ int hints = Shader::HINT_NONE;
+ for( Property::Array::SizeType i = 0; i < hintsArray.Count(); ++i)
{
- std::string hintString;
- Property::Array hintsArray;
-
- if( hintsValue->Get( hintString ) )
- {
- mHints = HintFromString( hintString );
- }
- else if( hintsValue->Get( hintsArray ) )
+ Property::Value hintValue = hintsArray[ i ];
+ if( hintValue.Get( hintString ) )
{
- int hints = Shader::HINT_NONE;
- for( Property::Array::SizeType i = 0; i < hintsArray.Count(); ++i)
- {
- Property::Value hintValue = hintsArray[ i ];
- if( hintValue.Get( hintString ) )
- {
- hints |= static_cast< int >( HintFromString( hintString ) );
- }
- else
- {
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify an hint string at index %d", CUSTOM_SHADER_HINTS, i );
- }
-
- mHints = static_cast< Shader::ShaderHints >( hints );
- }
+ hints |= static_cast< int >( HintFromString( hintString ) );
}
else
{
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify a hint string or an array of hint strings", CUSTOM_SHADER_HINTS );
+ DALI_LOG_ERROR( "'%s' parameter does not correctly specify an hint string at index %d", CUSTOM_SHADER_HINTS, i );
}
+
+ mHints = static_cast< Shader::ShaderHints >( hints );
}
}
else
{
- //use value with no type to mean reseting the shader back to default
- if( shaderValue->GetType() != Dali::Property::NONE )
- {
- DALI_LOG_ERROR( "'%s' parameter does not correctly specify a property map", CUSTOM_SHADER );
- }
+ DALI_LOG_ERROR( "'%s' parameter does not correctly specify a hint string or an array of hint strings", CUSTOM_SHADER_HINTS );
}
}
}