Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzu_animation_key.h File Reference

Single key frame of animation data. More...

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...
 

Functions

kzsError kzuAnimationKeyFloatCreate (const struct KzcMemoryManager *memoryManager, kzFloat time, kzFloat value, enum KzuAnimationInterpolation interpolation, struct KzuAnimationKeyFloat **out_animationKey)
 Creates animation key. More...
 
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. More...
 
kzsError kzuAnimationKeyTextureCreate (const struct KzcMemoryManager *memoryManager, kzFloat time, struct KzuTexture *outputTexture, struct KzuAnimationKeyTexture **out_animationKeyTexture)
 Creates new animation key for texture animation. More...
 
kzsError kzuAnimationKeyMatrix4x4Create (const struct KzcMemoryManager *memoryManager, kzFloat time, const struct KzcMatrix4x4 *outputMatrix, struct KzuAnimationKeyMatrix4x4 **out_animationKeyMatrix)
 Creates animation key for matrix4x4 animation. More...
 
kzsError kzuAnimationKeyDelete (struct KzuAnimationKey *animationKey)
 Deallocates memory reserved for animation key. More...
 
kzFloat kzuAnimationKeyGetTime (const struct KzuAnimationKey *key)
 Gets time from a given KzuAnimationKey. More...
 
kzFloat kzuAnimationKeyFloatGetValue (const struct KzuAnimationKeyFloat *key)
 Gets output value from a given KzuAnimationFloatKey. More...
 
kzsError kzuAnimationKeySetValueSource_private (struct KzuAnimationKey *key, enum KzuAnimationKeyValueSource source, struct KzuResource *resource)
 Private function for setting value source for animation key frame. More...
 
enum KzuAnimationKeyValueSource kzuAnimationKeyGetValueSource (const struct KzuAnimationKey *key)
 Gets value source from animation key. More...
 
void kzuAnimationKeyFloatSetValue (struct KzuAnimationKeyFloat *key, kzFloat value)
 Sets value for animation key float. More...
 
struct KzuResourcekzuAnimationKeyGetValueSourceTargetObject (const struct KzuAnimationKey *key)
 Gets target object from key frame value source. More...
 
kzsError kzuAnimationKeySetTargetObjectPath (struct KzuAnimationKey *key, enum KzuAnimationKeyValueSource source, kzString path)
 Sets target object path. More...
 
kzString kzuAnimationKeyGetTargetObjectPath (const struct KzuAnimationKey *key)
 Sets target object path. More...
 
struct KzuAnimationKeykzuAnimationKeyFloatToAnimationKey (const struct KzuAnimationKeyFloat *key)
 Type casts KzuAnimationKeyFloat to KzuAnimationKey. More...
 
struct KzuAnimationKeyFloatkzuAnimationKeyFloatFromAnimationKey (const struct KzuAnimationKey *key)
 Type casts KzuAnimationKeyFloat from KzuAnimationKey. More...
 
struct KzuAnimationKeykzuAnimationKeyFloatWithTangentsToAnimationKey (const struct KzuAnimationKeyFloatWithTangents *key)
 Type casts KzuAnimationKeyFloatWithTangents to KzuAnimationKey. More...
 
struct
KzuAnimationKeyFloatWithTangents
kzuAnimationKeyFloatWithTangentsFromAnimationKey (const struct KzuAnimationKey *key)
 Type casts KzuAnimationKeyFloatWithTangents from KzuAnimationKey. More...
 
struct KzuAnimationKeykzuAnimationKeyTextureToAnimationKey (const struct KzuAnimationKeyTexture *key)
 Type casts KzuAnimationKeyTexture to KzuAnimationKey. More...
 
struct KzuAnimationKeyTexturekzuAnimationKeyToAnimationKeyTexture (const struct KzuAnimationKey *key)
 Type casts KzuAnimationKeyTexture from KzuAnimationKey. More...
 
struct KzuAnimationKeykzuAnimationKeyMatrix4x4ToAnimationKey (const struct KzuAnimationKeyMatrix4x4 *key)
 Type casts KzuAnimationKeyMatrix4x4 to KzuAnimationKey. More...
 
struct KzuAnimationKeyMatrix4x4kzuAnimationKeyToAnimationKeyMatrix4x4 (const struct KzuAnimationKey *key)
 Type casts KzuAnimationKeyMatrix4x4 from KzuAnimationKey. More...
 
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. More...
 
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. More...
 
struct KzuTexturekzuAnimationKeyTextureInterpolate (const struct KzuAnimationKeyTexture *keyStart, const struct KzuAnimationKeyTexture *keyEnd)
 Returns the texture from given key frames. More...
 
kzFloat kzuAnimationInterpolateLinear (kzFloat time, kzFloat startValue, kzFloat endValue, kzFloat startTime, kzFloat endTime)
 Returns linearly interpolated value between given two values. More...
 
kzFloat kzuAnimationInterpolateSmoothstep (kzFloat time, kzFloat startValue, kzFloat endValue, kzFloat startTime, kzFloat endTime)
 Returns smoothstep interpolated value between given two values. More...
 
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. More...
 
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. More...
 

Detailed Description

Single key frame of animation data.

Copyright 2008-2019 by Rightware. All rights reserved.

Enumeration Type Documentation

Used interpolation method for animation key frame.

Enumerator
KZU_ANIMATION_INTERPOLATION_STEP 

Interpolation step.

KZU_ANIMATION_INTERPOLATION_LINEAR 

Interpolation linear.

KZU_ANIMATION_INTERPOLATION_BEZIER 

Interpolation Bezier.

KZU_ANIMATION_INTERPOLATION_SMOOTHSTEP 

Interpolation smoothstep.

Key frame value source, in additional to regular timeline keyframes the value can be fetch from source/target value.

