{
}
- Vector3 operator()(const Vector3& current)
+ void operator()( Vector3& current, const PropertyInputContainer& /* inputs */ )
{
- return mTarget;
+ current = mTarget;
}
Vector3 mTarget;
{
}
- Vector3 operator()(const Vector3& current, const PropertyInput& position)
+ void operator()( Vector3& current, const PropertyInputContainer& inputs )
{
-
- return position.GetVector3();
+ current = inputs[0]->GetVector3();
}
};
{
}
- Vector3 operator()(const Vector3& current)
+ void operator()( Vector3& current, const PropertyInputContainer& /* inputs */ )
{
- return mTarget * 2.0f;
+ current = mTarget * 2.0f;
}
Vector3 mTarget;
END_TEST;
}
-int UtcDaliShaderEffectMethodNew03(void)
-{
- TestApplication application;
-
- ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource, VertexSource, FragmentSource, ShaderEffect::HINT_NONE );
- DALI_TEST_CHECK(effect);
- END_TEST;
-}
-
int UtcDaliShaderEffectMethodNew04(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliShaderEffectMethodNew06(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::ShaderEffect::New() with shader sources for different geometry types");
-
- ShaderEffect effect = ShaderEffect::New( "imageVertexShader", "imageFragmentShader",
- "textVertexShader", "textFragmentShader",
- "texturedMeshVertexShader", "texturedMeshFragmentShader",
- "meshVertexShader", "meshFragmentShader",
- ShaderEffect::HINT_NONE );
- DALI_TEST_CHECK(effect);
- END_TEST;
-}
-
-
int UtcDaliShaderEffectMethodDownCast(void)
{
TestApplication application;
application.GetGlAbstraction().CheckUniformValue(
"uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
- Constraint constraint = Constraint::New<Vector3>( uVecProperty,
- TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
- effect.ApplyConstraint(constraint);
+ Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
+ constraint.Apply();
application.SendNotification();
application.Render();
Property::Index uVecProperty = effect.GetPropertyIndex("uVec3");
- Constraint constraint = Constraint::New<Vector3>( uVecProperty,
- Source(actor, Actor::Property::POSITION),
- TestConstraintFromPositionToVector3() );
-
- effect.ApplyConstraint(constraint);
+ Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintFromPositionToVector3() );
+ constraint.AddSource( Source( actor, Actor::Property::POSITION ) );
+ constraint.Apply();
application.SendNotification();
application.Render();
Property::Index uVecProperty = effect.GetPropertyIndex("uVec3");
- Constraint shaderConstraint = Constraint::New<Vector3>( uVecProperty,
- Source(actor, Actor::Property::POSITION),
- TestConstraintFromPositionToVector3() );
-
- effect.ApplyConstraint(shaderConstraint);
-
- Constraint actorConstraint = Constraint::New<Vector3>( Actor::Property::POSITION,
- TestConstraintToVector3Double(targetPosition) );
+ Constraint shaderConstraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintFromPositionToVector3() );
+ shaderConstraint.AddSource( Source(actor, Actor::Property::POSITION) );
+ shaderConstraint.Apply();
- actor.ApplyConstraint(actorConstraint);
+ Constraint actorConstraint = Constraint::New<Vector3>( actor, Actor::Property::POSITION, TestConstraintToVector3Double(targetPosition) );
+ actorConstraint.Apply();
application.SendNotification();
application.Render();
END_TEST;
}
-int UtcDaliShaderEffectMethodApplyConstraintCallback(void)
-{
- // Test whether Shader's uniform can be constrained to a stationary constraint.
- TestApplication application;
-
- ShaderEffect effect = ShaderEffect::New( VertexSource, FragmentSource );
- DALI_TEST_CHECK( effect );
-
- BufferImage image = CreateBufferImage();
-
- effect.SetUniform( "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) );
-
- ImageActor actor = ImageActor::New( image );
- actor.SetSize( 100.0f, 100.0f );
- actor.SetName("TestImageFilenameActor");
- actor.SetShaderEffect(effect);
- Stage::GetCurrent().Add(actor);
-
- Property::Index uVecProperty = effect.GetPropertyIndex("uVec3");
-
- application.SendNotification();
- application.Render();
-
- // Test effects of SetUniform...
- DALI_TEST_CHECK(
- application.GetGlAbstraction().CheckUniformValue(
- "uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
-
- Constraint constraint = Constraint::New<Vector3>( uVecProperty,
- TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
- constraint.SetApplyTime( 10.0f );
-
- bool constraintCheck( false );
- ConstraintAppliedCheck appliedCheck( constraintCheck );
-
- // We should receive the "Applied" signal after 10 seconds
- ActiveConstraint active = effect.ApplyConstraint(constraint);
- active.AppliedSignal().Connect( &application, appliedCheck );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>(1000.0f)); // 1 elapsed second
-
- // Check signal has not fired
- application.SendNotification();
- appliedCheck.CheckSignalNotReceived();
-
- application.Render(static_cast<unsigned int>(4000.0f)); // 5 elapsed seconds
-
- // Check signal has not fired
- application.SendNotification();
- appliedCheck.CheckSignalNotReceived();
-
- application.Render(static_cast<unsigned int>(5000.0f - 1.0f)); // <10 elapsed seconds
-
- // Check signal has not fired
- application.SendNotification();
- appliedCheck.CheckSignalNotReceived();
-
- application.Render(static_cast<unsigned int>(2.0f)); // >10 elapsed seconds
-
- // Signal should have fired
- application.SendNotification();
- appliedCheck.CheckSignalReceived();
-
- // Test effects of Constraint.
- DALI_TEST_CHECK(
- application.GetGlAbstraction().CheckUniformValue(
- "uVec3", Vector3( 4.0f, 9.0f, 16.0f ) ) );
- END_TEST;
-}
-
int UtcDaliShaderEffectMethodRemoveConstraints(void)
{
// Test if constrains can be removed before they are ever applyed.
application.GetGlAbstraction().CheckUniformValue(
"uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
- Constraint constraint = Constraint::New<Vector3>( uVecProperty,
- TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
- effect.ApplyConstraint(constraint);
+ Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
+ constraint.Apply();
// Remove the constraints
effect.RemoveConstraints();
application.GetGlAbstraction().CheckUniformValue(
"uVec3", Vector3( 1.0f, 2.0f, 3.0f ) ) );
- Constraint constraint = Constraint::New<Vector3>( uVecProperty,
- TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
-
- effect.ApplyConstraint(constraint);
+ Constraint constraint = Constraint::New<Vector3>( effect, uVecProperty, TestConstraintToVector3(Vector3(4.0f, 9.0f, 16.0f)) );
+ constraint.Apply();
application.SendNotification();
application.Render();
Property::IndexContainer indices;
effect.GetPropertyIndices( indices );
- DALI_TEST_CHECK( ! indices.empty() );
- DALI_TEST_EQUALS( indices.size(), effect.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK( indices.Size() );
+ DALI_TEST_EQUALS( indices.Size(), effect.GetPropertyCount(), TEST_LOCATION );
END_TEST;
}
END_TEST;
}
-int UtcDaliShaderEffectFromProperties01(void)
+int UtcDaliShaderEffectFromPropertiesP(void)
{
TestApplication application;
tet_infoline("UtcDaliShaderEffectFromProperties01()");
ShaderEffect effect = ShaderEffect::DownCast( typeInfo.CreateInstance() );
DALI_TEST_CHECK( effect );
- Property::Value programMap = Property::Value(Property::MAP);
+ Property::Value programValue = Property::Value(Property::MAP);
+ Property::Map* programMap = programValue.GetMap();
+ DALI_TEST_CHECK( programMap );
- programMap.SetValue("vertex", vertexShader);
- programMap.SetValue("fragment", fragmentShader);
+ programMap->Insert("vertex", vertexShader);
+ programMap->Insert("fragment", fragmentShader);
- programMap.SetValue("vertex-prefix", vertexShaderPrefix);
- programMap.SetValue("fragment-prefix", fragmentShaderPrefix);
+ programMap->Insert("vertex-prefix", vertexShaderPrefix);
+ programMap->Insert("fragment-prefix", fragmentShaderPrefix);
- programMap.SetValue("geometry-type", "GEOMETRY_TYPE_IMAGE");
+ programMap->Insert("geometry-type", "GEOMETRY_TYPE_IMAGE");
- effect.SetProperty(effect.GetPropertyIndex("program"), programMap);
+ effect.SetProperty(effect.GetPropertyIndex("program"), programValue);
- Property::Value imageMap = Property::Value(Property::MAP);
- imageMap.SetValue("filename", Property::Value(TestImageFilename));
- effect.SetProperty(effect.GetPropertyIndex("image"), imageMap);
+ Property::Value imageValue = Property::Value(Property::MAP);
+ Property::Map* imageMap = imageValue.GetMap();
+ DALI_TEST_CHECK( imageMap );
+ imageMap->Insert("filename", Property::Value(TestImageFilename));
+ effect.SetProperty(effect.GetPropertyIndex("image"), imageValue);
// do a update & render to get the image request
application.SendNotification();
END_TEST;
}
-int UtcDaliShaderEffectFromProperties02(void)
+int UtcDaliShaderEffectFromPropertiesN(void)
{
try
{
// Call render to compile default shaders.
application.SendNotification();
application.Render();
- application.Render();
- application.Render();
// create from type registry (currently only way to get ShaderEffect with no shader setup in constructor
TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ShaderEffect" );
ShaderEffect effect = ShaderEffect::DownCast( typeInfo.CreateInstance() );
DALI_TEST_CHECK( effect );
- Property::Value programMap = Property::Value(Property::MAP);
-
- programMap.SetValue("vertex", std::string(VertexSource));
- programMap.SetValue("fragment", std::string(FragmentSource));
+ Property::Value programValue = Property::Value(Property::MAP);
+ Property::Map* programMap = programValue.GetMap();
+ DALI_TEST_CHECK( programMap );
- // programMap.SetValue("geometry-type", "GEOMETRY_TYPE_IMAGE");
- // dont set by value
- programMap.SetValue("geometry-type", GeometryType( GEOMETRY_TYPE_IMAGE ));
+ programMap->Insert("vertex", std::string(VertexSource));
+ programMap->Insert("fragment", std::string(FragmentSource));
- effect.SetProperty(effect.GetPropertyIndex("program"), programMap);
+ // use wrong index on purpose
+ effect.SetProperty(effect.GetPropertyIndex("program") + 1, programValue );
tet_result( TET_FAIL );
}
END_TEST;
}
-int UtcDaliShaderEffectFromProperties03(void)
+int UtcDaliShaderEffectFromProperties2N(void)
{
try
{
// Call render to compile default shaders.
application.SendNotification();
application.Render();
- application.Render();
- application.Render();
// create from type registry (currently only way to get ShaderEffect with no shader setup in constructor
TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "ShaderEffect" );