|
@@ -50,7 +50,8 @@ void spAnimation_dispose (spAnimation* self) {
|
|
|
}
|
|
|
|
|
|
void spAnimation_apply (const spAnimation* self, spSkeleton* skeleton, float lastTime, float time, int loop, spEvent** events,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int i, n = self->timelinesCount;
|
|
|
|
|
|
if (loop && self->duration) {
|
|
@@ -66,15 +67,17 @@ void spAnimation_apply (const spAnimation* self, spSkeleton* skeleton, float las
|
|
|
|
|
|
typedef struct _spTimelineVtable {
|
|
|
void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
|
|
int (*getPropertyId) (const spTimeline* self);
|
|
|
void (*dispose) (spTimeline* self);
|
|
|
} _spTimelineVtable;
|
|
|
|
|
|
void _spTimeline_init (spTimeline* self, spTimelineType type, /**/
|
|
|
- void (*dispose) (spTimeline* self), /**/
|
|
|
- void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
|
|
- int (*getPropertyId) (const spTimeline* self)) {
|
|
|
+ void (*dispose) (spTimeline* self), /**/
|
|
|
+ void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
|
|
+ int (*getPropertyId) (const spTimeline* self)
|
|
|
+) {
|
|
|
CONST_CAST(spTimelineType, self->type) = type;
|
|
|
CONST_CAST(_spTimelineVtable*, self->vtable) = NEW(_spTimelineVtable);
|
|
|
VTABLE(spTimeline, self)->dispose = dispose;
|
|
@@ -105,9 +108,11 @@ static const float CURVE_LINEAR = 0, CURVE_STEPPED = 1, CURVE_BEZIER = 2;
|
|
|
static const int BEZIER_SIZE = 10 * 2 - 1;
|
|
|
|
|
|
void _spCurveTimeline_init (spCurveTimeline* self, spTimelineType type, int framesCount, /**/
|
|
|
- void (*dispose) (spTimeline* self), /**/
|
|
|
- void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
|
|
- int (*getPropertyId)(const spTimeline* self)) {
|
|
|
+ void (*dispose) (spTimeline* self), /**/
|
|
|
+ void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
|
|
+ int (*getPropertyId)(const spTimeline* self)
|
|
|
+) {
|
|
|
_spTimeline_init(SUPER(self), type, dispose, apply, getPropertyId);
|
|
|
self->curves = CALLOC(float, (framesCount - 1) * BEZIER_SIZE);
|
|
|
}
|
|
@@ -223,9 +228,10 @@ void _spBaseTimeline_dispose (spTimeline* timeline) {
|
|
|
|
|
|
/* Many timelines have structure identical to struct spBaseTimeline and extend spCurveTimeline. **/
|
|
|
struct spBaseTimeline* _spBaseTimeline_create (int framesCount, spTimelineType type, int frameSize, /**/
|
|
|
- void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
|
|
- int (*getPropertyId) (const spTimeline* self)) {
|
|
|
+ void (*apply) (const spTimeline* self, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction),
|
|
|
+ int (*getPropertyId) (const spTimeline* self)
|
|
|
+) {
|
|
|
struct spBaseTimeline* self = NEW(struct spBaseTimeline);
|
|
|
_spCurveTimeline_init(SUPER(self), type, framesCount, _spBaseTimeline_dispose, apply, getPropertyId);
|
|
|
|
|
@@ -238,7 +244,8 @@ struct spBaseTimeline* _spBaseTimeline_create (int framesCount, spTimelineType t
|
|
|
/**/
|
|
|
|
|
|
void _spRotateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
spBone *bone;
|
|
|
int frame;
|
|
|
float prevRotation, frameTime, percent, r;
|
|
@@ -248,16 +255,16 @@ void _spRotateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
if (!bone->active) return;
|
|
|
if (time < self->frames[0]) {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->rotation = bone->data->rotation;
|
|
|
- return;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- r = bone->data->rotation - bone->rotation;
|
|
|
- r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
|
|
|
- bone->rotation += r * alpha;
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- ; /* to appease compiler */
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->rotation = bone->data->rotation;
|
|
|
+ return;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ r = bone->data->rotation - bone->rotation;
|
|
|
+ r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360;
|
|
|
+ bone->rotation += r * alpha;
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ ; /* to appease compiler */
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -265,15 +272,15 @@ void _spRotateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
if (time >= self->frames[self->framesCount - ROTATE_ENTRIES]) { /* Time is after last frame. */
|
|
|
r = self->frames[self->framesCount + ROTATE_PREV_ROTATION];
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->rotation = bone->data->rotation + r * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- r += bone->data->rotation - bone->rotation;
|
|
|
- r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; /* Wrap within -180 and 180. */
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- bone->rotation += r * alpha;
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->rotation = bone->data->rotation + r * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ r += bone->data->rotation - bone->rotation;
|
|
|
+ r -= (16384 - (int)(16384.499999999996 - r / 360)) * 360; /* Wrap within -180 and 180. */
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ bone->rotation += r * alpha;
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -287,14 +294,14 @@ void _spRotateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
r = self->frames[frame + ROTATE_ROTATION] - prevRotation;
|
|
|
r = prevRotation + (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * percent;
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->rotation = bone->data->rotation + (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- r += bone->data->rotation - bone->rotation;
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- bone->rotation += (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha;
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->rotation = bone->data->rotation + (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ r += bone->data->rotation - bone->rotation;
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ bone->rotation += (r - (16384 - (int)(16384.499999999996 - r / 360)) * 360) * alpha;
|
|
|
}
|
|
|
|
|
|
UNUSED(lastTime);
|
|
@@ -323,7 +330,8 @@ static const int TRANSLATE_PREV_TIME = -3, TRANSLATE_PREV_X = -2, TRANSLATE_PREV
|
|
|
static const int TRANSLATE_X = 1, TRANSLATE_Y = 2;
|
|
|
|
|
|
void _spTranslateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time,
|
|
|
- spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
spBone *bone;
|
|
|
int frame;
|
|
|
float frameTime, percent;
|
|
@@ -337,16 +345,16 @@ void _spTranslateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleto
|
|
|
if (!bone->active) return;
|
|
|
if (time < self->frames[0]) {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->x = bone->data->x;
|
|
|
- bone->y = bone->data->y;
|
|
|
- return;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- bone->x += (bone->data->x - bone->x) * alpha;
|
|
|
- bone->y += (bone->data->y - bone->y) * alpha;
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- ; /* to appease compiler */
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->x = bone->data->x;
|
|
|
+ bone->y = bone->data->y;
|
|
|
+ return;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ bone->x += (bone->data->x - bone->x) * alpha;
|
|
|
+ bone->y += (bone->data->y - bone->y) * alpha;
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ ; /* to appease compiler */
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -363,24 +371,24 @@ void _spTranslateTimeline_apply (const spTimeline* timeline, spSkeleton* skeleto
|
|
|
y = frames[frame + TRANSLATE_PREV_Y];
|
|
|
frameTime = frames[frame];
|
|
|
percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TRANSLATE_ENTRIES - 1,
|
|
|
- 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime));
|
|
|
+ 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime));
|
|
|
|
|
|
x += (frames[frame + TRANSLATE_X] - x) * percent;
|
|
|
y += (frames[frame + TRANSLATE_Y] - y) * percent;
|
|
|
}
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->x = bone->data->x + x * alpha;
|
|
|
- bone->y = bone->data->y + y * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- bone->x += (bone->data->x + x - bone->x) * alpha;
|
|
|
- bone->y += (bone->data->y + y - bone->y) * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- bone->x += x * alpha;
|
|
|
- bone->y += y * alpha;
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->x = bone->data->x + x * alpha;
|
|
|
+ bone->y = bone->data->y + y * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ bone->x += (bone->data->x + x - bone->x) * alpha;
|
|
|
+ bone->y += (bone->data->y + y - bone->y) * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ bone->x += x * alpha;
|
|
|
+ bone->y += y * alpha;
|
|
|
}
|
|
|
|
|
|
UNUSED(lastTime);
|
|
@@ -407,7 +415,8 @@ void spTranslateTimeline_setFrame (spTranslateTimeline* self, int frameIndex, fl
|
|
|
/**/
|
|
|
|
|
|
void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
spBone *bone;
|
|
|
int frame;
|
|
|
float frameTime, percent, x, y;
|
|
@@ -420,16 +429,16 @@ void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
if (!bone->active) return;
|
|
|
if (time < self->frames[0]) {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->scaleX = bone->data->scaleX;
|
|
|
- bone->scaleY = bone->data->scaleY;
|
|
|
- return;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- bone->scaleX += (bone->data->scaleX - bone->scaleX) * alpha;
|
|
|
- bone->scaleY += (bone->data->scaleY - bone->scaleY) * alpha;
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- ; /* to appease compiler */
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->scaleX = bone->data->scaleX;
|
|
|
+ bone->scaleY = bone->data->scaleY;
|
|
|
+ return;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ bone->scaleX += (bone->data->scaleX - bone->scaleX) * alpha;
|
|
|
+ bone->scaleY += (bone->data->scaleY - bone->scaleY) * alpha;
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ ; /* to appease compiler */
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -446,7 +455,7 @@ void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
y = frames[frame + TRANSLATE_PREV_Y];
|
|
|
frameTime = frames[frame];
|
|
|
percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TRANSLATE_ENTRIES - 1,
|
|
|
- 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime));
|
|
|
+ 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime));
|
|
|
|
|
|
x = (x + (frames[frame + TRANSLATE_X] - x) * percent) * bone->data->scaleX;
|
|
|
y = (y + (frames[frame + TRANSLATE_Y] - y) * percent) * bone->data->scaleY;
|
|
@@ -463,45 +472,45 @@ void _spScaleTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
float bx, by;
|
|
|
if (direction == SP_MIX_DIRECTION_OUT) {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bx = bone->data->scaleX;
|
|
|
- by = bone->data->scaleY;
|
|
|
- bone->scaleX = bx + (ABS(x) * SIGNUM(bx) - bx) * alpha;
|
|
|
- bone->scaleY = by + (ABS(y) * SIGNUM(by) - by) * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- bx = bone->scaleX;
|
|
|
- by = bone->scaleY;
|
|
|
- bone->scaleX = bx + (ABS(x) * SIGNUM(bx) - bx) * alpha;
|
|
|
- bone->scaleY = by + (ABS(y) * SIGNUM(by) - by) * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- bx = bone->scaleX;
|
|
|
- by = bone->scaleY;
|
|
|
- bone->scaleX = bx + (ABS(x) * SIGNUM(bx) - bone->data->scaleX) * alpha;
|
|
|
- bone->scaleY = by + (ABS(y) * SIGNUM(by) - bone->data->scaleY) * alpha;
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bx = bone->data->scaleX;
|
|
|
+ by = bone->data->scaleY;
|
|
|
+ bone->scaleX = bx + (ABS(x) * SIGNUM(bx) - bx) * alpha;
|
|
|
+ bone->scaleY = by + (ABS(y) * SIGNUM(by) - by) * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ bx = bone->scaleX;
|
|
|
+ by = bone->scaleY;
|
|
|
+ bone->scaleX = bx + (ABS(x) * SIGNUM(bx) - bx) * alpha;
|
|
|
+ bone->scaleY = by + (ABS(y) * SIGNUM(by) - by) * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ bx = bone->scaleX;
|
|
|
+ by = bone->scaleY;
|
|
|
+ bone->scaleX = bx + (ABS(x) * SIGNUM(bx) - bone->data->scaleX) * alpha;
|
|
|
+ bone->scaleY = by + (ABS(y) * SIGNUM(by) - bone->data->scaleY) * alpha;
|
|
|
}
|
|
|
} else {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bx = ABS(bone->data->scaleX) * SIGNUM(x);
|
|
|
- by = ABS(bone->data->scaleY) * SIGNUM(y);
|
|
|
- bone->scaleX = bx + (x - bx) * alpha;
|
|
|
- bone->scaleY = by + (y - by) * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- bx = ABS(bone->scaleX) * SIGNUM(x);
|
|
|
- by = ABS(bone->scaleY) * SIGNUM(y);
|
|
|
- bone->scaleX = bx + (x - bx) * alpha;
|
|
|
- bone->scaleY = by + (y - by) * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- bx = SIGNUM(x);
|
|
|
- by = SIGNUM(y);
|
|
|
- bone->scaleX = ABS(bone->scaleX) * bx + (x - ABS(bone->data->scaleX) * bx) * alpha;
|
|
|
- bone->scaleY = ABS(bone->scaleY) * by + (y - ABS(bone->data->scaleY) * by) * alpha;
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bx = ABS(bone->data->scaleX) * SIGNUM(x);
|
|
|
+ by = ABS(bone->data->scaleY) * SIGNUM(y);
|
|
|
+ bone->scaleX = bx + (x - bx) * alpha;
|
|
|
+ bone->scaleY = by + (y - by) * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ bx = ABS(bone->scaleX) * SIGNUM(x);
|
|
|
+ by = ABS(bone->scaleY) * SIGNUM(y);
|
|
|
+ bone->scaleX = bx + (x - bx) * alpha;
|
|
|
+ bone->scaleY = by + (y - by) * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ bx = SIGNUM(x);
|
|
|
+ by = SIGNUM(y);
|
|
|
+ bone->scaleX = ABS(bone->scaleX) * bx + (x - ABS(bone->data->scaleX) * bx) * alpha;
|
|
|
+ bone->scaleY = ABS(bone->scaleY) * by + (y - ABS(bone->data->scaleY) * by) * alpha;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -526,7 +535,8 @@ void spScaleTimeline_setFrame (spScaleTimeline* self, int frameIndex, float time
|
|
|
/**/
|
|
|
|
|
|
void _spShearTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
spBone *bone;
|
|
|
int frame;
|
|
|
float frameTime, percent, x, y;
|
|
@@ -541,16 +551,16 @@ void _spShearTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
framesCount = self->framesCount;
|
|
|
if (time < self->frames[0]) {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->shearX = bone->data->shearX;
|
|
|
- bone->shearY = bone->data->shearY;
|
|
|
- return;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- bone->shearX += (bone->data->shearX - bone->shearX) * alpha;
|
|
|
- bone->shearY += (bone->data->shearY - bone->shearY) * alpha;
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- ; /* to appease compiler */
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->shearX = bone->data->shearX;
|
|
|
+ bone->shearY = bone->data->shearY;
|
|
|
+ return;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ bone->shearX += (bone->data->shearX - bone->shearX) * alpha;
|
|
|
+ bone->shearY += (bone->data->shearY - bone->shearY) * alpha;
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ ; /* to appease compiler */
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -565,24 +575,24 @@ void _spShearTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
y = frames[frame + TRANSLATE_PREV_Y];
|
|
|
frameTime = frames[frame];
|
|
|
percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TRANSLATE_ENTRIES - 1,
|
|
|
- 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime));
|
|
|
+ 1 - (time - frameTime) / (frames[frame + TRANSLATE_PREV_TIME] - frameTime));
|
|
|
|
|
|
x = x + (frames[frame + TRANSLATE_X] - x) * percent;
|
|
|
y = y + (frames[frame + TRANSLATE_Y] - y) * percent;
|
|
|
}
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- bone->shearX = bone->data->shearX + x * alpha;
|
|
|
- bone->shearY = bone->data->shearY + y * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- bone->shearX += (bone->data->shearX + x - bone->shearX) * alpha;
|
|
|
- bone->shearY += (bone->data->shearY + y - bone->shearY) * alpha;
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- bone->shearX += x * alpha;
|
|
|
- bone->shearY += y * alpha;
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ bone->shearX = bone->data->shearX + x * alpha;
|
|
|
+ bone->shearY = bone->data->shearY + y * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ bone->shearX += (bone->data->shearX + x - bone->shearX) * alpha;
|
|
|
+ bone->shearY += (bone->data->shearY + y - bone->shearY) * alpha;
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ bone->shearX += x * alpha;
|
|
|
+ bone->shearY += y * alpha;
|
|
|
}
|
|
|
|
|
|
UNUSED(lastTime);
|
|
@@ -609,7 +619,8 @@ static const int COLOR_PREV_TIME = -5, COLOR_PREV_R = -4, COLOR_PREV_G = -3, COL
|
|
|
static const int COLOR_R = 1, COLOR_G = 2, COLOR_B = 3, COLOR_A = 4;
|
|
|
|
|
|
void _spColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
spSlot *slot;
|
|
|
int frame;
|
|
|
float percent, frameTime;
|
|
@@ -622,17 +633,17 @@ void _spColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
|
|
|
if (time < self->frames[0]) {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
- return;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- color = &slot->color;
|
|
|
- setup = &slot->data->color;
|
|
|
- spColor_addFloats(color, (setup->r - color->r) * alpha, (setup->g - color->g) * alpha, (setup->b - color->b) * alpha,
|
|
|
- (setup->a - color->a) * alpha);
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- ; /* to appease compiler */
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
+ return;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ color = &slot->color;
|
|
|
+ setup = &slot->data->color;
|
|
|
+ spColor_addFloats(color, (setup->r - color->r) * alpha, (setup->g - color->g) * alpha, (setup->b - color->b) * alpha,
|
|
|
+ (setup->a - color->a) * alpha);
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ ; /* to appease compiler */
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -664,9 +675,7 @@ void _spColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, f
|
|
|
if (alpha == 1) {
|
|
|
spColor_setFromFloats(&slot->color, r, g, b, a);
|
|
|
} else {
|
|
|
- if (blend == SP_MIX_BLEND_SETUP) {
|
|
|
- spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
- }
|
|
|
+ if (blend == SP_MIX_BLEND_SETUP) spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
spColor_addFloats(&slot->color, (r - slot->color.r) * alpha, (g - slot->color.g) * alpha, (b - slot->color.b) * alpha, (a - slot->color.a) * alpha);
|
|
|
}
|
|
|
|
|
@@ -700,7 +709,8 @@ static const int TWOCOLOR_PREV_R2 = -3, TWOCOLOR_PREV_G2 = -2, TWOCOLOR_PREV_B2
|
|
|
static const int TWOCOLOR_R = 1, TWOCOLOR_G = 2, TWOCOLOR_B = 3, TWOCOLOR_A = 4, TWOCOLOR_R2 = 5, TWOCOLOR_G2 = 6, TWOCOLOR_B2 = 7;
|
|
|
|
|
|
void _spTwoColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
spSlot *slot;
|
|
|
int frame;
|
|
|
float percent, frameTime;
|
|
@@ -715,21 +725,21 @@ void _spTwoColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton
|
|
|
|
|
|
if (time < self->frames[0]) {
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
- spColor_setFromColor(slot->darkColor, slot->data->darkColor);
|
|
|
- return;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- light = &slot->color;
|
|
|
- dark = slot->darkColor;
|
|
|
- setupLight = &slot->data->color;
|
|
|
- setupDark = slot->data->darkColor;
|
|
|
- spColor_addFloats(light, (setupLight->r - light->r) * alpha, (setupLight->g - light->g) * alpha, (setupLight->b - light->b) * alpha,
|
|
|
- (setupLight->a - light->a) * alpha);
|
|
|
- spColor_addFloats(dark, (setupDark->r - dark->r) * alpha, (setupDark->g - dark->g) * alpha, (setupDark->b - dark->b) * alpha, 0);
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- ; /* to appease compiler */
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ spColor_setFromColor(&slot->color, &slot->data->color);
|
|
|
+ spColor_setFromColor(slot->darkColor, slot->data->darkColor);
|
|
|
+ return;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ light = &slot->color;
|
|
|
+ dark = slot->darkColor;
|
|
|
+ setupLight = &slot->data->color;
|
|
|
+ setupDark = slot->data->darkColor;
|
|
|
+ spColor_addFloats(light, (setupLight->r - light->r) * alpha, (setupLight->g - light->g) * alpha, (setupLight->b - light->b) * alpha,
|
|
|
+ (setupLight->a - light->a) * alpha);
|
|
|
+ spColor_addFloats(dark, (setupDark->r - dark->r) * alpha, (setupDark->g - dark->g) * alpha, (setupDark->b - dark->b) * alpha, 0);
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ ; /* to appease compiler */
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -757,7 +767,7 @@ void _spTwoColorTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton
|
|
|
|
|
|
frameTime = self->frames[frame];
|
|
|
percent = spCurveTimeline_getCurvePercent(SUPER(self), frame / TWOCOLOR_ENTRIES - 1,
|
|
|
- 1 - (time - frameTime) / (self->frames[frame + TWOCOLOR_PREV_TIME] - frameTime));
|
|
|
+ 1 - (time - frameTime) / (self->frames[frame + TWOCOLOR_PREV_TIME] - frameTime));
|
|
|
|
|
|
r += (self->frames[frame + TWOCOLOR_R] - r) * percent;
|
|
|
g += (self->frames[frame + TWOCOLOR_G] - g) * percent;
|
|
@@ -819,7 +829,7 @@ void _spAttachmentTimeline_apply (const spTimeline* timeline, spSkeleton* skelet
|
|
|
|
|
|
if (direction == SP_MIX_DIRECTION_OUT && blend == SP_MIX_BLEND_SETUP) {
|
|
|
attachmentName = slot->data->attachmentName;
|
|
|
- spSlot_setAttachment(slot, attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
|
+ spSlot_setAttachment(slot, attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -827,7 +837,7 @@ void _spAttachmentTimeline_apply (const spTimeline* timeline, spSkeleton* skelet
|
|
|
if (blend == SP_MIX_BLEND_SETUP || blend == SP_MIX_BLEND_FIRST) {
|
|
|
attachmentName = slot->data->attachmentName;
|
|
|
spSlot_setAttachment(skeleton->slots[self->slotIndex],
|
|
|
- attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
|
+ attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -839,7 +849,7 @@ void _spAttachmentTimeline_apply (const spTimeline* timeline, spSkeleton* skelet
|
|
|
|
|
|
attachmentName = self->attachmentNames[frameIndex];
|
|
|
spSlot_setAttachment(skeleton->slots[self->slotIndex],
|
|
|
- attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
|
+ attachmentName ? spSkeleton_getAttachmentForSlotIndex(skeleton, self->slotIndex, attachmentName) : 0);
|
|
|
|
|
|
UNUSED(lastTime);
|
|
|
UNUSED(firedEvents);
|
|
@@ -888,7 +898,8 @@ void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex,
|
|
|
/**/
|
|
|
|
|
|
void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int frame, i, vertexCount;
|
|
|
float percent, frameTime;
|
|
|
const float* prevVertices;
|
|
@@ -1053,42 +1064,42 @@ void _spDeformTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton,
|
|
|
} else {
|
|
|
spVertexAttachment* vertexAttachment;
|
|
|
switch (blend) {
|
|
|
- case SP_MIX_BLEND_SETUP:
|
|
|
- vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
|
|
- if (!vertexAttachment->bones) {
|
|
|
- float *setupVertices = vertexAttachment->vertices;
|
|
|
- for (i = 0; i < vertexCount; i++) {
|
|
|
- float prev = prevVertices[i], setup = setupVertices[i];
|
|
|
- deformArray[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha;
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (i = 0; i < vertexCount; i++) {
|
|
|
- float prev = prevVertices[i];
|
|
|
- deformArray[i] = (prev + (nextVertices[i] - prev) * percent) * alpha;
|
|
|
- }
|
|
|
+ case SP_MIX_BLEND_SETUP:
|
|
|
+ vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
|
|
+ if (!vertexAttachment->bones) {
|
|
|
+ float *setupVertices = vertexAttachment->vertices;
|
|
|
+ for (i = 0; i < vertexCount; i++) {
|
|
|
+ float prev = prevVertices[i], setup = setupVertices[i];
|
|
|
+ deformArray[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha;
|
|
|
}
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_FIRST:
|
|
|
- case SP_MIX_BLEND_REPLACE:
|
|
|
+ } else {
|
|
|
for (i = 0; i < vertexCount; i++) {
|
|
|
float prev = prevVertices[i];
|
|
|
- deformArray[i] += (prev + (nextVertices[i] - prev) * percent - deformArray[i]) * alpha;
|
|
|
+ deformArray[i] = (prev + (nextVertices[i] - prev) * percent) * alpha;
|
|
|
}
|
|
|
- break;
|
|
|
- case SP_MIX_BLEND_ADD:
|
|
|
- vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
|
|
- if (!vertexAttachment->bones) {
|
|
|
- float *setupVertices = vertexAttachment->vertices;
|
|
|
- for (i = 0; i < vertexCount; i++) {
|
|
|
- float prev = prevVertices[i];
|
|
|
- deformArray[i] += (prev + (nextVertices[i] - prev) * percent - setupVertices[i]) * alpha;
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (i = 0; i < vertexCount; i++) {
|
|
|
- float prev = prevVertices[i];
|
|
|
- deformArray[i] += (prev + (nextVertices[i] - prev) * percent) * alpha;
|
|
|
- }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_FIRST:
|
|
|
+ case SP_MIX_BLEND_REPLACE:
|
|
|
+ for (i = 0; i < vertexCount; i++) {
|
|
|
+ float prev = prevVertices[i];
|
|
|
+ deformArray[i] += (prev + (nextVertices[i] - prev) * percent - deformArray[i]) * alpha;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case SP_MIX_BLEND_ADD:
|
|
|
+ vertexAttachment = SUB_CAST(spVertexAttachment, slot->attachment);
|
|
|
+ if (!vertexAttachment->bones) {
|
|
|
+ float *setupVertices = vertexAttachment->vertices;
|
|
|
+ for (i = 0; i < vertexCount; i++) {
|
|
|
+ float prev = prevVertices[i];
|
|
|
+ deformArray[i] += (prev + (nextVertices[i] - prev) * percent - setupVertices[i]) * alpha;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ for (i = 0; i < vertexCount; i++) {
|
|
|
+ float prev = prevVertices[i];
|
|
|
+ deformArray[i] += (prev + (nextVertices[i] - prev) * percent) * alpha;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1142,7 +1153,8 @@ void spDeformTimeline_setFrame (spDeformTimeline* self, int frameIndex, float ti
|
|
|
|
|
|
/** Fires events for frames > lastTime and <= time. */
|
|
|
void _spEventTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time, spEvent** firedEvents,
|
|
|
- int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
spEventTimeline* self = (spEventTimeline*)timeline;
|
|
|
int frame;
|
|
|
if (!firedEvents) return;
|
|
@@ -1211,7 +1223,8 @@ void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* e
|
|
|
/**/
|
|
|
|
|
|
void _spDrawOrderTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time,
|
|
|
- spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int i;
|
|
|
int frame;
|
|
|
const int* drawOrderToSetupIndex;
|
|
@@ -1294,7 +1307,8 @@ static const int IKCONSTRAINT_PREV_TIME = -6, IKCONSTRAINT_PREV_MIX = -5, IKCONS
|
|
|
static const int IKCONSTRAINT_MIX = 1, IKCONSTRAINT_SOFTNESS = 2, IKCONSTRAINT_BEND_DIRECTION = 3, IKCONSTRAINT_COMPRESS = 4, IKCONSTRAINT_STRETCH = 5;
|
|
|
|
|
|
void _spIkConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time,
|
|
|
- spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int frame;
|
|
|
float frameTime, percent, mix, softness;
|
|
|
float *frames;
|
|
@@ -1333,7 +1347,7 @@ void _spIkConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skel
|
|
|
if (blend == SP_MIX_BLEND_SETUP) {
|
|
|
constraint->mix = constraint->data->mix + (frames[framesCount + IKCONSTRAINT_PREV_MIX] - constraint->data->mix) * alpha;
|
|
|
constraint->softness = constraint->data->softness
|
|
|
- + (frames[framesCount + IKCONSTRAINT_PREV_SOFTNESS] - constraint->data->softness) * alpha;
|
|
|
+ + (frames[framesCount + IKCONSTRAINT_PREV_SOFTNESS] - constraint->data->softness) * alpha;
|
|
|
if (direction == SP_MIX_DIRECTION_OUT) {
|
|
|
constraint->bendDirection = constraint->data->bendDirection;
|
|
|
constraint->compress = constraint->data->compress;
|
|
@@ -1365,7 +1379,7 @@ void _spIkConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skel
|
|
|
if (blend == SP_MIX_BLEND_SETUP) {
|
|
|
constraint->mix = constraint->data->mix + (mix + (frames[frame + IKCONSTRAINT_MIX] - mix) * percent - constraint->data->mix) * alpha;
|
|
|
constraint->softness = constraint->data->softness
|
|
|
- + (softness + (frames[frame + IKCONSTRAINT_SOFTNESS] - softness) * percent - constraint->data->softness) * alpha;
|
|
|
+ + (softness + (frames[frame + IKCONSTRAINT_SOFTNESS] - softness) * percent - constraint->data->softness) * alpha;
|
|
|
if (direction == SP_MIX_DIRECTION_OUT) {
|
|
|
constraint->bendDirection = constraint->data->bendDirection;
|
|
|
constraint->compress = constraint->data->compress;
|
|
@@ -1398,7 +1412,9 @@ spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount) {
|
|
|
return (spIkConstraintTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_IKCONSTRAINT, IKCONSTRAINT_ENTRIES, _spIkConstraintTimeline_apply, _spIkConstraintTimeline_getPropertyId);
|
|
|
}
|
|
|
|
|
|
-void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, float softness, int bendDirection, int /*boolean*/ compress, int /*boolean*/ stretch) {
|
|
|
+void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, float softness,
|
|
|
+ int bendDirection, int /*boolean*/ compress, int /*boolean*/ stretch
|
|
|
+) {
|
|
|
frameIndex *= IKCONSTRAINT_ENTRIES;
|
|
|
self->frames[frameIndex] = time;
|
|
|
self->frames[frameIndex + IKCONSTRAINT_MIX] = mix;
|
|
@@ -1420,7 +1436,8 @@ static const int TRANSFORMCONSTRAINT_SCALE = 3;
|
|
|
static const int TRANSFORMCONSTRAINT_SHEAR = 4;
|
|
|
|
|
|
void _spTransformConstraintTimeline_apply (const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time,
|
|
|
- spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int frame;
|
|
|
float frameTime, percent, rotate, translate, scale, shear;
|
|
|
spTransformConstraint* constraint;
|
|
@@ -1501,10 +1518,13 @@ int _spTransformConstraintTimeline_getPropertyId (const spTimeline* timeline) {
|
|
|
}
|
|
|
|
|
|
spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesCount) {
|
|
|
- return (spTransformConstraintTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_TRANSFORMCONSTRAINT, TRANSFORMCONSTRAINT_ENTRIES, _spTransformConstraintTimeline_apply, _spTransformConstraintTimeline_getPropertyId);
|
|
|
+ return (spTransformConstraintTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_TRANSFORMCONSTRAINT,
|
|
|
+ TRANSFORMCONSTRAINT_ENTRIES, _spTransformConstraintTimeline_apply, _spTransformConstraintTimeline_getPropertyId);
|
|
|
}
|
|
|
|
|
|
-void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix) {
|
|
|
+void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float rotateMix,
|
|
|
+ float translateMix, float scaleMix, float shearMix
|
|
|
+) {
|
|
|
frameIndex *= TRANSFORMCONSTRAINT_ENTRIES;
|
|
|
self->frames[frameIndex] = time;
|
|
|
self->frames[frameIndex + TRANSFORMCONSTRAINT_ROTATE] = rotateMix;
|
|
@@ -1520,7 +1540,8 @@ static const int PATHCONSTRAINTPOSITION_PREV_VALUE = -1;
|
|
|
static const int PATHCONSTRAINTPOSITION_VALUE = 1;
|
|
|
|
|
|
void _spPathConstraintPositionTimeline_apply(const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time,
|
|
|
- spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int frame;
|
|
|
float frameTime, percent, position;
|
|
|
spPathConstraint* constraint;
|
|
@@ -1575,7 +1596,8 @@ int _spPathConstraintPositionTimeline_getPropertyId (const spTimeline* timeline)
|
|
|
}
|
|
|
|
|
|
spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int framesCount) {
|
|
|
- return (spPathConstraintPositionTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTPOSITION, PATHCONSTRAINTPOSITION_ENTRIES, _spPathConstraintPositionTimeline_apply, _spPathConstraintPositionTimeline_getPropertyId);
|
|
|
+ return (spPathConstraintPositionTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTPOSITION,
|
|
|
+ PATHCONSTRAINTPOSITION_ENTRIES, _spPathConstraintPositionTimeline_apply, _spPathConstraintPositionTimeline_getPropertyId);
|
|
|
}
|
|
|
|
|
|
void spPathConstraintPositionTimeline_setFrame (spPathConstraintPositionTimeline* self, int frameIndex, float time, float value) {
|
|
@@ -1590,7 +1612,8 @@ static const int PATHCONSTRAINTSPACING_PREV_VALUE = -1;
|
|
|
static const int PATHCONSTRAINTSPACING_VALUE = 1;
|
|
|
|
|
|
void _spPathConstraintSpacingTimeline_apply(const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time,
|
|
|
- spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int frame;
|
|
|
float frameTime, percent, spacing;
|
|
|
spPathConstraint* constraint;
|
|
@@ -1646,7 +1669,8 @@ int _spPathConstraintSpacingTimeline_getPropertyId (const spTimeline* timeline)
|
|
|
}
|
|
|
|
|
|
spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int framesCount) {
|
|
|
- return (spPathConstraintSpacingTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTSPACING, PATHCONSTRAINTSPACING_ENTRIES, _spPathConstraintSpacingTimeline_apply, _spPathConstraintSpacingTimeline_getPropertyId);
|
|
|
+ return (spPathConstraintSpacingTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTSPACING,
|
|
|
+ PATHCONSTRAINTSPACING_ENTRIES, _spPathConstraintSpacingTimeline_apply, _spPathConstraintSpacingTimeline_getPropertyId);
|
|
|
}
|
|
|
|
|
|
void spPathConstraintSpacingTimeline_setFrame (spPathConstraintSpacingTimeline* self, int frameIndex, float time, float value) {
|
|
@@ -1664,7 +1688,8 @@ static const int PATHCONSTRAINTMIX_ROTATE = 1;
|
|
|
static const int PATHCONSTRAINTMIX_TRANSLATE = 2;
|
|
|
|
|
|
void _spPathConstraintMixTimeline_apply(const spTimeline* timeline, spSkeleton* skeleton, float lastTime, float time,
|
|
|
- spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction) {
|
|
|
+ spEvent** firedEvents, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction
|
|
|
+) {
|
|
|
int frame;
|
|
|
float frameTime, percent, rotate, translate;
|
|
|
spPathConstraint* constraint;
|
|
@@ -1728,7 +1753,8 @@ int _spPathConstraintMixTimeline_getPropertyId (const spTimeline* timeline) {
|
|
|
}
|
|
|
|
|
|
spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount) {
|
|
|
- return (spPathConstraintMixTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTMIX, PATHCONSTRAINTMIX_ENTRIES, _spPathConstraintMixTimeline_apply, _spPathConstraintMixTimeline_getPropertyId);
|
|
|
+ return (spPathConstraintMixTimeline*)_spBaseTimeline_create(framesCount, SP_TIMELINE_PATHCONSTRAINTMIX,
|
|
|
+ PATHCONSTRAINTMIX_ENTRIES, _spPathConstraintMixTimeline_apply, _spPathConstraintMixTimeline_getPropertyId);
|
|
|
}
|
|
|
|
|
|
void spPathConstraintMixTimeline_setFrame (spPathConstraintMixTimeline* self, int frameIndex, float time, float rotateMix, float translateMix) {
|