170 Commits

Author SHA1 Message Date
NathanSweet
bdace991a8 Removed unused local. 2014-07-25 22:09:50 +02:00
Leander Hasty
1135bf8a3c Json parser optimizations for spine-c.
Various optimizations for Json.c and Json.h.

parse_value uses a switch on starting character and avoids three strncmp
calls in many cases.

parse_number dispatches to strtod (C89) or strtof (C99), which is a
slightly more permissive superset of JSON's RFC4627 number parsing, but
is also quite a bit faster.   More explicit error handling added here
too.

(The parse_value and parse_number changes alone made for a ~1.5x speedup
on our tiny ARM926 platform using uclibc 0.9.30 and gcc 4.3.3.)

Use _stricmp or strcasecmp in Json_strcasecmp.  This one has a tricky
#include issue; it's in <strings.h> in some systems and <string.h> in
others.  Defining _DEFAULT_SOURCE and/or _BSD_SOURCE pulls it into
<string.h> in all of the systems we could find.  This is a noticeable
win, but less than parse_value or parse_number.

Elide NULL checks in almost all functions, insert one during
Json_create.  Everywhere else, the code already explicitly checks and
returns.  skip() keeps a NULL check but pushes it outside the loop, so
we only check it on entry to the method.

Also elide some redundant starting character checks for parse_object
('{') and parse_array ('[') since they're only called from parse_value
and we know the character is correct.  There's an opportunity to do this
also for parse_string, but it's a bit more complicated as it's called
from parse_object as well as parse_value.

For all these elided checks, allow them to reappear if SPINE_JSON_DEBUG
is defined and nonzero.

Spine doesn't use the "prev" field ever, so drop it entirely from the
Json structure unless someone defines SPINE_JSON_HAVE_PREV non-zero.

Pull some of the assignments out of conditionals to placate some of the
higher-warning-level compilers.

A few TODO comments left near some of the other speedup opportunities,
as well as one existing place that might need additional error handling.

