We were previously using a mixture of BLEND and BLENDING in enums.
The order of the BLEND_FACTOR enums & string names was also inconsistent.
As a rule of thumb always use Blend & BLEND for namespaces & enums/constants
(not Blending or BLENDING)
Change-Id: I464f9471dd6fdd4f865a2c1362a7c874fc3c315c
Property::Map* resultMap = propValue.GetMap();
DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "color" );
- DALI_TEST_CHECK( resultMap->Find( "blendColor" ) );
- DALI_TEST_CHECK( resultMap->Find( "blendColor" )->Get<Vector4>() == Color::RED );
+ DALI_TEST_CHECK( resultMap->Find( "mixColor" ) );
+ DALI_TEST_CHECK( resultMap->Find( "mixColor" )->Get<Vector4>() == Color::RED );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION );
propValue = control.GetProperty( Control::Property::BACKGROUND );
resultMap = propValue.GetMap();
- DALI_TEST_CHECK( resultMap->Find( "blendColor" ) );
- DALI_TEST_CHECK( resultMap->Find( "blendColor" )->Get<Vector4>() == Color::YELLOW );
+ DALI_TEST_CHECK( resultMap->Find( "mixColor" ) );
+ DALI_TEST_CHECK( resultMap->Find( "mixColor" )->Get<Vector4>() == Color::YELLOW );
DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::YELLOW, TEST_LOCATION );
Property::Map rendererMap;
rendererMap["rendererType"] = "color";
- rendererMap["blendColor"] = Color::CYAN;
+ rendererMap["mixColor"] = Color::CYAN;
control.SetProperty( Control::Property::BACKGROUND, rendererMap );
propValue = control.GetProperty( Control::Property::BACKGROUND );
resultMap = propValue.GetMap();
DALI_TEST_CHECK( resultMap->Find( "rendererType" ) );
DALI_TEST_CHECK( resultMap->Find( "rendererType" )->Get<std::string>() == "color" );
- DALI_TEST_CHECK( resultMap->Find( "blendColor" ) );
- DALI_TEST_CHECK( resultMap->Find( "blendColor" )->Get<Vector4>() == Color::CYAN );
+ DALI_TEST_CHECK( resultMap->Find( "mixColor" ) );
+ DALI_TEST_CHECK( resultMap->Find( "mixColor" )->Get<Vector4>() == Color::CYAN );
Property::Map emptyMap;
control.SetProperty( Control::Property::BACKGROUND, emptyMap );
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert("rendererType", "color");
- propertyMap.Insert("blendColor", Color::BLUE);
+ propertyMap.Insert("mixColor", Color::BLUE);
ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
ControlRenderer controlRendererCopy( controlRenderer );
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert("rendererType", "color");
- propertyMap.Insert("blendColor", Color::BLUE);
+ propertyMap.Insert("mixColor", Color::BLUE);
ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
controlRenderer.SetDepthIndex( 1.f );
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert("rendererType", "color");
- propertyMap.Insert("blendColor", Color::BLUE);
+ propertyMap.Insert("mixColor", Color::BLUE);
ControlRenderer controlRenderer = factory.GetControlRenderer( propertyMap );
Actor actor = Actor::New();
RendererFactory factory = RendererFactory::Get();
Property::Map propertyMap;
propertyMap.Insert("rendererType", "color");
- propertyMap.Insert("blendColor", Color::BLUE);
+ propertyMap.Insert("mixColor", Color::BLUE);
ControlRenderer colorRenderer = factory.GetControlRenderer( propertyMap );
Property::Map resultMap;
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( typeValue->Get<std::string>() == "color" );
- Property::Value* colorValue = resultMap.Find( "blendColor", Property::VECTOR4 );
+ Property::Value* colorValue = resultMap.Find( "mixColor", Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::BLUE );
factory.ResetRenderer( colorRenderer, actor, Color::CYAN );
colorRenderer.CreatePropertyMap( resultMap );
- colorValue = resultMap.Find( "blendColor", Property::VECTOR4 );
+ colorValue = resultMap.Find( "mixColor", Property::VECTOR4 );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
// Test that color renderer is replaced with debug renderer
Property::Map propertyMap1;
propertyMap1.Insert("rendererType", "color");
- propertyMap1.Insert("blendColor", Color::BLUE);
+ propertyMap1.Insert("mixColor", Color::BLUE);
ControlRenderer colorRenderer = factory.GetControlRenderer(propertyMap1);
DALI_TEST_CHECK( colorRenderer );
DALI_TEST_CHECK( IsDebugRenderer( colorRenderer ) );
application.SendNotification();
application.Render();
- // conventional alpha blending
+ // conventional alpha blending
Renderer renderer = imageView.GetRendererAt( 0 );
- BlendingFactor::Type srcFactorRgb;
- BlendingFactor::Type destFactorRgb;
- BlendingFactor::Type srcFactorAlpha;
- BlendingFactor::Type destFactorAlpha;
- renderer.GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
- DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::SRC_ALPHA );
- DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
- DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
- DALI_TEST_CHECK( destFactorAlpha == BlendingFactor::ONE_MINUS_SRC_ALPHA );
-
Property::Value value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
bool enable;
DALI_TEST_CHECK( value.Get( enable ) );
application.SendNotification();
application.Render();
- renderer.GetBlendFunc(srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha);
+ int srcFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+ int destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+ int srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+ int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
DALI_TEST_CHECK( srcFactorRgb == BlendingFactor::ONE );
DALI_TEST_CHECK( destFactorRgb == BlendingFactor::ONE_MINUS_SRC_ALPHA );
DALI_TEST_CHECK( srcFactorAlpha == BlendingFactor::ONE );
Property::Map propertyMap;
Vector4 testColor( 1.f, 0.5f, 0.3f, 0.2f );
propertyMap.Insert("rendererType", "color");
- propertyMap.Insert("blendColor", testColor);
+ propertyMap.Insert("mixColor", testColor);
ControlRenderer controlRenderer = factory.GetControlRenderer(propertyMap);
DALI_TEST_CHECK( controlRenderer );
Vector4 actualValue(Vector4::ZERO);
TestGlAbstraction& gl = application.GetGlAbstraction();
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "blendColor", actualValue ) );
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
DALI_TEST_EQUALS( actualValue, testColor, TEST_LOCATION );
END_TEST;
Vector4 actualValue(Vector4::ZERO);
TestGlAbstraction& gl = application.GetGlAbstraction();
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "blendColor", actualValue ) );
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
DALI_TEST_EQUALS( actualValue, testColor, TEST_LOCATION );
controlRenderer.SetOffStage( actor );
controlRenderer.SetOnStage( actor );
DALI_TEST_CHECK( actor.GetRendererCount() == 1u );
- int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLENDING_MODE );
+ int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
TestGlAbstraction& gl = application.GetGlAbstraction();
application.SendNotification();
application.Render(0);
- int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLENDING_MODE );
+ int blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::AUTO, TEST_LOCATION );
Vector4 actualColor(Vector4::ZERO);
application.SendNotification();
application.Render(0);
- blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLENDING_MODE );
+ blendMode = actor.GetRendererAt(0u).GetProperty<int>( Renderer::Property::BLEND_MODE );
DALI_TEST_EQUALS( static_cast<BlendingMode::Type>(blendMode), BlendingMode::ON, TEST_LOCATION );
END_TEST;
Vector4 actualValue(Vector4::ZERO);
TestGlAbstraction& gl = application.GetGlAbstraction();
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "blendColor", actualValue ) );
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
DALI_TEST_EQUALS( actualValue, Color::RED, TEST_LOCATION );
factory.ResetRenderer( controlRenderer, actor, Color::GREEN );
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "blendColor", actualValue ) );
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
Image bufferImage = CreateBufferImage( 100, 200, Vector4( 1.f, 1.f, 1.f, 1.f ) );
application.SendNotification();
application.Render(0);
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "blendColor", actualValue ) );
+ DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "mixColor", actualValue ) );
DALI_TEST_EQUALS( actualValue, Color::RED, TEST_LOCATION );
END_TEST;
if( mRenderer )
{
mRenderer.SetGeometry( mMesh );
- mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, Renderer::DEPTH_WRITE_ON );
+ mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
}
}
}
{
mRenderer.SetTextures( mTextureSet );
mRenderer.SetShader( mShader );
- mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, Renderer::CULL_NONE);
+ mRenderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
}
UpdateShaderUniforms();
}
renderer.SetTextures( textureSet );
- renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, Renderer::DEPTH_WRITE_ON );
+ renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
actor.AddRenderer( renderer );
}
}
mBorderColorIndex = (mImpl->mRenderer).RegisterProperty( COLOR_NAME, mBorderColor );
if( mBorderColor.a < 1.f || mAntiAliasing)
{
- mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
mBorderSizeIndex = (mImpl->mRenderer).RegisterProperty( SIZE_NAME, mBorderSize );
}
(mImpl->mRenderer).SetProperty( mBorderColorIndex, color );
if( color.a < 1.f )
{
- mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
}
}
mImpl->mRenderer.SetShader( borderShader );
if( mAntiAliasing )
{
- mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
}
}
namespace
{
-const char * const COLOR_NAME("blendColor");
+const char * const COLOR_NAME("mixColor");
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
- uniform lowp vec4 blendColor;\n
+ uniform lowp vec4 mixColor;\n
\n
void main()\n
{\n
- gl_FragColor = blendColor*uColor;\n
+ gl_FragColor = mixColor*uColor;\n
}\n
);
}
ColorRenderer::ColorRenderer( RendererFactoryCache& factoryCache )
: ControlRenderer( factoryCache ),
- mBlendColorIndex( Property::INVALID_INDEX )
+ mMixColorIndex( Property::INVALID_INDEX )
{
}
void ColorRenderer::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
Property::Value* color = propertyMap.Find( COLOR_NAME );
- if( !( color && color->Get(mBlendColor) ) )
+ if( !( color && color->Get(mMixColor) ) )
{
DALI_LOG_ERROR( "Fail to provide a color to the ColorRenderer object" );
}
{
map.Clear();
map.Insert( RENDERER_TYPE, COLOR_RENDERER );
- map.Insert( COLOR_NAME, mBlendColor );
+ map.Insert( COLOR_NAME, mMixColor );
}
void ColorRenderer::InitializeRenderer()
mImpl->mRenderer = Renderer::New( geometry, shader );
- mBlendColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mBlendColor );
- if( mBlendColor.a < 1.f )
+ mMixColorIndex = mImpl->mRenderer.RegisterProperty( COLOR_NAME, mMixColor );
+ if( mMixColor.a < 1.f )
{
- mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
}
void ColorRenderer::SetColor(const Vector4& color)
{
- mBlendColor = color;
+ mMixColor = color;
if( mImpl->mRenderer )
{
- (mImpl->mRenderer).SetProperty( mBlendColorIndex, color );
+ (mImpl->mRenderer).SetProperty( mMixColorIndex, color );
if( color.a < 1.f )
{
- mImpl->mRenderer.SetProperty( Renderer::Property::BLENDING_MODE, BlendingMode::ON );
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
}
}
}
*
* | %Property Name | Type |
* |-----------------|-------------|
- * | blendColor | VECTOR4 |
+ * | mixColor | VECTOR4 |
*/
class ColorRenderer: public ControlRenderer
{
private:
- Vector4 mBlendColor;
- Property::Index mBlendColorIndex;
+ Vector4 mMixColor;
+ Property::Index mMixColorIndex;
};
void Clipper::OnStageConnect( Dali::Actor actor )
{
Renderer renderer = mImageActor.GetRendererAt(0);
- renderer.SetBlendFunc(BlendingFactor::ONE, BlendingFactor::ONE_MINUS_SRC_ALPHA,
- BlendingFactor::ONE, BlendingFactor::ONE);
+ renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE );
+ renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_SRC_ALPHA );
+ renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE );
+ renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE );
}
Clipper::Clipper()
Shader shader( mGlyphManager.GetShader( meshRecord.mAtlasId ) );
Dali::Renderer renderer = Dali::Renderer::New( quadGeometry, shader );
renderer.SetTextures( textureSet );
- renderer.SetProperty( Dali::Renderer::Property::BLENDING_MODE, BlendingMode::ON );
+ renderer.SetProperty( Dali::Renderer::Property::BLEND_MODE, BlendMode::ON );
renderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, DepthIndex::CONTENT + mDepth );
Actor actor = Actor::New();
#if defined(DEBUG_ENABLED)
DALI_TYPE_REGISTRATION_END()
-const char * const COLOR_RENDERER_COLOR_NAME("blendColor");
-
} // unnamed namespace
namespace Internal
: mControlImpl( controlImpl ),
mStyleName(""),
mBackgroundRenderer(),
+ mBackgroundColor(Color::TRANSPARENT),
mStartingPinchScale( NULL ),
mKeyEventSignal(),
mPinchGestureDetector(),
Control& mControlImpl;
std::string mStyleName;
Toolkit::ControlRenderer mBackgroundRenderer; ///< The control renderer to render the background
+ Vector4 mBackgroundColor; ///< The color of the background renderer
Vector3* mStartingPinchScale; ///< The scale when a pinch gesture starts, TODO: consider removing this
Toolkit::Control::KeyEventSignalType mKeyEventSignal;
Toolkit::Control::KeyInputFocusSignalType mKeyInputFocusGainedSignal;
void Control::SetBackgroundColor( const Vector4& color )
{
+ mImpl->mBackgroundColor = color;
+
Actor self( Self() );
Toolkit::RendererFactory factory = Toolkit::RendererFactory::Get();
factory.ResetRenderer( mImpl->mBackgroundRenderer, self, color );
Vector4 Control::GetBackgroundColor() const
{
- if( mImpl->mBackgroundRenderer && ( &typeid( GetImplementation(mImpl->mBackgroundRenderer) ) == &typeid( ColorRenderer ) ) )
- {
- Property::Map map;
- mImpl->mBackgroundRenderer.CreatePropertyMap( map );
- const Property::Value* colorValue = map.Find( COLOR_RENDERER_COLOR_NAME );
- Vector4 color;
- if( colorValue && colorValue->Get(color))
- {
- return color;
- }
- }
-
- return Color::TRANSPARENT;
+ return mImpl->mBackgroundColor;
}
void Control::SetBackground(const Property::Map& map)
| Property Name | Type | Required | Description |
|---------------|:-------:|:--------:|---------------------------|
-| blendColor | VECTOR4 | Yes | The solid color required. |
+| mixColor | VECTOR4 | Yes | The solid color required. |
### Usage
Dali::Property::Map map;
map[ "rendererType" ] = "color";
-map[ "blendColor" ] = Color::RED;
+map[ "mixColor" ] = Color::RED;
control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
~~~
control.background =
{
rendererType : "color",
- blendColor : dali.COLOR_RED
+ mixColor : dali.COLOR_RED
};
~~~
___________________________________________________________________________________________________
{ "SAMPLING_MODE_NO_FILTER", SamplingMode::NO_FILTER },
{ "SAMPLING_MODE_DONT_CARE", SamplingMode::DONT_CARE },
- { "BLEND_FACTOR_ZERO", BlendingFactor::ZERO },
- { "BLEND_FACTOR_ONE", BlendingFactor::ONE },
- { "BLEND_FACTOR_SRC_COLOR", BlendingFactor::SRC_COLOR },
- { "BLEND_FACTOR_ONE_MINUS_SRC_COLOR", BlendingFactor::ONE_MINUS_SRC_COLOR },
- { "BLEND_FACTOR_SRC_ALPHA", BlendingFactor::SRC_ALPHA },
- { "BLEND_FACTOR_ONE_MINUS_SRC_ALPHA", BlendingFactor::ONE_MINUS_SRC_ALPHA },
- { "BLEND_FACTOR_DST_ALPHA", BlendingFactor::DST_ALPHA },
- { "BLEND_FACTOR_ONE_MINUS_DST_ALPHA", BlendingFactor::ONE_MINUS_DST_ALPHA },
- { "BLEND_FACTOR_DST_COLOR", BlendingFactor::DST_COLOR },
- { "BLEND_FACTOR_ONE_MINUS_DST_COLOR", BlendingFactor::ONE_MINUS_DST_COLOR },
- { "BLEND_FACTOR_SRC_ALPHA_SATURATE", BlendingFactor::SRC_ALPHA_SATURATE },
- { "BLEND_FACTOR_CONSTANT_COLOR", BlendingFactor::CONSTANT_COLOR },
- { "BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR", BlendingFactor::ONE_MINUS_CONSTANT_COLOR },
- { "BLEND_FACTOR_CONSTANT_ALPHA" , BlendingFactor::CONSTANT_ALPHA },
- { "BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA", BlendingFactor::ONE_MINUS_CONSTANT_ALPHA },
-
- { "BLENDING_OFF", BlendingMode::OFF },
- { "BLENDING_AUTO", BlendingMode::AUTO },
- { "BLENDING_ON", BlendingMode::ON },
-
- { "BLEND_EQUATION_ADD", BlendingEquation::ADD },
- { "BLEND_EQUATION_SUBTRACT", BlendingEquation::SUBTRACT },
- { "BLEND_EQUATION_REVERSE_SUBTRACT", BlendingEquation::REVERSE_SUBTRACT },
+ { "BLEND_FACTOR_ZERO", BlendFactor::ZERO },
+ { "BLEND_FACTOR_ONE", BlendFactor::ONE },
+ { "BLEND_FACTOR_SRC_COLOR", BlendFactor::SRC_COLOR },
+ { "BLEND_FACTOR_ONE_MINUS_SRC_COLOR", BlendFactor::ONE_MINUS_SRC_COLOR },
+ { "BLEND_FACTOR_SRC_ALPHA", BlendFactor::SRC_ALPHA },
+ { "BLEND_FACTOR_ONE_MINUS_SRC_ALPHA", BlendFactor::ONE_MINUS_SRC_ALPHA },
+ { "BLEND_FACTOR_DST_ALPHA", BlendFactor::DST_ALPHA },
+ { "BLEND_FACTOR_ONE_MINUS_DST_ALPHA", BlendFactor::ONE_MINUS_DST_ALPHA },
+ { "BLEND_FACTOR_DST_COLOR", BlendFactor::DST_COLOR },
+ { "BLEND_FACTOR_ONE_MINUS_DST_COLOR", BlendFactor::ONE_MINUS_DST_COLOR },
+ { "BLEND_FACTOR_SRC_ALPHA_SATURATE", BlendFactor::SRC_ALPHA_SATURATE },
+ { "BLEND_FACTOR_CONSTANT_COLOR", BlendFactor::CONSTANT_COLOR },
+ { "BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR", BlendFactor::ONE_MINUS_CONSTANT_COLOR },
+ { "BLEND_FACTOR_CONSTANT_ALPHA" , BlendFactor::CONSTANT_ALPHA },
+ { "BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA", BlendFactor::ONE_MINUS_CONSTANT_ALPHA },
+
+ { "BLEND_MODE_OFF", BlendMode::OFF },
+ { "BLEND_MODE_AUTO", BlendMode::AUTO },
+ { "BLEND_MODE_ON", BlendMode::ON },
+
+ { "BLEND_EQUATION_ADD", BlendEquation::ADD },
+ { "BLEND_EQUATION_SUBTRACT", BlendEquation::SUBTRACT },
+ { "BLEND_EQUATION_REVERSE_SUBTRACT", BlendEquation::REVERSE_SUBTRACT },
{ "CAMERA_FREE_LOOK" , Camera::FREE_LOOK },
{ "CAMERA_LOOK_AT_TARGET" , Camera::LOOK_AT_TARGET },
{ "WRAP_MODE_REPEAT", WrapMode::REPEAT },
{ "WRAP_MODE_MIRRORED_REPEAT", WrapMode::MIRRORED_REPEAT },
- { "RENDERER_CULL_NONE", Renderer::CULL_NONE },
- { "RENDERER_CULL_BACK", Renderer::CULL_BACK },
- { "RENDERER_CULL_FRONT", Renderer::CULL_FRONT },
- { "RENDERER_CULL_BACK_AND_FRONT", Renderer::CULL_BACK_AND_FRONT },
+ { "FACE_CULLING_NONE", FaceCullingMode::NONE },
+ { "FACE_CULLING_BACK", FaceCullingMode::BACK },
+ { "FACE_CULLING_FRONT", FaceCullingMode::FRONT },
+ { "FACE_CULLING_FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK },
- { "RENDERER_DEPTH_WRITE_OFF", Renderer::DEPTH_WRITE_OFF },
- { "RENDERER_DEPTH_WRITE_AUTO", Renderer::DEPTH_WRITE_AUTO },
- { "RENDERER_DEPTH_WRITE_ON", Renderer::DEPTH_WRITE_ON },
+ { "DEPTH_WRITE_OFF", DepthWriteMode::OFF },
+ { "DEPTH_WRITE_AUTO", DepthWriteMode::AUTO },
+ { "DEPTH_WRITE_ON", DepthWriteMode::ON },
{ "GEOMETRY_POINTS", Geometry::POINTS },
{ "GEOMETRY_LINES", Geometry::LINES },
args.GetReturnValue().Set( localObject );
}
-/**
- * Specify the pixel arithmetic used when the actor is blended.
- *
- * @for Renderer
- * @method setBlendFunc
- * @param {integer} srcFactorRgb Source Blending RGB
- * @param {integer} destFactorRgb Destination Blending RGB
- * @param {integer} srcFactorAlpha Source Blending Alpha
- * @param {integer} destFactorAlpha Destination Blending Alpha
- * @example
- * //blending constants
- * dali.BLEND_FACTOR_ZERO
- * dali.BLEND_FACTOR_ONE
- * dali.BLEND_FACTOR_SRC_COLOR
- * dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR
- * dali.BLEND_FACTOR_SRC_ALPHA
- * dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
- * dali.BLEND_FACTOR_DST_ALPHA
- * dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA
- * dali.BLEND_FACTOR_DST_COLOR
- * dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR
- * dali.BLEND_FACTOR_SRC_ALPHA_SATURATE
- * dali.BLEND_FACTOR_CONSTANT_COLOR
- * dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR
- * dali.BLEND_FACTOR_CONSTANT_ALPHA
- * dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA
- *
- * renderer.setBlendFunc( dali.BLEND_FACTOR_CONSTANT_COLOR, dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR,
- * dali.BLEND_FACTOR_CONSTANT_ALPHA, dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA );
- */
-void RendererApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- Renderer renderer = GetRenderer( isolate, args );
-
- int params[4];
- bool foundAllParams(false);
- V8Utils::ReadIntegerArguments( foundAllParams, ¶ms[0], 4, args, 0 );
- if( foundAllParams )
- {
- renderer.SetBlendFunc( static_cast< Dali::BlendingFactor::Type>(params[0]),
- static_cast< Dali::BlendingFactor::Type>(params[1]),
- static_cast< Dali::BlendingFactor::Type>(params[2]),
- static_cast< Dali::BlendingFactor::Type>(params[3]) );
- }
- else
- {
- DALI_SCRIPT_EXCEPTION( isolate, "invalid blendFunc parameter");
- }
-}
-
-/**
- * Query the pixel arithmetic used when the actor is blended.
- *
- * @for Renderer
- * @method getBlendFunc
- * @return {Object} Blend properties
- * @example Blend properties object has 4 fields
- *
- * blendProperties.sourceRgb // source rgb enum
- * blendProperties.destinationRgb // destination rgb enum
- * blendProperties.sourceAlpha source // alpha enum
- * blendProperties.destinationAlpha // destination alpha enum
- */
-void RendererApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- // Pass by reference doesn't work in Javascript
- // For now just return a vector 4...
-
- BlendingFactor::Type srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha;
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- Renderer renderer = GetRenderer( isolate, args );
-
- renderer.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-
- v8::Local<v8::Object> blendProperties = v8::Object::New( isolate );
-
- blendProperties->Set( v8::String::NewFromUtf8( isolate, "sourceRgb" ), v8::Integer::New( isolate, srcFactorRgb) );
- blendProperties->Set( v8::String::NewFromUtf8( isolate, "destinationRgb" ), v8::Integer::New( isolate, destFactorRgb ) );
- blendProperties->Set( v8::String::NewFromUtf8( isolate, "sourceAlpha" ), v8::Integer::New( isolate, srcFactorAlpha ) );
- blendProperties->Set( v8::String::NewFromUtf8( isolate, "destinationAlpha" ), v8::Integer::New( isolate, destFactorAlpha ) );
-
- args.GetReturnValue().Set( blendProperties );
-}
-
-/**
- * Specify the equation used when the actor is blended.
- *
- * @for Renderer
- * @method setBlendEquation
- * @param { integer } equationRgb The equation used for combining red, green, and blue components.
- * @param { integer } equationAlpha The equation used for combining the alpha component.
- * @example
- * // blend equation is one of the following
- * dali.BLEND_EQUATION_ADD
- * dali.BLEND_EQUATION_SUBTRACT
- * dali.BLEND_EQUATION_REVERSE_SUBTRACT
- *
- * renderer.setBlendEquation( dali.BLEND_EQUATION_ADD, dali.BLEND_EQUATION_REVERSE_SUBTRACT );
- */
-void RendererApi::SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- Renderer renderer = GetRenderer( isolate, args );
-
- int params[2];
- bool foundAllParams(false);
- V8Utils::ReadIntegerArguments( foundAllParams, ¶ms[0], 2, args, 0 );
- if( foundAllParams )
- {
- renderer.SetBlendEquation( static_cast< BlendingEquation::Type>(params[0]), static_cast< BlendingEquation::Type>(params[1]) );
- }
- else
- {
- DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendEquation parameter");
- }
-}
-
-/**
- * Query the equation used when the actor is blended.
- *
- * @for Renderer
- * @method getBlendEquation
- * @return {Object} Blend equations
- * @example Blend equations object has 2 fields
- *
- * blendEquations.equationRgb // equation used for combining rgb components
- * blendEquations.equationAlpha // equation used for combining alpha components
- */
-void RendererApi::GetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args )
-{
- // Pass by reference doesn't work in Javascript
- // For now just return a vector 2...
-
- BlendingEquation::Type equationRgb, equationAlpha;
- v8::Isolate* isolate = args.GetIsolate();
- v8::HandleScope handleScope( isolate );
-
- Renderer renderer = GetRenderer( isolate, args );
-
- renderer.GetBlendEquation( equationRgb, equationAlpha );
-
- v8::Local<v8::Object> blendEquations = v8::Object::New( isolate );
-
- blendEquations->Set( v8::String::NewFromUtf8( isolate, "equationRgb" ), v8::Integer::New( isolate, equationRgb) );
- blendEquations->Set( v8::String::NewFromUtf8( isolate, "equationAlpha" ), v8::Integer::New( isolate, equationAlpha ) );
-
- args.GetReturnValue().Set( blendEquations );
-}
-
} // namespace V8Plugin
} // namespace Dali