Single key frame of animation data. More...
#include <kanzi/platform/memory.hpp>
#include <kanzi/resource/resource_manager.hpp>
#include <core/util/math/kzc_vector2.h>
#include <system/kzs_types.h>
#include <system/debug/kzs_error.h>
Namespaces | |
kanzi | |
Enumerations | |
enum | KzuAnimationInterpolation { KZU_ANIMATION_INTERPOLATION_STEP, KZU_ANIMATION_INTERPOLATION_LINEAR, KZU_ANIMATION_INTERPOLATION_BEZIER, KZU_ANIMATION_INTERPOLATION_SMOOTHSTEP } |
Used interpolation method for animation key frame. More... | |
enum | KzuAnimationKeyValueSource { KZU_ANIMATION_KEY_VALUE_SOURCE_TIMELINE, KZU_ANIMATION_KEY_VALUE_SOURCE_ANIMATED_OBJECT_CURRENT_VALUE, KZU_ANIMATION_KEY_VALUE_SOURCE_TARGET_OBJECT_CURRENT_VALUE } |
Key frame value source, in additional to regular timeline keyframes the value can be fetch from source/target value. More... | |
Single key frame of animation data.
Copyright 2008-2020 by Rightware. All rights reserved.
Key frame value source, in additional to regular timeline keyframes the value can be fetch from source/target value.
KANZI_API kzsError kzuAnimationKeyFloatCreate | ( | const struct KzcMemoryManager * | memoryManager, |
kzFloat | time, | ||
kzFloat | value, | ||
enum KzuAnimationInterpolation | interpolation, | ||
struct KzuAnimationKeyFloat ** | out_animationKey | ||
) |
Creates animation key.
memoryManager | The memory manager to use. |
time | The time when the animation has value 'value'. |
value | The value the animation has at time 'time'. |
interpolation | This must be KZU_ANIMATION_INTERPOLATION_STEP, KZU_ANIMATION_INTERPOLATION_LINEAR or KZU_ANIMATION_INTERPOLATION_SMOOTHSTEP. |
out_animationKey | A pointer that is set to point to the new animation key. |
KANZI_API kzsError kzuAnimationKeyFloatWithTangentsCreate | ( | const struct KzcMemoryManager * | memoryManager, |
kzFloat | time, | ||
kzFloat | value, | ||
enum KzuAnimationInterpolation | interpolation, | ||
struct KzcVector2 | inPoint, | ||
struct KzcVector2 | outPoint, | ||
struct KzuAnimationKeyFloatWithTangents ** | out_animationKey | ||
) |
Creates an animation key, which represents a point on a Bezier curve and up to two Bezier control points.
The Bezier curve will go through the point (time, value). The 'inPoint' parameter defines a Bezier control point in case the animation key before 'time' also defines a Bezier point. Similarly, the 'outPoint' is used as an additional Bezier control point if there is a Bezier animation key after 'time'.
For example, if there are two Bezier animation keys A and B and A's 'time' (A_time) is smaller than B's 'time' (B_time), then A and B together define a cubic Bezier curve which starting point is (A_time, A_value), the first control point is (A_outPoint.data[0], A_outPoint.data[1]), the second control point is (B_inPoint.data[0], B_inPoint.data[1]) and the end point is (B_time, B_value). Now, if there is a third Bezier animation key C and C_time > B_time, then there would be another cubic Bezier curve defined by (B_time, B_value), (B_outPoint.data[0], B_outPoint.data[1]), (C_inPoint.data[0], C_inPoint.data[1]), and (C_time, C_value).
If the animation key before 'time' is not of Bezier type, the animation value will transition linearly from that point to (time, value). Similarly, if the animation key after 'time' is not of Bezier type, the animation value will transition linearly from (time, value) to that point.
memoryManager | The memory manager to use. |
time | The time when the curve has value 'value'. |
value | The value the curve has at time 'time'. |
interpolation | This must be KZU_ANIMATION_INTERPOLATION_BEZIER. |
inPoint | A Bezier control point that is used in case there is a Bezier animation key before 'time'. |
outPoint | A Bezier control point that is used in case there is a Bezier animation key after 'time'. |
out_animationKey | A pointer that is set to point to the new animation key. |
KANZI_API KzuAnimationKeyTexture* kzuAnimationKeyTextureCreate | ( | const KzcMemoryManager * | memoryManager, |
kzFloat | time, | ||
kanzi::TextureSharedPtr | outputTexture | ||
) |
Creates new animation key for texture animation.
KANZI_API kzsError kzuAnimationKeyMatrix4x4Create | ( | const struct KzcMemoryManager * | memoryManager, |
kzFloat | time, | ||
const struct KzcMatrix4x4 * | outputMatrix, | ||
struct KzuAnimationKeyMatrix4x4 ** | out_animationKeyMatrix | ||
) |
Creates animation key for matrix4x4 animation.
KANZI_API kzsError kzuAnimationKeyDelete | ( | struct KzuAnimationKey * | animationKey | ) |
Deallocates memory reserved for animation key.
KANZI_API kzFloat kzuAnimationKeyGetTime | ( | const struct KzuAnimationKey * | key | ) |
Gets time from a given KzuAnimationKey.
KANZI_API KzuAnimationInterpolation kzuAnimationKeyGetInterpolation | ( | const struct KzuAnimationKey * | key | ) |
Gets interpolation type from a given KzuAnimationKey.
KANZI_API kzFloat kzuAnimationKeyFloatGetValue | ( | const struct KzuAnimationKeyFloat * | key | ) |
Gets output value from a given KzuAnimationFloatKey.
KANZI_API void kzuAnimationKeyFloatWithTangentsGetTangents | ( | KzuAnimationKeyFloatWithTangents * | animationKey, |
KzcVector2 * | out_inPoint, | ||
KzcVector2 * | out_outPoint | ||
) |
Gets tangents from a given KzuAnimationKeyFloatWithTangents.
KANZI_API void kzuAnimationKeySetValueSource_private | ( | KzuAnimationKey * | key, |
KzuAnimationKeyValueSource | source, | ||
kanzi::ResourceSharedPtr | resource | ||
) |
Private function for setting value source for animation key frame.
KANZI_API enum KzuAnimationKeyValueSource kzuAnimationKeyGetValueSource | ( | const struct KzuAnimationKey * | key | ) |
Gets value source from animation key.
KANZI_API void kzuAnimationKeyFloatSetValue | ( | struct KzuAnimationKeyFloat * | key, |
kzFloat | value | ||
) |
Sets value for animation key float.
KANZI_API kanzi::Resource* kzuAnimationKeyGetValueSourceTargetObject | ( | const struct KzuAnimationKey * | key | ) |
Gets target object from key frame value source.
KANZI_API kzsError kzuAnimationKeySetTargetObjectPath | ( | struct KzuAnimationKey * | key, |
enum KzuAnimationKeyValueSource | source, | ||
kzString | path | ||
) |
Sets target object path.
KANZI_API kzString kzuAnimationKeyGetTargetObjectPath | ( | const struct KzuAnimationKey * | key | ) |
Sets target object path.
KANZI_API struct KzuAnimationKey* kzuAnimationKeyFloatToAnimationKey | ( | const struct KzuAnimationKeyFloat * | key | ) |
Type casts KzuAnimationKeyFloat to KzuAnimationKey.
KANZI_API struct KzuAnimationKeyFloat* kzuAnimationKeyFloatFromAnimationKey | ( | const struct KzuAnimationKey * | key | ) |
Type casts KzuAnimationKeyFloat from KzuAnimationKey.
KANZI_API struct KzuAnimationKey* kzuAnimationKeyFloatWithTangentsToAnimationKey | ( | const struct KzuAnimationKeyFloatWithTangents * | key | ) |
Type casts KzuAnimationKeyFloatWithTangents to KzuAnimationKey.
KANZI_API struct KzuAnimationKeyFloatWithTangents* kzuAnimationKeyFloatWithTangentsFromAnimationKey | ( | const struct KzuAnimationKey * | key | ) |
Type casts KzuAnimationKeyFloatWithTangents from KzuAnimationKey.
KANZI_API struct KzuAnimationKey* kzuAnimationKeyTextureToAnimationKey | ( | const struct KzuAnimationKeyTexture * | key | ) |
Type casts KzuAnimationKeyTexture to KzuAnimationKey.
KANZI_API struct KzuAnimationKeyTexture* kzuAnimationKeyToAnimationKeyTexture | ( | const struct KzuAnimationKey * | key | ) |
Type casts KzuAnimationKeyTexture from KzuAnimationKey.
KANZI_API struct KzuAnimationKey* kzuAnimationKeyMatrix4x4ToAnimationKey | ( | const struct KzuAnimationKeyMatrix4x4 * | key | ) |
Type casts KzuAnimationKeyMatrix4x4 to KzuAnimationKey.
KANZI_API struct KzuAnimationKeyMatrix4x4* kzuAnimationKeyToAnimationKeyMatrix4x4 | ( | const struct KzuAnimationKey * | key | ) |
Type casts KzuAnimationKeyMatrix4x4 from KzuAnimationKey.
KANZI_API kzFloat kzuAnimationKeyFloatInterpolate | ( | kzFloat | input, |
struct KzuAnimationKeyFloat * | keyStart, | ||
struct KzuAnimationKeyFloat * | keyEnd | ||
) |
Returns the output value from given point input, which is located between the two keys.
KANZI_API void kzuAnimationKeyMatrix4x4Interpolate | ( | kzFloat | input, |
const struct KzuAnimationKeyMatrix4x4 * | keyStart, | ||
const struct KzuAnimationKeyMatrix4x4 * | keyEnd, | ||
struct KzcMatrix4x4 * | out_matrix | ||
) |
Returns the interpolated output value from input point, which is between the given two keys.
KANZI_API kanzi::Texture* kzuAnimationKeyTextureInterpolate | ( | const struct KzuAnimationKeyTexture * | keyStart, |
const struct KzuAnimationKeyTexture * | keyEnd | ||
) |
Returns the texture from given key frames.
The interpolation is made with step interpolation.
KANZI_API kzFloat kzuAnimationInterpolateLinear | ( | kzFloat | time, |
kzFloat | startValue, | ||
kzFloat | endValue, | ||
kzFloat | startTime, | ||
kzFloat | endTime | ||
) |
Returns linearly interpolated value between given two values.
KANZI_API kzFloat kzuAnimationInterpolateSmoothstep | ( | kzFloat | time, |
kzFloat | startValue, | ||
kzFloat | endValue, | ||
kzFloat | startTime, | ||
kzFloat | endTime | ||
) |
Returns smoothstep interpolated value between given two values.
KANZI_API kzFloat kzuAnimationInterpolateBezier | ( | kzFloat | time, |
kzFloat | startValue, | ||
kzFloat | endValue, | ||
kzFloat | startTime, | ||
kzFloat | endTime, | ||
const struct KzcVector2 * | outTangent, | ||
const struct KzcVector2 * | inTangent | ||
) |
Returns cubic Bezier interpolated value from given values.
KANZI_API kzFloat kzuAnimationInterpolateHermite | ( | kzFloat | time, |
kzFloat | startValue, | ||
kzFloat | endValue, | ||
kzFloat | startTime, | ||
kzFloat | endTime, | ||
const struct KzcVector2 * | outTangent, | ||
const struct KzcVector2 * | inTangent | ||
) |
Returns hermite interpolated value from given values.
KANZI_API kzFloat kzuAnimationKeyBezierGetValue | ( | kzFloat | phase, |
kzFloat | startValue, | ||
kzFloat | controlValue1, | ||
kzFloat | controlValue2, | ||
kzFloat | endValue | ||
) |
Returns value of bezier for given phase value (in [0, 1]) and given control points.