Skip to content
modkitv0.2

curve.h

#include <modkit/curve.h>10 functions · 8 structs · 4 enums · 12 typedefs · 2 macros

Immutable baked scalar curves and color gradients.

Functions

mk_color_distribution_samplefunction

mk_vec4 mk_color_distribution_sample(const mk_color_distribution *distribution, float time, float random01)

Sample an authored RGBA distribution with random01 clamped to [0,1].

ParameterTypeDescription
distributionconst mk_color_distribution *Value for distribution.
timefloatValue for time.
random01floatValue for random01.

Returns The resulting value.

mk_curve_createfunction

mk_curve_t mk_curve_create(const mk_curve_desc *desc)

Create curve.

ParameterTypeDescription
descconst mk_curve_desc *Configuration descriptor.

Returns The resulting handle or value.

mk_curve_destroyfunction

void mk_curve_destroy(mk_curve_t curve)

Destroy the curve.

ParameterTypeDescription
curvemk_curve_tValue for curve.

mk_curve_samplefunction

float mk_curve_sample(mk_curve_t curve, float time)

Perform the curve sample operation.

ParameterTypeDescription
curvemk_curve_tValue for curve.
timefloatValue for time.

Returns The resulting value.

mk_curve_validfunction

bool mk_curve_valid(mk_curve_t curve)

Perform the curve valid operation.

ParameterTypeDescription
curvemk_curve_tValue for curve.

Returns True when the operation succeeds.

mk_gradient_createfunction

mk_gradient_t mk_gradient_create(const mk_gradient_desc *desc)

Create gradient.

ParameterTypeDescription
descconst mk_gradient_desc *Configuration descriptor.

Returns The resulting handle or value.

mk_gradient_destroyfunction

void mk_gradient_destroy(mk_gradient_t gradient)

Destroy the gradient.

ParameterTypeDescription
gradientmk_gradient_tValue for gradient.

mk_gradient_samplefunction

mk_vec4 mk_gradient_sample(mk_gradient_t gradient, float time)

Perform the gradient sample operation.

ParameterTypeDescription
gradientmk_gradient_tValue for gradient.
timefloatValue for time.

Returns The resulting value.

mk_gradient_validfunction

bool mk_gradient_valid(mk_gradient_t gradient)

Perform the gradient valid operation.

ParameterTypeDescription
gradientmk_gradient_tValue for gradient.

Returns True when the operation succeeds.

mk_scalar_distribution_samplefunction

float mk_scalar_distribution_sample(const mk_scalar_distribution *distribution, float time, float random01)

Perform the scalar distribution sample operation.

ParameterTypeDescription
distributionconst mk_scalar_distribution *Value for distribution.
timefloatValue for time.
random01floatValue for random01.

Returns The resulting value.

Structs

mk_color_distributionstruct

Data for color distribution.

FieldTypeDescription
typemk_color_distribution_typeThe type.
min_colormk_vec4The min color.
max_colormk_vec4The max color.
min_gradientmk_gradient_tThe min gradient.
max_gradientmk_gradient_tThe max gradient.

mk_curvestruct

Data for curve.

FieldTypeDescription
iduint32_tThe ID.

mk_curve_descstruct

Data for curve desc.

FieldTypeDescription
keysconst mk_curve_key *The keys.
key_countuint32_tThe key count.
bake_samplesuint32_t0 selects 256.
wrapmk_curve_wrapThe wrap.

mk_curve_keystruct

Data for curve key.

FieldTypeDescription
timefloatThe time.
valuefloatThe value.
in_tangentfloatThe in tangent.
out_tangentfloatThe out tangent.
interpolationmk_curve_interpolationThe interpolation.

mk_gradientstruct

Data for gradient.

FieldTypeDescription
iduint32_tThe ID.

mk_gradient_descstruct

Data for gradient desc.

FieldTypeDescription
keysconst mk_gradient_key *The keys.
key_countuint32_tThe key count.
bake_samplesuint32_t0 selects 256.
wrapmk_curve_wrapThe wrap.

mk_gradient_keystruct

Data for gradient key.

FieldTypeDescription
timefloatThe time.
colormk_vec4The color.
interpolationmk_curve_interpolationThe interpolation.

mk_scalar_distributionstruct

Data for scalar distribution.

FieldTypeDescription
typemk_scalar_distribution_typeThe type.
min_valuefloatThe min value.
max_valuefloatThe max value.
min_curvemk_curve_tThe min curve.
max_curvemk_curve_tThe max curve.

Enums

mk_color_distribution_typeenum

Values for color distribution type.

ValueDescription
MK_COLOR_DISTRIBUTION_CONSTANTSelects constant.
MK_COLOR_DISTRIBUTION_RANGESelects range.
MK_COLOR_DISTRIBUTION_GRADIENTSelects gradient.
MK_COLOR_DISTRIBUTION_TWO_GRADIENTSSelects two gradients.

mk_curve_interpolationenum

Values for curve interpolation.

ValueDescription
MK_CURVE_LINEARSelects linear.
MK_CURVE_STEPSelects step.
MK_CURVE_HERMITESelects hermite.

mk_curve_wrapenum

Values for curve wrap.

ValueDescription
MK_CURVE_WRAP_CLAMPSelects clamp.
MK_CURVE_WRAP_REPEATSelects repeat.
MK_CURVE_WRAP_MIRRORSelects mirror.

mk_scalar_distribution_typeenum

A compact authored scalar distribution shared by particles and tweens.

random01 must be in [0,1]. Curve modes sample normalized time.

ValueDescription
MK_SCALAR_CONSTANTSelects constant.
MK_SCALAR_RANGESelects range.
MK_SCALAR_CURVESelects curve.
MK_SCALAR_TWO_CURVESSelects two curves.

Typedefs

mk_color_distributiontypedef

typedef struct mk_color_distribution mk_color_distribution

Data for color distribution.

mk_color_distribution_typetypedef

typedef enum mk_color_distribution_type mk_color_distribution_type

Values for color distribution type.

mk_curve_desctypedef

typedef struct mk_curve_desc mk_curve_desc

Data for curve desc.

mk_curve_interpolationtypedef

typedef enum mk_curve_interpolation mk_curve_interpolation

Values for curve interpolation.

mk_curve_keytypedef

typedef struct mk_curve_key mk_curve_key

Data for curve key.

mk_curve_ttypedef

typedef struct mk_curve mk_curve_t

Data for curve.

mk_curve_wraptypedef

typedef enum mk_curve_wrap mk_curve_wrap

Values for curve wrap.

mk_gradient_desctypedef

typedef struct mk_gradient_desc mk_gradient_desc

Data for gradient desc.

mk_gradient_keytypedef

typedef struct mk_gradient_key mk_gradient_key

Data for gradient key.

mk_gradient_ttypedef

typedef struct mk_gradient mk_gradient_t

Data for gradient.

mk_scalar_distributiontypedef

typedef struct mk_scalar_distribution mk_scalar_distribution

Data for scalar distribution.

mk_scalar_distribution_typetypedef

typedef enum mk_scalar_distribution_type mk_scalar_distribution_type

A compact authored scalar distribution shared by particles and tweens.

random01 must be in [0,1]. Curve modes sample normalized time.

Macros

MK_CURVE_INVALIDdefine

MK_CURVE_INVALID

Invalid sentinel for curve.

MK_GRADIENT_INVALIDdefine

MK_GRADIENT_INVALID

Invalid sentinel for gradient.