Submitting small changes to tizen branch so all demos don't break straight away.
Change-Id: I2b381ec30528f44dedb437ebfd65ac4497ccc229
typedef SceneGraph::Constraint< PropertyType, PropertyAccessor<PropertyType> > SceneGraphConstraint;
typedef const SceneGraph::AnimatableProperty<PropertyType>* ScenePropertyPtr;
typedef typename PropertyConstraintPtr<PropertyType>::Type ConstraintFunctionPtr;
- typedef boost::function< PropertyType (const PropertyType&, const PropertyType&, float) > InterpolatorFunction;
/**
* Construct a new active-constraint.
* @param[in] targetIndex The index of the property to constrain.
* @param[in] sources The sources of the input properties passed to func.
* @param[in] func The constraint function.
- * @param[in] interpolator The interpolator function.
* @return A newly allocated active-constraint.
*/
static ActiveConstraintBase* New( Property::Index targetIndex,
SourceContainer& sources,
- ConstraintFunctionPtr func,
- InterpolatorFunction interpolator )
+ ConstraintFunctionPtr func )
{
ThreadLocalStorage& tls = ThreadLocalStorage::Get();
- return new ActiveConstraint< PropertyType >( tls.GetEventToUpdate(), targetIndex, sources, sources.size(), func, interpolator );
+ return new ActiveConstraint< PropertyType >( tls.GetEventToUpdate(), targetIndex, sources, sources.size(), func );
}
/**
mTargetIndex,
mSources,
mSourceCount,
- funcPtr,
- mInterpolatorFunction );
+ funcPtr );
clone->SetAlphaFunction(mAlphaFunction);
clone->SetRemoveAction(mRemoveAction);
Property::Index targetIndex,
SourceContainer& sources,
unsigned int sourceCount,
- ConstraintFunctionPtr& func,
- InterpolatorFunction& interpolator )
+ ConstraintFunctionPtr& func )
: ActiveConstraintBase( eventToUpdate, targetIndex, sources, sourceCount ),
mTargetIndex( targetIndex ),
- mUserFunction( func ),
- mInterpolatorFunction( interpolator )
+ mUserFunction( func )
{
}
SceneGraph::ConstraintBase* sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty,
propertyOwners,
func,
- mInterpolatorFunction,
mCustomWeight );
DALI_ASSERT_DEBUG( NULL != sceneGraphConstraint );
sceneGraphConstraint->SetInitialWeight( mOffstageWeight );
Property::Index mTargetIndex;
ConstraintFunctionPtr mUserFunction;
- InterpolatorFunction mInterpolatorFunction;
};
/**
public:
typedef typename PropertyConstraintPtr<float>::Type ConstraintFunctionPtr;
- typedef boost::function< float (const float&, const float&, float) > InterpolatorFunction;
/**
* Construct a new active-constraint.
* @param[in] targetIndex The index of the property to constrain.
* @param[in] sources The sources of the input properties passed to func.
* @param[in] func The constraint function.
- * @param[in] interpolator The interpolator function.
* @return A newly allocated active-constraint.
*/
static ActiveConstraintBase* New( Property::Index targetIndex,
SourceContainer& sources,
- ConstraintFunctionPtr func,
- InterpolatorFunction interpolator )
+ ConstraintFunctionPtr func )
{
ThreadLocalStorage& tls = ThreadLocalStorage::Get();
- return new ActiveConstraint< float >( tls.GetEventToUpdate(), targetIndex, sources, sources.size(), func, interpolator );
+ return new ActiveConstraint< float >( tls.GetEventToUpdate(), targetIndex, sources, sources.size(), func );
}
/**
mTargetIndex,
mSources,
mSourceCount,
- funcPtr,
- mInterpolatorFunction );
+ funcPtr );
clone->SetAlphaFunction(mAlphaFunction);
clone->SetRemoveAction(mRemoveAction);
Property::Index targetIndex,
SourceContainer& sources,
unsigned int sourceCount,
- ConstraintFunctionPtr& func,
- InterpolatorFunction& interpolator )
+ ConstraintFunctionPtr& func )
: ActiveConstraintBase( eventToUpdate, targetIndex, sources, sourceCount ),
mTargetIndex( targetIndex ),
- mUserFunction( func ),
- mInterpolatorFunction( interpolator )
+ mUserFunction( func )
{
}
sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty,
propertyOwners,
func,
- mInterpolatorFunction,
mCustomWeight );
}
else
if ( 0 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorX<Vector3> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mInterpolatorFunction, mCustomWeight );
+ sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mCustomWeight );
}
else if ( 1 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorY<Vector3> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mInterpolatorFunction, mCustomWeight );
+ sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mCustomWeight );
}
else if ( 2 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorZ<Vector3> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mInterpolatorFunction, mCustomWeight );
+ sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mCustomWeight );
}
}
else if ( PropertyTypes::Get< Vector4 >() == targetProperty->GetType() )
if ( 0 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorX<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mInterpolatorFunction, mCustomWeight );
+ sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mCustomWeight );
}
else if ( 1 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorY<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mInterpolatorFunction, mCustomWeight );
+ sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mCustomWeight );
}
else if ( 2 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorZ<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mInterpolatorFunction, mCustomWeight );
+ sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mCustomWeight );
}
else if ( 3 == componentIndex )
{
typedef SceneGraph::Constraint< float, PropertyComponentAccessorW<Vector4> > SceneGraphConstraint;
- sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mInterpolatorFunction, mCustomWeight );
+ sceneGraphConstraint = SceneGraphConstraint::New( *targetProperty, propertyOwners, func, mCustomWeight );
}
}
}
Property::Index mTargetIndex;
ConstraintFunctionPtr mUserFunction;
- InterpolatorFunction mInterpolatorFunction;
};
} // namespace Internal
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/matrix3.h>
-namespace
-{
-// Constraint Interpolation function prototypes
-typedef boost::function<bool (const bool& start, const bool& target, float progress)> BoolInterpolator;
-typedef boost::function<float (const float& start, const float& target, float progress)> FloatInterpolator;
-typedef boost::function<int (const int& start, const int& target, float progress)> IntegerInterpolator;
-typedef boost::function<Dali::Vector2 (const Dali::Vector2& current, const Dali::Vector2& target, float progress)> Vector2Interpolator;
-typedef boost::function<Dali::Vector3 (const Dali::Vector3& current, const Dali::Vector3& target, float progress)> Vector3Interpolator;
-typedef boost::function<Dali::Vector4 (const Dali::Vector4& current, const Dali::Vector4& target, float progress)> Vector4Interpolator;
-typedef boost::function<Dali::Quaternion (const Dali::Quaternion& current, const Dali::Quaternion& target, float progress)> QuaternionInterpolator;
-typedef boost::function<Dali::Matrix3 (const Dali::Matrix3& current, const Dali::Matrix3& target, float progress)> Matrix3Interpolator;
-typedef boost::function<Dali::Matrix (const Dali::Matrix& current, const Dali::Matrix& target, float progress)> MatrixInterpolator;
-
-}
-
namespace Dali
{
Constraint::Constraint( Property::Index targetIndex,
Property::Type targetType,
SourceContainer& sources,
- AnyFunction& func,
- AnyFunction& interpolator )
+ AnyFunction& func )
: mApplyTime( 0.0f )
{
switch ( targetType )
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<bool>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< BoolInterpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<float>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< FloatInterpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<int>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< IntegerInterpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<Vector2>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< Vector2Interpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<Vector3>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< Vector3Interpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<Vector4>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< Vector4Interpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<Quaternion>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< QuaternionInterpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<Matrix>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< MatrixInterpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
mActiveConstraintTemplate = Dali::ActiveConstraint( ActiveConstraint<Matrix3>::New( targetIndex,
sources,
- funcPtr,
- AnyCast< Matrix3Interpolator >( interpolator ) ) );
+ funcPtr ) );
break;
}
* @param [in] targetType The type of the constrained property.
* @param [in] sources The objects which provide parameters for func.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
*/
Constraint( Property::Index target,
Property::Type targetType,
SourceContainer& sources,
- AnyFunction& func,
- AnyFunction& interpolator );
+ AnyFunction& func );
/**
* @copydoc Dali::Constraint::SetApplyTime()
$(internal_src_dir)/render/shaders/program-controller.cpp \
$(internal_src_dir)/render/shaders/shader.cpp \
\
+ $(internal_src_dir)/update/animation/interpolator-functions.cpp \
$(internal_src_dir)/update/animation/scene-graph-animation.cpp \
$(internal_src_dir)/update/animation/scene-graph-constraint-base.cpp \
$(internal_src_dir)/update/common/discard-queue.cpp \
--- /dev/null
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/update/animation/interpolator-functions.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/vector3.h>
+#include <dali/public-api/math/vector4.h>
+#include <dali/public-api/math/quaternion.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/matrix3.h>
+
+
+namespace
+{
+
+bool LerpBoolean( const bool& current, const bool& target, float progress )
+{
+ // Not particularly useful for boolean values
+ if (progress >= 1.0f)
+ {
+ return target;
+ }
+
+ return current;
+}
+
+float LerpFloat( const float& current, const float& target, float progress )
+{
+ return current + ((target - current) * progress);
+}
+
+int LerpInteger( const int& current, const int& target, float progress )
+{
+ return static_cast<int>( current + ( (target - current) * progress ) + 0.5f );
+}
+
+Dali::Vector2 LerpVector2( const Dali::Vector2& current, const Dali::Vector2& target, float progress )
+{
+ return current + ((target - current) * progress);
+}
+
+Dali::Vector3 LerpVector3( const Dali::Vector3& current, const Dali::Vector3& target, float progress )
+{
+ return current + ((target - current) * progress);
+}
+
+Dali::Vector4 LerpVector4( const Dali::Vector4& current, const Dali::Vector4& target, float progress )
+{
+ return current + ((target - current) * progress);
+}
+
+Dali::Quaternion SlerpQuaternion( const Dali::Quaternion& current, const Dali::Quaternion& target, float progress )
+{
+ return Dali::Quaternion::Slerp(current, target, progress);
+}
+
+Dali::Matrix LerpMatrix( const Dali::Matrix& current, const Dali::Matrix& target, float progress )
+{
+ if (progress > 0.5f)
+ {
+ return target;
+ }
+
+ return current;
+}
+
+Dali::Matrix3 LerpMatrix3( const Dali::Matrix3& current, const Dali::Matrix3& target, float progress )
+{
+ if (progress > 0.5f)
+ {
+ return target;
+ }
+
+ return current;
+}
+
+} // unnamed namespace
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace SceneGraph
+{
+
+CallbackBase* GetDefaultInterpolator( Property::Type type )
+{
+ CallbackBase* function = NULL;
+
+ switch ( type )
+ {
+ case Property::BOOLEAN:
+ {
+ function = MakeCallback( LerpBoolean );
+ break;
+ }
+
+ case Property::FLOAT:
+ {
+ function = MakeCallback( LerpFloat );
+ break;
+ }
+
+ case Property::INTEGER:
+ {
+ function = MakeCallback( LerpInteger );
+ break;
+ }
+
+ case Property::VECTOR2:
+ {
+ function = MakeCallback( LerpVector2 );
+ break;
+ }
+
+ case Property::VECTOR3:
+ {
+ function = MakeCallback( LerpVector3 );
+ break;
+ }
+
+ case Property::VECTOR4:
+ {
+ function = MakeCallback( LerpVector4 );
+ break;
+ }
+
+ case Property::ROTATION:
+ {
+ function = MakeCallback( SlerpQuaternion );
+ break;
+ }
+
+ case Property::MATRIX3:
+ {
+ function = MakeCallback( LerpMatrix3 );
+ break;
+ }
+
+ case Property::MATRIX:
+ {
+ function = MakeCallback( LerpMatrix );
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return function;
+}
+
+} // namespace SceneGraph
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERPOLATOR_FUNCTIONS_H__
+#define __DALI_INTERPOLATOR_FUNCTIONS_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/any.h>
+#include <dali/public-api/object/property.h>
+#include <dali/public-api/signals/callback.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace SceneGraph
+{
+
+/**
+ * @brief Retrieve an interpolator function for a property.
+ *
+ * @param[in] type The property type for which to get an interpolator
+ * @return The interpolator function.
+ *
+ * @note This returns dynamically allocated memory. The caller is responsible for deleting it.
+ */
+CallbackBase* GetDefaultInterpolator( Property::Type type );
+
+} // namespace Internal
+
+} //namespace SceneGraph
+
+} // namespace Dali
+
+#endif // __DALI_INTERPOLATOR_FUNCTIONS_H__
#include <dali/public-api/animation/active-constraint.h>
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/signals/callback.h>
#include <dali/internal/event/animation/property-constraint-ptr.h>
#include <dali/internal/update/common/animatable-property.h>
#include <dali/internal/update/common/property-owner.h>
+#include <dali/internal/update/animation/interpolator-functions.h>
#include <dali/internal/update/animation/scene-graph-constraint-base.h>
#include <dali/internal/render/common/performance-monitor.h>
* @param[in] targetProperty The target property.
* @param[in] ownerSet A set of property owners; func is connected to the properties provided by these objects.
* @param[in] func The function to calculate the final constrained value.
- * @param[in] interpolator The function to interpolate between start & final value.
* @param[in] customWeight A custom weight property, or NULL if the constraint is using its own.
* @return A smart-pointer to a newly allocated constraint.
*/
static ConstraintBase* New( const PropertyBase& targetProperty,
PropertyOwnerContainer& ownerContainer,
ConstraintFunctionPtr func,
- InterpolatorFunc interpolator,
const AnimatableProperty<float>* customWeight )
{
// Scene-graph thread can edit these objects
return new Constraint< PropertyType, PropertyAccessorType >( property,
ownerContainer,
func,
- interpolator,
customWeight );
}
*/
virtual ~Constraint()
{
+ delete mInterpolator;
}
/**
! Equals( Dali::ActiveConstraint::FINAL_WEIGHT, (*mWeightInput)[updateBufferIndex] ) )
{
// Constraint is not fully-applied; interpolation between start & final values
- mTargetProperty.Set( updateBufferIndex,
- mInterpolator( current, mFunc->Apply( updateBufferIndex, current ), (*mWeightInput)[updateBufferIndex] ) );
+ mTargetProperty.Set(
+ updateBufferIndex,
+ CallbackBase::ExecuteReturn< PropertyType, const PropertyType&, const PropertyType&, float >( *mInterpolator, current, mFunc->Apply( updateBufferIndex, current ), (*mWeightInput)[updateBufferIndex] ));
}
else
{
Constraint( PropertyBase& targetProperty,
PropertyOwnerContainer& ownerContainer,
ConstraintFunctionPtr func,
- InterpolatorFunc interpolator,
const AnimatableProperty<float>* customWeight )
: ConstraintBase( ownerContainer ),
mTargetProperty( &targetProperty ),
mFunc( func ),
- mInterpolator( interpolator ),
+ mInterpolator( GetDefaultInterpolator( PropertyTypes::Get< PropertyType >() ) ),
mWeightInput( customWeight ? customWeight : &mWeight)
{
}
ConstraintFunctionPtr mFunc;
- InterpolatorFunc mInterpolator;
+ CallbackBase* mInterpolator;
const AnimatableProperty<float>* mWeightInput;
};
Constraint Constraint::New( Property::Index target,
Property::Type targetType,
- AnyFunction func,
- AnyFunction interpolator )
+ AnyFunction func )
{
Internal::SourceContainer sources; // empty
return Constraint( new Internal::Constraint( target,
targetType,
sources,
- func,
- interpolator ) );
+ func ) );
}
Constraint Constraint::New( Property::Index target,
Property::Type targetType,
ConstraintSource source1,
- AnyFunction func,
- AnyFunction interpolator )
+ AnyFunction func )
{
Internal::SourceContainer sources;
sources.push_back( Internal::Source( source1 ) );
return Constraint( new Internal::Constraint( target,
targetType,
sources,
- func,
- interpolator ) );
+ func ) );
}
Constraint Constraint::New( Property::Index target,
Property::Type targetType,
ConstraintSource source1,
ConstraintSource source2,
- AnyFunction func,
- AnyFunction interpolator )
+ AnyFunction func )
{
Internal::SourceContainer sources;
sources.push_back( Internal::Source( source1 ) );
return Constraint( new Internal::Constraint( target,
targetType,
sources,
- func,
- interpolator ) );
+ func ) );
}
Constraint Constraint::New( Property::Index target,
ConstraintSource source1,
ConstraintSource source2,
ConstraintSource source3,
- AnyFunction func,
- AnyFunction interpolator )
+ AnyFunction func )
{
Internal::SourceContainer sources;
sources.push_back( Internal::Source( source1 ) );
return Constraint( new Internal::Constraint( target,
targetType,
sources,
- func,
- interpolator ) );
+ func ) );
}
Constraint Constraint::New( Property::Index target,
ConstraintSource source2,
ConstraintSource source3,
ConstraintSource source4,
- AnyFunction func,
- AnyFunction interpolator )
+ AnyFunction func )
{
Internal::SourceContainer sources;
sources.push_back( Internal::Source( source1 ) );
return Constraint( new Internal::Constraint( target,
targetType,
sources,
- func,
- interpolator ) );
+ func ) );
}
Constraint Constraint::New( Property::Index target,
ConstraintSource source3,
ConstraintSource source4,
ConstraintSource source5,
- AnyFunction func,
- AnyFunction interpolator )
+ AnyFunction func )
{
Internal::SourceContainer sources;
sources.push_back( Internal::Source( source1 ) );
return Constraint( new Internal::Constraint( target,
targetType,
sources,
- func,
- interpolator ) );
+ func ) );
}
Constraint Constraint::New( Property::Index target,
ConstraintSource source4,
ConstraintSource source5,
ConstraintSource source6,
- AnyFunction func,
- AnyFunction interpolator )
+ AnyFunction func )
{
Internal::SourceContainer sources;
sources.push_back( Internal::Source( source1 ) );
return Constraint( new Internal::Constraint( target,
targetType,
sources,
- func,
- interpolator ) );
+ func ) );
}
Constraint Constraint::DownCast( BaseHandle handle )
// INTERNAL INCLUDES
#include <dali/public-api/animation/alpha-functions.h>
#include <dali/public-api/animation/constraint-source.h>
-#include <dali/public-api/animation/interpolator-functions.h>
#include <dali/public-api/object/any.h>
#include <dali/public-api/object/handle.h>
#include <dali/public-api/object/property.h>
{
public:
- typedef Any AnyFunction; ///< Generic function pointer for constraint and interpolator functions
+ typedef Any AnyFunction; ///< Generic function pointer for constraint
/**
* @brief The action that will happen when the constraint is removed.
* @brief Create a constraint which targets a property.
*
* The templated parameter P, is the type of the property to constrain.
- * Animation will be performed using the default interpolator.
* @param [in] target The index of the property to constrain.
* @param [in] func A function which returns the constrained property value.
* @return The new constraint.
{
return New( target,
PropertyTypes::Get<P>(),
- func,
- GetDefaultInterpolator( PropertyTypes::Get<P>() ) );
+ func );
}
/**
*
* The templated parameter P, is the type of the property to constrain.
* @param [in] target The index of the property to constrain.
- * @param [in] func A function which returns the constrained property value.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
- * @return The new constraint.
- */
- template <class P>
- static Constraint NewWithInterpolator( Property::Index target,
- boost::function<P (const P& current)> func,
- boost::function<P (const P&, const P&, float)> interpolator )
- {
- return New( target,
- PropertyTypes::Get<P>(),
- func,
- interpolator );
- }
-
- /**
- * @brief Create a constraint which targets a property.
- *
- * The templated parameter P, is the type of the property to constrain.
- * Animation will be performed using the default interpolator.
- * @param [in] target The index of the property to constrain.
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] func A function which returns the constrained property value.
* @return The new constraint.
return New( target,
PropertyTypes::Get<P>(),
source1,
- func,
- GetDefaultInterpolator( PropertyTypes::Get<P>() ) );
+ func );
}
/**
* The templated parameter P, is the type of the property to constrain.
* @param [in] target The index of the property to constrain.
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
- * @param [in] func A function which returns the constrained property value.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
- * @return The new constraint.
- */
- template <class P>
- static Constraint NewWithInterpolator( Property::Index target,
- ConstraintSource source1,
- boost::function<P (const P& current, const PropertyInput& input1)> func,
- boost::function<P (const P&, const P&, float)> interpolator )
- {
- return New( target,
- PropertyTypes::Get<P>(),
- source1,
- func,
- interpolator );
- }
-
- /**
- * @brief Create a constraint which targets a property.
- *
- * The templated parameter P, is the type of the property to constrain.
- * Animation will be performed using the default interpolator.
- * @param [in] target The index of the property to constrain.
- * @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
* @param [in] func A function which returns the constrained property value.
* @return The new constraint.
PropertyTypes::Get<P>(),
source1,
source2,
- func,
- GetDefaultInterpolator(PropertyTypes::Get<P>()) );
- }
-
- /**
- * @brief Create a constraint which targets a property.
- *
- * The templated parameter P, is the type of the property to constrain.
- * @param [in] target The index of the property to constrain.
- * @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
- * @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
- * @param [in] func A function which returns the constrained property value.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
- * @return The new constraint.
- */
- template <class P>
- static Constraint NewWithInterpolator( Property::Index target,
- ConstraintSource source1,
- ConstraintSource source2,
- boost::function<P (const P& current, const PropertyInput& input1, const PropertyInput& input2)> func,
- boost::function<P (const P&, const P&, float)> interpolator )
- {
- return New( target,
- PropertyTypes::Get<P>(),
- source1,
- source2,
- func,
- interpolator );
+ func );
}
/**
* @brief Create a constraint which targets a property.
*
* The templated parameter P, is the type of the property to constrain.
- * Animation will be performed using the default interpolator.
* @param [in] target The index of the property to constrain.
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
source1,
source2,
source3,
- func,
- GetDefaultInterpolator(PropertyTypes::Get<P>()) );
+ func );
}
/**
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
* @param [in] source3 The source of a property; the current value will be passed as the 4th parameter of func.
- * @param [in] func A function which returns the constrained property value.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
- * @return The new constraint.
- */
- template <class P>
- static Constraint NewWithInterpolator( Property::Index target,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- boost::function<P (const P& current, const PropertyInput& input1, const PropertyInput& input2, const PropertyInput& input3)> func,
- boost::function<P (const P&, const P&, float)> interpolator )
- {
- return New( target,
- PropertyTypes::Get<P>(),
- source1,
- source2,
- source3,
- func,
- interpolator );
- }
-
- /**
- * @brief Create a constraint which targets a property.
- *
- * The templated parameter P, is the type of the property to constrain.
- * Animation will be performed using the default interpolator.
- * @param [in] target The index of the property to constrain.
- * @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
- * @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
- * @param [in] source3 The source of a property; the current value will be passed as the 4th parameter of func.
* @param [in] source4 The source of a property; the current value will be passed as the 5th parameter of func.
* @param [in] func A function which returns the constrained property value.
* @return The new constraint.
source2,
source3,
source4,
- func,
- GetDefaultInterpolator(PropertyTypes::Get<P>()) );
- }
-
- /**
- * @brief Create a constraint which targets a property.
- *
- * The templated parameter P, is the type of the property to constrain.
- * @param [in] target The index of the property to constrain.
- * @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
- * @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
- * @param [in] source3 The source of a property; the current value will be passed as the 4th parameter of func.
- * @param [in] source4 The source of a property; the current value will be passed as the 5th parameter of func.
- * @param [in] func A function which returns the constrained property value.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
- * @return The new constraint.
- */
- template <class P>
- static Constraint NewWithInterpolator( Property::Index target,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- ConstraintSource source4,
- boost::function<P (const P& current,
- const PropertyInput& input1,
- const PropertyInput& input2,
- const PropertyInput& input3,
- const PropertyInput& input4)> func,
- boost::function<P (const P&, const P&, float)> interpolator )
- {
- return New( target,
- PropertyTypes::Get<P>(),
- source1,
- source2,
- source3,
- source4,
- func,
- interpolator );
+ func );
}
/**
* @brief Create a constraint which targets a property.
*
* The templated parameter P, is the type of the property to constrain.
- * Animation will be performed using the default interpolator.
* @param [in] target The index of the property to constrain.
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
source3,
source4,
source5,
- func,
- GetDefaultInterpolator(PropertyTypes::Get<P>()) );
- }
-
- /**
- * @brief Create a constraint which targets a property.
- *
- * The templated parameter P, is the type of the property to constrain.
- * @param [in] target The index of the property to constrain.
- * @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
- * @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
- * @param [in] source3 The source of a property; the current value will be passed as the 4th parameter of func.
- * @param [in] source4 The source of a property; the current value will be passed as the 5th parameter of func.
- * @param [in] source5 The source of a property; the current value will be passed as the 6th parameter of func.
- * @param [in] func A function which returns the constrained property value.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
- * @return The new constraint.
- */
- template <class P>
- static Constraint NewWithInterpolator( Property::Index target,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- ConstraintSource source4,
- ConstraintSource source5,
- boost::function<P (const P& current,
- const PropertyInput& input1,
- const PropertyInput& input2,
- const PropertyInput& input3,
- const PropertyInput& input4,
- const PropertyInput& input5)> func,
- boost::function<P (const P&, const P&, float)> interpolator )
- {
- return New( target,
- PropertyTypes::Get<P>(),
- source1,
- source2,
- source3,
- source4,
- source5,
- func,
- interpolator );
+ func );
}
/**
* @brief Create a constraint which targets a property.
*
* The templated parameter P, is the type of the property to constrain.
- * Animation will be performed using the default interpolator.
* @param [in] target The index of the property to constrain.
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
source4,
source5,
source6,
- func,
- GetDefaultInterpolator(PropertyTypes::Get<P>()) );
- }
-
- /**
- * @brief Create a constraint which targets a property.
- *
- * The templated parameter P, is the type of the property to constrain.
- * @param [in] target The index of the property to constrain.
- * @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
- * @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
- * @param [in] source3 The source of a property; the current value will be passed as the 4th parameter of func.
- * @param [in] source4 The source of a property; the current value will be passed as the 5th parameter of func.
- * @param [in] source5 The source of a property; the current value will be passed as the 6th parameter of func.
- * @param [in] source6 The source of a property; the current value will be passed as the 7th parameter of func.
- * @param [in] func A function which returns the constrained property value.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
- * @return The new constraint.
- */
- template <class P>
- static Constraint NewWithInterpolator( Property::Index target,
- ConstraintSource source1,
- ConstraintSource source2,
- ConstraintSource source3,
- ConstraintSource source4,
- ConstraintSource source5,
- ConstraintSource source6,
- boost::function<P (const P& current,
- const PropertyInput& input1,
- const PropertyInput& input2,
- const PropertyInput& input3,
- const PropertyInput& input4,
- const PropertyInput& input5,
- const PropertyInput& input6)> func,
- boost::function<P (const P&, const P&, float)> interpolator )
- {
- return New( target,
- PropertyTypes::Get<P>(),
- source1,
- source2,
- source3,
- source4,
- source5,
- source6,
- func,
- interpolator );
+ func );
}
/**
* @param [in] target The index of the property to constrain.
* @param [in] targetType The type of the constrained property.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
* @return The new constraint.
*/
static Constraint New( Property::Index target,
Property::Type targetType,
- AnyFunction func,
- AnyFunction interpolator );
+ AnyFunction func );
/**
* @brief Construct a new constraint which targets a property.
* @param [in] targetType The type of the constrained property.
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
* @return The new constraint.
*/
static Constraint New( Property::Index target,
Property::Type targetType,
ConstraintSource source1,
- AnyFunction func,
- AnyFunction interpolator );
+ AnyFunction func );
/**
* @brief Construct a new constraint which targets a property.
* @param [in] source1 The source of a property; the current value will be passed as the 2nd parameter of func.
* @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
* @return The new constraint.
*/
static Constraint New( Property::Index target,
Property::Type targetType,
ConstraintSource source1,
ConstraintSource source2,
- AnyFunction func,
- AnyFunction interpolator );
+ AnyFunction func );
/**
* @brief Construct a new constraint which targets a property.
* @param [in] source2 The source of a property; the current value will be passed as the 3rd parameter of func.
* @param [in] source3 The source of a property; the current value will be passed as the 4th parameter of func.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
* @return The new constraint.
*/
static Constraint New( Property::Index target,
ConstraintSource source1,
ConstraintSource source2,
ConstraintSource source3,
- AnyFunction func,
- AnyFunction interpolator );
+ AnyFunction func );
/**
* @brief Construct a new constraint which targets a property.
* @param [in] source3 The source of a property; the current value will be passed as the 4th parameter of func.
* @param [in] source4 The source of a property; the current value will be passed as the 5th parameter of func.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
* @return The new constraint.
*/
static Constraint New( Property::Index target,
ConstraintSource source2,
ConstraintSource source3,
ConstraintSource source4,
- AnyFunction func,
- AnyFunction interpolator );
+ AnyFunction func );
/**
* @brief Construct a new constraint which targets a property.
* @param [in] source4 The source of a property; the current value will be passed as the 5th parameter of func.
* @param [in] source5 The source of a property; the current value will be passed as the 6th parameter of func.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
* @return The new constraint.
*/
static Constraint New( Property::Index target,
ConstraintSource source3,
ConstraintSource source4,
ConstraintSource source5,
- AnyFunction func,
- AnyFunction interpolator );
+ AnyFunction func );
/**
* @brief Construct a new constraint which targets a property.
* @param [in] source5 The source of a property; the current value will be passed as the 6th parameter of func.
* @param [in] source6 The source of a property; the current value will be passed as the 7th parameter of func.
* @param [in] func The constraint function.
- * @param [in] interpolator A function used to interpolate between the start value, and the value returned by func.
* @return The new constraint.
*/
static Constraint New( Property::Index target,
ConstraintSource source4,
ConstraintSource source5,
ConstraintSource source6,
- AnyFunction func,
- AnyFunction interpolator );
+ AnyFunction func );
};
} // namespace Dali
+++ /dev/null
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <boost/function.hpp>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/animation/interpolator-functions.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/math/vector4.h>
-#include <dali/public-api/math/quaternion.h>
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/matrix3.h>
-
-namespace
-{
-
-bool LerpBoolean( const bool& current, const bool& target, float progress )
-{
- // Not particularly useful for boolean values
- if (progress >= 1.0f)
- {
- return target;
- }
-
- return current;
-}
-
-float LerpFloat( const float& current, const float& target, float progress )
-{
- return current + ((target - current) * progress);
-}
-
-int LerpInteger( const int& current, const int& target, float progress )
-{
- return static_cast<int>( current + ( (target - current) * progress ) + 0.5f );
-}
-
-Dali::Vector2 LerpVector2( const Dali::Vector2& current, const Dali::Vector2& target, float progress )
-{
- return current + ((target - current) * progress);
-}
-
-Dali::Vector3 LerpVector3( const Dali::Vector3& current, const Dali::Vector3& target, float progress )
-{
- return current + ((target - current) * progress);
-}
-
-Dali::Vector4 LerpVector4( const Dali::Vector4& current, const Dali::Vector4& target, float progress )
-{
- return current + ((target - current) * progress);
-}
-
-Dali::Quaternion SlerpQuaternion( const Dali::Quaternion& current, const Dali::Quaternion& target, float progress )
-{
- return Dali::Quaternion::Slerp(current, target, progress);
-}
-
-Dali::Matrix LerpMatrix( const Dali::Matrix& current, const Dali::Matrix& target, float progress )
-{
- if (progress > 0.5f)
- {
- return target;
- }
-
- return current;
-}
-
-Dali::Matrix3 LerpMatrix3( const Dali::Matrix3& current, const Dali::Matrix3& target, float progress )
-{
- if (progress > 0.5f)
- {
- return target;
- }
-
- return current;
-}
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-AnyInterpolator GetDefaultInterpolator( Property::Type type )
-{
- AnyInterpolator function;
-
- switch ( type )
- {
- case Property::BOOLEAN:
- {
- function = boost::function<bool (const bool&, const bool&, float)>( &LerpBoolean );
- break;
- }
-
- case Property::FLOAT:
- {
- function = boost::function<float (const float&, const float&, float)>( &LerpFloat );
- break;
- }
-
- case Property::INTEGER:
- {
- function = boost::function<int (const int&, const int&, float)>( &LerpInteger );
- break;
- }
-
- case Property::VECTOR2:
- {
- function = boost::function<Vector2 (const Vector2&, const Vector2&, float)>( &LerpVector2 );
- break;
- }
-
- case Property::VECTOR3:
- {
- function = boost::function<Vector3 (const Vector3&, const Vector3&, float)>( &LerpVector3 );
- break;
- }
-
- case Property::VECTOR4:
- {
- function = boost::function<Vector4 (const Vector4&, const Vector4&, float)>( &LerpVector4 );
- break;
- }
-
- case Property::ROTATION:
- {
- function = boost::function<Quaternion (const Quaternion&, const Quaternion&, float)>( &SlerpQuaternion );
- break;
- }
-
- case Property::MATRIX3:
- {
- function = boost::function<Matrix3 (const Matrix3&, const Matrix3&, float)>(&LerpMatrix3);
- break;
- }
-
- case Property::MATRIX:
- {
- function = boost::function<Matrix (const Matrix&, const Matrix&, float)>(&LerpMatrix);
- break;
- }
-
- default:
- break;
- }
-
- return function;
-}
-
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERPOLATOR_FUNCTIONS_H__
-#define __DALI_INTERPOLATOR_FUNCTIONS_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/any.h>
-#include <dali/public-api/object/property.h>
-
-namespace Dali
-{
-
-/**
- * @brief Any interpolator function.
- */
-typedef Any AnyInterpolator;
-
-/**
- * @brief Retrieve an interpolator function for a property.
- *
- * This can be cast to boost::function<P (const P&, const P&, float)> where P corresponds to the property type.
- * @param[in] type The property type for which to get an interpolator
- * @return The interpolator function.
- */
-AnyInterpolator DALI_IMPORT_API GetDefaultInterpolator(Property::Type type);
-
-} // namespace Dali
-
-#endif // __DALI_INTERPOLATOR_FUNCTIONS_H__
#include <dali/public-api/animation/constraint-source.h>
#include <dali/public-api/animation/constraint.h>
#include <dali/public-api/animation/constraints.h>
-#include <dali/public-api/animation/interpolator-functions.h>
#include <dali/public-api/animation/key-frames.h>
#include <dali/public-api/animation/path.h>
#include <dali/public-api/animation/time-period.h>
$(public_api_src_dir)/animation/alpha-functions.cpp \
$(public_api_src_dir)/animation/constraint.cpp \
$(public_api_src_dir)/animation/constraint-source.cpp \
- $(public_api_src_dir)/animation/interpolator-functions.cpp \
$(public_api_src_dir)/animation/key-frames.cpp \
$(public_api_src_dir)/animation/path.cpp \
$(public_api_src_dir)/animation/time-period.cpp \
$(public_api_src_dir)/animation/constraints.h \
$(public_api_src_dir)/animation/constraint-functions.h \
$(public_api_src_dir)/animation/constraint-source.h \
- $(public_api_src_dir)/animation/interpolator-functions.h \
$(public_api_src_dir)/animation/key-frames.h \
$(public_api_src_dir)/animation/path.h \
$(public_api_src_dir)/animation/time-period.h