(Tested on various x86 and ARM gcc versions, Xcode 5.x series, Visual
Studio 2010 SP1, ARMCC 5.04, and MWCCARM 4.0.  Holler if this should be
decomposed into a patch series, if there are any suggestions or idiom
changes, or a different submission method we should be using.)
2014-06-20 11:46:40 -04:00
NathanSweet
7f6abc8c00 Fixed mixing from uninitialized slot vertices.
http://esotericsoftware.com/forum/viewtopic.php?f=9&t=2775
2014-06-03 18:37:42 +02:00
NathanSweet
cf41610f8a Minor fixes. 2014-05-23 10:46:26 +02:00
NathanSweet
01c0e1881f Minor changes. 2014-05-21 22:28:50 +02:00
NathanSweet
cff77e7dea Fixed double free. 2014-05-21 10:11:57 +02:00
NathanSweet
a62b1ff0f2 Warning. 2014-05-18 21:51:42 +02:00
NathanSweet
066fa3dcae Fixed TrackEntry leak. 2014-05-17 23:21:22 +02:00
NathanSweet
2e266127a0 Carry over remaining time when playing queued animations.
http://esotericsoftware.com/forum/viewtopic.php?f=7&t=2633
2014-05-15 20:11:09 +02:00
NathanSweet
72a4ad4cc1 Minor refactoring. 2014-05-14 21:49:15 +02:00
NathanSweet
f869e93546 spine-c Eclipse project builds lib instead of exe, spine-sfml uses static libs. 2014-05-12 22:57:30 +02:00
NathanSweet
36809166a2 Make AnimationState TrackEntry create/dispose functions optional.
closes #218
2014-05-12 17:12:24 +02:00
NathanSweet
7199d22417 Better AnimationState listeners, including on a TrackEntry. 2014-05-11 21:00:50 +02:00
NathanSweet
cd7538d6a1 Fixed memory leak when track is cleared while mixing from a previous animation. 2014-05-11 20:42:48 +02:00
NathanSweet
3370501317 Rename AnimationState context to rendererObject to match all other void*. 2014-05-11 16:33:24 +02:00
NathanSweet
496466a1cc Hull length is no longer nonessential. 2014-05-10 15:33:00 +02:00
NathanSweet
77d7bf83fb Fixed small memory leak. 2014-05-08 19:26:34 +02:00
NathanSweet
5848973f0b Hull length is int. 2014-05-08 17:38:31 +02:00
jpoag
ff07eb02d8 * Allow memory tracking inside spine 2014-05-08 10:49:46 -04:00
NathanSweet
0a275f0ac7 Added includes to spine.h.
closes #214
2014-05-07 15:03:10 +02:00
NathanSweet
3729bc1c88 Read new atlas format that has width and height for each page. 2014-05-06 18:48:52 +02:00
NathanSweet
f6cbff942f ANSI C is fun! 2014-05-05 21:31:59 +02:00
NathanSweet
4346db1f31 Fixed atlas rendererObject not being set. 2014-05-05 21:23:52 +02:00
NathanSweet
79c11424f4 Pre-increment for consistency. 2014-05-05 15:07:28 +02:00
NathanSweet
cc472d134f Renamed spAtlas constructor methods to match others. Added void* to spAtlas constructors.
Inside _spAtlasPage_createTexture you can use `self->atlas->rendererObject` to get the void* specified at atlas creation.
2014-05-02 17:55:54 +02:00
NathanSweet
b7a788bc1e Fixed memory errors. 2014-05-02 10:21:16 +02:00
NathanSweet
99a8de4bb4 FFD for spine-c and spine-sfml. 2014-04-29 20:28:27 +02:00
NathanSweet
23d4d0558c Fixed bug loading skinned meshes. 2014-04-29 00:48:12 +02:00
NathanSweet
e782b6effa Cleaning up. 2014-04-29 00:31:24 +02:00
NathanSweet
3ff8661670 Updated example. 2014-04-28 17:57:52 +02:00
NathanSweet
b1f851a246 Meshes, FFD and skinning for spine-c.
Untested since rendering hasn't yet been done for a runtime that extends spine-c.
2014-04-28 17:52:01 +02:00
NathanSweet
a180398975 Added SP_ prefix to enums.
Super fun. Don't forget you can use SPINE_SHORT_NAMES.
2014-04-27 23:23:13 +02:00
NathanSweet
b44bca68d9 Fixing things up. 2014-04-27 22:18:31 +02:00
NathanSweet
ca9274539e setSkin should attach setup pose attachments if there was no old skin. 2014-04-27 22:02:51 +02:00
NathanSweet
cf9a3a4109 Per attachment color. 2014-04-27 22:02:44 +02:00
NathanSweet
55c98fc7f1 Fix AnimationState to use previous.timeScale when mixing. 2014-04-27 22:02:17 +02:00
NathanSweet
afe0817811 Fix color timeline mixing when animation is after the last frame. 2014-04-27 22:02:08 +02:00
NathanSweet
26e4fb0d74 License header update.
2 -> 2.1 (clearer how permission is granted, formatting).
2014-04-23 12:04:43 +02:00
NathanSweet
11266e0cc5 Better handling of AnimationState state changes during listeners.
Except "end" listeners, don't change the state from there.
2014-03-17 16:54:25 +01:00
NathanSweet
df70264a5b Go back to clearing the entry after the "end" listeners.
Changing the AnimationState state from an "end" listener is problematic even when the entry is cleared before the listener, so better to make the track that is ending available to the listener.
2014-03-17 16:53:33 +01:00
NathanSweet
aff250daf4 Allow a track to mix with the track below.
http://esotericsoftware.com/forum/viewtopic.php?f=7&t=2248
2014-03-09 12:06:36 +01:00
NathanSweet
211f82fedd Clear the track before calling end on the listener. 2014-03-08 00:20:26 +01:00
Nathan Sweet
29ff735384 Merge pull request #161 from tadas-miceika/master
fix copy-paste error
2014-02-05 16:42:21 +01:00
NathanSweet
a9abb3155b Fixed spSkeleton_setSlotsToSetupPose. 2014-02-03 22:28:11 +01:00
NathanSweet
661a0436bc Documentation 2014-01-20 04:51:20 +01:00
NathanSweet
44ba6c4832 Documentation 2014-01-19 19:26:07 +01:00
NathanSweet
4adb4af985 Documentation 2014-01-19 17:52:31 +01:00
NathanSweet
2b241c3628 Fixed root bone translation.
Again.
2014-01-17 00:58:29 +01:00
NathanSweet
b0c96fd66b Typo 2014-01-11 21:20:46 +01:00
NathanSweet
d520addb9b Updated license to version 2.
Version 1 of the license didn't make sense: it required a Spine license to use the Spine Runtimes at all. This means if you used the Spine Runtimes in your application, anyone who purchased a copy of your application also needed a Spine license to use the runtimes. This was not the intent!

Version 2 of the license fixes this by allowing anyone to use the Spine Runtimes but only for internal use. When you purchase Spine, the Spine license (http://esotericsoftware.com/spine/files/license.txt) grants you the right to make and distribute derivative works of the Spine Runtimes. Now it makes sense: making and distributing applications with the Spine Runtimes requires a Spine license, but anyone can run that software without needing a Spine license.

With this fixed, I hope we never need to change the license again!
2014-01-11 21:07:28 +01:00