Enumerator
KZU_ANIMATION_KEY_VALUE_SOURCE_TIMELINE 

Key frame value fetch from timeline.

KZU_ANIMATION_KEY_VALUE_SOURCE_ANIMATED_OBJECT_CURRENT_VALUE 

Key frame value fetch from animated object current value.

KZU_ANIMATION_KEY_VALUE_SOURCE_TARGET_OBJECT_CURRENT_VALUE 

Key frame value fetch from target object current value.

Function Documentation

kzsError kzuAnimationKeyFloatCreate ( const struct KzcMemoryManager memoryManager,
kzFloat  time,
kzFloat  value,
enum KzuAnimationInterpolation  interpolation,
struct KzuAnimationKeyFloat **  out_animationKey 
)

Creates animation key.

Parameters
memoryManagerThe memory manager to use.
timeThe time when the animation has value 'value'.
valueThe value the animation has at time 'time'.
interpolationThis must be KZU_ANIMATION_INTERPOLATION_STEP, KZU_ANIMATION_INTERPOLATION_LINEAR or KZU_ANIMATION_INTERPOLATION_SMOOTHSTEP.
out_animationKeyA pointer that is set to point to the new animation key.
Returns
KZS_SUCCESS on success.
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.

Parameters
memoryManagerThe memory manager to use.
timeThe time when the curve has value 'value'.
valueThe value the curve has at time 'time'.
interpolationThis must be KZU_ANIMATION_INTERPOLATION_BEZIER.
inPointA Bezier control point that is used in case there is a Bezier animation key before 'time'.
outPointA Bezier control point that is used in case there is a Bezier animation key after 'time'.
out_animationKeyA pointer that is set to point to the new animation key.
Returns
KZS_SUCCESS on success.
kzsError kzuAnimationKeyTextureCreate ( const struct KzcMemoryManager memoryManager,
kzFloat  time,
struct KzuTexture outputTexture,
struct KzuAnimationKeyTexture **  out_animationKeyTexture 
)

Creates new animation key for texture animation.

kzsError kzuAnimationKeyMatrix4x4Create ( const struct KzcMemoryManager memoryManager,
kzFloat  time,
const struct KzcMatrix4x4 outputMatrix,
struct KzuAnimationKeyMatrix4x4 **  out_animationKeyMatrix 
)

Creates animation key for matrix4x4 animation.

kzsError kzuAnimationKeyDelete ( struct KzuAnimationKey animationKey)

Deallocates memory reserved for animation key.

kzFloat kzuAnimationKeyGetTime ( const struct KzuAnimationKey key)

Gets time from a given KzuAnimationKey.

kzFloat kzuAnimationKeyFloatGetValue ( const struct KzuAnimationKeyFloat key)

Gets output value from a given KzuAnimationFloatKey.

kzsError kzuAnimationKeySetValueSource_private ( struct KzuAnimationKey key,
enum KzuAnimationKeyValueSource  source,
struct KzuResource resource 
)

Private function for setting value source for animation key frame.

enum KzuAnimationKeyValueSource kzuAnimationKeyGetValueSource ( const struct KzuAnimationKey key)

Gets value source from animation key.

void kzuAnimationKeyFloatSetValue ( struct KzuAnimationKeyFloat key,
kzFloat  value 
)

Sets value for animation key float.

struct KzuResource* kzuAnimationKeyGetValueSourceTargetObject ( const struct KzuAnimationKey key)

Gets target object from key frame value source.

kzsError kzuAnimationKeySetTargetObjectPath ( struct KzuAnimationKey key,
enum KzuAnimationKeyValueSource  source,
kzString  path 
)

Sets target object path.

kzString kzuAnimationKeyGetTargetObjectPath ( const struct KzuAnimationKey key)

Sets target object path.

struct KzuAnimationKey* kzuAnimationKeyFloatToAnimationKey ( const struct KzuAnimationKeyFloat key)
struct KzuAnimationKeyFloat* kzuAnimationKeyFloatFromAnimationKey ( const struct KzuAnimationKey key)
struct KzuAnimationKey* kzuAnimationKeyFloatWithTangentsToAnimationKey ( const struct KzuAnimationKeyFloatWithTangents key)
struct KzuAnimationKeyFloatWithTangents* kzuAnimationKeyFloatWithTangentsFromAnimationKey ( const struct KzuAnimationKey key)
struct KzuAnimationKey* kzuAnimationKeyTextureToAnimationKey ( const struct KzuAnimationKeyTexture key)
struct KzuAnimationKeyTexture* kzuAnimationKeyToAnimationKeyTexture ( const struct KzuAnimationKey key)
struct KzuAnimationKey* kzuAnimationKeyMatrix4x4ToAnimationKey ( const struct KzuAnimationKeyMatrix4x4 key)
struct KzuAnimationKeyMatrix4x4* kzuAnimationKeyToAnimationKeyMatrix4x4 ( const struct KzuAnimationKey key)
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.

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.

struct KzuTexture* kzuAnimationKeyTextureInterpolate ( const struct KzuAnimationKeyTexture keyStart,
const struct KzuAnimationKeyTexture keyEnd 
)

Returns the texture from given key frames.

The interpolation is made with step interpolation.

kzFloat kzuAnimationInterpolateLinear ( kzFloat  time,
kzFloat  startValue,
kzFloat  endValue,
kzFloat  startTime,
kzFloat  endTime 
)

Returns linearly interpolated value between given two values.

kzFloat kzuAnimationInterpolateSmoothstep ( kzFloat  time,
kzFloat  startValue,
kzFloat  endValue,
kzFloat  startTime,
kzFloat  endTime 
)

Returns smoothstep interpolated value between given two values.

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.

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.