* A typical use case is to determine when GL draw calls have finished drawing
* to a framebuffer.
*/
-class DALI_IMPORT_API GlSyncAbstraction
+class GlSyncAbstraction
{
protected:
/**
* A concrete implementation must be created for each platform, and provided when creating the
* Dali::Integration::Core object.
*/
-class DALI_IMPORT_API PlatformAbstraction
+class PlatformAbstraction
{
public:
* Abstract interface for an object which controls rendering.
* This will be informed when Dali has new content to render.
*/
-class DALI_IMPORT_API RenderController
+class RenderController
{
protected:
* Abstract interface to receive notifications of resource IO operations.
* This is used when pulling loaded resources from the PlatformAbstraction.
*/
-class DALI_IMPORT_API ResourceCache
+class ResourceCache
{
protected:
/**
* Used to request a resource from the native filesystem.
*/
-class DALI_IMPORT_API ResourceRequest
+class ResourceRequest
{
public:
*
*/
-// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
-
namespace Dali
{
#include <dali/internal/event/animation/property-constraint-ptr.h>
#include <dali/internal/event/animation/property-constraint.h>
#include <dali/internal/event/animation/property-input-accessor.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
+{
+// 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
{
// INTERNAL INCLUDES
#include <dali/public-api/animation/interpolator-functions.h>
-
-namespace Dali
+#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 )
return static_cast<int>( current + ( (target - current) * progress ) + 0.5f );
}
-Vector2 LerpVector2( const Vector2& current, const Vector2& target, float progress )
+Dali::Vector2 LerpVector2( const Dali::Vector2& current, const Dali::Vector2& target, float progress )
{
return current + ((target - current) * progress);
}
-Vector3 LerpVector3( const Vector3& current, const Vector3& target, float progress )
+Dali::Vector3 LerpVector3( const Dali::Vector3& current, const Dali::Vector3& target, float progress )
{
return current + ((target - current) * progress);
}
-Vector4 LerpVector4( const Vector4& current, const Vector4& target, float progress )
+Dali::Vector4 LerpVector4( const Dali::Vector4& current, const Dali::Vector4& target, float progress )
{
return current + ((target - current) * progress);
}
-Quaternion SlerpQuaternion( const Quaternion& current, const Quaternion& target, float progress )
+Dali::Quaternion SlerpQuaternion( const Dali::Quaternion& current, const Dali::Quaternion& target, float progress )
{
- return Quaternion::Slerp(current, target, progress);
+ return Dali::Quaternion::Slerp(current, target, progress);
}
-Matrix LerpMatrix( const Matrix& current, const Matrix& target, float progress )
+Dali::Matrix LerpMatrix( const Dali::Matrix& current, const Dali::Matrix& target, float progress )
{
if (progress > 0.5f)
{
return current;
}
-Matrix3 LerpMatrix3( const Matrix3& current, const Matrix3& target, float progress )
+Dali::Matrix3 LerpMatrix3( const Dali::Matrix3& current, const Dali::Matrix3& target, float progress )
{
if (progress > 0.5f)
{
return current;
}
+} // unnamed namespace
+
+namespace Dali
+{
+
AnyInterpolator GetDefaultInterpolator( Property::Type type )
{
AnyInterpolator function;
// INTERNAL INCLUDES
#include <dali/public-api/object/any.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>
#include <dali/public-api/object/property.h>
namespace Dali DALI_IMPORT_API
{
-// Interpolation functions used by Constraints
-
-/**
- * @brief Interpolate linearly between two boolean values.
- * @param [in] current The current value.
- * @param [in] target The target value.
- * @param [in] progress The current progress (between 0 & 1).
- * @return The interpolated value.
- */
-bool LerpBoolean( const bool& current, const bool& target, float progress );
-
-/**
- * @brief Interpolate linearly between two float values.
- *
- * @param [in] current The current value.
- * @param [in] target The target value.
- * @param [in] progress The current progress (between 0 & 1).
- * @return The interpolated value.
- */
-float LerpFloat( const float& current, const float& target, float progress );
-
-/**
- * @brief Interpolate linearly between two integer values.
- *
- * @param [in] current The current value.
- * @param [in] target The target value.
- * @param [in] progress The current progress (between 0 & 1).
- * @return The interpolated value.
- */
-int LerpInteger( const int& current, const int& target, float progress );
-
-/**
- * @brief Interpolate linearly between two Vector2 values.
- *
- * @param [in] current The current value.
- * @param [in] target The target value.
- * @param [in] progress The current progress (between 0 & 1).
- * @return The interpolated value.
- */
-Vector2 LerpVector2( const Vector2& current, const Vector2& target, float progress );
-
-/**
- * @brief Interpolate linearly between two Vector3 values.
- *
- * @param [in] current The current value.
- * @param [in] target The target value.
- * @param [in] progress The current progress (between 0 & 1).
- * @return The interpolated value.
- */
-Vector3 LerpVector3( const Vector3& current, const Vector3& target, float progress );
-
-/**
- * @brief Interpolate linearly between two Vector4 values.
- *
- * @param [in] current The current value.
- * @param [in] target The target value.
- * @param [in] progress The current progress (between 0 & 1).
- * @return The interpolated value.
- */
-Vector4 LerpVector4( const Vector4& current, const Vector4& target, float progress );
-
-/**
- * @brief Spherical linear interpolation between two Quaternion values.
- *
- * @param [in] current The current value.
- * @param [in] target The target value.
- * @param [in] progress The current progress (between 0 & 1).
- * @return The interpolated value.
- */
-Quaternion SlerpQuaternion( const Quaternion& current, const Quaternion& target, float progress );
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<bool (const bool& start, const bool& target, float progress)> BoolInterpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<float (const float& start, const float& target, float progress)> FloatInterpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<int (const int& start, const int& target, float progress)> IntegerInterpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<Vector2 (const Vector2& current, const Vector2& target, float progress)> Vector2Interpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<Vector3 (const Vector3& current, const Vector3& target, float progress)> Vector3Interpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<Vector4 (const Vector4& current, const Vector4& target, float progress)> Vector4Interpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<Quaternion (const Quaternion& current, const Quaternion& target, float progress)> QuaternionInterpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<Matrix3 (const Matrix3& current, const Matrix3& target, float progress)> Matrix3Interpolator;
-
-/**
- * @brief A function which interpolates between a start and target value.
- *
- * @param[in] start The start value.
- * @param[in] target The target value.
- * @param[in] progress The current progress (between 0 and 1).
- * @return The interpolated value.
- */
-typedef boost::function<Matrix (const Matrix& current, const Matrix& target, float progress)> MatrixInterpolator;
-
/**
* @brief Any interpolator function.
*/
#include <math.h> // M_PI
// INTERNAL INCLUDES
-#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/radian.h>
$(public_api_src_dir)/math/angle-axis.cpp \
$(public_api_src_dir)/math/compile-time-math.cpp \
$(public_api_src_dir)/math/degree.cpp \
- $(public_api_src_dir)/math/math-utils.cpp \
$(public_api_src_dir)/math/matrix.cpp \
$(public_api_src_dir)/math/matrix3.cpp \
$(public_api_src_dir)/math/quaternion.cpp \
#include <dali/public-api/common/constants.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/math/math-utils.h>
namespace Dali
{
#include <dali/public-api/math/degree.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
+#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/radian.h>
namespace
+++ /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.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/math/math-utils.h>
-
-// EXTERNAL INCLUDES
-#include <math.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
-
-
-namespace Dali
-{
-
-unsigned int NextPowerOfTwo(unsigned int i)
-{
- DALI_ASSERT_DEBUG(i <= 1U << (sizeof(unsigned) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument.");
- if(i==0)
- {
- return 1;
- }
-
- i--;
- i |= i >> 1;
- i |= i >> 2;
- i |= i >> 4;
- i |= i >> 8;
- i |= i >> 16;
- i++;
- return i;
-}
-
-bool IsPowerOfTwo(unsigned int i)
-{
- return (i != 0) && ((i & (i - 1)) == 0);
-}
-
-float GetRangedEpsilon(float a, float b)
-{
- float abs_f = std::max(fabsf(a), fabsf(b));
- int abs_i = (int) abs_f;
-
- float epsilon = Math::MACHINE_EPSILON_10000;
- if (abs_f < 0.1f)
- {
- return Math::MACHINE_EPSILON_0;
- }
- else if (abs_i < 2)
- {
- return Math::MACHINE_EPSILON_1;
- }
- else if (abs_i < 20)
- {
- return Math::MACHINE_EPSILON_10;
- }
- else if (abs_i < 200)
- {
- return Math::MACHINE_EPSILON_100;
- }
- else if (abs_i < 2000)
- {
- return Math::MACHINE_EPSILON_1000;
- }
- return epsilon;
-}
-
-// TODO: Change this to use #pragma GCC diagnostic push / pop when the compiler is updated to 4.6.0+
-#pragma GCC diagnostic ignored "-Wfloat-equal"
-bool EqualsZero( float value )
-{
- return value == 0.0f;
-}
-#pragma GCC diagnostic error "-Wfloat-equal"
-
-bool Equals( float a, float b )
-{
- return ( fabsf( a - b ) <= GetRangedEpsilon( a, b ) );
-}
-
-bool Equals( float a, float b, float epsilon )
-{
- return ( fabsf( a - b ) <= epsilon );
-}
-
-float Round(float value, int pos)
-{
- float temp;
- temp = value * powf( 10, pos );
- temp = floorf( temp + 0.5 );
- temp *= powf( 10, -pos );
- return temp;
-}
-
-float WrapInDomain(float x, float start, float end)
-{
- float domain = end - start;
- x -= start;
-
- if(fabsf(domain) > Math::MACHINE_EPSILON_1)
- {
- return start + (x - floorf(x / domain) * domain);
- }
-
- return start;
-}
-
-float ShortestDistanceInDomain(float a, float b, float start, float end)
-{
- // (a-start + end-b)
- float size = end-start;
- float vect = b-a;
-
- if(vect > 0)
- {
- // +ve vector, let's try perspective 1 domain to the right,
- // and see if closer.
- float aRight = a+size;
- if( aRight-b < vect )
- {
- return b-aRight;
- }
- }
- else
- {
- // -ve vector, let's try perspective 1 domain to the left,
- // and see if closer.
- float aLeft = a-size;
- if( aLeft-b > vect )
- {
- return b-aLeft;
- }
- }
-
- return vect;
-}
-
-} // namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/common/constants.h>
namespace Dali
{
* @param[in] i input number
* @return next power of two or i itself in case it's a power of two
*/
-DALI_IMPORT_API unsigned int NextPowerOfTwo( unsigned int i );
+inline unsigned int NextPowerOfTwo( unsigned int i )
+{
+ DALI_ASSERT_DEBUG(i <= 1U << (sizeof(unsigned) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument.");
+ if(i==0)
+ {
+ return 1;
+ }
+
+ i--;
+ i |= i >> 1;
+ i |= i >> 2;
+ i |= i >> 4;
+ i |= i >> 8;
+ i |= i >> 16;
+ i++;
+ return i;
+}
/**
* @brief Whether a number is power of two.
* @param[in] i input number
* @return true if i is power of two
*/
-DALI_IMPORT_API bool IsPowerOfTwo( unsigned int i );
+inline bool IsPowerOfTwo( unsigned int i )
+{
+ return (i != 0) && ((i & (i - 1)) == 0);
+}
/**
* @brief Clamp a value.
* @return T the clamped value
*/
template< typename T >
-const T& Clamp( const T& value, const T& min, const T& max )
+inline const T& Clamp( const T& value, const T& min, const T& max )
{
return std::max( std::min( value, max ), min );
}
* @param[in] max The maximum allowed value.
*/
template< typename T >
-void ClampInPlace( T& value, const T& min, const T& max )
+inline void ClampInPlace( T& value, const T& min, const T& max )
{
value = std::max( std::min( value, max ), min );
}
* @param[in] b the second value in the range.
* @return a suitable epsilon
*/
-DALI_IMPORT_API float GetRangedEpsilon(float a, float b);
+inline float GetRangedEpsilon(float a, float b)
+{
+ float abs_f = std::max(fabsf(a), fabsf(b));
+ int abs_i = (int) abs_f;
+
+ float epsilon = Math::MACHINE_EPSILON_10000;
+ if (abs_f < 0.1f)
+ {
+ return Math::MACHINE_EPSILON_0;
+ }
+ else if (abs_i < 2)
+ {
+ return Math::MACHINE_EPSILON_1;
+ }
+ else if (abs_i < 20)
+ {
+ return Math::MACHINE_EPSILON_10;
+ }
+ else if (abs_i < 200)
+ {
+ return Math::MACHINE_EPSILON_100;
+ }
+ else if (abs_i < 2000)
+ {
+ return Math::MACHINE_EPSILON_1000;
+ }
+ return epsilon;
+}
/**
* @brief Helper function to compare equality of a floating point value with zero.
* @param[in] value the value to compare
* @return true if the value is equal to zero
*/
-DALI_IMPORT_API bool EqualsZero( float value );
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+inline bool EqualsZero( float value )
+{
+ return value == 0.0f;
+}
+#pragma GCC diagnostic pop
/**
* @brief Helper function to compare equality of two floating point values.
* @param[in] b the second value to compare
* @return true if the values are equal within a minimal epsilon for their values
*/
-DALI_IMPORT_API bool Equals( float a, float b );
+inline bool Equals( float a, float b )
+{
+ return ( fabsf( a - b ) <= GetRangedEpsilon( a, b ) );
+}
/**
* @brief Helper function to compare equality of two floating point values.
* @param[in] epsilon the minimum epsilon value that will be used to consider the values different
* @return true if the difference between the values is less than the epsilon
*/
-DALI_IMPORT_API bool Equals( float a, float b, float epsilon );
+inline bool Equals( float a, float b, float epsilon )
+{
+ return ( fabsf( a - b ) <= epsilon );
+}
/**
* @brief Get an float that is rounded at specified place of decimals.
* @param[in] pos decimal place
* @return a rounded float
*/
-DALI_IMPORT_API float Round( float value, int pos );
+inline float Round(float value, int pos)
+{
+ float temp;
+ temp = value * powf( 10, pos );
+ temp = floorf( temp + 0.5 );
+ temp *= powf( 10, -pos );
+ return temp;
+}
/**
* @brief Wrap x in domain (start) to (end).
*
* @return the wrapped value over the domain (start) (end)
*/
-DALI_IMPORT_API float WrapInDomain(float x, float start, float end);
+inline float WrapInDomain(float x, float start, float end)
+{
+ float domain = end - start;
+ x -= start;
+
+ if(fabsf(domain) > Math::MACHINE_EPSILON_1)
+ {
+ return start + (x - floorf(x / domain) * domain);
+ }
+
+ return start;
+}
+
/**
* @brief Find the shortest distance (magnitude) and direction (sign)
* @param end the end of the domain
* @return the shortest direction (the sign) and distance (the magnitude)
*/
-DALI_IMPORT_API float ShortestDistanceInDomain(float a, float b, float start, float end);
+inline float ShortestDistanceInDomain( float a, float b, float start, float end )
+{
+ // (a-start + end-b)
+ float size = end-start;
+ float vect = b-a;
+
+ if(vect > 0)
+ {
+ // +ve vector, let's try perspective 1 domain to the right,
+ // and see if closer.
+ float aRight = a+size;
+ if( aRight-b < vect )
+ {
+ return b-aRight;
+ }
+ }
+ else
+ {
+ // -ve vector, let's try perspective 1 domain to the left,
+ // and see if closer.
+ float aLeft = a-size;
+ if( aLeft-b > vect )
+ {
+ return b-aLeft;
+ }
+ }
+
+ return vect;
+}
} // namespace Dali
#include <dali/public-api/math/degree.h>
#include <dali/public-api/math/matrix.h>
#include <dali/public-api/math/radian.h>
+#include <dali/public-api/math/math-utils.h>
#include <dali/internal/render/common/performance-monitor.h>
namespace Dali
#include <dali/public-api/math/radian.h>
// INTERNAL INCLUDES
-#include <dali/public-api/common/constants.h>
+#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/math/degree.h>
namespace
#include <iostream>
// INTERNAL INCLUDES
-#include <dali/public-api/math/math-utils.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali DALI_IMPORT_API
{
#include <iostream>
// INTERNAL INCLUDES
-#include <dali/public-api/math/math-utils.h>
-#include <dali/public-api/common/constants.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali DALI_IMPORT_API
{
#include <math.h>
// INTERNAL INCLUDES
-#include <dali/public-api/math/math-utils.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali DALI_IMPORT_API
{