mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-05 10:16:54 +08:00
[cpp] Rename Vector -> Array, ContainerUtil > ArrayUtils
This commit is contained in:
parent
c75fd64189
commit
9d384c50ed
2
.gitignore
vendored
2
.gitignore
vendored
@ -240,3 +240,5 @@ docs/
|
|||||||
out.json
|
out.json
|
||||||
spine-cpp/extraction.log
|
spine-cpp/extraction.log
|
||||||
extraction.log
|
extraction.log
|
||||||
|
spine-c-new/codegen/dist
|
||||||
|
spine-c-new/codegen/all-spine-types.json
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_Animation_h
|
#ifndef Spine_Animation_h
|
||||||
#define Spine_Animation_h
|
#define Spine_Animation_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/HashMap.h>
|
#include <spine/HashMap.h>
|
||||||
#include <spine/MixBlend.h>
|
#include <spine/MixBlend.h>
|
||||||
#include <spine/MixDirection.h>
|
#include <spine/MixDirection.h>
|
||||||
@ -101,17 +101,17 @@ namespace spine {
|
|||||||
friend class Slider;
|
friend class Slider;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Animation(const String &name, Vector<Timeline *> &timelines, float duration);
|
Animation(const String &name, Array<Timeline *> &timelines, float duration);
|
||||||
|
|
||||||
~Animation();
|
~Animation();
|
||||||
|
|
||||||
/// If the returned array or the timelines it contains are modified, setTimelines() must be called.
|
/// If the returned array or the timelines it contains are modified, setTimelines() must be called.
|
||||||
Vector<Timeline *> &getTimelines();
|
Array<Timeline *> &getTimelines();
|
||||||
|
|
||||||
void setTimelines(Vector<Timeline *> &timelines);
|
void setTimelines(Array<Timeline *> &timelines);
|
||||||
|
|
||||||
/// Returns true if this animation contains a timeline with any of the specified property IDs.
|
/// Returns true if this animation contains a timeline with any of the specified property IDs.
|
||||||
bool hasTimeline(Vector<PropertyId> &ids);
|
bool hasTimeline(Array<PropertyId> &ids);
|
||||||
|
|
||||||
/// The duration of the animation in seconds, which is usually the highest time of all frames in the timeline. The duration is
|
/// The duration of the animation in seconds, which is usually the highest time of all frames in the timeline. The duration is
|
||||||
/// used to know when it has completed and when it should loop back to the start.
|
/// used to know when it has completed and when it should loop back to the start.
|
||||||
@ -139,23 +139,23 @@ namespace spine {
|
|||||||
/// @param blend Controls how mixing is applied when alpha < 1.
|
/// @param blend Controls how mixing is applied when alpha < 1.
|
||||||
/// @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions,
|
/// @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions,
|
||||||
/// such as DrawOrderTimeline or AttachmentTimeline.
|
/// such as DrawOrderTimeline or AttachmentTimeline.
|
||||||
void apply(Skeleton &skeleton, float lastTime, float time, bool loop, Vector<Event *> *pEvents, float alpha,
|
void apply(Skeleton &skeleton, float lastTime, float time, bool loop, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose);
|
MixBlend blend, MixDirection direction, bool appliedPose);
|
||||||
|
|
||||||
/// The animation's name, which is unique across all animations in the skeleton.
|
/// The animation's name, which is unique across all animations in the skeleton.
|
||||||
const String &getName();
|
const String &getName();
|
||||||
|
|
||||||
/// The bone indices affected by this animation.
|
/// The bone indices affected by this animation.
|
||||||
const Vector<int> &getBones();
|
const Array<int> &getBones();
|
||||||
|
|
||||||
/// @param target After the first and before the last entry.
|
/// @param target After the first and before the last entry.
|
||||||
static int search(Vector<float> &values, float target);
|
static int search(Array<float> &values, float target);
|
||||||
|
|
||||||
static int search(Vector<float> &values, float target, int step);
|
static int search(Array<float> &values, float target, int step);
|
||||||
protected:
|
protected:
|
||||||
Vector<Timeline *> _timelines;
|
Array<Timeline *> _timelines;
|
||||||
HashMap<PropertyId, bool> _timelineIds;
|
HashMap<PropertyId, bool> _timelineIds;
|
||||||
Vector<int> _bones;
|
Array<int> _bones;
|
||||||
float _duration;
|
float _duration;
|
||||||
String _name;
|
String _name;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_AnimationState_h
|
#ifndef Spine_AnimationState_h
|
||||||
#define Spine_AnimationState_h
|
#define Spine_AnimationState_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Pool.h>
|
#include <spine/Pool.h>
|
||||||
#include <spine/Property.h>
|
#include <spine/Property.h>
|
||||||
#include <spine/MixBlend.h>
|
#include <spine/MixBlend.h>
|
||||||
@ -339,9 +339,9 @@ namespace spine {
|
|||||||
float _delay, _trackTime, _trackLast, _nextTrackLast, _trackEnd, _timeScale;
|
float _delay, _trackTime, _trackLast, _nextTrackLast, _trackEnd, _timeScale;
|
||||||
float _alpha, _mixTime, _mixDuration, _interruptAlpha, _totalAlpha;
|
float _alpha, _mixTime, _mixDuration, _interruptAlpha, _totalAlpha;
|
||||||
MixBlend _mixBlend;
|
MixBlend _mixBlend;
|
||||||
Vector<int> _timelineMode;
|
Array<int> _timelineMode;
|
||||||
Vector<TrackEntry *> _timelineHoldMix;
|
Array<TrackEntry *> _timelineHoldMix;
|
||||||
Vector<float> _timelinesRotation;
|
Array<float> _timelinesRotation;
|
||||||
AnimationStateListener _listener;
|
AnimationStateListener _listener;
|
||||||
AnimationStateListenerObject *_listenerObject;
|
AnimationStateListenerObject *_listenerObject;
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ namespace spine {
|
|||||||
friend class AnimationState;
|
friend class AnimationState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<EventQueueEntry> _eventQueueEntries;
|
Array<EventQueueEntry> _eventQueueEntries;
|
||||||
AnimationState &_state;
|
AnimationState &_state;
|
||||||
bool _drainDisabled;
|
bool _drainDisabled;
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ namespace spine {
|
|||||||
AnimationStateData *getData();
|
AnimationStateData *getData();
|
||||||
|
|
||||||
/// The list of tracks that have had animations, which may contain null entries for tracks that currently have no animation.
|
/// The list of tracks that have had animations, which may contain null entries for tracks that currently have no animation.
|
||||||
Vector<TrackEntry *> &getTracks();
|
Array<TrackEntry *> &getTracks();
|
||||||
|
|
||||||
/// Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
|
/// Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
|
||||||
/// or faster. Defaults to 1.
|
/// or faster. Defaults to 1.
|
||||||
@ -539,8 +539,8 @@ namespace spine {
|
|||||||
AnimationStateData *_data;
|
AnimationStateData *_data;
|
||||||
|
|
||||||
Pool<TrackEntry> _trackEntryPool;
|
Pool<TrackEntry> _trackEntryPool;
|
||||||
Vector<TrackEntry *> _tracks;
|
Array<TrackEntry *> _tracks;
|
||||||
Vector<Event *> _events;
|
Array<Event *> _events;
|
||||||
EventQueue *_queue;
|
EventQueue *_queue;
|
||||||
|
|
||||||
HashMap<PropertyId, bool> _propertyIDs;
|
HashMap<PropertyId, bool> _propertyIDs;
|
||||||
@ -561,7 +561,7 @@ namespace spine {
|
|||||||
/// the first time the mixing was applied.
|
/// the first time the mixing was applied.
|
||||||
static void
|
static void
|
||||||
applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleton &skeleton, float time, float alpha, MixBlend pose,
|
applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleton &skeleton, float time, float alpha, MixBlend pose,
|
||||||
Vector<float> &timelinesRotation, size_t i, bool firstFrame);
|
Array<float> &timelinesRotation, size_t i, bool firstFrame);
|
||||||
|
|
||||||
/// Applies the attachment timeline and sets Slot::attachmentState.
|
/// Applies the attachment timeline and sets Slot::attachmentState.
|
||||||
/// @param attachments False when: 1) the attachment timeline is mixing out, 2) mix < attachmentThreshold, and 3) the timeline
|
/// @param attachments False when: 1) the attachment timeline is mixing out, 2) mix < attachmentThreshold, and 3) the timeline
|
||||||
|
|||||||
@ -27,8 +27,8 @@
|
|||||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef Spine_Vector_h
|
#ifndef Spine_Array_h
|
||||||
#define Spine_Vector_h
|
#define Spine_Array_h
|
||||||
|
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
@ -37,24 +37,24 @@
|
|||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class SP_API Vector : public SpineObject {
|
class SP_API Array : public SpineObject {
|
||||||
public:
|
public:
|
||||||
using size_type = size_t;
|
using size_type = size_t;
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
|
|
||||||
Vector() : _size(0), _capacity(0), _buffer(NULL) {
|
Array() : _size(0), _capacity(0), _buffer(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector(const Vector &inVector) : _size(inVector._size), _capacity(inVector._capacity), _buffer(NULL) {
|
Array(const Array &inArray) : _size(inArray._size), _capacity(inArray._capacity), _buffer(NULL) {
|
||||||
if (_capacity > 0) {
|
if (_capacity > 0) {
|
||||||
_buffer = allocate(_capacity);
|
_buffer = allocate(_capacity);
|
||||||
for (size_t i = 0; i < _size; ++i) {
|
for (size_t i = 0; i < _size; ++i) {
|
||||||
construct(_buffer + i, inVector._buffer[i]);
|
construct(_buffer + i, inArray._buffer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~Vector() {
|
~Array() {
|
||||||
clear();
|
clear();
|
||||||
deallocate(_buffer);
|
deallocate(_buffer);
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ namespace spine {
|
|||||||
return _size;
|
return _size;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Vector<T> &setSize(size_t newSize, const T &defaultValue) {
|
inline Array<T> &setSize(size_t newSize, const T &defaultValue) {
|
||||||
assert(newSize >= 0);
|
assert(newSize >= 0);
|
||||||
size_t oldSize = _size;
|
size_t oldSize = _size;
|
||||||
_size = newSize;
|
_size = newSize;
|
||||||
@ -122,14 +122,14 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void addAll(const Vector<T> &inValue) {
|
inline void addAll(const Array<T> &inValue) {
|
||||||
ensureCapacity(this->size() + inValue.size());
|
ensureCapacity(this->size() + inValue.size());
|
||||||
for (size_t i = 0; i < inValue.size(); i++) {
|
for (size_t i = 0; i < inValue.size(); i++) {
|
||||||
add(inValue[i]);
|
add(inValue[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void clearAndAddAll(const Vector<T> &inValue) {
|
inline void clearAndAddAll(const Array<T> &inValue) {
|
||||||
ensureCapacity(inValue.size());
|
ensureCapacity(inValue.size());
|
||||||
for (size_t i = 0; i < inValue.size(); i++)
|
for (size_t i = 0; i < inValue.size(); i++)
|
||||||
_buffer[i] = inValue[i];
|
_buffer[i] = inValue[i];
|
||||||
@ -184,7 +184,7 @@ namespace spine {
|
|||||||
return _buffer[inIndex];
|
return _buffer[inIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline friend bool operator==(Vector<T> &lhs, Vector<T> &rhs) {
|
inline friend bool operator==(Array<T> &lhs, Array<T> &rhs) {
|
||||||
if (lhs.size() != rhs.size()) {
|
if (lhs.size() != rhs.size()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -198,13 +198,13 @@ namespace spine {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline friend bool operator!=(Vector<T> &lhs, Vector<T> &rhs) {
|
inline friend bool operator!=(Array<T> &lhs, Array<T> &rhs) {
|
||||||
return !(lhs == rhs);
|
return !(lhs == rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector &operator=(const Vector &inVector) {
|
Array &operator=(const Array &inArray) {
|
||||||
if (this != &inVector) {
|
if (this != &inArray) {
|
||||||
clearAndAddAll(inVector);
|
clearAndAddAll(inArray);
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -245,4 +245,4 @@ namespace spine {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* Spine_Vector_h */
|
#endif /* Spine_Array_h */
|
||||||
@ -31,7 +31,7 @@
|
|||||||
#define Spine_ContainerUtil_h
|
#define Spine_ContainerUtil_h
|
||||||
|
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/HashMap.h>
|
#include <spine/HashMap.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
@ -39,13 +39,13 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class SP_API ContainerUtil : public SpineObject {
|
class SP_API ArrayUtils : public SpineObject {
|
||||||
public:
|
public:
|
||||||
/// Finds an item by comparing each item's name.
|
/// Finds an item by comparing each item's name.
|
||||||
/// It is more efficient to cache the results of this method than to call it multiple times.
|
/// It is more efficient to cache the results of this method than to call it multiple times.
|
||||||
/// @return May be NULL.
|
/// @return May be NULL.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static T *findWithName(Vector<T *> &items, const String &name) {
|
static T *findWithName(Array<T *> &items, const String &name) {
|
||||||
assert(name.length() > 0);
|
assert(name.length() > 0);
|
||||||
|
|
||||||
for (size_t i = 0; i < items.size(); ++i) {
|
for (size_t i = 0; i < items.size(); ++i) {
|
||||||
@ -60,7 +60,7 @@ namespace spine {
|
|||||||
|
|
||||||
/// @return -1 if the item was not found.
|
/// @return -1 if the item was not found.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static int findIndexWithName(Vector<T *> &items, const String &name) {
|
static int findIndexWithName(Array<T *> &items, const String &name) {
|
||||||
assert(name.length() > 0);
|
assert(name.length() > 0);
|
||||||
|
|
||||||
for (size_t i = 0, len = items.size(); i < len; ++i) {
|
for (size_t i = 0, len = items.size(); i < len; ++i) {
|
||||||
@ -77,7 +77,7 @@ namespace spine {
|
|||||||
/// It is more efficient to cache the results of this method than to call it multiple times.
|
/// It is more efficient to cache the results of this method than to call it multiple times.
|
||||||
/// @return May be NULL.
|
/// @return May be NULL.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static T *findWithDataName(Vector<T *> &items, const String &name) {
|
static T *findWithDataName(Array<T *> &items, const String &name) {
|
||||||
assert(name.length() > 0);
|
assert(name.length() > 0);
|
||||||
|
|
||||||
for (size_t i = 0; i < items.size(); ++i) {
|
for (size_t i = 0; i < items.size(); ++i) {
|
||||||
@ -92,7 +92,7 @@ namespace spine {
|
|||||||
|
|
||||||
/// @return -1 if the item was not found.
|
/// @return -1 if the item was not found.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static int findIndexWithDataName(Vector<T *> &items, const String &name) {
|
static int findIndexWithDataName(Array<T *> &items, const String &name) {
|
||||||
assert(name.length() > 0);
|
assert(name.length() > 0);
|
||||||
|
|
||||||
for (size_t i = 0, len = items.size(); i < len; ++i) {
|
for (size_t i = 0, len = items.size(); i < len; ++i) {
|
||||||
@ -106,7 +106,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void cleanUpVectorOfPointers(Vector<T *> &items) {
|
static void deleteElements(Array<T *> &items) {
|
||||||
for (int i = (int) items.size() - 1; i >= 0; i--) {
|
for (int i = (int) items.size() - 1; i >= 0; i--) {
|
||||||
T *item = items[i];
|
T *item = items[i];
|
||||||
|
|
||||||
@ -118,11 +118,11 @@ namespace spine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// ctor, copy ctor, and assignment should be private in a Singleton
|
// ctor, copy ctor, and assignment should be private in a Singleton
|
||||||
ContainerUtil();
|
ArrayUtils();
|
||||||
|
|
||||||
ContainerUtil(const ContainerUtil &);
|
ArrayUtils(const ArrayUtils &);
|
||||||
|
|
||||||
ContainerUtil &operator=(const ContainerUtil &);
|
ArrayUtils &operator=(const ArrayUtils &);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_Atlas_h
|
#ifndef Spine_Atlas_h
|
||||||
#define Spine_Atlas_h
|
#define Spine_Atlas_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
@ -112,10 +112,10 @@ namespace spine {
|
|||||||
String name;
|
String name;
|
||||||
int index;
|
int index;
|
||||||
int x, y;
|
int x, y;
|
||||||
Vector<int> splits;
|
Array<int> splits;
|
||||||
Vector<int> pads;
|
Array<int> pads;
|
||||||
Vector <String> names;
|
Array <String> names;
|
||||||
Vector<float> values;
|
Array<float> values;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextureLoader;
|
class TextureLoader;
|
||||||
@ -135,13 +135,13 @@ namespace spine {
|
|||||||
/// @return The region, or NULL.
|
/// @return The region, or NULL.
|
||||||
AtlasRegion *findRegion(const String &name);
|
AtlasRegion *findRegion(const String &name);
|
||||||
|
|
||||||
Vector<AtlasPage *> &getPages();
|
Array<AtlasPage *> &getPages();
|
||||||
|
|
||||||
Vector<AtlasRegion *> &getRegions();
|
Array<AtlasRegion *> &getRegions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<AtlasPage *> _pages;
|
Array<AtlasPage *> _pages;
|
||||||
Vector<AtlasRegion *> _regions;
|
Array<AtlasRegion *> _regions;
|
||||||
TextureLoader *_textureLoader;
|
TextureLoader *_textureLoader;
|
||||||
|
|
||||||
void load(const char *begin, int length, const char *dir, bool createTexture);
|
void load(const char *begin, int length, const char *dir, bool createTexture);
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#define Spine_AtlasAttachmentLoader_h
|
#define Spine_AtlasAttachmentLoader_h
|
||||||
|
|
||||||
#include <spine/AttachmentLoader.h>
|
#include <spine/AttachmentLoader.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <spine/Timeline.h>
|
#include <spine/Timeline.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/MixBlend.h>
|
#include <spine/MixBlend.h>
|
||||||
#include <spine/MixDirection.h>
|
#include <spine/MixDirection.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
@ -61,7 +61,7 @@ namespace spine {
|
|||||||
virtual ~AttachmentTimeline();
|
virtual ~AttachmentTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
/// Sets the time and attachment name for the specified frame.
|
/// Sets the time and attachment name for the specified frame.
|
||||||
@ -70,10 +70,10 @@ namespace spine {
|
|||||||
void setFrame(int frame, float time, const String &attachmentName);
|
void setFrame(int frame, float time, const String &attachmentName);
|
||||||
|
|
||||||
/// The attachment name for each frame. May contain null values to clear the attachment.
|
/// The attachment name for each frame. May contain null values to clear the attachment.
|
||||||
Vector<String> &getAttachmentNames();
|
Array<String> &getAttachmentNames();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Vector<String> _attachmentNames;
|
Array<String> _attachmentNames;
|
||||||
|
|
||||||
void setAttachment(Skeleton &skeleton, SlotPose &pose, String *attachmentName);
|
void setAttachment(Skeleton &skeleton, SlotPose &pose, String *attachmentName);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/MathUtil.h>
|
#include <spine/MathUtil.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
struct Block {
|
struct Block {
|
||||||
@ -59,7 +59,7 @@ namespace spine {
|
|||||||
|
|
||||||
class BlockAllocator : public SpineObject {
|
class BlockAllocator : public SpineObject {
|
||||||
int initialBlockSize;
|
int initialBlockSize;
|
||||||
Vector <Block> blocks;
|
Array <Block> blocks;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BlockAllocator(int initialBlockSize) : initialBlockSize(initialBlockSize) {
|
BlockAllocator(int initialBlockSize) : initialBlockSize(initialBlockSize) {
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include <spine/BoneData.h>
|
#include <spine/BoneData.h>
|
||||||
#include <spine/BoneLocal.h>
|
#include <spine/BoneLocal.h>
|
||||||
#include <spine/BonePose.h>
|
#include <spine/BonePose.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
/// The current pose for a bone, before constraints are applied.
|
/// The current pose for a bone, before constraints are applied.
|
||||||
@ -85,7 +85,7 @@ namespace spine {
|
|||||||
Bone* getParent();
|
Bone* getParent();
|
||||||
|
|
||||||
/// The immediate children of this bone.
|
/// The immediate children of this bone.
|
||||||
Vector<Bone*>& getChildren();
|
Array<Bone*>& getChildren();
|
||||||
|
|
||||||
static bool isYDown() { return yDown; }
|
static bool isYDown() { return yDown; }
|
||||||
static void setYDown(bool value) { yDown = value; }
|
static void setYDown(bool value) { yDown = value; }
|
||||||
@ -93,7 +93,7 @@ namespace spine {
|
|||||||
private:
|
private:
|
||||||
static bool yDown;
|
static bool yDown;
|
||||||
Bone* const _parent;
|
Bone* const _parent;
|
||||||
Vector<Bone*> _children;
|
Array<Bone*> _children;
|
||||||
bool _sorted;
|
bool _sorted;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,24 +42,39 @@ namespace spine {
|
|||||||
/// Skeleton::updateWorldTransform(Physics).
|
/// Skeleton::updateWorldTransform(Physics).
|
||||||
class SP_API BonePose : public BoneLocal, public Update {
|
class SP_API BonePose : public BoneLocal, public Update {
|
||||||
friend class IkConstraint;
|
friend class IkConstraint;
|
||||||
|
friend class PathConstraint;
|
||||||
|
friend class PhysicsConstraint;
|
||||||
|
friend class TransformConstraint;
|
||||||
|
friend class TransformConstraintData;
|
||||||
|
friend class FromRotate;
|
||||||
|
friend class ToRotate;
|
||||||
|
friend class FromX;
|
||||||
|
friend class ToX;
|
||||||
|
friend class FromY;
|
||||||
|
friend class ToY;
|
||||||
|
friend class FromScaleX;
|
||||||
|
friend class ToScaleX;
|
||||||
|
friend class FromScaleY;
|
||||||
|
friend class ToScaleY;
|
||||||
|
friend class FromShearX;
|
||||||
|
friend class ToShearX;
|
||||||
|
friend class FromShearY;
|
||||||
|
friend class ToShearY;
|
||||||
|
friend class Skeleton;
|
||||||
|
friend class Bone;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Bone* _bone;
|
|
||||||
float _a, _b, _worldX;
|
|
||||||
float _c, _d, _worldY;
|
|
||||||
int _world, _local;
|
|
||||||
|
|
||||||
BonePose();
|
BonePose();
|
||||||
virtual ~BonePose();
|
virtual ~BonePose();
|
||||||
|
|
||||||
/// Called by Skeleton::updateCache() to compute the world transform, if needed.
|
/// Called by Skeleton::updateCache() to compute the world transform, if needed.
|
||||||
virtual void update(Skeleton& skeleton, Physics physics) override;
|
virtual void update(Skeleton &skeleton, Physics physics) override;
|
||||||
|
|
||||||
/// Computes the world transform using the parent bone's applied pose and this pose. Child bones are not updated.
|
/// Computes the world transform using the parent bone's applied pose and this pose. Child bones are not updated.
|
||||||
///
|
///
|
||||||
/// See <a href="https://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
|
/// See <a href="https://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
|
||||||
/// Runtimes Guide.
|
/// Runtimes Guide.
|
||||||
void updateWorldTransform(Skeleton& skeleton);
|
void updateWorldTransform(Skeleton &skeleton);
|
||||||
|
|
||||||
/// Computes the local transform values from the world transform.
|
/// Computes the local transform values from the world transform.
|
||||||
///
|
///
|
||||||
@ -69,12 +84,12 @@ namespace spine {
|
|||||||
///
|
///
|
||||||
/// Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The local transform after
|
/// Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The local transform after
|
||||||
/// calling this method is equivalent to the local transform used to compute the world transform, but may not be identical.
|
/// calling this method is equivalent to the local transform used to compute the world transform, but may not be identical.
|
||||||
void updateLocalTransform(Skeleton& skeleton);
|
void updateLocalTransform(Skeleton &skeleton);
|
||||||
|
|
||||||
/// If the world transform has been modified and the local transform no longer matches, updateLocalTransform() is called.
|
/// If the world transform has been modified and the local transform no longer matches, updateLocalTransform() is called.
|
||||||
void validateLocalTransform(Skeleton& skeleton);
|
void validateLocalTransform(Skeleton &skeleton);
|
||||||
|
|
||||||
void modifyLocal(Skeleton& skeleton);
|
void modifyLocal(Skeleton &skeleton);
|
||||||
void modifyWorld(int update);
|
void modifyWorld(int update);
|
||||||
void resetWorld(int update);
|
void resetWorld(int update);
|
||||||
|
|
||||||
@ -115,16 +130,16 @@ namespace spine {
|
|||||||
float getWorldScaleY();
|
float getWorldScaleY();
|
||||||
|
|
||||||
/// Transforms a point from world coordinates to the bone's local coordinates.
|
/// Transforms a point from world coordinates to the bone's local coordinates.
|
||||||
void worldToLocal(float worldX, float worldY, float& outLocalX, float& outLocalY);
|
void worldToLocal(float worldX, float worldY, float &outLocalX, float &outLocalY);
|
||||||
|
|
||||||
/// Transforms a point from the bone's local coordinates to world coordinates.
|
/// Transforms a point from the bone's local coordinates to world coordinates.
|
||||||
void localToWorld(float localX, float localY, float& outWorldX, float& outWorldY);
|
void localToWorld(float localX, float localY, float &outWorldX, float &outWorldY);
|
||||||
|
|
||||||
/// Transforms a point from world coordinates to the parent bone's local coordinates.
|
/// Transforms a point from world coordinates to the parent bone's local coordinates.
|
||||||
void worldToParent(float worldX, float worldY, float& outParentX, float& outParentY);
|
void worldToParent(float worldX, float worldY, float &outParentX, float &outParentY);
|
||||||
|
|
||||||
/// Transforms a point from the parent bone's coordinates to world coordinates.
|
/// Transforms a point from the parent bone's coordinates to world coordinates.
|
||||||
void parentToWorld(float parentX, float parentY, float& outWorldX, float& outWorldY);
|
void parentToWorld(float parentX, float parentY, float &outWorldX, float &outWorldY);
|
||||||
|
|
||||||
/// Transforms a world rotation to a local rotation.
|
/// Transforms a world rotation to a local rotation.
|
||||||
float worldToLocalRotation(float worldRotation);
|
float worldToLocalRotation(float worldRotation);
|
||||||
@ -137,7 +152,13 @@ namespace spine {
|
|||||||
/// After changes are made to the world transform, updateLocalTransform() should be called on this bone and any
|
/// After changes are made to the world transform, updateLocalTransform() should be called on this bone and any
|
||||||
/// child bones, recursively.
|
/// child bones, recursively.
|
||||||
void rotateWorld(float degrees);
|
void rotateWorld(float degrees);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Bone *_bone;
|
||||||
|
float _a, _b, _worldX;
|
||||||
|
float _c, _d, _worldY;
|
||||||
|
int _world, _local;
|
||||||
};
|
};
|
||||||
}
|
}// namespace spine
|
||||||
|
|
||||||
#endif /* SPINE_BONEPOSE_H_ */
|
#endif /* SPINE_BONEPOSE_H_ */
|
||||||
@ -67,7 +67,7 @@ namespace spine {
|
|||||||
BoneTimeline1(size_t frameCount, size_t bezierCount, int boneIndex, Property property);
|
BoneTimeline1(size_t frameCount, size_t bezierCount, int boneIndex, Property property);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -88,7 +88,7 @@ namespace spine {
|
|||||||
BoneTimeline2(size_t frameCount, size_t bezierCount, int boneIndex, Property property1, Property property2);
|
BoneTimeline2(size_t frameCount, size_t bezierCount, int boneIndex, Property property1, Property property2);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -102,7 +102,7 @@ namespace spine {
|
|||||||
virtual ~AlphaTimeline();
|
virtual ~AlphaTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#define Spine_CurveTimeline_h
|
#define Spine_CurveTimeline_h
|
||||||
|
|
||||||
#include <spine/Timeline.h>
|
#include <spine/Timeline.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
/// Base class for frames that use an interpolation bezier curve.
|
/// Base class for frames that use an interpolation bezier curve.
|
||||||
@ -53,7 +53,7 @@ namespace spine {
|
|||||||
|
|
||||||
float getBezierValue(float time, size_t frame, size_t valueOffset, size_t i);
|
float getBezierValue(float time, size_t frame, size_t valueOffset, size_t i);
|
||||||
|
|
||||||
Vector<float> &getCurves();
|
Array<float> &getCurves();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const int LINEAR = 0;
|
static const int LINEAR = 0;
|
||||||
@ -61,7 +61,7 @@ namespace spine {
|
|||||||
static const int BEZIER = 2;
|
static const int BEZIER = 2;
|
||||||
static const int BEZIER_SIZE = 18;
|
static const int BEZIER_SIZE = 18;
|
||||||
|
|
||||||
Vector<float> _curves; // type, x, y, ...
|
Array<float> _curves; // type, x, y, ...
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The base class for a CurveTimeline that sets one property.
|
/// The base class for a CurveTimeline that sets one property.
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#define SPINE_LOG_H
|
#define SPINE_LOG_H
|
||||||
|
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/HashMap.h>
|
#include <spine/HashMap.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
|
|||||||
@ -47,10 +47,10 @@ namespace spine {
|
|||||||
explicit DeformTimeline(size_t frameCount, size_t bezierCount, int slotIndex, VertexAttachment *attachment);
|
explicit DeformTimeline(size_t frameCount, size_t bezierCount, int slotIndex, VertexAttachment *attachment);
|
||||||
|
|
||||||
/// Sets the time and vertices for the specified frame.
|
/// Sets the time and vertices for the specified frame.
|
||||||
void setFrame(int frameIndex, float time, Vector<float> &vertices);
|
void setFrame(int frameIndex, float time, Array<float> &vertices);
|
||||||
|
|
||||||
/// The vertices for each frame.
|
/// The vertices for each frame.
|
||||||
Vector <Vector<float>> &getVertices();
|
Array <Array<float>> &getVertices();
|
||||||
|
|
||||||
/// The attachment that will be deformed.
|
/// The attachment that will be deformed.
|
||||||
VertexAttachment *getAttachment();
|
VertexAttachment *getAttachment();
|
||||||
@ -69,7 +69,7 @@ namespace spine {
|
|||||||
void apply(Slot &slot, SlotPose &pose, float time, float alpha, MixBlend blend) override;
|
void apply(Slot &slot, SlotPose &pose, float time, float alpha, MixBlend blend) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector <Vector<float>> _vertices;
|
Array <Array<float>> _vertices;
|
||||||
|
|
||||||
VertexAttachment *_attachment;
|
VertexAttachment *_attachment;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -45,22 +45,22 @@ namespace spine {
|
|||||||
explicit DrawOrderTimeline(size_t frameCount);
|
explicit DrawOrderTimeline(size_t frameCount);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
size_t getFrameCount();
|
size_t getFrameCount();
|
||||||
|
|
||||||
/// The draw order for each frame. See setFrame().
|
/// The draw order for each frame. See setFrame().
|
||||||
Vector <Vector<int>> &getDrawOrders();
|
Array <Array<int>> &getDrawOrders();
|
||||||
|
|
||||||
/// Sets the time and draw order for the specified frame.
|
/// Sets the time and draw order for the specified frame.
|
||||||
/// @param frame Between 0 and frameCount, inclusive.
|
/// @param frame Between 0 and frameCount, inclusive.
|
||||||
/// @param time The frame time in seconds.
|
/// @param time The frame time in seconds.
|
||||||
/// @param drawOrder For each slot in Skeleton::slots, the index of the slot in the new draw order. May be null to use setup pose draw order.
|
/// @param drawOrder For each slot in Skeleton::slots, the index of the slot in the new draw order. May be null to use setup pose draw order.
|
||||||
void setFrame(size_t frame, float time, Vector<int> *drawOrder);
|
void setFrame(size_t frame, float time, Array<int> *drawOrder);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector <Vector<int>> _drawOrders;
|
Array <Array<int>> _drawOrders;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,20 +48,20 @@ namespace spine {
|
|||||||
|
|
||||||
/// Fires events for frames > lastTime and <= time.
|
/// Fires events for frames > lastTime and <= time.
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
size_t getFrameCount();
|
size_t getFrameCount();
|
||||||
|
|
||||||
/// The event for each frame.
|
/// The event for each frame.
|
||||||
Vector<Event *> &getEvents();
|
Array<Event *> &getEvents();
|
||||||
|
|
||||||
/// Sets the time and event for the specified frame.
|
/// Sets the time and event for the specified frame.
|
||||||
/// @param frame Between 0 and frameCount, inclusive.
|
/// @param frame Between 0 and frameCount, inclusive.
|
||||||
void setFrame(size_t frame, Event *event);
|
void setFrame(size_t frame, Event *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<Event *> _events;
|
Array<Event *> _events;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_HashMap_h
|
#ifndef Spine_HashMap_h
|
||||||
#define Spine_HashMap_h
|
#define Spine_HashMap_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
// Required for new with line number and file name in MSVC
|
// Required for new with line number and file name in MSVC
|
||||||
@ -131,7 +131,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool addAll(Vector <K> &keys, const V &value) {
|
bool addAll(Array <K> &keys, const V &value) {
|
||||||
size_t oldSize = _size;
|
size_t oldSize = _size;
|
||||||
for (size_t i = 0; i < keys.size(); i++) {
|
for (size_t i = 0; i < keys.size(); i++) {
|
||||||
put(keys[i], value);
|
put(keys[i], value);
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
#include <spine/IkConstraintData.h>
|
#include <spine/IkConstraintData.h>
|
||||||
#include <spine/IkConstraintPose.h>
|
#include <spine/IkConstraintPose.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class Skeleton;
|
class Skeleton;
|
||||||
@ -61,7 +61,7 @@ namespace spine {
|
|||||||
|
|
||||||
IkConstraintData &getData() override;
|
IkConstraintData &getData() override;
|
||||||
|
|
||||||
Vector<BonePose *> &getBones();
|
Array<BonePose *> &getBones();
|
||||||
|
|
||||||
Bone *getTarget();
|
Bone *getTarget();
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ namespace spine {
|
|||||||
float softness, float mix);
|
float softness, float mix);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<BonePose *> _bones;
|
Array<BonePose *> _bones;
|
||||||
Bone *_target;
|
Bone *_target;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_IkConstraintData_h
|
#ifndef Spine_IkConstraintData_h
|
||||||
#define Spine_IkConstraintData_h
|
#define Spine_IkConstraintData_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
@ -60,7 +60,7 @@ namespace spine {
|
|||||||
virtual Constraint* create(Skeleton& skeleton) override;
|
virtual Constraint* create(Skeleton& skeleton) override;
|
||||||
|
|
||||||
/// The bones that are constrained by this IK Constraint.
|
/// The bones that are constrained by this IK Constraint.
|
||||||
Vector<BoneData *> &getBones();
|
Array<BoneData *> &getBones();
|
||||||
|
|
||||||
/// The bone that is the IK target.
|
/// The bone that is the IK target.
|
||||||
BoneData *getTarget();
|
BoneData *getTarget();
|
||||||
@ -73,7 +73,7 @@ namespace spine {
|
|||||||
void setUniform(bool uniform);
|
void setUniform(bool uniform);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<BoneData *> _bones;
|
Array<BoneData *> _bones;
|
||||||
BoneData *_target;
|
BoneData *_target;
|
||||||
bool _uniform;
|
bool _uniform;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace spine {
|
|||||||
virtual ~IkConstraintTimeline();
|
virtual ~IkConstraintTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
/// Sets the time, mix, softness, bend direction, compress, and stretch for the specified frame.
|
/// Sets the time, mix, softness, bend direction, compress, and stretch for the specified frame.
|
||||||
|
|||||||
@ -57,7 +57,7 @@ namespace spine {
|
|||||||
void setFrame(int frame, float time, Inherit inherit);
|
void setFrame(int frame, float time, Inherit inherit);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#define Spine_Json_h
|
#define Spine_Json_h
|
||||||
|
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
#ifndef SPINE_JSON_HAVE_PREV
|
#ifndef SPINE_JSON_HAVE_PREV
|
||||||
/* spine doesn't use the "prev" link in the Json sibling lists. */
|
/* spine doesn't use the "prev" link in the Json sibling lists. */
|
||||||
@ -53,7 +53,7 @@ namespace spine {
|
|||||||
static const int JSON_OBJECT;
|
static const int JSON_OBJECT;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static bool asArray(Json *value, Vector<T> &array) {
|
static bool asArray(Json *value, Array<T> &array) {
|
||||||
if (value == NULL) return false;
|
if (value == NULL) return false;
|
||||||
array.setSize(value->_size, 0);
|
array.setSize(value->_size, 0);
|
||||||
Json *vertex = value->_child;
|
Json *vertex = value->_child;
|
||||||
|
|||||||
@ -39,19 +39,19 @@ namespace spine {
|
|||||||
|
|
||||||
SP_API void spDebug_printTimeline(Timeline *timeline);
|
SP_API void spDebug_printTimeline(Timeline *timeline);
|
||||||
|
|
||||||
SP_API void spDebug_printBoneDatas(Vector<BoneData *> &boneDatas);
|
SP_API void spDebug_printBoneDatas(Array<BoneData *> &boneDatas);
|
||||||
|
|
||||||
SP_API void spDebug_printBoneData(BoneData *boneData);
|
SP_API void spDebug_printBoneData(BoneData *boneData);
|
||||||
|
|
||||||
SP_API void spDebug_printSkeleton(Skeleton *skeleton);
|
SP_API void spDebug_printSkeleton(Skeleton *skeleton);
|
||||||
|
|
||||||
SP_API void spDebug_printBones(Vector<Bone *> &bones);
|
SP_API void spDebug_printBones(Array<Bone *> &bones);
|
||||||
|
|
||||||
SP_API void spDebug_printBone(Bone *bone);
|
SP_API void spDebug_printBone(Bone *bone);
|
||||||
|
|
||||||
SP_API void spDebug_printFloats(float *values, int numFloats);
|
SP_API void spDebug_printFloats(float *values, int numFloats);
|
||||||
|
|
||||||
SP_API void spDebug_printFloats(Vector<float> &values);
|
SP_API void spDebug_printFloats(Array<float> &values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include <spine/VertexAttachment.h>
|
#include <spine/VertexAttachment.h>
|
||||||
#include <spine/TextureRegion.h>
|
#include <spine/TextureRegion.h>
|
||||||
#include <spine/Sequence.h>
|
#include <spine/Sequence.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
#include <spine/HasRendererObject.h>
|
#include <spine/HasRendererObject.h>
|
||||||
|
|
||||||
@ -64,16 +64,16 @@ namespace spine {
|
|||||||
|
|
||||||
void setHullLength(int inValue);
|
void setHullLength(int inValue);
|
||||||
|
|
||||||
Vector<float> &getRegionUVs();
|
Array<float> &getRegionUVs();
|
||||||
|
|
||||||
void setRegionUVs(Vector<float> &inValue);
|
void setRegionUVs(Array<float> &inValue);
|
||||||
|
|
||||||
/// The UV pair for each vertex, normalized within the entire texture. See also MeshAttachment::updateRegion
|
/// The UV pair for each vertex, normalized within the entire texture. See also MeshAttachment::updateRegion
|
||||||
Vector<float> &getUVs();
|
Array<float> &getUVs();
|
||||||
|
|
||||||
Vector<unsigned short> &getTriangles();
|
Array<unsigned short> &getTriangles();
|
||||||
|
|
||||||
void setTriangles(Vector<unsigned short> &inValue);
|
void setTriangles(Array<unsigned short> &inValue);
|
||||||
|
|
||||||
Color &getColor();
|
Color &getColor();
|
||||||
|
|
||||||
@ -94,9 +94,9 @@ namespace spine {
|
|||||||
void setParentMesh(MeshAttachment *inValue);
|
void setParentMesh(MeshAttachment *inValue);
|
||||||
|
|
||||||
// Nonessential.
|
// Nonessential.
|
||||||
Vector<unsigned short> &getEdges();
|
Array<unsigned short> &getEdges();
|
||||||
|
|
||||||
void setEdges(Vector<unsigned short> &inValue);
|
void setEdges(Array<unsigned short> &inValue);
|
||||||
|
|
||||||
float getWidth();
|
float getWidth();
|
||||||
|
|
||||||
@ -112,10 +112,10 @@ namespace spine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MeshAttachment *_parentMesh;
|
MeshAttachment *_parentMesh;
|
||||||
Vector<float> _uvs;
|
Array<float> _uvs;
|
||||||
Vector<float> _regionUVs;
|
Array<float> _regionUVs;
|
||||||
Vector<unsigned short> _triangles;
|
Array<unsigned short> _triangles;
|
||||||
Vector<unsigned short> _edges;
|
Array<unsigned short> _edges;
|
||||||
String _path;
|
String _path;
|
||||||
Color _color;
|
Color _color;
|
||||||
int _hullLength;
|
int _hullLength;
|
||||||
|
|||||||
@ -45,9 +45,9 @@ namespace spine {
|
|||||||
explicit PathAttachment(const String &name);
|
explicit PathAttachment(const String &name);
|
||||||
|
|
||||||
/// The length in the setup pose from the start of the path to the end of each curve.
|
/// The length in the setup pose from the start of the path to the end of each curve.
|
||||||
Vector<float> &getLengths();
|
Array<float> &getLengths();
|
||||||
|
|
||||||
void setLengths(Vector<float> &inValue);
|
void setLengths(Array<float> &inValue);
|
||||||
|
|
||||||
bool isClosed();
|
bool isClosed();
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace spine {
|
|||||||
virtual Attachment *copy() override;
|
virtual Attachment *copy() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<float> _lengths;
|
Array<float> _lengths;
|
||||||
bool _closed;
|
bool _closed;
|
||||||
bool _constantSpeed;
|
bool _constantSpeed;
|
||||||
Color _color;
|
Color _color;
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
#include <spine/PathConstraintData.h>
|
#include <spine/PathConstraintData.h>
|
||||||
#include <spine/PathConstraintPose.h>
|
#include <spine/PathConstraintPose.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class Skeleton;
|
class Skeleton;
|
||||||
@ -74,7 +74,7 @@ namespace spine {
|
|||||||
virtual bool isSourceActive() override;
|
virtual bool isSourceActive() override;
|
||||||
|
|
||||||
/// The bones that will be modified by this path constraint.
|
/// The bones that will be modified by this path constraint.
|
||||||
Vector<BonePose *> &getBones();
|
Array<BonePose *> &getBones();
|
||||||
|
|
||||||
/// The slot whose path attachment will be used to constrained the bones.
|
/// The slot whose path attachment will be used to constrained the bones.
|
||||||
Slot *getSlot();
|
Slot *getSlot();
|
||||||
@ -86,24 +86,24 @@ namespace spine {
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<BonePose *> _bones;
|
Array<BonePose *> _bones;
|
||||||
Slot *_slot;
|
Slot *_slot;
|
||||||
|
|
||||||
Vector<float> _spaces;
|
Array<float> _spaces;
|
||||||
Vector<float> _positions;
|
Array<float> _positions;
|
||||||
Vector<float> _world;
|
Array<float> _world;
|
||||||
Vector<float> _curves;
|
Array<float> _curves;
|
||||||
Vector<float> _lengths;
|
Array<float> _lengths;
|
||||||
Vector<float> _segments;
|
Array<float> _segments;
|
||||||
|
|
||||||
Vector<float> &computeWorldPositions(Skeleton& skeleton, PathAttachment &path, int spacesCount, bool tangents);
|
Array<float> &computeWorldPositions(Skeleton& skeleton, PathAttachment &path, int spacesCount, bool tangents);
|
||||||
|
|
||||||
void addBeforePosition(float p, Vector<float> &temp, int i, Vector<float> &output, int o);
|
void addBeforePosition(float p, Array<float> &temp, int i, Array<float> &output, int o);
|
||||||
|
|
||||||
void addAfterPosition(float p, Vector<float> &temp, int i, Vector<float> &output, int o);
|
void addAfterPosition(float p, Array<float> &temp, int i, Array<float> &output, int o);
|
||||||
|
|
||||||
void addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2,
|
void addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2,
|
||||||
Vector<float> &output, int o, bool tangents);
|
Array<float> &output, int o, bool tangents);
|
||||||
|
|
||||||
void sortPathSlot(Skeleton& skeleton, Skin& skin, int slotIndex, Bone& slotBone);
|
void sortPathSlot(Skeleton& skeleton, Skin& skin, int slotIndex, Bone& slotBone);
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
#include <spine/PosedData.h>
|
#include <spine/PosedData.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/PathConstraintPose.h>
|
#include <spine/PathConstraintPose.h>
|
||||||
#include <spine/dll.h>
|
#include <spine/dll.h>
|
||||||
#include <spine/PositionMode.h>
|
#include <spine/PositionMode.h>
|
||||||
@ -72,7 +72,7 @@ namespace spine {
|
|||||||
|
|
||||||
|
|
||||||
/// The bones that will be modified by this path constraint.
|
/// The bones that will be modified by this path constraint.
|
||||||
Vector<BoneData *> &getBones();
|
Array<BoneData *> &getBones();
|
||||||
|
|
||||||
/// The slot whose path attachment will be used to constrained the bones.
|
/// The slot whose path attachment will be used to constrained the bones.
|
||||||
SlotData *getSlot();
|
SlotData *getSlot();
|
||||||
@ -100,7 +100,7 @@ namespace spine {
|
|||||||
void setOffsetRotation(float offsetRotation);
|
void setOffsetRotation(float offsetRotation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<BoneData *> _bones;
|
Array<BoneData *> _bones;
|
||||||
SlotData *_slot;
|
SlotData *_slot;
|
||||||
PositionMode _positionMode;
|
PositionMode _positionMode;
|
||||||
SpacingMode _spacingMode;
|
SpacingMode _spacingMode;
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace spine {
|
|||||||
virtual ~PathConstraintMixTimeline();
|
virtual ~PathConstraintMixTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
/// Sets the time and color for the specified frame.
|
/// Sets the time and color for the specified frame.
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace spine {
|
|||||||
virtual ~PathConstraintPositionTimeline();
|
virtual ~PathConstraintPositionTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace spine {
|
|||||||
virtual ~PathConstraintSpacingTimeline();
|
virtual ~PathConstraintSpacingTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include <spine/PhysicsConstraintData.h>
|
#include <spine/PhysicsConstraintData.h>
|
||||||
#include <spine/PhysicsConstraintPose.h>
|
#include <spine/PhysicsConstraintPose.h>
|
||||||
#include <spine/BonePose.h>
|
#include <spine/BonePose.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class Skeleton;
|
class Skeleton;
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace spine {
|
|||||||
explicit PhysicsConstraintTimeline(size_t frameCount, size_t bezierCount, int constraintIndex, Property property);
|
explicit PhysicsConstraintTimeline(size_t frameCount, size_t bezierCount, int constraintIndex, Property property);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -254,7 +254,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
int getFrameCount() { return (int)_frames.size(); }
|
int getFrameCount() { return (int)_frames.size(); }
|
||||||
|
|||||||
@ -31,8 +31,8 @@
|
|||||||
#define Spine_Pool_h
|
#define Spine_Pool_h
|
||||||
|
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
@ -43,7 +43,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
~Pool() {
|
~Pool() {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_objects);
|
ArrayUtils::deleteElements(_objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
T *obtain() {
|
T *obtain() {
|
||||||
@ -67,7 +67,7 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<T *> _objects;
|
Array<T *> _objects;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#define Spine_RegionAttachment_h
|
#define Spine_RegionAttachment_h
|
||||||
|
|
||||||
#include <spine/Attachment.h>
|
#include <spine/Attachment.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
#include <spine/Sequence.h>
|
#include <spine/Sequence.h>
|
||||||
#include <spine/TextureRegion.h>
|
#include <spine/TextureRegion.h>
|
||||||
@ -68,7 +68,7 @@ namespace spine {
|
|||||||
/// @param stride The number of worldVertices entries between the value pairs written.
|
/// @param stride The number of worldVertices entries between the value pairs written.
|
||||||
void computeWorldVertices(Slot &slot, float *worldVertices, size_t offset, size_t stride = 2);
|
void computeWorldVertices(Slot &slot, float *worldVertices, size_t offset, size_t stride = 2);
|
||||||
|
|
||||||
void computeWorldVertices(Slot &slot, Vector<float> &worldVertices, size_t offset, size_t stride = 2);
|
void computeWorldVertices(Slot &slot, Array<float> &worldVertices, size_t offset, size_t stride = 2);
|
||||||
|
|
||||||
float getX();
|
float getX();
|
||||||
|
|
||||||
@ -112,9 +112,9 @@ namespace spine {
|
|||||||
|
|
||||||
void setSequence(Sequence *sequence);
|
void setSequence(Sequence *sequence);
|
||||||
|
|
||||||
Vector<float> &getOffset();
|
Array<float> &getOffset();
|
||||||
|
|
||||||
Vector<float> &getUVs();
|
Array<float> &getUVs();
|
||||||
|
|
||||||
virtual Attachment *copy() override;
|
virtual Attachment *copy() override;
|
||||||
|
|
||||||
@ -129,8 +129,8 @@ namespace spine {
|
|||||||
static const int BRY;
|
static const int BRY;
|
||||||
|
|
||||||
float _x, _y, _rotation, _scaleX, _scaleY, _width, _height;
|
float _x, _y, _rotation, _scaleX, _scaleY, _width, _height;
|
||||||
Vector<float> _vertexOffset;
|
Array<float> _vertexOffset;
|
||||||
Vector<float> _uvs;
|
Array<float> _uvs;
|
||||||
String _path;
|
String _path;
|
||||||
Color _color;
|
Color _color;
|
||||||
TextureRegion *_region;
|
TextureRegion *_region;
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_Sequence_h
|
#ifndef Spine_Sequence_h
|
||||||
#define Spine_Sequence_h
|
#define Spine_Sequence_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <spine/TextureRegion.h>
|
#include <spine/TextureRegion.h>
|
||||||
#include <spine/RTTI.h>
|
#include <spine/RTTI.h>
|
||||||
@ -74,12 +74,12 @@ namespace spine {
|
|||||||
|
|
||||||
void setSetupIndex(int setupIndex) { _setupIndex = setupIndex; }
|
void setSetupIndex(int setupIndex) { _setupIndex = setupIndex; }
|
||||||
|
|
||||||
Vector<TextureRegion *> &getRegions() { return _regions; }
|
Array<TextureRegion *> &getRegions() { return _regions; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int _nextID;
|
static int _nextID;
|
||||||
int _id;
|
int _id;
|
||||||
Vector<TextureRegion *> _regions;
|
Array<TextureRegion *> _regions;
|
||||||
int _start;
|
int _start;
|
||||||
int _digits;
|
int _digits;
|
||||||
int _setupIndex;
|
int _setupIndex;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ namespace spine {
|
|||||||
virtual ~SequenceTimeline();
|
virtual ~SequenceTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
/// Sets the time, mode, index, and frame time for the specified frame.
|
/// Sets the time, mode, index, and frame time for the specified frame.
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_Skeleton_h
|
#ifndef Spine_Skeleton_h
|
||||||
#define Spine_Skeleton_h
|
#define Spine_Skeleton_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/MathUtil.h>
|
#include <spine/MathUtil.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
@ -165,7 +165,7 @@ namespace spine {
|
|||||||
|
|
||||||
void sortBone(Bone *bone);
|
void sortBone(Bone *bone);
|
||||||
|
|
||||||
static void sortReset(Vector<Bone *> &bones);
|
static void sortReset(Array<Bone *> &bones);
|
||||||
|
|
||||||
/// Updates the world transform for each bone and applies all constraints.
|
/// Updates the world transform for each bone and applies all constraints.
|
||||||
///
|
///
|
||||||
@ -185,21 +185,21 @@ namespace spine {
|
|||||||
|
|
||||||
SkeletonData *getData();
|
SkeletonData *getData();
|
||||||
|
|
||||||
Vector<Bone *> &getBones();
|
Array<Bone *> &getBones();
|
||||||
|
|
||||||
Vector<Update *> &getUpdateCache();
|
Array<Update *> &getUpdateCache();
|
||||||
|
|
||||||
Bone *getRootBone();
|
Bone *getRootBone();
|
||||||
|
|
||||||
/// @return May be NULL.
|
/// @return May be NULL.
|
||||||
Bone *findBone(const String &boneName);
|
Bone *findBone(const String &boneName);
|
||||||
|
|
||||||
Vector<Slot *> &getSlots();
|
Array<Slot *> &getSlots();
|
||||||
|
|
||||||
/// @return May be NULL.
|
/// @return May be NULL.
|
||||||
Slot *findSlot(const String &slotName);
|
Slot *findSlot(const String &slotName);
|
||||||
|
|
||||||
Vector<Slot *> &getDrawOrder();
|
Array<Slot *> &getDrawOrder();
|
||||||
|
|
||||||
Skin *getSkin();
|
Skin *getSkin();
|
||||||
|
|
||||||
@ -224,9 +224,9 @@ namespace spine {
|
|||||||
/// @param attachmentName May be empty.
|
/// @param attachmentName May be empty.
|
||||||
void setAttachment(const String &slotName, const String &attachmentName);
|
void setAttachment(const String &slotName, const String &attachmentName);
|
||||||
|
|
||||||
Vector<Constraint *> &getConstraints();
|
Array<Constraint *> &getConstraints();
|
||||||
|
|
||||||
Vector<PhysicsConstraint *> &getPhysicsConstraints();
|
Array<PhysicsConstraint *> &getPhysicsConstraints();
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
T *findConstraint(const String &constraintName) {
|
T *findConstraint(const String &constraintName) {
|
||||||
@ -247,10 +247,10 @@ namespace spine {
|
|||||||
/// @param outY The vertical distance between the skeleton origin and the bottom side of the AABB.
|
/// @param outY The vertical distance between the skeleton origin and the bottom side of the AABB.
|
||||||
/// @param outWidth The width of the AABB
|
/// @param outWidth The width of the AABB
|
||||||
/// @param outHeight The height of the AABB.
|
/// @param outHeight The height of the AABB.
|
||||||
/// @param outVertexBuffer Reference to hold a Vector of floats. This method will assign it with new floats as needed.
|
/// @param outVertexBuffer Reference to hold an array of floats. This method will assign it with new floats as needed.
|
||||||
// @param clipping Pointer to a SkeletonClipping instance or NULL. If a clipper is given, clipping attachments will be taken into account.
|
// @param clipping Pointer to a SkeletonClipping instance or NULL. If a clipper is given, clipping attachments will be taken into account.
|
||||||
void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector<float> &outVertexBuffer);
|
void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array<float> &outVertexBuffer);
|
||||||
void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector<float> &outVertexBuffer, SkeletonClipping *clipper);
|
void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array<float> &outVertexBuffer, SkeletonClipping *clipper);
|
||||||
|
|
||||||
Color &getColor();
|
Color &getColor();
|
||||||
|
|
||||||
@ -309,13 +309,13 @@ namespace spine {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
SkeletonData &_data;
|
SkeletonData &_data;
|
||||||
Vector<Bone *> _bones;
|
Array<Bone *> _bones;
|
||||||
Vector<Slot *> _slots;
|
Array<Slot *> _slots;
|
||||||
Vector<Slot *> _drawOrder;
|
Array<Slot *> _drawOrder;
|
||||||
Vector<Constraint *> _constraints;
|
Array<Constraint *> _constraints;
|
||||||
Vector<PhysicsConstraint *> _physics;
|
Array<PhysicsConstraint *> _physics;
|
||||||
Vector<Update *> _updateCache;
|
Array<Update *> _updateCache;
|
||||||
Vector<Posed *> _resetCache;
|
Array<Posed *> _resetCache;
|
||||||
Skin *_skin;
|
Skin *_skin;
|
||||||
Color _color;
|
Color _color;
|
||||||
float _x, _y;
|
float _x, _y;
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#define Spine_SkeletonBinary_h
|
#define Spine_SkeletonBinary_h
|
||||||
|
|
||||||
#include <spine/Inherit.h>
|
#include <spine/Inherit.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
@ -225,7 +225,7 @@ namespace spine {
|
|||||||
};
|
};
|
||||||
|
|
||||||
AttachmentLoader *_attachmentLoader;
|
AttachmentLoader *_attachmentLoader;
|
||||||
Vector<LinkedMesh *> _linkedMeshes;
|
Array<LinkedMesh *> _linkedMeshes;
|
||||||
String _error;
|
String _error;
|
||||||
float _scale;
|
float _scale;
|
||||||
const bool _ownsLoader;
|
const bool _ownsLoader;
|
||||||
@ -239,17 +239,17 @@ namespace spine {
|
|||||||
|
|
||||||
Sequence *readSequence(DataInput &input);
|
Sequence *readSequence(DataInput &input);
|
||||||
|
|
||||||
int readVertices(DataInput &input, Vector<float> &vertices, Vector<int> &bones, bool weighted);
|
int readVertices(DataInput &input, Array<float> &vertices, Array<int> &bones, bool weighted);
|
||||||
|
|
||||||
void readFloatArray(DataInput &input, int n, float scale, Vector<float> &array);
|
void readFloatArray(DataInput &input, int n, float scale, Array<float> &array);
|
||||||
|
|
||||||
void readShortArray(DataInput &input, Vector<unsigned short> &array, int n);
|
void readShortArray(DataInput &input, Array<unsigned short> &array, int n);
|
||||||
|
|
||||||
Animation *readAnimation(DataInput &input, const String &name, SkeletonData &skeletonData);
|
Animation *readAnimation(DataInput &input, const String &name, SkeletonData &skeletonData);
|
||||||
|
|
||||||
void readTimeline(DataInput &input, Vector<Timeline *> &timelines, CurveTimeline1 &timeline, float scale);
|
void readTimeline(DataInput &input, Array<Timeline *> &timelines, CurveTimeline1 &timeline, float scale);
|
||||||
|
|
||||||
void readTimeline(DataInput &input, Vector<Timeline *> &timelines, BoneTimeline2 &timeline, float scale);
|
void readTimeline(DataInput &input, Array<Timeline *> &timelines, BoneTimeline2 &timeline, float scale);
|
||||||
|
|
||||||
void
|
void
|
||||||
setBezier(DataInput &input, CurveTimeline &timeline, int bezier, int frame, int value, float time1, float time2,
|
setBezier(DataInput &input, CurveTimeline &timeline, int bezier, int frame, int value, float time1, float time2,
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_SkeletonBounds_h
|
#ifndef Spine_SkeletonBounds_h
|
||||||
#define Spine_SkeletonBounds_h
|
#define Spine_SkeletonBounds_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Pool.h>
|
#include <spine/Pool.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
@ -88,11 +88,11 @@ namespace spine {
|
|||||||
/// Returns the bounding box for the given polygon or null. Requires a call to update() first.
|
/// Returns the bounding box for the given polygon or null. Requires a call to update() first.
|
||||||
BoundingBoxAttachment * getBoundingBox(Polygon *polygon);
|
BoundingBoxAttachment * getBoundingBox(Polygon *polygon);
|
||||||
|
|
||||||
/// Returns all polygons or an empty vector. Requires a call to update() first.
|
/// Returns all polygons or an empty array. Requires a call to update() first.
|
||||||
Vector<Polygon *> &getPolygons();
|
Array<Polygon *> &getPolygons();
|
||||||
|
|
||||||
/// Returns all bounding boxes. Requires a call to update() first.
|
/// Returns all bounding boxes. Requires a call to update() first.
|
||||||
Vector<BoundingBoxAttachment *> &getBoundingBoxes();
|
Array<BoundingBoxAttachment *> &getBoundingBoxes();
|
||||||
|
|
||||||
/// The left edge of the axis aligned bounding box.
|
/// The left edge of the axis aligned bounding box.
|
||||||
float getMinX();
|
float getMinX();
|
||||||
@ -114,8 +114,8 @@ namespace spine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Pool <Polygon> _polygonPool;
|
Pool <Polygon> _polygonPool;
|
||||||
Vector<BoundingBoxAttachment *> _boundingBoxes;
|
Array<BoundingBoxAttachment *> _boundingBoxes;
|
||||||
Vector<Polygon *> _polygons;
|
Array<Polygon *> _polygons;
|
||||||
float _minX, _minY, _maxX, _maxY;
|
float _minX, _minY, _maxX, _maxY;
|
||||||
|
|
||||||
void aabbCompute();
|
void aabbCompute();
|
||||||
@ -123,7 +123,7 @@ namespace spine {
|
|||||||
|
|
||||||
class Polygon : public SpineObject {
|
class Polygon : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Vector<float> _vertices;
|
Array<float> _vertices;
|
||||||
int _count;
|
int _count;
|
||||||
|
|
||||||
Polygon() : _count(0) {
|
Polygon() : _count(0) {
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_SkeletonClipping_h
|
#ifndef Spine_SkeletonClipping_h
|
||||||
#define Spine_SkeletonClipping_h
|
#define Spine_SkeletonClipping_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Triangulator.h>
|
#include <spine/Triangulator.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
@ -55,33 +55,33 @@ namespace spine {
|
|||||||
clipTriangles(float *vertices, unsigned short *triangles, size_t trianglesLength, float *uvs, size_t stride);
|
clipTriangles(float *vertices, unsigned short *triangles, size_t trianglesLength, float *uvs, size_t stride);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
clipTriangles(Vector<float> &vertices, Vector<unsigned short> &triangles, Vector<float> &uvs, size_t stride);
|
clipTriangles(Array<float> &vertices, Array<unsigned short> &triangles, Array<float> &uvs, size_t stride);
|
||||||
|
|
||||||
bool isClipping();
|
bool isClipping();
|
||||||
|
|
||||||
Vector<float> &getClippedVertices();
|
Array<float> &getClippedVertices();
|
||||||
|
|
||||||
Vector<unsigned short> &getClippedTriangles();
|
Array<unsigned short> &getClippedTriangles();
|
||||||
|
|
||||||
Vector<float> &getClippedUVs();
|
Array<float> &getClippedUVs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Triangulator _triangulator;
|
Triangulator _triangulator;
|
||||||
Vector<float> _clippingPolygon;
|
Array<float> _clippingPolygon;
|
||||||
Vector<float> _clipOutput;
|
Array<float> _clipOutput;
|
||||||
Vector<float> _clippedVertices;
|
Array<float> _clippedVertices;
|
||||||
Vector<unsigned short> _clippedTriangles;
|
Array<unsigned short> _clippedTriangles;
|
||||||
Vector<float> _clippedUVs;
|
Array<float> _clippedUVs;
|
||||||
Vector<float> _scratch;
|
Array<float> _scratch;
|
||||||
ClippingAttachment *_clipAttachment;
|
ClippingAttachment *_clipAttachment;
|
||||||
Vector<Vector<float> *> *_clippingPolygons;
|
Array<Array<float> *> *_clippingPolygons;
|
||||||
|
|
||||||
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
|
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
|
||||||
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
||||||
bool clip(float x1, float y1, float x2, float y2, float x3, float y3, Vector<float> *clippingArea,
|
bool clip(float x1, float y1, float x2, float y2, float x3, float y3, Array<float> *clippingArea,
|
||||||
Vector<float> *output);
|
Array<float> *output);
|
||||||
|
|
||||||
static void makeClockwise(Vector<float> &polygon);
|
static void makeClockwise(Array<float> &polygon);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_SkeletonData_h
|
#ifndef Spine_SkeletonData_h
|
||||||
#define Spine_SkeletonData_h
|
#define Spine_SkeletonData_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
|
|
||||||
@ -107,13 +107,13 @@ namespace spine {
|
|||||||
void setName(const String &inValue);
|
void setName(const String &inValue);
|
||||||
|
|
||||||
/// The skeleton's bones, sorted parent first. The root bone is always the first bone.
|
/// The skeleton's bones, sorted parent first. The root bone is always the first bone.
|
||||||
Vector<BoneData *> &getBones();
|
Array<BoneData *> &getBones();
|
||||||
|
|
||||||
/// The skeleton's slots in the setup pose draw order.
|
/// The skeleton's slots in the setup pose draw order.
|
||||||
Vector<SlotData *> &getSlots();
|
Array<SlotData *> &getSlots();
|
||||||
|
|
||||||
/// All skins, including the default skin.
|
/// All skins, including the default skin.
|
||||||
Vector<Skin *> &getSkins();
|
Array<Skin *> &getSkins();
|
||||||
|
|
||||||
/// The skeleton's default skin.
|
/// The skeleton's default skin.
|
||||||
/// By default this skin contains all attachments that were not in a skin in Spine.
|
/// By default this skin contains all attachments that were not in a skin in Spine.
|
||||||
@ -123,21 +123,21 @@ namespace spine {
|
|||||||
void setDefaultSkin(Skin *inValue);
|
void setDefaultSkin(Skin *inValue);
|
||||||
|
|
||||||
/// The skeleton's events.
|
/// The skeleton's events.
|
||||||
Vector<spine::EventData *> &getEvents();
|
Array<spine::EventData *> &getEvents();
|
||||||
|
|
||||||
/// The skeleton's animations.
|
/// The skeleton's animations.
|
||||||
Vector<Animation *> &getAnimations();
|
Array<Animation *> &getAnimations();
|
||||||
|
|
||||||
Vector<IkConstraintData *> &getIkConstraints();
|
Array<IkConstraintData *> &getIkConstraints();
|
||||||
|
|
||||||
Vector<TransformConstraintData *> &getTransformConstraints();
|
Array<TransformConstraintData *> &getTransformConstraints();
|
||||||
|
|
||||||
Vector<PathConstraintData *> &getPathConstraints();
|
Array<PathConstraintData *> &getPathConstraints();
|
||||||
|
|
||||||
Vector<PhysicsConstraintData *> &getPhysicsConstraints();
|
Array<PhysicsConstraintData *> &getPhysicsConstraints();
|
||||||
|
|
||||||
/// The skeleton's constraints.
|
/// The skeleton's constraints.
|
||||||
Vector<ConstraintData *> &getConstraints();
|
Array<ConstraintData *> &getConstraints();
|
||||||
|
|
||||||
/// Finds a constraint by name and type.
|
/// Finds a constraint by name and type.
|
||||||
/// @return May be NULL.
|
/// @return May be NULL.
|
||||||
@ -206,22 +206,22 @@ namespace spine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
String _name;
|
String _name;
|
||||||
Vector<BoneData *> _bones; // Ordered parents first
|
Array<BoneData *> _bones; // Ordered parents first
|
||||||
Vector<SlotData *> _slots; // Setup pose draw order.
|
Array<SlotData *> _slots; // Setup pose draw order.
|
||||||
Vector<Skin *> _skins;
|
Array<Skin *> _skins;
|
||||||
Skin *_defaultSkin;
|
Skin *_defaultSkin;
|
||||||
Vector<EventData *> _events;
|
Array<EventData *> _events;
|
||||||
Vector<Animation *> _animations;
|
Array<Animation *> _animations;
|
||||||
Vector<IkConstraintData *> _ikConstraints;
|
Array<IkConstraintData *> _ikConstraints;
|
||||||
Vector<TransformConstraintData *> _transformConstraints;
|
Array<TransformConstraintData *> _transformConstraints;
|
||||||
Vector<PathConstraintData *> _pathConstraints;
|
Array<PathConstraintData *> _pathConstraints;
|
||||||
Vector<PhysicsConstraintData *> _physicsConstraints;
|
Array<PhysicsConstraintData *> _physicsConstraints;
|
||||||
Vector<ConstraintData *> _constraints;
|
Array<ConstraintData *> _constraints;
|
||||||
float _x, _y, _width, _height;
|
float _x, _y, _width, _height;
|
||||||
float _referenceScale;
|
float _referenceScale;
|
||||||
String _version;
|
String _version;
|
||||||
String _hash;
|
String _hash;
|
||||||
Vector<char *> _strings;
|
Array<char *> _strings;
|
||||||
|
|
||||||
// Nonessential.
|
// Nonessential.
|
||||||
float _fps;
|
float _fps;
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_SkeletonJson_h
|
#ifndef Spine_SkeletonJson_h
|
||||||
#define Spine_SkeletonJson_h
|
#define Spine_SkeletonJson_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ namespace spine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
AttachmentLoader *_attachmentLoader;
|
AttachmentLoader *_attachmentLoader;
|
||||||
Vector<LinkedMesh *> _linkedMeshes;
|
Array<LinkedMesh *> _linkedMeshes;
|
||||||
float _scale;
|
float _scale;
|
||||||
const bool _ownsLoader;
|
const bool _ownsLoader;
|
||||||
String _error;
|
String _error;
|
||||||
@ -99,10 +99,10 @@ namespace spine {
|
|||||||
readCurve(Json *curve, CurveTimeline *timeline, int bezier, int frame, int value, float time1, float time2,
|
readCurve(Json *curve, CurveTimeline *timeline, int bezier, int frame, int value, float time1, float time2,
|
||||||
float value1, float value2, float scale);
|
float value1, float value2, float scale);
|
||||||
|
|
||||||
static void readTimeline(Vector<Timeline *> &timelines, Json *keyMap, CurveTimeline1 *timeline, float defaultValue, float scale);
|
static void readTimeline(Array<Timeline *> &timelines, Json *keyMap, CurveTimeline1 *timeline, float defaultValue, float scale);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
readTimeline(Vector<Timeline *> &timelines, Json *keyMap, CurveTimeline2 *timeline, const char *name1, const char *name2, float defaultValue,
|
readTimeline(Array<Timeline *> &timelines, Json *keyMap, CurveTimeline2 *timeline, const char *name1, const char *name2, float defaultValue,
|
||||||
float scale);
|
float scale);
|
||||||
|
|
||||||
Animation *readAnimation(Json *root, SkeletonData *skeletonData);
|
Animation *readAnimation(Json *root, SkeletonData *skeletonData);
|
||||||
@ -113,7 +113,7 @@ namespace spine {
|
|||||||
|
|
||||||
void setError(Json *root, const String &value1, const String &value2);
|
void setError(Json *root, const String &value1, const String &value2);
|
||||||
|
|
||||||
int findSlotIndex(SkeletonData *skeletonData, const String &slotName, Vector<Timeline *> timelines);
|
int findSlotIndex(SkeletonData *skeletonData, const String &slotName, Array<Timeline *> timelines);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,10 +59,10 @@ namespace spine {
|
|||||||
RenderCommand *render(Skeleton &skeleton);
|
RenderCommand *render(Skeleton &skeleton);
|
||||||
private:
|
private:
|
||||||
BlockAllocator _allocator;
|
BlockAllocator _allocator;
|
||||||
Vector<float> _worldVertices;
|
Array<float> _worldVertices;
|
||||||
Vector<unsigned short> _quadIndices;
|
Array<unsigned short> _quadIndices;
|
||||||
SkeletonClipping _clipping;
|
SkeletonClipping _clipping;
|
||||||
Vector<RenderCommand *> _renderCommands;
|
Array<RenderCommand *> _renderCommands;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_Skin_h
|
#ifndef Spine_Skin_h
|
||||||
#define Spine_Skin_h
|
#define Spine_Skin_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
|
|
||||||
@ -89,11 +89,11 @@ namespace spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Entries(Vector <Vector<Entry>> &buckets) : _buckets(buckets), _slotIndex(0), _bucketIndex(0) {
|
Entries(Array <Array<Entry>> &buckets) : _buckets(buckets), _slotIndex(0), _bucketIndex(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector <Vector<Entry>> &_buckets;
|
Array <Array<Entry>> &_buckets;
|
||||||
size_t _slotIndex;
|
size_t _slotIndex;
|
||||||
size_t _bucketIndex;
|
size_t _bucketIndex;
|
||||||
};
|
};
|
||||||
@ -111,9 +111,9 @@ namespace spine {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int findInBucket(Vector <Entry> &, const String &attachmentName);
|
int findInBucket(Array <Entry> &, const String &attachmentName);
|
||||||
|
|
||||||
Vector <Vector<Entry>> _buckets;
|
Array <Array<Entry>> _buckets;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit Skin(const String &name);
|
explicit Skin(const String &name);
|
||||||
@ -133,12 +133,12 @@ namespace spine {
|
|||||||
/// Finds the skin keys for a given slot. The results are added to the passed array of names.
|
/// Finds the skin keys for a given slot. The results are added to the passed array of names.
|
||||||
/// @param slotIndex The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex.
|
/// @param slotIndex The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex.
|
||||||
/// @param names Found skin key names will be added to this array.
|
/// @param names Found skin key names will be added to this array.
|
||||||
void findNamesForSlot(size_t slotIndex, Vector <String> &names);
|
void findNamesForSlot(size_t slotIndex, Array <String> &names);
|
||||||
|
|
||||||
/// Finds the attachments for a given slot. The results are added to the passed array of Attachments.
|
/// Finds the attachments for a given slot. The results are added to the passed array of Attachments.
|
||||||
/// @param slotIndex The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex.
|
/// @param slotIndex The target slotIndex. To find the slot index, use SkeletonData::findSlot and SlotData::getIndex.
|
||||||
/// @param attachments Found Attachments will be added to this array.
|
/// @param attachments Found Attachments will be added to this array.
|
||||||
void findAttachmentsForSlot(size_t slotIndex, Vector<Attachment *> &attachments);
|
void findAttachmentsForSlot(size_t slotIndex, Array<Attachment *> &attachments);
|
||||||
|
|
||||||
const String &getName();
|
const String &getName();
|
||||||
|
|
||||||
@ -150,17 +150,17 @@ namespace spine {
|
|||||||
|
|
||||||
AttachmentMap::Entries getAttachments();
|
AttachmentMap::Entries getAttachments();
|
||||||
|
|
||||||
Vector<BoneData *> &getBones();
|
Array<BoneData *> &getBones();
|
||||||
|
|
||||||
Vector<ConstraintData *> &getConstraints();
|
Array<ConstraintData *> &getConstraints();
|
||||||
|
|
||||||
Color &getColor() { return _color; }
|
Color &getColor() { return _color; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const String _name;
|
const String _name;
|
||||||
AttachmentMap _attachments;
|
AttachmentMap _attachments;
|
||||||
Vector<BoneData *> _bones;
|
Array<BoneData *> _bones;
|
||||||
Vector<ConstraintData *> _constraints;
|
Array<ConstraintData *> _constraints;
|
||||||
Color _color;
|
Color _color;
|
||||||
|
|
||||||
/// Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached.
|
/// Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached.
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace spine {
|
|||||||
virtual ~SliderMixTimeline();
|
virtual ~SliderMixTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace spine {
|
|||||||
virtual ~SliderTimeline();
|
virtual ~SliderTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include <spine/Posed.h>
|
#include <spine/Posed.h>
|
||||||
#include <spine/SlotData.h>
|
#include <spine/SlotData.h>
|
||||||
#include <spine/SlotPose.h>
|
#include <spine/SlotPose.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
|
|||||||
@ -49,7 +49,7 @@ namespace spine {
|
|||||||
|
|
||||||
virtual ~SlotCurveTimeline();
|
virtual ~SlotCurveTimeline();
|
||||||
|
|
||||||
virtual void apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
virtual void apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) override;
|
MixBlend blend, MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include <spine/RTTI.h>
|
#include <spine/RTTI.h>
|
||||||
#include <spine/Pose.h>
|
#include <spine/Pose.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class Attachment;
|
class Attachment;
|
||||||
@ -60,7 +60,7 @@ namespace spine {
|
|||||||
bool _hasDarkColor;
|
bool _hasDarkColor;
|
||||||
Attachment* _attachment;
|
Attachment* _attachment;
|
||||||
int _sequenceIndex;
|
int _sequenceIndex;
|
||||||
Vector<float> _deform;
|
Array<float> _deform;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SlotPose();
|
SlotPose();
|
||||||
@ -98,7 +98,7 @@ namespace spine {
|
|||||||
/// weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
|
/// weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
|
||||||
///
|
///
|
||||||
/// See VertexAttachment::computeWorldVertices() and DeformTimeline.
|
/// See VertexAttachment::computeWorldVertices() and DeformTimeline.
|
||||||
Vector<float>& getDeform();
|
Array<float>& getDeform();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_TextureRegion_h
|
#ifndef Spine_TextureRegion_h
|
||||||
#define Spine_TextureRegion_h
|
#define Spine_TextureRegion_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class SP_API TextureRegion : public SpineObject {
|
class SP_API TextureRegion : public SpineObject {
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#define Spine_Timeline_h
|
#define Spine_Timeline_h
|
||||||
|
|
||||||
#include <spine/RTTI.h>
|
#include <spine/RTTI.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/MixBlend.h>
|
#include <spine/MixBlend.h>
|
||||||
#include <spine/MixDirection.h>
|
#include <spine/MixDirection.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
@ -62,24 +62,24 @@ namespace spine {
|
|||||||
/// @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline.
|
/// @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions such as DrawOrderTimeline and AttachmentTimeline.
|
||||||
/// @param appliedPose True to modify the applied pose.
|
/// @param appliedPose True to modify the applied pose.
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) = 0;
|
MixDirection direction, bool appliedPose) = 0;
|
||||||
|
|
||||||
size_t getFrameEntries();
|
size_t getFrameEntries();
|
||||||
|
|
||||||
size_t getFrameCount();
|
size_t getFrameCount();
|
||||||
|
|
||||||
Vector<float> &getFrames();
|
Array<float> &getFrames();
|
||||||
|
|
||||||
float getDuration();
|
float getDuration();
|
||||||
|
|
||||||
virtual Vector <PropertyId> &getPropertyIds();
|
virtual Array <PropertyId> &getPropertyIds();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setPropertyIds(PropertyId propertyIds[], size_t propertyIdsCount);
|
void setPropertyIds(PropertyId propertyIds[], size_t propertyIdsCount);
|
||||||
|
|
||||||
Vector <PropertyId> _propertyIds;
|
Array <PropertyId> _propertyIds;
|
||||||
Vector<float> _frames;
|
Array<float> _frames;
|
||||||
size_t _frameEntries;
|
size_t _frameEntries;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include <spine/Constraint.h>
|
#include <spine/Constraint.h>
|
||||||
#include <spine/TransformConstraintData.h>
|
#include <spine/TransformConstraintData.h>
|
||||||
#include <spine/TransformConstraintPose.h>
|
#include <spine/TransformConstraintPose.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class Skeleton;
|
class Skeleton;
|
||||||
@ -59,7 +59,7 @@ namespace spine {
|
|||||||
bool isSourceActive() override;
|
bool isSourceActive() override;
|
||||||
|
|
||||||
/// The bones that will be modified by this transform constraint.
|
/// The bones that will be modified by this transform constraint.
|
||||||
Vector<BonePose*>& getBones();
|
Array<BonePose*>& getBones();
|
||||||
|
|
||||||
/// The bone whose world transform will be copied to the constrained bones.
|
/// The bone whose world transform will be copied to the constrained bones.
|
||||||
Bone* getSource();
|
Bone* getSource();
|
||||||
@ -67,7 +67,7 @@ namespace spine {
|
|||||||
void setSource(Bone* source);
|
void setSource(Bone* source);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<BonePose*> _bones;
|
Array<BonePose*> _bones;
|
||||||
Bone* _source;
|
Bone* _source;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
#include <spine/PosedData.h>
|
#include <spine/PosedData.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/TransformConstraintPose.h>
|
#include <spine/TransformConstraintPose.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
@ -50,7 +50,7 @@ namespace spine {
|
|||||||
float _offset;
|
float _offset;
|
||||||
|
|
||||||
/// Constrained properties.
|
/// Constrained properties.
|
||||||
Vector<class ToProperty*> _to;
|
Array<class ToProperty*> _to;
|
||||||
|
|
||||||
FromProperty();
|
FromProperty();
|
||||||
virtual ~FromProperty();
|
virtual ~FromProperty();
|
||||||
@ -169,7 +169,7 @@ namespace spine {
|
|||||||
virtual Constraint* create(Skeleton& skeleton) override;
|
virtual Constraint* create(Skeleton& skeleton) override;
|
||||||
|
|
||||||
/// The bones that will be modified by this transform constraint.
|
/// The bones that will be modified by this transform constraint.
|
||||||
Vector<BoneData*>& getBones();
|
Array<BoneData*>& getBones();
|
||||||
|
|
||||||
/// The bone whose world transform will be copied to the constrained bones.
|
/// The bone whose world transform will be copied to the constrained bones.
|
||||||
BoneData* getSource();
|
BoneData* getSource();
|
||||||
@ -216,14 +216,14 @@ namespace spine {
|
|||||||
void setClamp(bool clamp);
|
void setClamp(bool clamp);
|
||||||
|
|
||||||
/// The mapping of transform properties to other transform properties.
|
/// The mapping of transform properties to other transform properties.
|
||||||
Vector<class FromProperty*>& getProperties();
|
Array<class FromProperty*>& getProperties();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<BoneData*> _bones;
|
Array<BoneData*> _bones;
|
||||||
BoneData* _source;
|
BoneData* _source;
|
||||||
float _offsets[6]; // [rotation, x, y, scaleX, scaleY, shearY]
|
float _offsets[6]; // [rotation, x, y, scaleX, scaleY, shearY]
|
||||||
bool _localSource, _localTarget, _additive, _clamp;
|
bool _localSource, _localTarget, _additive, _clamp;
|
||||||
Vector<class FromProperty*> _properties;
|
Array<class FromProperty*> _properties;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace spine {
|
|||||||
virtual ~TransformConstraintTimeline();
|
virtual ~TransformConstraintTimeline();
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha, MixBlend blend,
|
apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha, MixBlend blend,
|
||||||
MixDirection direction, bool appliedPose) override;
|
MixDirection direction, bool appliedPose) override;
|
||||||
|
|
||||||
/// Sets the time, rotate mix, translate mix, scale mix, and shear mix for the specified frame.
|
/// Sets the time, rotate mix, translate mix, scale mix, and shear mix for the specified frame.
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#ifndef Spine_Triangulator_h
|
#ifndef Spine_Triangulator_h
|
||||||
#define Spine_Triangulator_h
|
#define Spine_Triangulator_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/Pool.h>
|
#include <spine/Pool.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
@ -38,28 +38,28 @@ namespace spine {
|
|||||||
public:
|
public:
|
||||||
~Triangulator();
|
~Triangulator();
|
||||||
|
|
||||||
Vector<int> &triangulate(Vector<float> &vertices);
|
Array<int> &triangulate(Array<float> &vertices);
|
||||||
|
|
||||||
Vector<Vector < float>* > &
|
Array<Array < float>* > &
|
||||||
decompose(Vector<float>
|
decompose(Array<float>
|
||||||
&vertices,
|
&vertices,
|
||||||
Vector<int> &triangles
|
Array<int> &triangles
|
||||||
);
|
);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<Vector < float>* >
|
Array<Array < float>* >
|
||||||
_convexPolygons;
|
_convexPolygons;
|
||||||
Vector<Vector < int>* >
|
Array<Array < int>* >
|
||||||
_convexPolygonsIndices;
|
_convexPolygonsIndices;
|
||||||
|
|
||||||
Vector<int> _indices;
|
Array<int> _indices;
|
||||||
Vector<bool> _isConcaveArray;
|
Array<bool> _isConcaveArray;
|
||||||
Vector<int> _triangles;
|
Array<int> _triangles;
|
||||||
|
|
||||||
Pool <Vector<float>> _polygonPool;
|
Pool <Array<float>> _polygonPool;
|
||||||
Pool <Vector<int>> _polygonIndicesPool;
|
Pool <Array<int>> _polygonIndicesPool;
|
||||||
|
|
||||||
static bool isConcave(int index, int vertexCount, Vector<float> &vertices, Vector<int> &indices);
|
static bool isConcave(int index, int vertexCount, Array<float> &vertices, Array<int> &indices);
|
||||||
|
|
||||||
static bool positiveArea(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y);
|
static bool positiveArea(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y);
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <spine/Attachment.h>
|
#include <spine/Attachment.h>
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class Slot;
|
class Slot;
|
||||||
@ -68,19 +68,19 @@ namespace spine {
|
|||||||
virtual void computeWorldVertices(Skeleton &skeleton, Slot &slot, size_t start, size_t count, float *worldVertices, size_t offset,
|
virtual void computeWorldVertices(Skeleton &skeleton, Slot &slot, size_t start, size_t count, float *worldVertices, size_t offset,
|
||||||
size_t stride = 2);
|
size_t stride = 2);
|
||||||
|
|
||||||
virtual void computeWorldVertices(Skeleton &skeleton, Slot &slot, size_t start, size_t count, Vector<float> &worldVertices, size_t offset,
|
virtual void computeWorldVertices(Skeleton &skeleton, Slot &slot, size_t start, size_t count, Array<float> &worldVertices, size_t offset,
|
||||||
size_t stride = 2);
|
size_t stride = 2);
|
||||||
|
|
||||||
/// Gets a unique ID for this attachment.
|
/// Gets a unique ID for this attachment.
|
||||||
int getId();
|
int getId();
|
||||||
|
|
||||||
Vector<int> &getBones();
|
Array<int> &getBones();
|
||||||
|
|
||||||
void setBones(Vector<int> &bones);
|
void setBones(Array<int> &bones);
|
||||||
|
|
||||||
Vector<float> &getVertices();
|
Array<float> &getVertices();
|
||||||
|
|
||||||
void setVertices(Vector<float> &vertices);
|
void setVertices(Array<float> &vertices);
|
||||||
|
|
||||||
size_t getWorldVerticesLength();
|
size_t getWorldVerticesLength();
|
||||||
|
|
||||||
@ -93,8 +93,8 @@ namespace spine {
|
|||||||
void copyTo(VertexAttachment *other);
|
void copyTo(VertexAttachment *other);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Vector <int> _bones;
|
Array <int> _bones;
|
||||||
Vector<float> _vertices;
|
Array<float> _vertices;
|
||||||
size_t _worldVerticesLength;
|
size_t _worldVerticesLength;
|
||||||
Attachment *_timelineAttachment;
|
Attachment *_timelineAttachment;
|
||||||
|
|
||||||
|
|||||||
@ -30,13 +30,13 @@
|
|||||||
#ifndef Spine_Vertices_h
|
#ifndef Spine_Vertices_h
|
||||||
#define Spine_Vertices_h
|
#define Spine_Vertices_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class SP_API Vertices : public SpineObject {
|
class SP_API Vertices : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Vector <int> _bones;
|
Array <int> _bones;
|
||||||
Vector<float> _weights;
|
Array<float> _weights;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
#include <spine/ConstraintTimeline.h>
|
#include <spine/ConstraintTimeline.h>
|
||||||
#include <spine/ConstraintTimeline1.h>
|
#include <spine/ConstraintTimeline1.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
#include <spine/CurveTimeline.h>
|
#include <spine/CurveTimeline.h>
|
||||||
#include <spine/DeformTimeline.h>
|
#include <spine/DeformTimeline.h>
|
||||||
#include <spine/DrawOrderTimeline.h>
|
#include <spine/DrawOrderTimeline.h>
|
||||||
@ -128,7 +128,7 @@
|
|||||||
#include <spine/TranslateTimeline.h>
|
#include <spine/TranslateTimeline.h>
|
||||||
#include <spine/Triangulator.h>
|
#include <spine/Triangulator.h>
|
||||||
#include <spine/Update.h>
|
#include <spine/Update.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
#include <spine/VertexAttachment.h>
|
#include <spine/VertexAttachment.h>
|
||||||
#include <spine/Vertices.h>
|
#include <spine/Vertices.h>
|
||||||
|
|
||||||
|
|||||||
@ -35,13 +35,13 @@
|
|||||||
#include <spine/RotateTimeline.h>
|
#include <spine/RotateTimeline.h>
|
||||||
#include <spine/TranslateTimeline.h>
|
#include <spine/TranslateTimeline.h>
|
||||||
|
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
Animation::Animation(const String &name, Vector<Timeline *> &timelines, float duration) : _timelines(),
|
Animation::Animation(const String &name, Array<Timeline *> &timelines, float duration) : _timelines(),
|
||||||
_timelineIds(),
|
_timelineIds(),
|
||||||
_bones(),
|
_bones(),
|
||||||
_duration(duration),
|
_duration(duration),
|
||||||
@ -49,7 +49,7 @@ Animation::Animation(const String &name, Vector<Timeline *> &timelines, float du
|
|||||||
setTimelines(timelines);
|
setTimelines(timelines);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Animation::hasTimeline(Vector<PropertyId> &ids) {
|
bool Animation::hasTimeline(Array<PropertyId> &ids) {
|
||||||
for (size_t i = 0; i < ids.size(); i++) {
|
for (size_t i = 0; i < ids.size(); i++) {
|
||||||
if (_timelineIds.containsKey(ids[i])) return true;
|
if (_timelineIds.containsKey(ids[i])) return true;
|
||||||
}
|
}
|
||||||
@ -57,10 +57,10 @@ bool Animation::hasTimeline(Vector<PropertyId> &ids) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Animation::~Animation() {
|
Animation::~Animation() {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_timelines);
|
ArrayUtils::deleteElements(_timelines);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::apply(Skeleton &skeleton, float lastTime, float time, bool loop, Vector<Event *> *pEvents, float alpha,
|
void Animation::apply(Skeleton &skeleton, float lastTime, float time, bool loop, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
if (loop && _duration != 0) {
|
if (loop && _duration != 0) {
|
||||||
time = MathUtil::fmod(time, _duration);
|
time = MathUtil::fmod(time, _duration);
|
||||||
@ -78,11 +78,11 @@ const String &Animation::getName() {
|
|||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vector<int> &Animation::getBones() {
|
const Array<int> &Animation::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Timeline *> &Animation::getTimelines() {
|
Array<Timeline *> &Animation::getTimelines() {
|
||||||
return _timelines;
|
return _timelines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ void Animation::setDuration(float inValue) {
|
|||||||
_duration = inValue;
|
_duration = inValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Animation::search(Vector<float> &frames, float target) {
|
int Animation::search(Array<float> &frames, float target) {
|
||||||
size_t n = (int) frames.size();
|
size_t n = (int) frames.size();
|
||||||
for (size_t i = 1; i < n; i++) {
|
for (size_t i = 1; i < n; i++) {
|
||||||
if (frames[i] > target) return (int) (i - 1);
|
if (frames[i] > target) return (int) (i - 1);
|
||||||
@ -102,14 +102,14 @@ int Animation::search(Vector<float> &frames, float target) {
|
|||||||
return (int) (n - 1);
|
return (int) (n - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Animation::search(Vector<float> &frames, float target, int step) {
|
int Animation::search(Array<float> &frames, float target, int step) {
|
||||||
size_t n = frames.size();
|
size_t n = frames.size();
|
||||||
for (size_t i = step; i < n; i += step)
|
for (size_t i = step; i < n; i += step)
|
||||||
if (frames[i] > target) return (int) (i - step);
|
if (frames[i] > target) return (int) (i - step);
|
||||||
return (int) (n - step);
|
return (int) (n - step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::setTimelines(Vector<Timeline *> &timelines) {
|
void Animation::setTimelines(Array<Timeline *> &timelines) {
|
||||||
_timelines = timelines;
|
_timelines = timelines;
|
||||||
|
|
||||||
size_t n = timelines.size();
|
size_t n = timelines.size();
|
||||||
@ -119,7 +119,7 @@ void Animation::setTimelines(Vector<Timeline *> &timelines) {
|
|||||||
HashMap<int, bool> boneSet;
|
HashMap<int, bool> boneSet;
|
||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
Timeline *timeline = timelines[i];
|
Timeline *timeline = timelines[i];
|
||||||
Vector<PropertyId> &propertyIds = timeline->getPropertyIds();
|
Array<PropertyId> &propertyIds = timeline->getPropertyIds();
|
||||||
for (size_t ii = 0; ii < propertyIds.size(); ii++) {
|
for (size_t ii = 0; ii < propertyIds.size(); ii++) {
|
||||||
_timelineIds.put(propertyIds[ii], true);
|
_timelineIds.put(propertyIds[ii], true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -477,13 +477,13 @@ bool AnimationState::apply(Skeleton &skeleton) {
|
|||||||
// apply current entry.
|
// apply current entry.
|
||||||
float animationLast = current._animationLast, animationTime = current.getAnimationTime();
|
float animationLast = current._animationLast, animationTime = current.getAnimationTime();
|
||||||
float applyTime = animationTime;
|
float applyTime = animationTime;
|
||||||
Vector<Event *> *applyEvents = &_events;
|
Array<Event *> *applyEvents = &_events;
|
||||||
if (current._reverse) {
|
if (current._reverse) {
|
||||||
applyTime = current._animation->getDuration() - applyTime;
|
applyTime = current._animation->getDuration() - applyTime;
|
||||||
applyEvents = NULL;
|
applyEvents = NULL;
|
||||||
}
|
}
|
||||||
size_t timelineCount = current._animation->_timelines.size();
|
size_t timelineCount = current._animation->_timelines.size();
|
||||||
Vector<Timeline *> &timelines = current._animation->_timelines;
|
Array<Timeline *> &timelines = current._animation->_timelines;
|
||||||
if ((i == 0 && alpha == 1) || blend == MixBlend_Add) {
|
if ((i == 0 && alpha == 1) || blend == MixBlend_Add) {
|
||||||
if (i == 0) attachments = true;
|
if (i == 0) attachments = true;
|
||||||
for (size_t ii = 0; ii < timelineCount; ++ii) {
|
for (size_t ii = 0; ii < timelineCount; ++ii) {
|
||||||
@ -495,12 +495,12 @@ bool AnimationState::apply(Skeleton &skeleton) {
|
|||||||
timeline->apply(skeleton, animationLast, applyTime, applyEvents, alpha, blend, MixDirection_In, false);
|
timeline->apply(skeleton, animationLast, applyTime, applyEvents, alpha, blend, MixDirection_In, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Vector<int> &timelineMode = current._timelineMode;
|
Array<int> &timelineMode = current._timelineMode;
|
||||||
|
|
||||||
bool shortestRotation = current._shortestRotation;
|
bool shortestRotation = current._shortestRotation;
|
||||||
bool firstFrame = !shortestRotation && current._timelinesRotation.size() != timelines.size() << 1;
|
bool firstFrame = !shortestRotation && current._timelinesRotation.size() != timelines.size() << 1;
|
||||||
if (firstFrame) current._timelinesRotation.setSize(timelines.size() << 1, 0);
|
if (firstFrame) current._timelinesRotation.setSize(timelines.size() << 1, 0);
|
||||||
Vector<float> &timelinesRotation = current._timelinesRotation;
|
Array<float> &timelinesRotation = current._timelinesRotation;
|
||||||
|
|
||||||
for (size_t ii = 0; ii < timelineCount; ++ii) {
|
for (size_t ii = 0; ii < timelineCount; ++ii) {
|
||||||
Timeline *timeline = timelines[ii];
|
Timeline *timeline = timelines[ii];
|
||||||
@ -527,7 +527,7 @@ bool AnimationState::apply(Skeleton &skeleton) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setupState = _unkeyedState + Setup;
|
int setupState = _unkeyedState + Setup;
|
||||||
Vector<Slot *> &slots = skeleton.getSlots();
|
Array<Slot *> &slots = skeleton.getSlots();
|
||||||
for (int i = 0, n = (int) slots.size(); i < n; i++) {
|
for (int i = 0, n = (int) slots.size(); i < n; i++) {
|
||||||
Slot *slot = slots[i];
|
Slot *slot = slots[i];
|
||||||
if (slot->_attachmentState == setupState) {
|
if (slot->_attachmentState == setupState) {
|
||||||
@ -676,7 +676,7 @@ AnimationStateData *AnimationState::getData() {
|
|||||||
return _data;
|
return _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<TrackEntry *> &AnimationState::getTracks() {
|
Array<TrackEntry *> &AnimationState::getTracks() {
|
||||||
return _tracks;
|
return _tracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +720,7 @@ void AnimationState::disposeTrackEntry(TrackEntry *entry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Animation *AnimationState::getEmptyAnimation() {
|
Animation *AnimationState::getEmptyAnimation() {
|
||||||
static Vector<Timeline *> timelines;
|
static Array<Timeline *> timelines;
|
||||||
static Animation ret(String("<empty>"), timelines, 0);
|
static Animation ret(String("<empty>"), timelines, 0);
|
||||||
return &ret;
|
return &ret;
|
||||||
}
|
}
|
||||||
@ -730,7 +730,7 @@ void AnimationState::applyAttachmentTimeline(AttachmentTimeline *attachmentTimel
|
|||||||
Slot *slot = skeleton.getSlots()[attachmentTimeline->getSlotIndex()];
|
Slot *slot = skeleton.getSlots()[attachmentTimeline->getSlotIndex()];
|
||||||
if (!slot->getBone().isActive()) return;
|
if (!slot->getBone().isActive()) return;
|
||||||
|
|
||||||
Vector<float> &frames = attachmentTimeline->getFrames();
|
Array<float> &frames = attachmentTimeline->getFrames();
|
||||||
if (time < frames[0]) {
|
if (time < frames[0]) {
|
||||||
if (blend == MixBlend_Setup || blend == MixBlend_First)
|
if (blend == MixBlend_Setup || blend == MixBlend_First)
|
||||||
setAttachment(skeleton, *slot, slot->getData().getAttachmentName(), attachments);
|
setAttachment(skeleton, *slot, slot->getData().getAttachmentName(), attachments);
|
||||||
@ -745,7 +745,7 @@ void AnimationState::applyAttachmentTimeline(AttachmentTimeline *attachmentTimel
|
|||||||
|
|
||||||
|
|
||||||
void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleton &skeleton, float time, float alpha,
|
void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleton &skeleton, float time, float alpha,
|
||||||
MixBlend blend, Vector<float> &timelinesRotation, size_t i, bool firstFrame) {
|
MixBlend blend, Array<float> &timelinesRotation, size_t i, bool firstFrame) {
|
||||||
if (firstFrame) timelinesRotation[i] = 0;
|
if (firstFrame) timelinesRotation[i] = 0;
|
||||||
|
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
@ -757,7 +757,7 @@ void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleto
|
|||||||
if (!bone->isActive()) return;
|
if (!bone->isActive()) return;
|
||||||
BoneLocal &pose = bone->_pose;
|
BoneLocal &pose = bone->_pose;
|
||||||
BoneLocal &setup = bone->_data._setup;
|
BoneLocal &setup = bone->_data._setup;
|
||||||
Vector<float> &frames = rotateTimeline->_frames;
|
Array<float> &frames = rotateTimeline->_frames;
|
||||||
float r1, r2;
|
float r1, r2;
|
||||||
if (time < frames[0]) {
|
if (time < frames[0]) {
|
||||||
switch (blend) {
|
switch (blend) {
|
||||||
@ -856,12 +856,12 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool attachments = mix < from->_mixAttachmentThreshold, drawOrder = mix < from->_mixDrawOrderThreshold;
|
bool attachments = mix < from->_mixAttachmentThreshold, drawOrder = mix < from->_mixDrawOrderThreshold;
|
||||||
Vector<Timeline *> &timelines = from->_animation->_timelines;
|
Array<Timeline *> &timelines = from->_animation->_timelines;
|
||||||
size_t timelineCount = timelines.size();
|
size_t timelineCount = timelines.size();
|
||||||
float alphaHold = from->_alpha * to->_interruptAlpha, alphaMix = alphaHold * (1 - mix);
|
float alphaHold = from->_alpha * to->_interruptAlpha, alphaMix = alphaHold * (1 - mix);
|
||||||
float animationLast = from->_animationLast, animationTime = from->getAnimationTime();
|
float animationLast = from->_animationLast, animationTime = from->getAnimationTime();
|
||||||
float applyTime = animationTime;
|
float applyTime = animationTime;
|
||||||
Vector<Event *> *events = NULL;
|
Array<Event *> *events = NULL;
|
||||||
if (from->_reverse) {
|
if (from->_reverse) {
|
||||||
applyTime = from->_animation->_duration - applyTime;
|
applyTime = from->_animation->_duration - applyTime;
|
||||||
} else {
|
} else {
|
||||||
@ -872,14 +872,14 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
|
|||||||
for (size_t i = 0; i < timelineCount; i++)
|
for (size_t i = 0; i < timelineCount; i++)
|
||||||
timelines[i]->apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection_Out, false);
|
timelines[i]->apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection_Out, false);
|
||||||
} else {
|
} else {
|
||||||
Vector<int> &timelineMode = from->_timelineMode;
|
Array<int> &timelineMode = from->_timelineMode;
|
||||||
Vector<TrackEntry *> &timelineHoldMix = from->_timelineHoldMix;
|
Array<TrackEntry *> &timelineHoldMix = from->_timelineHoldMix;
|
||||||
|
|
||||||
bool shortestRotation = from->_shortestRotation;
|
bool shortestRotation = from->_shortestRotation;
|
||||||
bool firstFrame = !shortestRotation && from->_timelinesRotation.size() != timelines.size() << 1;
|
bool firstFrame = !shortestRotation && from->_timelinesRotation.size() != timelines.size() << 1;
|
||||||
if (firstFrame) from->_timelinesRotation.setSize(timelines.size() << 1, 0);
|
if (firstFrame) from->_timelinesRotation.setSize(timelines.size() << 1, 0);
|
||||||
|
|
||||||
Vector<float> &timelinesRotation = from->_timelinesRotation;
|
Array<float> &timelinesRotation = from->_timelinesRotation;
|
||||||
|
|
||||||
from->_totalAlpha = 0;
|
from->_totalAlpha = 0;
|
||||||
for (size_t i = 0; i < timelineCount; i++) {
|
for (size_t i = 0; i < timelineCount; i++) {
|
||||||
@ -1079,11 +1079,11 @@ void AnimationState::animationsChanged() {
|
|||||||
|
|
||||||
void AnimationState::computeHold(TrackEntry *entry) {
|
void AnimationState::computeHold(TrackEntry *entry) {
|
||||||
TrackEntry *to = entry->_mixingTo;
|
TrackEntry *to = entry->_mixingTo;
|
||||||
Vector<Timeline *> &timelines = entry->_animation->_timelines;
|
Array<Timeline *> &timelines = entry->_animation->_timelines;
|
||||||
size_t timelinesCount = timelines.size();
|
size_t timelinesCount = timelines.size();
|
||||||
Vector<int> &timelineMode = entry->_timelineMode;
|
Array<int> &timelineMode = entry->_timelineMode;
|
||||||
timelineMode.setSize(timelinesCount, 0);
|
timelineMode.setSize(timelinesCount, 0);
|
||||||
Vector<TrackEntry *> &timelineHoldMix = entry->_timelineHoldMix;
|
Array<TrackEntry *> &timelineHoldMix = entry->_timelineHoldMix;
|
||||||
timelineHoldMix.setSize(timelinesCount, 0);
|
timelineHoldMix.setSize(timelinesCount, 0);
|
||||||
|
|
||||||
if (to != NULL && to->_holdPrevious) {
|
if (to != NULL && to->_holdPrevious) {
|
||||||
@ -1098,7 +1098,7 @@ void AnimationState::computeHold(TrackEntry *entry) {
|
|||||||
continue_outer:
|
continue_outer:
|
||||||
for (; i < timelinesCount; ++i) {
|
for (; i < timelinesCount; ++i) {
|
||||||
Timeline *timeline = timelines[i];
|
Timeline *timeline = timelines[i];
|
||||||
Vector<PropertyId> &ids = timeline->getPropertyIds();
|
Array<PropertyId> &ids = timeline->getPropertyIds();
|
||||||
if (!_propertyIDs.addAll(ids, true)) {
|
if (!_propertyIDs.addAll(ids, true)) {
|
||||||
timelineMode[i] = Subsequent;
|
timelineMode[i] = Subsequent;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <spine/Atlas.h>
|
#include <spine/Atlas.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
#include <spine/TextureLoader.h>
|
#include <spine/TextureLoader.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -72,8 +72,8 @@ Atlas::~Atlas() {
|
|||||||
_textureLoader->unload(_pages[i]->texture);
|
_textureLoader->unload(_pages[i]->texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_pages);
|
ArrayUtils::deleteElements(_pages);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_regions);
|
ArrayUtils::deleteElements(_regions);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Atlas::flipV() {
|
void Atlas::flipV() {
|
||||||
@ -91,11 +91,11 @@ AtlasRegion *Atlas::findRegion(const String &name) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<AtlasPage *> &Atlas::getPages() {
|
Array<AtlasPage *> &Atlas::getPages() {
|
||||||
return _pages;
|
return _pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<AtlasRegion *> &Atlas::getRegions() {
|
Array<AtlasRegion *> &Atlas::getRegions() {
|
||||||
return _regions;
|
return _regions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ AtlasAttachmentLoader::AtlasAttachmentLoader(Atlas *atlas) : AttachmentLoader(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool loadSequence(Atlas *atlas, const String &basePath, Sequence *sequence) {
|
bool loadSequence(Atlas *atlas, const String &basePath, Sequence *sequence) {
|
||||||
Vector<TextureRegion *> ®ions = sequence->getRegions();
|
Array<TextureRegion *> ®ions = sequence->getRegions();
|
||||||
for (int i = 0, n = (int) regions.size(); i < n; i++) {
|
for (int i = 0, n = (int) regions.size(); i < n; i++) {
|
||||||
String path = sequence->getPath(basePath, i);
|
String path = sequence->getPath(basePath, i);
|
||||||
regions[i] = atlas->findRegion(path);
|
regions[i] = atlas->findRegion(path);
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void AttachmentTimeline::setAttachment(Skeleton &skeleton, SlotPose &pose, Strin
|
|||||||
pose.setAttachment(attachmentName == NULL || attachmentName->isEmpty() ? NULL : skeleton.getAttachment(_slotIndex, *attachmentName));
|
pose.setAttachment(attachmentName == NULL || attachmentName->isEmpty() ? NULL : skeleton.getAttachment(_slotIndex, *attachmentName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachmentTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void AttachmentTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
@ -84,6 +84,6 @@ void AttachmentTimeline::setFrame(int frame, float time, const String &attachmen
|
|||||||
_attachmentNames[frame] = attachmentName;
|
_attachmentNames[frame] = attachmentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<String> &AttachmentTimeline::getAttachmentNames() {
|
Array<String> &AttachmentTimeline::getAttachmentNames() {
|
||||||
return _attachmentNames;
|
return _attachmentNames;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,6 @@ Bone *Bone::getParent() {
|
|||||||
return _parent;
|
return _parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Bone *> &Bone::getChildren() {
|
Array<Bone *> &Bone::getChildren() {
|
||||||
return _children;
|
return _children;
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ void BonePose::modifyWorld(int update) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BonePose::resetWorld(int update) {
|
void BonePose::resetWorld(int update) {
|
||||||
Vector<Bone *> &children = _bone->getChildren();
|
Array<Bone *> &children = _bone->getChildren();
|
||||||
for (size_t i = 0, n = children.size(); i < n; i++) {
|
for (size_t i = 0, n = children.size(); i < n; i++) {
|
||||||
BonePose &child = children[i]->getAppliedPose();
|
BonePose &child = children[i]->getAppliedPose();
|
||||||
if (child._world == update) {
|
if (child._world == update) {
|
||||||
|
|||||||
@ -47,7 +47,7 @@ BoneTimeline1::BoneTimeline1(size_t frameCount, size_t bezierCount, int boneInde
|
|||||||
setPropertyIds(ids, 1);
|
setPropertyIds(ids, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoneTimeline1::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void BoneTimeline1::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
@ -65,7 +65,7 @@ BoneTimeline2::BoneTimeline2(size_t frameCount, size_t bezierCount, int boneInde
|
|||||||
setPropertyIds(ids, 2);
|
setPropertyIds(ids, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoneTimeline2::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void BoneTimeline2::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -216,7 +216,7 @@ AlphaTimeline::AlphaTimeline(size_t frameCount, size_t bezierCount, int slotInde
|
|||||||
AlphaTimeline::~AlphaTimeline() {
|
AlphaTimeline::~AlphaTimeline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlphaTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void AlphaTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -90,7 +90,7 @@ float CurveTimeline::getBezierValue(float time, size_t frameIndex, size_t valueO
|
|||||||
return y + (time - x) / (_frames[frameIndex] - x) * (_frames[frameIndex + valueOffset] - y);
|
return y + (time - x) / (_frames[frameIndex] - x) * (_frames[frameIndex + valueOffset] - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &CurveTimeline::getCurves() {
|
Array<float> &CurveTimeline::getCurves() {
|
||||||
return _curves;
|
return _curves;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ DeformTimeline::DeformTimeline(size_t frameCount, size_t bezierCount, int slotIn
|
|||||||
|
|
||||||
_vertices.ensureCapacity(frameCount);
|
_vertices.ensureCapacity(frameCount);
|
||||||
for (size_t i = 0; i < frameCount; ++i) {
|
for (size_t i = 0; i < frameCount; ++i) {
|
||||||
Vector<float> vec;
|
Array<float> vec;
|
||||||
_vertices.add(vec);
|
_vertices.add(vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,15 +67,15 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &deformArray = pose._deform;
|
Array<float> &deformArray = pose._deform;
|
||||||
if (deformArray.size() == 0) {
|
if (deformArray.size() == 0) {
|
||||||
blend = MixBlend_Setup;
|
blend = MixBlend_Setup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Vector<float>> &vertices = _vertices;
|
Array<Array<float>> &vertices = _vertices;
|
||||||
size_t vertexCount = vertices[0].size();
|
size_t vertexCount = vertices[0].size();
|
||||||
|
|
||||||
Vector<float> &frames = _frames;
|
Array<float> &frames = _frames;
|
||||||
if (time < frames[0]) {
|
if (time < frames[0]) {
|
||||||
switch (blend) {
|
switch (blend) {
|
||||||
case MixBlend_Setup:
|
case MixBlend_Setup:
|
||||||
@ -87,10 +87,10 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
deformArray.setSize(vertexCount, 0);
|
deformArray.setSize(vertexCount, 0);
|
||||||
Vector<float> &deform = deformArray;
|
Array<float> &deform = deformArray;
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (vertexAttachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions.
|
// Unweighted vertex positions.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Array<float> &setupVertices = vertexAttachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++)
|
for (size_t i = 0; i < vertexCount; i++)
|
||||||
deform[i] += (setupVertices[i] - deform[i]) * alpha;
|
deform[i] += (setupVertices[i] - deform[i]) * alpha;
|
||||||
} else {
|
} else {
|
||||||
@ -109,15 +109,15 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
}
|
}
|
||||||
|
|
||||||
deformArray.setSize(vertexCount, 0);
|
deformArray.setSize(vertexCount, 0);
|
||||||
Vector<float> &deform = deformArray;
|
Array<float> &deform = deformArray;
|
||||||
|
|
||||||
if (time >= frames[frames.size() - 1]) {// Time is after last frame.
|
if (time >= frames[frames.size() - 1]) {// Time is after last frame.
|
||||||
Vector<float> &lastVertices = vertices[frames.size() - 1];
|
Array<float> &lastVertices = vertices[frames.size() - 1];
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
if (blend == MixBlend_Add) {
|
if (blend == MixBlend_Add) {
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (vertexAttachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions, no alpha.
|
// Unweighted vertex positions, no alpha.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Array<float> &setupVertices = vertexAttachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++)
|
for (size_t i = 0; i < vertexCount; i++)
|
||||||
deform[i] += lastVertices[i] - setupVertices[i];
|
deform[i] += lastVertices[i] - setupVertices[i];
|
||||||
} else {
|
} else {
|
||||||
@ -134,7 +134,7 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
case MixBlend_Setup: {
|
case MixBlend_Setup: {
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (vertexAttachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions, with alpha.
|
// Unweighted vertex positions, with alpha.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Array<float> &setupVertices = vertexAttachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++) {
|
for (size_t i = 0; i < vertexCount; i++) {
|
||||||
float setup = setupVertices[i];
|
float setup = setupVertices[i];
|
||||||
deform[i] = setup + (lastVertices[i] - setup) * alpha;
|
deform[i] = setup + (lastVertices[i] - setup) * alpha;
|
||||||
@ -155,7 +155,7 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
case MixBlend_Add:
|
case MixBlend_Add:
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (vertexAttachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions, with alpha.
|
// Unweighted vertex positions, with alpha.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Array<float> &setupVertices = vertexAttachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++)
|
for (size_t i = 0; i < vertexCount; i++)
|
||||||
deform[i] += (lastVertices[i] - setupVertices[i]) * alpha;
|
deform[i] += (lastVertices[i] - setupVertices[i]) * alpha;
|
||||||
} else {
|
} else {
|
||||||
@ -172,14 +172,14 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
// Interpolate between the previous frame and the current frame.
|
// Interpolate between the previous frame and the current frame.
|
||||||
int frame = Animation::search(frames, time);
|
int frame = Animation::search(frames, time);
|
||||||
float percent = getCurvePercent(time, frame);
|
float percent = getCurvePercent(time, frame);
|
||||||
Vector<float> &prevVertices = vertices[frame];
|
Array<float> &prevVertices = vertices[frame];
|
||||||
Vector<float> &nextVertices = vertices[frame + 1];
|
Array<float> &nextVertices = vertices[frame + 1];
|
||||||
|
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
if (blend == MixBlend_Add) {
|
if (blend == MixBlend_Add) {
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (vertexAttachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions, no alpha.
|
// Unweighted vertex positions, no alpha.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Array<float> &setupVertices = vertexAttachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++) {
|
for (size_t i = 0; i < vertexCount; i++) {
|
||||||
float prev = prevVertices[i];
|
float prev = prevVertices[i];
|
||||||
deform[i] += prev + (nextVertices[i] - prev) * percent - setupVertices[i];
|
deform[i] += prev + (nextVertices[i] - prev) * percent - setupVertices[i];
|
||||||
@ -205,7 +205,7 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
case MixBlend_Setup: {
|
case MixBlend_Setup: {
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (vertexAttachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions, with alpha.
|
// Unweighted vertex positions, with alpha.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Array<float> &setupVertices = vertexAttachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++) {
|
for (size_t i = 0; i < vertexCount; i++) {
|
||||||
float prev = prevVertices[i], setup = setupVertices[i];
|
float prev = prevVertices[i], setup = setupVertices[i];
|
||||||
deform[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha;
|
deform[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha;
|
||||||
@ -230,7 +230,7 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
|
|||||||
case MixBlend_Add:
|
case MixBlend_Add:
|
||||||
if (vertexAttachment->getBones().size() == 0) {
|
if (vertexAttachment->getBones().size() == 0) {
|
||||||
// Unweighted vertex positions, with alpha.
|
// Unweighted vertex positions, with alpha.
|
||||||
Vector<float> &setupVertices = vertexAttachment->getVertices();
|
Array<float> &setupVertices = vertexAttachment->getVertices();
|
||||||
for (size_t i = 0; i < vertexCount; i++) {
|
for (size_t i = 0; i < vertexCount; i++) {
|
||||||
float prev = prevVertices[i];
|
float prev = prevVertices[i];
|
||||||
deform[i] += (prev + (nextVertices[i] - prev) * percent - setupVertices[i]) * alpha;
|
deform[i] += (prev + (nextVertices[i] - prev) * percent - setupVertices[i]) * alpha;
|
||||||
@ -251,7 +251,7 @@ void DeformTimeline::setBezier(size_t bezier, size_t frame, float value, float t
|
|||||||
float cx2, float cy2, float time2, float value2) {
|
float cx2, float cy2, float time2, float value2) {
|
||||||
SP_UNUSED(value1);
|
SP_UNUSED(value1);
|
||||||
SP_UNUSED(value2);
|
SP_UNUSED(value2);
|
||||||
Vector<float> &curves = _curves;
|
Array<float> &curves = _curves;
|
||||||
size_t i = getFrameCount() + bezier * BEZIER_SIZE;
|
size_t i = getFrameCount() + bezier * BEZIER_SIZE;
|
||||||
if (value == 0) curves[frame] = BEZIER + (float) i;
|
if (value == 0) curves[frame] = BEZIER + (float) i;
|
||||||
float tmpx = (time1 - cx1 * 2 + cx2) * 0.03f, tmpy = cy2 * 0.03f - cy1 * 0.06f;
|
float tmpx = (time1 - cx1 * 2 + cx2) * 0.03f, tmpy = cy2 * 0.03f - cy1 * 0.06f;
|
||||||
@ -272,7 +272,7 @@ void DeformTimeline::setBezier(size_t bezier, size_t frame, float value, float t
|
|||||||
}
|
}
|
||||||
|
|
||||||
float DeformTimeline::getCurvePercent(float time, int frame) {
|
float DeformTimeline::getCurvePercent(float time, int frame) {
|
||||||
Vector<float> &curves = _curves;
|
Array<float> &curves = _curves;
|
||||||
int i = (int) curves[frame];
|
int i = (int) curves[frame];
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case LINEAR: {
|
case LINEAR: {
|
||||||
@ -299,13 +299,13 @@ float DeformTimeline::getCurvePercent(float time, int frame) {
|
|||||||
return y + (1 - y) * (time - x) / (_frames[frame + getFrameEntries()] - x);
|
return y + (1 - y) * (time - x) / (_frames[frame + getFrameEntries()] - x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeformTimeline::setFrame(int frame, float time, Vector<float> &vertices) {
|
void DeformTimeline::setFrame(int frame, float time, Array<float> &vertices) {
|
||||||
_frames[frame] = time;
|
_frames[frame] = time;
|
||||||
_vertices[frame].clear();
|
_vertices[frame].clear();
|
||||||
_vertices[frame].addAll(vertices);
|
_vertices[frame].addAll(vertices);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Vector<float>> &DeformTimeline::getVertices() {
|
Array<Array<float>> &DeformTimeline::getVertices() {
|
||||||
return _vertices;
|
return _vertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,20 +47,20 @@ DrawOrderTimeline::DrawOrderTimeline(size_t frameCount) : Timeline(frameCount, 1
|
|||||||
|
|
||||||
_drawOrders.ensureCapacity(frameCount);
|
_drawOrders.ensureCapacity(frameCount);
|
||||||
for (size_t i = 0; i < frameCount; ++i) {
|
for (size_t i = 0; i < frameCount; ++i) {
|
||||||
Vector<int> vec;
|
Array<int> vec;
|
||||||
_drawOrders.add(vec);
|
_drawOrders.add(vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawOrderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void DrawOrderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(appliedPose);
|
SP_UNUSED(appliedPose);
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
SP_UNUSED(alpha);
|
SP_UNUSED(alpha);
|
||||||
|
|
||||||
Vector<Slot *> &drawOrder = skeleton._drawOrder;
|
Array<Slot *> &drawOrder = skeleton._drawOrder;
|
||||||
Vector<Slot *> &slots = skeleton._slots;
|
Array<Slot *> &slots = skeleton._slots;
|
||||||
if (direction == MixDirection_Out) {
|
if (direction == MixDirection_Out) {
|
||||||
if (blend == MixBlend_Setup) {
|
if (blend == MixBlend_Setup) {
|
||||||
drawOrder.clear();
|
drawOrder.clear();
|
||||||
@ -81,7 +81,7 @@ void DrawOrderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Ve
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<int> &drawOrderToSetupIndex = _drawOrders[Animation::search(_frames, time)];
|
Array<int> &drawOrderToSetupIndex = _drawOrders[Animation::search(_frames, time)];
|
||||||
if (drawOrderToSetupIndex.size() == 0) {
|
if (drawOrderToSetupIndex.size() == 0) {
|
||||||
drawOrder.clear();
|
drawOrder.clear();
|
||||||
drawOrder.ensureCapacity(slots.size());
|
drawOrder.ensureCapacity(slots.size());
|
||||||
@ -95,7 +95,7 @@ void DrawOrderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Ve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawOrderTimeline::setFrame(size_t frame, float time, Vector<int> *drawOrder) {
|
void DrawOrderTimeline::setFrame(size_t frame, float time, Array<int> *drawOrder) {
|
||||||
_frames[frame] = time;
|
_frames[frame] = time;
|
||||||
_drawOrders[frame].clear();
|
_drawOrders[frame].clear();
|
||||||
if (drawOrder != NULL) {
|
if (drawOrder != NULL) {
|
||||||
@ -107,6 +107,6 @@ size_t DrawOrderTimeline::getFrameCount() {
|
|||||||
return _frames.size();
|
return _frames.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Vector<int>> &DrawOrderTimeline::getDrawOrders() {
|
Array<Array<int>> &DrawOrderTimeline::getDrawOrders() {
|
||||||
return _drawOrders;
|
return _drawOrders;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include <spine/Skeleton.h>
|
#include <spine/Skeleton.h>
|
||||||
|
|
||||||
#include <spine/Animation.h>
|
#include <spine/Animation.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
#include <spine/EventData.h>
|
#include <spine/EventData.h>
|
||||||
#include <spine/Property.h>
|
#include <spine/Property.h>
|
||||||
#include <spine/Slot.h>
|
#include <spine/Slot.h>
|
||||||
@ -52,14 +52,14 @@ EventTimeline::EventTimeline(size_t frameCount) : Timeline(frameCount, 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EventTimeline::~EventTimeline() {
|
EventTimeline::~EventTimeline() {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_events);
|
ArrayUtils::deleteElements(_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void EventTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
if (pEvents == NULL) return;
|
if (pEvents == NULL) return;
|
||||||
|
|
||||||
Vector<Event *> &events = *pEvents;
|
Array<Event *> &events = *pEvents;
|
||||||
|
|
||||||
size_t frameCount = _frames.size();
|
size_t frameCount = _frames.size();
|
||||||
|
|
||||||
@ -100,6 +100,6 @@ size_t EventTimeline::getFrameCount() {
|
|||||||
return _frames.size();
|
return _frames.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Event *> &EventTimeline::getEvents() {
|
Array<Event *> &EventTimeline::getEvents() {
|
||||||
return _events;
|
return _events;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,7 +87,7 @@ IkConstraintData &IkConstraint::getData() {
|
|||||||
return _data;
|
return _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<BonePose *> &IkConstraint::getBones() {
|
Array<BonePose *> &IkConstraint::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ IkConstraintData::IkConstraintData(const String &name) : ConstraintDataGeneric<I
|
|||||||
_uniform(false) {
|
_uniform(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<BoneData *> &IkConstraintData::getBones() {
|
Array<BoneData *> &IkConstraintData::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ IkConstraintTimeline::IkConstraintTimeline(size_t frameCount, size_t bezierCount
|
|||||||
IkConstraintTimeline::~IkConstraintTimeline() {
|
IkConstraintTimeline::~IkConstraintTimeline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IkConstraintTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void IkConstraintTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -58,7 +58,7 @@ void InheritTimeline::setFrame(int frame, float time, Inherit inherit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InheritTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void InheritTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ THE SOFTWARE.
|
|||||||
#include <spine/Json.h>
|
#include <spine/Json.h>
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Array.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|||||||
@ -75,7 +75,7 @@ void spine::spDebug_printAnimation(Animation *animation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void spine::spDebug_printBoneDatas(Vector<BoneData *> &boneDatas) {
|
void spine::spDebug_printBoneDatas(Array<BoneData *> &boneDatas) {
|
||||||
int i, n;
|
int i, n;
|
||||||
for (i = 0, n = (int) boneDatas.size(); i < n; i++) {
|
for (i = 0, n = (int) boneDatas.size(); i < n; i++) {
|
||||||
spDebug_printBoneData(boneDatas[i]);
|
spDebug_printBoneData(boneDatas[i]);
|
||||||
@ -93,7 +93,7 @@ void spine::spDebug_printSkeleton(Skeleton *skeleton) {
|
|||||||
spDebug_printBones(skeleton->getBones());
|
spDebug_printBones(skeleton->getBones());
|
||||||
}
|
}
|
||||||
|
|
||||||
void spine::spDebug_printBones(Vector<Bone *> &bones) {
|
void spine::spDebug_printBones(Array<Bone *> &bones) {
|
||||||
int i, n;
|
int i, n;
|
||||||
for (i = 0, n = (int) bones.size(); i < n; i++) {
|
for (i = 0, n = (int) bones.size(); i < n; i++) {
|
||||||
spDebug_printBone(bones[i]);
|
spDebug_printBone(bones[i]);
|
||||||
@ -115,7 +115,7 @@ void spine::spDebug_printFloats(float *values, int numFloats) {
|
|||||||
printf("]");
|
printf("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void spine::spDebug_printFloats(Vector<float> &values) {
|
void spine::spDebug_printFloats(Array<float> &values) {
|
||||||
int i, n;
|
int i, n;
|
||||||
printf("(%zu) [", values.size());
|
printf("(%zu) [", values.size());
|
||||||
for (i = 0, n = (int) values.size(); i < n; i++) {
|
for (i = 0, n = (int) values.size(); i < n; i++) {
|
||||||
|
|||||||
@ -123,23 +123,23 @@ void MeshAttachment::setHullLength(int inValue) {
|
|||||||
_hullLength = inValue;
|
_hullLength = inValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &MeshAttachment::getRegionUVs() {
|
Array<float> &MeshAttachment::getRegionUVs() {
|
||||||
return _regionUVs;
|
return _regionUVs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshAttachment::setRegionUVs(Vector<float> &inValue) {
|
void MeshAttachment::setRegionUVs(Array<float> &inValue) {
|
||||||
_regionUVs.clearAndAddAll(inValue);
|
_regionUVs.clearAndAddAll(inValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &MeshAttachment::getUVs() {
|
Array<float> &MeshAttachment::getUVs() {
|
||||||
return _uvs;
|
return _uvs;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<unsigned short> &MeshAttachment::getTriangles() {
|
Array<unsigned short> &MeshAttachment::getTriangles() {
|
||||||
return _triangles;
|
return _triangles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshAttachment::setTriangles(Vector<unsigned short> &inValue) {
|
void MeshAttachment::setTriangles(Array<unsigned short> &inValue) {
|
||||||
_triangles.clearAndAddAll(inValue);
|
_triangles.clearAndAddAll(inValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,11 +186,11 @@ void MeshAttachment::setParentMesh(MeshAttachment *inValue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<unsigned short> &MeshAttachment::getEdges() {
|
Array<unsigned short> &MeshAttachment::getEdges() {
|
||||||
return _edges;
|
return _edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshAttachment::setEdges(Vector<unsigned short> &inValue) {
|
void MeshAttachment::setEdges(Array<unsigned short> &inValue) {
|
||||||
_edges.clearAndAddAll(inValue);
|
_edges.clearAndAddAll(inValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,11 +37,11 @@ PathAttachment::PathAttachment(const String &name) : VertexAttachment(name), _cl
|
|||||||
_color() {
|
_color() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &PathAttachment::getLengths() {
|
Array<float> &PathAttachment::getLengths() {
|
||||||
return _lengths;
|
return _lengths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathAttachment::setLengths(Vector<float> &inValue) {
|
void PathAttachment::setLengths(Array<float> &inValue) {
|
||||||
_lengths.clearAndAddAll(inValue);
|
_lengths.clearAndAddAll(inValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -152,7 +152,7 @@ void PathConstraint::update(Skeleton &skeleton, Physics physics) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &positions = computeWorldPositions(skeleton, *pathAttachment, (int) spacesCount, tangents);
|
Array<float> &positions = computeWorldPositions(skeleton, *pathAttachment, (int) spacesCount, tangents);
|
||||||
float *positionsBuffer = positions.buffer();
|
float *positionsBuffer = positions.buffer();
|
||||||
float boneX = positionsBuffer[0], boneY = positionsBuffer[1], offsetRotation = data._offsetRotation;
|
float boneX = positionsBuffer[0], boneY = positionsBuffer[1], offsetRotation = data._offsetRotation;
|
||||||
bool tip;
|
bool tip;
|
||||||
@ -241,7 +241,7 @@ PathConstraintData &PathConstraint::getData() {
|
|||||||
return _data;
|
return _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<BonePose *> &PathConstraint::getBones() {
|
Array<BonePose *> &PathConstraint::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,13 +253,13 @@ void PathConstraint::setSlot(Slot *slot) {
|
|||||||
_slot = slot;
|
_slot = slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &
|
Array<float> &
|
||||||
PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path, int spacesCount, bool tangents) {
|
PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path, int spacesCount, bool tangents) {
|
||||||
float position = _applied->_position;
|
float position = _applied->_position;
|
||||||
float *spaces = _spaces.buffer();
|
float *spaces = _spaces.buffer();
|
||||||
_positions.setSize(spacesCount * 3 + 2, 0);
|
_positions.setSize(spacesCount * 3 + 2, 0);
|
||||||
Vector<float> &out = _positions;
|
Array<float> &out = _positions;
|
||||||
Vector<float> &world = _world;
|
Array<float> &world = _world;
|
||||||
bool closed = path.isClosed();
|
bool closed = path.isClosed();
|
||||||
int verticesLength = (int) path.getWorldVerticesLength();
|
int verticesLength = (int) path.getWorldVerticesLength();
|
||||||
int curveCount = verticesLength / 6;
|
int curveCount = verticesLength / 6;
|
||||||
@ -267,7 +267,7 @@ PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path,
|
|||||||
|
|
||||||
float pathLength;
|
float pathLength;
|
||||||
if (!path.isConstantSpeed()) {
|
if (!path.isConstantSpeed()) {
|
||||||
Vector<float> &lengths = path.getLengths();
|
Array<float> &lengths = path.getLengths();
|
||||||
float *lengthsBuffer = lengths.buffer();
|
float *lengthsBuffer = lengths.buffer();
|
||||||
curveCount -= closed ? 1 : 2;
|
curveCount -= closed ? 1 : 2;
|
||||||
pathLength = lengthsBuffer[curveCount];
|
pathLength = lengthsBuffer[curveCount];
|
||||||
@ -500,14 +500,14 @@ PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path,
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathConstraint::addBeforePosition(float p, Vector<float> &temp, int i, Vector<float> &output, int o) {
|
void PathConstraint::addBeforePosition(float p, Array<float> &temp, int i, Array<float> &output, int o) {
|
||||||
float x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = MathUtil::atan2(dy, dx);
|
float x1 = temp[i], y1 = temp[i + 1], dx = temp[i + 2] - x1, dy = temp[i + 3] - y1, r = MathUtil::atan2(dy, dx);
|
||||||
output[o] = x1 + p * MathUtil::cos(r);
|
output[o] = x1 + p * MathUtil::cos(r);
|
||||||
output[o + 1] = y1 + p * MathUtil::sin(r);
|
output[o + 1] = y1 + p * MathUtil::sin(r);
|
||||||
output[o + 2] = r;
|
output[o + 2] = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathConstraint::addAfterPosition(float p, Vector<float> &temp, int i, Vector<float> &output, int o) {
|
void PathConstraint::addAfterPosition(float p, Array<float> &temp, int i, Array<float> &output, int o) {
|
||||||
float x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = MathUtil::atan2(dy, dx);
|
float x1 = temp[i + 2], y1 = temp[i + 3], dx = x1 - temp[i], dy = y1 - temp[i + 1], r = MathUtil::atan2(dy, dx);
|
||||||
output[o] = x1 + p * MathUtil::cos(r);
|
output[o] = x1 + p * MathUtil::cos(r);
|
||||||
output[o + 1] = y1 + p * MathUtil::sin(r);
|
output[o + 1] = y1 + p * MathUtil::sin(r);
|
||||||
@ -515,7 +515,7 @@ void PathConstraint::addAfterPosition(float p, Vector<float> &temp, int i, Vecto
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PathConstraint::addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2,
|
void PathConstraint::addCurvePosition(float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2,
|
||||||
float y2, Vector<float> &output, int o, bool tangents) {
|
float y2, Array<float> &output, int o, bool tangents) {
|
||||||
if (p < epsilon || MathUtil::isNan(p)) {
|
if (p < epsilon || MathUtil::isNan(p)) {
|
||||||
output[o] = x1;
|
output[o] = x1;
|
||||||
output[o + 1] = y1;
|
output[o + 1] = y1;
|
||||||
@ -547,11 +547,11 @@ void PathConstraint::sortPathSlot(Skeleton &skeleton, Skin &skin, int slotIndex,
|
|||||||
void PathConstraint::sortPath(Skeleton &skeleton, Attachment *attachment, Bone &slotBone) {
|
void PathConstraint::sortPath(Skeleton &skeleton, Attachment *attachment, Bone &slotBone) {
|
||||||
if (attachment == NULL || !attachment->getRTTI().instanceOf(PathAttachment::rtti)) return;
|
if (attachment == NULL || !attachment->getRTTI().instanceOf(PathAttachment::rtti)) return;
|
||||||
PathAttachment *pathAttachment = static_cast<PathAttachment *>(attachment);
|
PathAttachment *pathAttachment = static_cast<PathAttachment *>(attachment);
|
||||||
Vector<int> &pathBones = pathAttachment->getBones();
|
Array<int> &pathBones = pathAttachment->getBones();
|
||||||
if (pathBones.size() == 0)
|
if (pathBones.size() == 0)
|
||||||
skeleton.sortBone(&slotBone);
|
skeleton.sortBone(&slotBone);
|
||||||
else {
|
else {
|
||||||
Vector<Bone *> &bones = skeleton._bones;
|
Array<Bone *> &bones = skeleton._bones;
|
||||||
for (size_t i = 0, n = pathBones.size(); i < n;) {
|
for (size_t i = 0, n = pathBones.size(); i < n;) {
|
||||||
int nn = pathBones[i++];
|
int nn = pathBones[i++];
|
||||||
nn += i;
|
nn += i;
|
||||||
|
|||||||
@ -46,7 +46,7 @@ PathConstraintData::PathConstraintData(const String &name) : ConstraintDataGener
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Vector<BoneData *> &PathConstraintData::getBones() {
|
Array<BoneData *> &PathConstraintData::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ PathConstraintMixTimeline::PathConstraintMixTimeline(size_t frameCount, size_t b
|
|||||||
PathConstraintMixTimeline::~PathConstraintMixTimeline() {
|
PathConstraintMixTimeline::~PathConstraintMixTimeline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathConstraintMixTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents, float alpha,
|
void PathConstraintMixTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents, float alpha,
|
||||||
MixBlend blend, MixDirection direction, bool appliedPose) {
|
MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -53,7 +53,7 @@ PathConstraintPositionTimeline::PathConstraintPositionTimeline(size_t frameCount
|
|||||||
PathConstraintPositionTimeline::~PathConstraintPositionTimeline() {
|
PathConstraintPositionTimeline::~PathConstraintPositionTimeline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathConstraintPositionTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents,
|
void PathConstraintPositionTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents,
|
||||||
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -53,7 +53,7 @@ PathConstraintSpacingTimeline::PathConstraintSpacingTimeline(size_t frameCount,
|
|||||||
PathConstraintSpacingTimeline::~PathConstraintSpacingTimeline() {
|
PathConstraintSpacingTimeline::~PathConstraintSpacingTimeline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathConstraintSpacingTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents,
|
void PathConstraintSpacingTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents,
|
||||||
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -58,12 +58,12 @@ PhysicsConstraintTimeline::PhysicsConstraintTimeline(size_t frameCount, size_t b
|
|||||||
setPropertyIds(ids, 1);
|
setPropertyIds(ids, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsConstraintTimeline::apply(Skeleton &skeleton, float, float time, Vector<Event *> *,
|
void PhysicsConstraintTimeline::apply(Skeleton &skeleton, float, float time, Array<Event *> *,
|
||||||
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
if (_constraintIndex == -1) {
|
if (_constraintIndex == -1) {
|
||||||
float value = time >= _frames[0] ? getCurveValue(time) : 0;
|
float value = time >= _frames[0] ? getCurveValue(time) : 0;
|
||||||
|
|
||||||
Vector<PhysicsConstraint *> &physicsConstraints = skeleton.getPhysicsConstraints();
|
Array<PhysicsConstraint *> &physicsConstraints = skeleton.getPhysicsConstraints();
|
||||||
for (size_t i = 0; i < physicsConstraints.size(); i++) {
|
for (size_t i = 0; i < physicsConstraints.size(); i++) {
|
||||||
PhysicsConstraint *constraint = physicsConstraints[i];
|
PhysicsConstraint *constraint = physicsConstraints[i];
|
||||||
if (constraint->isActive() && global(constraint->_data)) {
|
if (constraint->isActive() && global(constraint->_data)) {
|
||||||
@ -80,7 +80,7 @@ void PhysicsConstraintTimeline::apply(Skeleton &skeleton, float, float time, Vec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsConstraintResetTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *, float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
void PhysicsConstraintResetTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *, float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
PhysicsConstraint *constraint = nullptr;
|
PhysicsConstraint *constraint = nullptr;
|
||||||
if (_constraintIndex != -1) {
|
if (_constraintIndex != -1) {
|
||||||
constraint = static_cast<PhysicsConstraint *>(skeleton.getConstraints()[_constraintIndex]);
|
constraint = static_cast<PhysicsConstraint *>(skeleton.getConstraints()[_constraintIndex]);
|
||||||
@ -98,7 +98,7 @@ void PhysicsConstraintResetTimeline::apply(Skeleton &skeleton, float lastTime, f
|
|||||||
if (constraint != nullptr)
|
if (constraint != nullptr)
|
||||||
constraint->reset(skeleton);
|
constraint->reset(skeleton);
|
||||||
else {
|
else {
|
||||||
Vector<PhysicsConstraint *> &physicsConstraints = skeleton.getPhysicsConstraints();
|
Array<PhysicsConstraint *> &physicsConstraints = skeleton.getPhysicsConstraints();
|
||||||
for (size_t i = 0; i < physicsConstraints.size(); i++) {
|
for (size_t i = 0; i < physicsConstraints.size(); i++) {
|
||||||
constraint = physicsConstraints[i];
|
constraint = physicsConstraints[i];
|
||||||
if (constraint->isActive()) constraint->reset(skeleton);
|
if (constraint->isActive()) constraint->reset(skeleton);
|
||||||
|
|||||||
@ -127,7 +127,7 @@ void RegionAttachment::updateRegion() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegionAttachment::computeWorldVertices(Slot &slot, Vector<float> &worldVertices, size_t offset, size_t stride) {
|
void RegionAttachment::computeWorldVertices(Slot &slot, Array<float> &worldVertices, size_t offset, size_t stride) {
|
||||||
assert(worldVertices.size() >= (offset + 8));
|
assert(worldVertices.size() >= (offset + 8));
|
||||||
computeWorldVertices(slot, worldVertices.buffer(), offset, stride);
|
computeWorldVertices(slot, worldVertices.buffer(), offset, stride);
|
||||||
}
|
}
|
||||||
@ -244,11 +244,11 @@ void RegionAttachment::setSequence(Sequence *sequence) {
|
|||||||
_sequence = sequence;
|
_sequence = sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &RegionAttachment::getOffset() {
|
Array<float> &RegionAttachment::getOffset() {
|
||||||
return _vertexOffset;
|
return _vertexOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &RegionAttachment::getUVs() {
|
Array<float> &RegionAttachment::getUVs() {
|
||||||
return _uvs;
|
return _uvs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,14 +55,14 @@ SequenceTimeline::~SequenceTimeline() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SequenceTimeline::setFrame(int frame, float time, SequenceMode mode, int index, float delay) {
|
void SequenceTimeline::setFrame(int frame, float time, SequenceMode mode, int index, float delay) {
|
||||||
Vector<float> &frames = this->_frames;
|
Array<float> &frames = this->_frames;
|
||||||
frame *= ENTRIES;
|
frame *= ENTRIES;
|
||||||
frames[frame] = time;
|
frames[frame] = time;
|
||||||
frames[frame + MODE] = mode | (index << 4);
|
frames[frame + MODE] = mode | (index << 4);
|
||||||
frames[frame + DELAY] = delay;
|
frames[frame + DELAY] = delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents,
|
void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents,
|
||||||
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(alpha);
|
SP_UNUSED(alpha);
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
@ -86,7 +86,7 @@ void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &frames = this->_frames;
|
Array<float> &frames = this->_frames;
|
||||||
if (time < frames[0]) {
|
if (time < frames[0]) {
|
||||||
if (blend == MixBlend_Setup || blend == MixBlend_First) pose.setSequenceIndex(-1);
|
if (blend == MixBlend_Setup || blend == MixBlend_First) pose.setSequenceIndex(-1);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
#include <spine/TransformConstraintData.h>
|
#include <spine/TransformConstraintData.h>
|
||||||
#include <spine/SkeletonClipping.h>
|
#include <spine/SkeletonClipping.h>
|
||||||
|
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
@ -101,9 +101,9 @@ Skeleton::Skeleton(SkeletonData &skeletonData) : _data(skeletonData), _skin(NULL
|
|||||||
}
|
}
|
||||||
|
|
||||||
Skeleton::~Skeleton() {
|
Skeleton::~Skeleton() {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_bones);
|
ArrayUtils::deleteElements(_bones);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_slots);
|
ArrayUtils::deleteElements(_slots);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_constraints);
|
ArrayUtils::deleteElements(_constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton::updateCache() {
|
void Skeleton::updateCache() {
|
||||||
@ -125,7 +125,7 @@ void Skeleton::updateCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_skin) {
|
if (_skin) {
|
||||||
Vector<BoneData *> &skinBones = _skin->getBones();
|
Array<BoneData *> &skinBones = _skin->getBones();
|
||||||
for (size_t i = 0, n = skinBones.size(); i < n; i++) {
|
for (size_t i = 0, n = skinBones.size(); i < n; i++) {
|
||||||
Bone *bone = _bones[skinBones[i]->getIndex()];
|
Bone *bone = _bones[skinBones[i]->getIndex()];
|
||||||
do {
|
do {
|
||||||
@ -198,7 +198,7 @@ void Skeleton::sortBone(Bone *bone) {
|
|||||||
_updateCache.add((Update *)bone);
|
_updateCache.add((Update *)bone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton::sortReset(Vector<Bone *> &bones) {
|
void Skeleton::sortReset(Array<Bone *> &bones) {
|
||||||
Bone **items = bones.buffer();
|
Bone **items = bones.buffer();
|
||||||
for (size_t i = 0, n = bones.size(); i < n; i++) {
|
for (size_t i = 0, n = bones.size(); i < n; i++) {
|
||||||
Bone *bone = items[i];
|
Bone *bone = items[i];
|
||||||
@ -293,11 +293,11 @@ SkeletonData *Skeleton::getData() {
|
|||||||
return &_data;
|
return &_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Bone *> &Skeleton::getBones() {
|
Array<Bone *> &Skeleton::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Update *> &Skeleton::getUpdateCache() {
|
Array<Update *> &Skeleton::getUpdateCache() {
|
||||||
return _updateCache;
|
return _updateCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ Bone *Skeleton::findBone(const String &boneName) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Slot *> &Skeleton::getSlots() {
|
Array<Slot *> &Skeleton::getSlots() {
|
||||||
return _slots;
|
return _slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ Slot *Skeleton::findSlot(const String &slotName) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Slot *> &Skeleton::getDrawOrder() {
|
Array<Slot *> &Skeleton::getDrawOrder() {
|
||||||
return _drawOrder;
|
return _drawOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,19 +392,19 @@ void Skeleton::setAttachment(const String &slotName, const String &attachmentNam
|
|||||||
slot->_pose.setAttachment(attachment);
|
slot->_pose.setAttachment(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Constraint *> &Skeleton::getConstraints() {
|
Array<Constraint *> &Skeleton::getConstraints() {
|
||||||
return _constraints;
|
return _constraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<PhysicsConstraint *> &Skeleton::getPhysicsConstraints() {
|
Array<PhysicsConstraint *> &Skeleton::getPhysicsConstraints() {
|
||||||
return _physics;
|
return _physics;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector<float> &outVertexBuffer) {
|
void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array<float> &outVertexBuffer) {
|
||||||
getBounds(outX, outY, outWidth, outHeight, outVertexBuffer, NULL);
|
getBounds(outX, outY, outWidth, outHeight, outVertexBuffer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector<float> &outVertexBuffer, SkeletonClipping *clipper) {
|
void Skeleton::getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array<float> &outVertexBuffer, SkeletonClipping *clipper) {
|
||||||
static unsigned short quadIndices[] = {0, 1, 2, 2, 3, 0};
|
static unsigned short quadIndices[] = {0, 1, 2, 2, 3, 0};
|
||||||
float minX = FLT_MAX;
|
float minX = FLT_MAX;
|
||||||
float minY = FLT_MAX;
|
float minY = FLT_MAX;
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
#include <spine/BoundingBoxAttachment.h>
|
#include <spine/BoundingBoxAttachment.h>
|
||||||
#include <spine/ClippingAttachment.h>
|
#include <spine/ClippingAttachment.h>
|
||||||
#include <spine/ColorTimeline.h>
|
#include <spine/ColorTimeline.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
#include <spine/DeformTimeline.h>
|
#include <spine/DeformTimeline.h>
|
||||||
#include <spine/DrawOrderTimeline.h>
|
#include <spine/DrawOrderTimeline.h>
|
||||||
#include <spine/Event.h>
|
#include <spine/Event.h>
|
||||||
@ -93,7 +93,7 @@ SkeletonBinary::SkeletonBinary(AttachmentLoader *attachmentLoader, bool ownsLoad
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkeletonBinary::~SkeletonBinary() {
|
SkeletonBinary::~SkeletonBinary() {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
ArrayUtils::deleteElements(_linkedMeshes);
|
||||||
_linkedMeshes.clear();
|
_linkedMeshes.clear();
|
||||||
|
|
||||||
if (_ownsLoader) delete _attachmentLoader;
|
if (_ownsLoader) delete _attachmentLoader;
|
||||||
@ -136,7 +136,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
ArrayUtils::deleteElements(_linkedMeshes);
|
||||||
_linkedMeshes.clear();
|
_linkedMeshes.clear();
|
||||||
|
|
||||||
SkeletonData *skeletonData = new (__FILE__, __LINE__) SkeletonData();
|
SkeletonData *skeletonData = new (__FILE__, __LINE__) SkeletonData();
|
||||||
@ -177,12 +177,12 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
int n = input.readInt(true);
|
int n = input.readInt(true);
|
||||||
Vector<char *> &strings = skeletonData->_strings.setSize(n, NULL);
|
Array<char *> &strings = skeletonData->_strings.setSize(n, NULL);
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
strings[i] = input.readString();
|
strings[i] = input.readString();
|
||||||
|
|
||||||
/* Bones. */
|
/* Bones. */
|
||||||
Vector<BoneData *> &bones = skeletonData->_bones.setSize(input.readInt(true), NULL);
|
Array<BoneData *> &bones = skeletonData->_bones.setSize(input.readInt(true), NULL);
|
||||||
for (int i = 0; i < (int)bones.size(); ++i) {
|
for (int i = 0; i < (int)bones.size(); ++i) {
|
||||||
const char *name = input.readString();
|
const char *name = input.readString();
|
||||||
BoneData *parent = i == 0 ? 0 : bones[input.readInt(true)];
|
BoneData *parent = i == 0 ? 0 : bones[input.readInt(true)];
|
||||||
@ -207,7 +207,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Slots. */
|
/* Slots. */
|
||||||
Vector<SlotData *> &slots = skeletonData->_slots.setSize(input.readInt(true), NULL);
|
Array<SlotData *> &slots = skeletonData->_slots.setSize(input.readInt(true), NULL);
|
||||||
for (int i = 0; i < (int)slots.size(); ++i) {
|
for (int i = 0; i < (int)slots.size(); ++i) {
|
||||||
String slotName = String(input.readString(), true);
|
String slotName = String(input.readString(), true);
|
||||||
BoneData *boneData = bones[input.readInt(true)];
|
BoneData *boneData = bones[input.readInt(true)];
|
||||||
@ -228,14 +228,14 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
|
|
||||||
/* Constraints. */
|
/* Constraints. */
|
||||||
int constraintCount = input.readInt(true);
|
int constraintCount = input.readInt(true);
|
||||||
Vector<ConstraintData *> &constraints = skeletonData->_constraints.setSize(constraintCount, NULL);
|
Array<ConstraintData *> &constraints = skeletonData->_constraints.setSize(constraintCount, NULL);
|
||||||
for (int i = 0; i < constraintCount; i++) {
|
for (int i = 0; i < constraintCount; i++) {
|
||||||
String name(input.readString(), true);
|
String name(input.readString(), true);
|
||||||
int nn;
|
int nn;
|
||||||
switch (input.readByte()) {
|
switch (input.readByte()) {
|
||||||
case CONSTRAINT_IK: {
|
case CONSTRAINT_IK: {
|
||||||
IkConstraintData *data = new (__FILE__, __LINE__) IkConstraintData(name);
|
IkConstraintData *data = new (__FILE__, __LINE__) IkConstraintData(name);
|
||||||
Vector<BoneData *> &constraintBones = data->_bones.setSize(nn = input.readInt(true), NULL);
|
Array<BoneData *> &constraintBones = data->_bones.setSize(nn = input.readInt(true), NULL);
|
||||||
for (int ii = 0; ii < nn; ii++)
|
for (int ii = 0; ii < nn; ii++)
|
||||||
constraintBones[ii] = bones[input.readInt(true)];
|
constraintBones[ii] = bones[input.readInt(true)];
|
||||||
data->_target = bones[input.readInt(true)];
|
data->_target = bones[input.readInt(true)];
|
||||||
@ -253,7 +253,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
}
|
}
|
||||||
case CONSTRAINT_TRANSFORM: {
|
case CONSTRAINT_TRANSFORM: {
|
||||||
TransformConstraintData *data = new (__FILE__, __LINE__) TransformConstraintData(name);
|
TransformConstraintData *data = new (__FILE__, __LINE__) TransformConstraintData(name);
|
||||||
Vector<BoneData *> &constraintBones = data->_bones.setSize(nn = input.readInt(true), NULL);
|
Array<BoneData *> &constraintBones = data->_bones.setSize(nn = input.readInt(true), NULL);
|
||||||
for (int ii = 0; ii < nn; ii++)
|
for (int ii = 0; ii < nn; ii++)
|
||||||
constraintBones[ii] = bones[input.readInt(true)];
|
constraintBones[ii] = bones[input.readInt(true)];
|
||||||
data->_source = bones[input.readInt(true)];
|
data->_source = bones[input.readInt(true)];
|
||||||
@ -263,7 +263,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
data->_localTarget = (flags & 4) != 0;
|
data->_localTarget = (flags & 4) != 0;
|
||||||
data->_additive = (flags & 8) != 0;
|
data->_additive = (flags & 8) != 0;
|
||||||
data->_clamp = (flags & 16) != 0;
|
data->_clamp = (flags & 16) != 0;
|
||||||
Vector<FromProperty *> &froms = data->_properties.setSize(nn = flags >> 5, NULL);
|
Array<FromProperty *> &froms = data->_properties.setSize(nn = flags >> 5, NULL);
|
||||||
for (int ii = 0, tn; ii < nn; ii++) {
|
for (int ii = 0, tn; ii < nn; ii++) {
|
||||||
float fromScale = 1;
|
float fromScale = 1;
|
||||||
FromProperty *from = NULL;
|
FromProperty *from = NULL;
|
||||||
@ -290,7 +290,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
from->_offset = input.readFloat() * fromScale;
|
from->_offset = input.readFloat() * fromScale;
|
||||||
Vector<ToProperty *> &tos = from->_to.setSize(tn = input.readByte(), NULL);
|
Array<ToProperty *> &tos = from->_to.setSize(tn = input.readByte(), NULL);
|
||||||
for (int t = 0; t < tn; t++) {
|
for (int t = 0; t < tn; t++) {
|
||||||
float toScale = 1;
|
float toScale = 1;
|
||||||
ToProperty *to = NULL;
|
ToProperty *to = NULL;
|
||||||
@ -343,7 +343,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
}
|
}
|
||||||
case CONSTRAINT_PATH: {
|
case CONSTRAINT_PATH: {
|
||||||
PathConstraintData *data = new (__FILE__, __LINE__) PathConstraintData(name);
|
PathConstraintData *data = new (__FILE__, __LINE__) PathConstraintData(name);
|
||||||
Vector<BoneData *> &constraintBones = data->_bones.setSize(nn = input.readInt(true), NULL);
|
Array<BoneData *> &constraintBones = data->_bones.setSize(nn = input.readInt(true), NULL);
|
||||||
for (int ii = 0; ii < nn; ii++)
|
for (int ii = 0; ii < nn; ii++)
|
||||||
constraintBones[ii] = bones[input.readInt(true)];
|
constraintBones[ii] = bones[input.readInt(true)];
|
||||||
data->_slot = slots[input.readInt(true)];
|
data->_slot = slots[input.readInt(true)];
|
||||||
@ -459,7 +459,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
/* Skins. */
|
/* Skins. */
|
||||||
{
|
{
|
||||||
int i = skeletonData->_skins.size();
|
int i = skeletonData->_skins.size();
|
||||||
Vector<Skin *> &skins = skeletonData->_skins.setSize(n = i + input.readInt(true), NULL);
|
Array<Skin *> &skins = skeletonData->_skins.setSize(n = i + input.readInt(true), NULL);
|
||||||
for (; i < n; i++) {
|
for (; i < n; i++) {
|
||||||
Skin *skin = readSkin(input, *skeletonData, false, nonessential);
|
Skin *skin = readSkin(input, *skeletonData, false, nonessential);
|
||||||
if (skin)
|
if (skin)
|
||||||
@ -472,7 +472,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Linked meshes. */
|
/* Linked meshes. */
|
||||||
Vector<LinkedMesh *> &items = _linkedMeshes;
|
Array<LinkedMesh *> &items = _linkedMeshes;
|
||||||
for (int i = 0, n = items.size(); i < n; i++) {
|
for (int i = 0, n = items.size(); i < n; i++) {
|
||||||
LinkedMesh *linkedMesh = items[i];
|
LinkedMesh *linkedMesh = items[i];
|
||||||
Skin *skin = skeletonData->_skins[linkedMesh->_skinIndex];
|
Skin *skin = skeletonData->_skins[linkedMesh->_skinIndex];
|
||||||
@ -487,12 +487,12 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
linkedMesh->_mesh->setParentMesh(static_cast<MeshAttachment *>(parent));
|
linkedMesh->_mesh->setParentMesh(static_cast<MeshAttachment *>(parent));
|
||||||
if (linkedMesh->_mesh->getSequence() == NULL) linkedMesh->_mesh->updateRegion();
|
if (linkedMesh->_mesh->getSequence() == NULL) linkedMesh->_mesh->updateRegion();
|
||||||
}
|
}
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
ArrayUtils::deleteElements(_linkedMeshes);
|
||||||
_linkedMeshes.clear();
|
_linkedMeshes.clear();
|
||||||
|
|
||||||
/* Events. */
|
/* Events. */
|
||||||
int eventsCount = input.readInt(true);
|
int eventsCount = input.readInt(true);
|
||||||
Vector<EventData *> &events = skeletonData->_events.setSize(eventsCount, NULL);
|
Array<EventData *> &events = skeletonData->_events.setSize(eventsCount, NULL);
|
||||||
for (int i = 0; i < eventsCount; ++i) {
|
for (int i = 0; i < eventsCount; ++i) {
|
||||||
EventData *eventData = new (__FILE__, __LINE__) EventData(String(input.readString(), true));
|
EventData *eventData = new (__FILE__, __LINE__) EventData(String(input.readString(), true));
|
||||||
eventData->_intValue = input.readInt(false);
|
eventData->_intValue = input.readInt(false);
|
||||||
@ -508,7 +508,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
|
|||||||
|
|
||||||
/* Animations. */
|
/* Animations. */
|
||||||
int animationsCount = input.readInt(true);
|
int animationsCount = input.readInt(true);
|
||||||
Vector<Animation *> &animations = skeletonData->_animations.setSize(animationsCount, NULL);
|
Array<Animation *> &animations = skeletonData->_animations.setSize(animationsCount, NULL);
|
||||||
for (int i = 0; i < animationsCount; ++i) {
|
for (int i = 0; i < animationsCount; ++i) {
|
||||||
Animation *animation = readAnimation(input, String(input.readString(), true), *skeletonData);
|
Animation *animation = readAnimation(input, String(input.readString(), true), *skeletonData);
|
||||||
if (!animation) {
|
if (!animation) {
|
||||||
@ -552,13 +552,13 @@ Skin *SkeletonBinary::readSkin(DataInput &input, SkeletonData &skeletonData, boo
|
|||||||
if (nonessential) Color::rgba8888ToColor(skin->getColor(), input.readInt());
|
if (nonessential) Color::rgba8888ToColor(skin->getColor(), input.readInt());
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
Vector<BoneData *> &from = skeletonData._bones;
|
Array<BoneData *> &from = skeletonData._bones;
|
||||||
Vector<BoneData *> &bones = skin->getBones().setSize(n = input.readInt(true), NULL);
|
Array<BoneData *> &bones = skin->getBones().setSize(n = input.readInt(true), NULL);
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
bones[i] = from[input.readInt(true)];
|
bones[i] = from[input.readInt(true)];
|
||||||
|
|
||||||
Vector<ConstraintData *> &fromConstraints = skeletonData._constraints;
|
Array<ConstraintData *> &fromConstraints = skeletonData._constraints;
|
||||||
Vector<ConstraintData *> &constraints = skin->getConstraints().setSize(n = input.readInt(true), NULL);
|
Array<ConstraintData *> &constraints = skin->getConstraints().setSize(n = input.readInt(true), NULL);
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
constraints[i] = fromConstraints[input.readInt(true)];
|
constraints[i] = fromConstraints[input.readInt(true)];
|
||||||
|
|
||||||
@ -618,8 +618,8 @@ Attachment *SkeletonBinary::readAttachment(DataInput &input, Skin &skin, int slo
|
|||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
case AttachmentType_Boundingbox: {
|
case AttachmentType_Boundingbox: {
|
||||||
Vector<float> vertices;
|
Array<float> vertices;
|
||||||
Vector<int> bones;
|
Array<int> bones;
|
||||||
int verticesLength = readVertices(input, vertices, bones, (flags & 16) != 0);
|
int verticesLength = readVertices(input, vertices, bones, (flags & 16) != 0);
|
||||||
int color = nonessential ? input.readInt() : 0;
|
int color = nonessential ? input.readInt() : 0;
|
||||||
|
|
||||||
@ -636,15 +636,15 @@ Attachment *SkeletonBinary::readAttachment(DataInput &input, Skin &skin, int slo
|
|||||||
int color = (flags & 32) != 0 ? input.readInt() : 0xffffffff;
|
int color = (flags & 32) != 0 ? input.readInt() : 0xffffffff;
|
||||||
Sequence *sequence = (flags & 64) != 0 ? readSequence(input) : nullptr;
|
Sequence *sequence = (flags & 64) != 0 ? readSequence(input) : nullptr;
|
||||||
int hullLength = input.readInt(true);
|
int hullLength = input.readInt(true);
|
||||||
Vector<float> vertices;
|
Array<float> vertices;
|
||||||
Vector<int> bones;
|
Array<int> bones;
|
||||||
int verticesLength = readVertices(input, vertices, bones, (flags & 128) != 0);
|
int verticesLength = readVertices(input, vertices, bones, (flags & 128) != 0);
|
||||||
Vector<float> uvs;
|
Array<float> uvs;
|
||||||
readFloatArray(input, verticesLength, 1, uvs);
|
readFloatArray(input, verticesLength, 1, uvs);
|
||||||
Vector<unsigned short> triangles;
|
Array<unsigned short> triangles;
|
||||||
readShortArray(input, triangles, (verticesLength - hullLength - 2) * 3);
|
readShortArray(input, triangles, (verticesLength - hullLength - 2) * 3);
|
||||||
|
|
||||||
Vector<unsigned short> edges;
|
Array<unsigned short> edges;
|
||||||
float width = 0, height = 0;
|
float width = 0, height = 0;
|
||||||
if (nonessential) {
|
if (nonessential) {
|
||||||
readShortArray(input, edges, input.readInt(true));
|
readShortArray(input, edges, input.readInt(true));
|
||||||
@ -699,10 +699,10 @@ Attachment *SkeletonBinary::readAttachment(DataInput &input, Skin &skin, int slo
|
|||||||
case AttachmentType_Path: {
|
case AttachmentType_Path: {
|
||||||
bool closed = (flags & 16) != 0;
|
bool closed = (flags & 16) != 0;
|
||||||
bool constantSpeed = (flags & 32) != 0;
|
bool constantSpeed = (flags & 32) != 0;
|
||||||
Vector<float> vertices;
|
Array<float> vertices;
|
||||||
Vector<int> bones;
|
Array<int> bones;
|
||||||
int verticesLength = readVertices(input, vertices, bones, (flags & 64) != 0);
|
int verticesLength = readVertices(input, vertices, bones, (flags & 64) != 0);
|
||||||
Vector<float> lengths;
|
Array<float> lengths;
|
||||||
lengths.setSize(verticesLength / 6, 0);
|
lengths.setSize(verticesLength / 6, 0);
|
||||||
for (int i = 0, n = lengths.size(); i < n; i++)
|
for (int i = 0, n = lengths.size(); i < n; i++)
|
||||||
lengths[i] = input.readFloat() * scale;
|
lengths[i] = input.readFloat() * scale;
|
||||||
@ -735,8 +735,8 @@ Attachment *SkeletonBinary::readAttachment(DataInput &input, Skin &skin, int slo
|
|||||||
}
|
}
|
||||||
case AttachmentType_Clipping: {
|
case AttachmentType_Clipping: {
|
||||||
int endSlotIndex = input.readInt(true);
|
int endSlotIndex = input.readInt(true);
|
||||||
Vector<float> vertices;
|
Array<float> vertices;
|
||||||
Vector<int> bones;
|
Array<int> bones;
|
||||||
int verticesLength = readVertices(input, vertices, bones, (flags & 16) != 0);
|
int verticesLength = readVertices(input, vertices, bones, (flags & 16) != 0);
|
||||||
int color = nonessential ? input.readInt() : 0;
|
int color = nonessential ? input.readInt() : 0;
|
||||||
|
|
||||||
@ -761,7 +761,7 @@ Sequence *SkeletonBinary::readSequence(DataInput &input) {
|
|||||||
return sequence;
|
return sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkeletonBinary::readVertices(DataInput &input, Vector<float> &vertices, Vector<int> &bones, bool weighted) {
|
int SkeletonBinary::readVertices(DataInput &input, Array<float> &vertices, Array<int> &bones, bool weighted) {
|
||||||
float scale = _scale;
|
float scale = _scale;
|
||||||
int vertexCount = input.readInt(true);
|
int vertexCount = input.readInt(true);
|
||||||
int verticesLength = vertexCount << 1;
|
int verticesLength = vertexCount << 1;
|
||||||
@ -784,7 +784,7 @@ int SkeletonBinary::readVertices(DataInput &input, Vector<float> &vertices, Vect
|
|||||||
return verticesLength;
|
return verticesLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonBinary::readFloatArray(DataInput &input, int n, float scale, Vector<float> &array) {
|
void SkeletonBinary::readFloatArray(DataInput &input, int n, float scale, Array<float> &array) {
|
||||||
array.setSize(n, 0);
|
array.setSize(n, 0);
|
||||||
int i;
|
int i;
|
||||||
if (scale == 1) {
|
if (scale == 1) {
|
||||||
@ -798,7 +798,7 @@ void SkeletonBinary::readFloatArray(DataInput &input, int n, float scale, Vector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonBinary::readShortArray(DataInput &input, Vector<unsigned short> &array, int n) {
|
void SkeletonBinary::readShortArray(DataInput &input, Array<unsigned short> &array, int n) {
|
||||||
array.setSize(n, 0);
|
array.setSize(n, 0);
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
array[i] = (short) input.readInt(true);
|
array[i] = (short) input.readInt(true);
|
||||||
@ -806,7 +806,7 @@ void SkeletonBinary::readShortArray(DataInput &input, Vector<unsigned short> &ar
|
|||||||
}
|
}
|
||||||
|
|
||||||
Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, SkeletonData &skeletonData) {
|
Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, SkeletonData &skeletonData) {
|
||||||
Vector<Timeline *> timelines;
|
Array<Timeline *> timelines;
|
||||||
timelines.ensureCapacity(input.readInt(true));
|
timelines.ensureCapacity(input.readInt(true));
|
||||||
float scale = _scale;
|
float scale = _scale;
|
||||||
|
|
||||||
@ -986,7 +986,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError("Invalid slot timeline type: ", String().append(timelineType).buffer());
|
setError("Invalid slot timeline type: ", String().append(timelineType).buffer());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1042,7 +1042,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
readTimeline(input, timelines, *(new (__FILE__, __LINE__) ShearYTimeline(frameCount, bezierCount, boneIndex)), 1);
|
readTimeline(input, timelines, *(new (__FILE__, __LINE__) ShearYTimeline(frameCount, bezierCount, boneIndex)), 1);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError("Invalid bone timeline type: ", String().append(timelineType).buffer());
|
setError("Invalid bone timeline type: ", String().append(timelineType).buffer());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1161,7 +1161,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError("Invalid path constraint timeline type: ", String().append(type).buffer());
|
setError("Invalid path constraint timeline type: ", String().append(type).buffer());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1205,7 +1205,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
readTimeline(input, timelines, *(new (__FILE__, __LINE__) PhysicsConstraintMixTimeline(frameCount, bezierCount, index)), 1);
|
readTimeline(input, timelines, *(new (__FILE__, __LINE__) PhysicsConstraintMixTimeline(frameCount, bezierCount, index)), 1);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError("Invalid physics constraint timeline type: ", String().append(type).buffer());
|
setError("Invalid physics constraint timeline type: ", String().append(type).buffer());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1226,7 +1226,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
readTimeline(input, timelines, *(new (__FILE__, __LINE__) SliderMixTimeline(frameCount, bezierCount, index)), 1);
|
readTimeline(input, timelines, *(new (__FILE__, __LINE__) SliderMixTimeline(frameCount, bezierCount, index)), 1);
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError("Invalid slider timeline type: ", String().append(type).buffer());
|
setError("Invalid slider timeline type: ", String().append(type).buffer());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1243,7 +1243,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
const char *attachmentName = input.readStringRef();
|
const char *attachmentName = input.readStringRef();
|
||||||
Attachment *attachment = skin->getAttachment(slotIndex, String(attachmentName));
|
Attachment *attachment = skin->getAttachment(slotIndex, String(attachmentName));
|
||||||
if (!attachment) {
|
if (!attachment) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError("Timeline attachment not found: ", attachmentName);
|
setError("Timeline attachment not found: ", attachmentName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1252,7 +1252,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
case ATTACHMENT_DEFORM: {
|
case ATTACHMENT_DEFORM: {
|
||||||
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
|
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
|
||||||
bool weighted = vertexAttachment->_bones.size() > 0;
|
bool weighted = vertexAttachment->_bones.size() > 0;
|
||||||
Vector<float> &vertices = vertexAttachment->_vertices;
|
Array<float> &vertices = vertexAttachment->_vertices;
|
||||||
int deformLength = weighted ? (int) vertices.size() / 3 * 2 : (int) vertices.size();
|
int deformLength = weighted ? (int) vertices.size() / 3 * 2 : (int) vertices.size();
|
||||||
|
|
||||||
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frameCount, input.readInt(true), slotIndex,
|
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frameCount, input.readInt(true), slotIndex,
|
||||||
@ -1260,7 +1260,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
|
|
||||||
float time = input.readFloat();
|
float time = input.readFloat();
|
||||||
for (int frame = 0, bezier = 0;; ++frame) {
|
for (int frame = 0, bezier = 0;; ++frame) {
|
||||||
Vector<float> deform;
|
Array<float> deform;
|
||||||
size_t end = (size_t) input.readInt(true);
|
size_t end = (size_t) input.readInt(true);
|
||||||
if (end == 0) {
|
if (end == 0) {
|
||||||
if (weighted) {
|
if (weighted) {
|
||||||
@ -1315,7 +1315,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError("Invalid attachment timeline type: ", String().append(timelineType).buffer());
|
setError("Invalid attachment timeline type: ", String().append(timelineType).buffer());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1332,11 +1332,11 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
for (size_t i = 0; i < drawOrderCount; ++i) {
|
for (size_t i = 0; i < drawOrderCount; ++i) {
|
||||||
float time = input.readFloat();
|
float time = input.readFloat();
|
||||||
size_t offsetCount = (size_t) input.readInt(true);
|
size_t offsetCount = (size_t) input.readInt(true);
|
||||||
Vector<int> drawOrder;
|
Array<int> drawOrder;
|
||||||
drawOrder.setSize(slotCount, 0);
|
drawOrder.setSize(slotCount, 0);
|
||||||
for (int ii = (int) slotCount - 1; ii >= 0; --ii)
|
for (int ii = (int) slotCount - 1; ii >= 0; --ii)
|
||||||
drawOrder[ii] = -1;
|
drawOrder[ii] = -1;
|
||||||
Vector<int> unchanged;
|
Array<int> unchanged;
|
||||||
unchanged.setSize(slotCount - offsetCount, 0);
|
unchanged.setSize(slotCount - offsetCount, 0);
|
||||||
size_t originalIndex = 0, unchangedIndex = 0;
|
size_t originalIndex = 0, unchangedIndex = 0;
|
||||||
for (size_t ii = 0; ii < offsetCount; ++ii) {
|
for (size_t ii = 0; ii < offsetCount; ++ii) {
|
||||||
@ -1391,7 +1391,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
|
|||||||
return new (__FILE__, __LINE__) Animation(String(name), timelines, duration);
|
return new (__FILE__, __LINE__) Animation(String(name), timelines, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonBinary::readTimeline(DataInput &input, Vector<Timeline *> &timelines, CurveTimeline1 &timeline, float scale) {
|
void SkeletonBinary::readTimeline(DataInput &input, Array<Timeline *> &timelines, CurveTimeline1 &timeline, float scale) {
|
||||||
float time = input.readFloat(), value = input.readFloat() * scale;
|
float time = input.readFloat(), value = input.readFloat() * scale;
|
||||||
for (int frame = 0, bezier = 0, frameLast = (int) timeline.getFrameCount() - 1;; frame++) {
|
for (int frame = 0, bezier = 0, frameLast = (int) timeline.getFrameCount() - 1;; frame++) {
|
||||||
timeline.setFrame(frame, time, value);
|
timeline.setFrame(frame, time, value);
|
||||||
@ -1411,7 +1411,7 @@ void SkeletonBinary::readTimeline(DataInput &input, Vector<Timeline *> &timeline
|
|||||||
timelines.add(&timeline);
|
timelines.add(&timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonBinary::readTimeline(DataInput &input, Vector<Timeline *> &timelines, BoneTimeline2 &timeline, float scale) {
|
void SkeletonBinary::readTimeline(DataInput &input, Array<Timeline *> &timelines, BoneTimeline2 &timeline, float scale) {
|
||||||
float time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
|
float time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
|
||||||
for (int frame = 0, bezier = 0, frameLast = (int) timeline.getFrameCount() - 1;; frame++) {
|
for (int frame = 0, bezier = 0, frameLast = (int) timeline.getFrameCount() - 1;; frame++) {
|
||||||
timeline.setFrame(frame, time, value1, value2);
|
timeline.setFrame(frame, time, value1, value2);
|
||||||
|
|||||||
@ -49,7 +49,7 @@ SkeletonBounds::~SkeletonBounds() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) {
|
void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) {
|
||||||
Vector<Slot *> &slots = skeleton.getSlots();
|
Array<Slot *> &slots = skeleton.getSlots();
|
||||||
size_t slotCount = slots.size();
|
size_t slotCount = slots.size();
|
||||||
|
|
||||||
_boundingBoxes.clear();
|
_boundingBoxes.clear();
|
||||||
@ -123,7 +123,7 @@ bool SkeletonBounds::aabbIntersectsSkeleton(SkeletonBounds &bounds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonBounds::containsPoint(spine::Polygon *polygon, float x, float y) {
|
bool SkeletonBounds::containsPoint(spine::Polygon *polygon, float x, float y) {
|
||||||
Vector<float> &vertices = polygon->_vertices;
|
Array<float> &vertices = polygon->_vertices;
|
||||||
int nn = polygon->_count;
|
int nn = polygon->_count;
|
||||||
|
|
||||||
int prevIndex = nn - 2;
|
int prevIndex = nn - 2;
|
||||||
@ -155,7 +155,7 @@ BoundingBoxAttachment *SkeletonBounds::intersectsSegment(float x1, float y1, flo
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonBounds::intersectsSegment(spine::Polygon *polygon, float x1, float y1, float x2, float y2) {
|
bool SkeletonBounds::intersectsSegment(spine::Polygon *polygon, float x1, float y1, float x2, float y2) {
|
||||||
Vector<float> &vertices = polygon->_vertices;
|
Array<float> &vertices = polygon->_vertices;
|
||||||
size_t nn = polygon->_count;
|
size_t nn = polygon->_count;
|
||||||
|
|
||||||
float width12 = x1 - x2, height12 = y1 - y2;
|
float width12 = x1 - x2, height12 = y1 - y2;
|
||||||
@ -190,11 +190,11 @@ BoundingBoxAttachment *SkeletonBounds::getBoundingBox(Polygon *polygon) {
|
|||||||
return index == -1 ? NULL : _boundingBoxes[index];
|
return index == -1 ? NULL : _boundingBoxes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<spine::Polygon *> &SkeletonBounds::getPolygons() {
|
Array<spine::Polygon *> &SkeletonBounds::getPolygons() {
|
||||||
return _polygons;
|
return _polygons;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<BoundingBoxAttachment *> &SkeletonBounds::getBoundingBoxes() {
|
Array<BoundingBoxAttachment *> &SkeletonBounds::getBoundingBoxes() {
|
||||||
return _boundingBoxes;
|
return _boundingBoxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ void SkeletonBounds::aabbCompute() {
|
|||||||
|
|
||||||
for (size_t i = 0, n = _polygons.size(); i < n; ++i) {
|
for (size_t i = 0, n = _polygons.size(); i < n; ++i) {
|
||||||
spine::Polygon *polygon = _polygons[i];
|
spine::Polygon *polygon = _polygons[i];
|
||||||
Vector<float> &vertices = polygon->_vertices;
|
Array<float> &vertices = polygon->_vertices;
|
||||||
for (int ii = 0, nn = polygon->_count; ii < nn; ii += 2) {
|
for (int ii = 0, nn = polygon->_count; ii < nn; ii += 2) {
|
||||||
float x = vertices[ii];
|
float x = vertices[ii];
|
||||||
float y = vertices[ii + 1];
|
float y = vertices[ii + 1];
|
||||||
|
|||||||
@ -58,8 +58,8 @@ size_t SkeletonClipping::clipStart(Skeleton &skeleton, Slot &slot, ClippingAttac
|
|||||||
_clippingPolygons = &_triangulator.decompose(_clippingPolygon, _triangulator.triangulate(_clippingPolygon));
|
_clippingPolygons = &_triangulator.decompose(_clippingPolygon, _triangulator.triangulate(_clippingPolygon));
|
||||||
|
|
||||||
for (size_t i = 0; i < _clippingPolygons->size(); ++i) {
|
for (size_t i = 0; i < _clippingPolygons->size(); ++i) {
|
||||||
Vector<float> *polygonP = (*_clippingPolygons)[i];
|
Array<float> *polygonP = (*_clippingPolygons)[i];
|
||||||
Vector<float> &polygon = *polygonP;
|
Array<float> &polygon = *polygonP;
|
||||||
makeClockwise(polygon);
|
makeClockwise(polygon);
|
||||||
polygon.add(polygon[0]);
|
polygon.add(polygon[0]);
|
||||||
polygon.add(polygon[1]);
|
polygon.add(polygon[1]);
|
||||||
@ -87,10 +87,10 @@ void SkeletonClipping::clipEnd() {
|
|||||||
|
|
||||||
bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
|
bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
|
||||||
size_t trianglesLength) {
|
size_t trianglesLength) {
|
||||||
Vector<float> &clipOutput = _clipOutput;
|
Array<float> &clipOutput = _clipOutput;
|
||||||
Vector<float> &clippedVertices = _clippedVertices;
|
Array<float> &clippedVertices = _clippedVertices;
|
||||||
Vector<unsigned short> &clippedTriangles = _clippedTriangles;
|
Array<unsigned short> &clippedTriangles = _clippedTriangles;
|
||||||
Vector<Vector<float> *> &polygons = *_clippingPolygons;
|
Array<Array<float> *> &polygons = *_clippingPolygons;
|
||||||
size_t polygonsCount = (*_clippingPolygons).size();
|
size_t polygonsCount = (*_clippingPolygons).size();
|
||||||
|
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
@ -159,17 +159,17 @@ bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
|
|||||||
return clipped;
|
return clipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonClipping::clipTriangles(Vector<float> &vertices, Vector<unsigned short> &triangles, Vector<float> &uvs,
|
bool SkeletonClipping::clipTriangles(Array<float> &vertices, Array<unsigned short> &triangles, Array<float> &uvs,
|
||||||
size_t stride) {
|
size_t stride) {
|
||||||
return clipTriangles(vertices.buffer(), triangles.buffer(), triangles.size(), uvs.buffer(), stride);
|
return clipTriangles(vertices.buffer(), triangles.buffer(), triangles.size(), uvs.buffer(), stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
|
bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
|
||||||
size_t trianglesLength, float *uvs, size_t stride) {
|
size_t trianglesLength, float *uvs, size_t stride) {
|
||||||
Vector<float> &clipOutput = _clipOutput;
|
Array<float> &clipOutput = _clipOutput;
|
||||||
Vector<float> &clippedVertices = _clippedVertices;
|
Array<float> &clippedVertices = _clippedVertices;
|
||||||
Vector<unsigned short> &clippedTriangles = _clippedTriangles;
|
Array<unsigned short> &clippedTriangles = _clippedTriangles;
|
||||||
Vector<Vector<float> *> &polygons = *_clippingPolygons;
|
Array<Array<float> *> &polygons = *_clippingPolygons;
|
||||||
size_t polygonsCount = (*_clippingPolygons).size();
|
size_t polygonsCount = (*_clippingPolygons).size();
|
||||||
|
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
@ -261,25 +261,25 @@ bool SkeletonClipping::isClipping() {
|
|||||||
return _clipAttachment != NULL;
|
return _clipAttachment != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &SkeletonClipping::getClippedVertices() {
|
Array<float> &SkeletonClipping::getClippedVertices() {
|
||||||
return _clippedVertices;
|
return _clippedVertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<unsigned short> &SkeletonClipping::getClippedTriangles() {
|
Array<unsigned short> &SkeletonClipping::getClippedTriangles() {
|
||||||
return _clippedTriangles;
|
return _clippedTriangles;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> &SkeletonClipping::getClippedUVs() {
|
Array<float> &SkeletonClipping::getClippedUVs() {
|
||||||
return _clippedUVs;
|
return _clippedUVs;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, float y3, Vector<float> *clippingArea,
|
bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, float y3, Array<float> *clippingArea,
|
||||||
Vector<float> *output) {
|
Array<float> *output) {
|
||||||
Vector<float> *originalOutput = output;
|
Array<float> *originalOutput = output;
|
||||||
bool clipped = false;
|
bool clipped = false;
|
||||||
|
|
||||||
// Avoid copy at the end.
|
// Avoid copy at the end.
|
||||||
Vector<float> *input;
|
Array<float> *input;
|
||||||
if (clippingArea->size() % 4 >= 2) {
|
if (clippingArea->size() % 4 >= 2) {
|
||||||
input = output;
|
input = output;
|
||||||
output = &_scratch;
|
output = &_scratch;
|
||||||
@ -298,13 +298,13 @@ bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, fl
|
|||||||
output->clear();
|
output->clear();
|
||||||
|
|
||||||
size_t clippingVerticesLast = clippingArea->size() - 4;
|
size_t clippingVerticesLast = clippingArea->size() - 4;
|
||||||
Vector<float> &clippingVertices = *clippingArea;
|
Array<float> &clippingVertices = *clippingArea;
|
||||||
for (size_t i = 0;; i += 2) {
|
for (size_t i = 0;; i += 2) {
|
||||||
float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
|
float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
|
||||||
float ex = edgeX - clippingVertices[i + 2], ey = edgeY - clippingVertices[i + 3];
|
float ex = edgeX - clippingVertices[i + 2], ey = edgeY - clippingVertices[i + 3];
|
||||||
|
|
||||||
size_t outputStart = output->size();
|
size_t outputStart = output->size();
|
||||||
Vector<float> &inputVertices = *input;
|
Array<float> &inputVertices = *input;
|
||||||
for (size_t ii = 0, nn = input->size() - 2; ii < nn;) {
|
for (size_t ii = 0, nn = input->size() - 2; ii < nn;) {
|
||||||
float inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
|
float inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
|
||||||
ii += 2;
|
ii += 2;
|
||||||
@ -355,7 +355,7 @@ bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, fl
|
|||||||
if (i == clippingVerticesLast) {
|
if (i == clippingVerticesLast) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Vector<float> *temp = output;
|
Array<float> *temp = output;
|
||||||
output = input;
|
output = input;
|
||||||
output->clear();
|
output->clear();
|
||||||
input = temp;
|
input = temp;
|
||||||
@ -375,7 +375,7 @@ bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, fl
|
|||||||
return clipped;
|
return clipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonClipping::makeClockwise(Vector<float> &polygon) {
|
void SkeletonClipping::makeClockwise(Array<float> &polygon) {
|
||||||
size_t verticeslength = polygon.size();
|
size_t verticeslength = polygon.size();
|
||||||
|
|
||||||
float area = polygon[verticeslength - 2] * polygon[1] - polygon[0] * polygon[verticeslength - 1];
|
float area = polygon[verticeslength - 2] * polygon[1] - polygon[0] * polygon[verticeslength - 1];
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
#include <spine/SlotData.h>
|
#include <spine/SlotData.h>
|
||||||
#include <spine/TransformConstraintData.h>
|
#include <spine/TransformConstraintData.h>
|
||||||
|
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
@ -59,18 +59,18 @@ SkeletonData::SkeletonData() : _name(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkeletonData::~SkeletonData() {
|
SkeletonData::~SkeletonData() {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_bones);
|
ArrayUtils::deleteElements(_bones);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_slots);
|
ArrayUtils::deleteElements(_slots);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_skins);
|
ArrayUtils::deleteElements(_skins);
|
||||||
|
|
||||||
_defaultSkin = NULL;
|
_defaultSkin = NULL;
|
||||||
|
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_events);
|
ArrayUtils::deleteElements(_events);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_animations);
|
ArrayUtils::deleteElements(_animations);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_ikConstraints);
|
ArrayUtils::deleteElements(_ikConstraints);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_transformConstraints);
|
ArrayUtils::deleteElements(_transformConstraints);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_pathConstraints);
|
ArrayUtils::deleteElements(_pathConstraints);
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_physicsConstraints);
|
ArrayUtils::deleteElements(_physicsConstraints);
|
||||||
// Note: _constraints contains pointers to objects already cleaned up above, so just clear
|
// Note: _constraints contains pointers to objects already cleaned up above, so just clear
|
||||||
_constraints.clear();
|
_constraints.clear();
|
||||||
for (size_t i = 0; i < _strings.size(); i++) {
|
for (size_t i = 0; i < _strings.size(); i++) {
|
||||||
@ -79,39 +79,39 @@ SkeletonData::~SkeletonData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BoneData *SkeletonData::findBone(const String &boneName) {
|
BoneData *SkeletonData::findBone(const String &boneName) {
|
||||||
return ContainerUtil::findWithName(_bones, boneName);
|
return ArrayUtils::findWithName(_bones, boneName);
|
||||||
}
|
}
|
||||||
|
|
||||||
SlotData *SkeletonData::findSlot(const String &slotName) {
|
SlotData *SkeletonData::findSlot(const String &slotName) {
|
||||||
return ContainerUtil::findWithName(_slots, slotName);
|
return ArrayUtils::findWithName(_slots, slotName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Skin *SkeletonData::findSkin(const String &skinName) {
|
Skin *SkeletonData::findSkin(const String &skinName) {
|
||||||
return ContainerUtil::findWithName(_skins, skinName);
|
return ArrayUtils::findWithName(_skins, skinName);
|
||||||
}
|
}
|
||||||
|
|
||||||
spine::EventData *SkeletonData::findEvent(const String &eventDataName) {
|
spine::EventData *SkeletonData::findEvent(const String &eventDataName) {
|
||||||
return ContainerUtil::findWithName(_events, eventDataName);
|
return ArrayUtils::findWithName(_events, eventDataName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation *SkeletonData::findAnimation(const String &animationName) {
|
Animation *SkeletonData::findAnimation(const String &animationName) {
|
||||||
return ContainerUtil::findWithName(_animations, animationName);
|
return ArrayUtils::findWithName(_animations, animationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
IkConstraintData *SkeletonData::findIkConstraint(const String &constraintName) {
|
IkConstraintData *SkeletonData::findIkConstraint(const String &constraintName) {
|
||||||
return ContainerUtil::findWithName(_ikConstraints, constraintName);
|
return ArrayUtils::findWithName(_ikConstraints, constraintName);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransformConstraintData *SkeletonData::findTransformConstraint(const String &constraintName) {
|
TransformConstraintData *SkeletonData::findTransformConstraint(const String &constraintName) {
|
||||||
return ContainerUtil::findWithName(_transformConstraints, constraintName);
|
return ArrayUtils::findWithName(_transformConstraints, constraintName);
|
||||||
}
|
}
|
||||||
|
|
||||||
PathConstraintData *SkeletonData::findPathConstraint(const String &constraintName) {
|
PathConstraintData *SkeletonData::findPathConstraint(const String &constraintName) {
|
||||||
return ContainerUtil::findWithName(_pathConstraints, constraintName);
|
return ArrayUtils::findWithName(_pathConstraints, constraintName);
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicsConstraintData *SkeletonData::findPhysicsConstraint(const String &constraintName) {
|
PhysicsConstraintData *SkeletonData::findPhysicsConstraint(const String &constraintName) {
|
||||||
return ContainerUtil::findWithName(_physicsConstraints, constraintName);
|
return ArrayUtils::findWithName(_physicsConstraints, constraintName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const String &SkeletonData::getName() {
|
const String &SkeletonData::getName() {
|
||||||
@ -122,15 +122,15 @@ void SkeletonData::setName(const String &inValue) {
|
|||||||
_name = inValue;
|
_name = inValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<BoneData *> &SkeletonData::getBones() {
|
Array<BoneData *> &SkeletonData::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<SlotData *> &SkeletonData::getSlots() {
|
Array<SlotData *> &SkeletonData::getSlots() {
|
||||||
return _slots;
|
return _slots;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Skin *> &SkeletonData::getSkins() {
|
Array<Skin *> &SkeletonData::getSkins() {
|
||||||
return _skins;
|
return _skins;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,27 +142,27 @@ void SkeletonData::setDefaultSkin(Skin *inValue) {
|
|||||||
_defaultSkin = inValue;
|
_defaultSkin = inValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<spine::EventData *> &SkeletonData::getEvents() {
|
Array<spine::EventData *> &SkeletonData::getEvents() {
|
||||||
return _events;
|
return _events;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Animation *> &SkeletonData::getAnimations() {
|
Array<Animation *> &SkeletonData::getAnimations() {
|
||||||
return _animations;
|
return _animations;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<IkConstraintData *> &SkeletonData::getIkConstraints() {
|
Array<IkConstraintData *> &SkeletonData::getIkConstraints() {
|
||||||
return _ikConstraints;
|
return _ikConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<TransformConstraintData *> &SkeletonData::getTransformConstraints() {
|
Array<TransformConstraintData *> &SkeletonData::getTransformConstraints() {
|
||||||
return _transformConstraints;
|
return _transformConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<PathConstraintData *> &SkeletonData::getPathConstraints() {
|
Array<PathConstraintData *> &SkeletonData::getPathConstraints() {
|
||||||
return _pathConstraints;
|
return _pathConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<PhysicsConstraintData *> &SkeletonData::getPhysicsConstraints() {
|
Array<PhysicsConstraintData *> &SkeletonData::getPhysicsConstraints() {
|
||||||
return _physicsConstraints;
|
return _physicsConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ void SkeletonData::setFps(float inValue) {
|
|||||||
_fps = inValue;
|
_fps = inValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<ConstraintData *> &SkeletonData::getConstraints() {
|
Array<ConstraintData *> &SkeletonData::getConstraints() {
|
||||||
// Build unified constraints array by aggregating all constraint types
|
// Build unified constraints array by aggregating all constraint types
|
||||||
_constraints.clear();
|
_constraints.clear();
|
||||||
for (size_t i = 0, n = _ikConstraints.size(); i < n; i++) {
|
for (size_t i = 0, n = _ikConstraints.size(); i < n; i++) {
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
#include <spine/BoundingBoxAttachment.h>
|
#include <spine/BoundingBoxAttachment.h>
|
||||||
#include <spine/ClippingAttachment.h>
|
#include <spine/ClippingAttachment.h>
|
||||||
#include <spine/ColorTimeline.h>
|
#include <spine/ColorTimeline.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ArrayUtils.h>
|
||||||
#include <spine/DeformTimeline.h>
|
#include <spine/DeformTimeline.h>
|
||||||
#include <spine/DrawOrderTimeline.h>
|
#include <spine/DrawOrderTimeline.h>
|
||||||
#include <spine/Event.h>
|
#include <spine/Event.h>
|
||||||
@ -117,7 +117,7 @@ SkeletonJson::SkeletonJson(AttachmentLoader *attachmentLoader, bool ownsLoader)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkeletonJson::~SkeletonJson() {
|
SkeletonJson::~SkeletonJson() {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
ArrayUtils::deleteElements(_linkedMeshes);
|
||||||
|
|
||||||
if (_ownsLoader) delete _attachmentLoader;
|
if (_ownsLoader) delete _attachmentLoader;
|
||||||
}
|
}
|
||||||
@ -554,7 +554,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
|
|||||||
linkedMesh->_mesh->setParentMesh(static_cast<MeshAttachment *>(parent));
|
linkedMesh->_mesh->setParentMesh(static_cast<MeshAttachment *>(parent));
|
||||||
if (linkedMesh->_mesh->_region != NULL) linkedMesh->_mesh->updateRegion();
|
if (linkedMesh->_mesh->_region != NULL) linkedMesh->_mesh->updateRegion();
|
||||||
}
|
}
|
||||||
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
ArrayUtils::deleteElements(_linkedMeshes);
|
||||||
_linkedMeshes.clear();
|
_linkedMeshes.clear();
|
||||||
|
|
||||||
/* Events. */
|
/* Events. */
|
||||||
@ -669,17 +669,17 @@ Attachment *SkeletonJson::readAttachment(Json *map, Skin *skin, int slotIndex, c
|
|||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> uvs;
|
Array<float> uvs;
|
||||||
if (!Json::asArray(Json::getItem(map, "uvs"), uvs)) return NULL;
|
if (!Json::asArray(Json::getItem(map, "uvs"), uvs)) return NULL;
|
||||||
readVertices(map, mesh, uvs.size());
|
readVertices(map, mesh, uvs.size());
|
||||||
Vector<unsigned short> triangles;
|
Array<unsigned short> triangles;
|
||||||
if (!Json::asArray(Json::getItem(map, "triangles"), triangles)) return NULL;
|
if (!Json::asArray(Json::getItem(map, "triangles"), triangles)) return NULL;
|
||||||
mesh->_triangles.clearAndAddAll(triangles);
|
mesh->_triangles.clearAndAddAll(triangles);
|
||||||
mesh->_regionUVs.clearAndAddAll(uvs);
|
mesh->_regionUVs.clearAndAddAll(uvs);
|
||||||
if (mesh->_region != NULL) mesh->updateRegion();
|
if (mesh->_region != NULL) mesh->updateRegion();
|
||||||
|
|
||||||
if (Json::getInt(map, "hull", 0)) mesh->setHullLength(Json::getInt(map, "hull", 0) << 1);
|
if (Json::getInt(map, "hull", 0)) mesh->setHullLength(Json::getInt(map, "hull", 0) << 1);
|
||||||
Vector<unsigned short> edges;
|
Array<unsigned short> edges;
|
||||||
Json::asArray(Json::getItem(map, "edges"), edges);
|
Json::asArray(Json::getItem(map, "edges"), edges);
|
||||||
if (edges.size() > 0) mesh->_edges.clearAndAddAll(edges);
|
if (edges.size() > 0) mesh->_edges.clearAndAddAll(edges);
|
||||||
return mesh;
|
return mesh;
|
||||||
@ -745,7 +745,7 @@ Sequence *SkeletonJson::readSequence(Json *item) {
|
|||||||
|
|
||||||
void SkeletonJson::readVertices(Json *map, VertexAttachment *attachment, size_t verticesLength) {
|
void SkeletonJson::readVertices(Json *map, VertexAttachment *attachment, size_t verticesLength) {
|
||||||
attachment->setWorldVerticesLength(verticesLength);
|
attachment->setWorldVerticesLength(verticesLength);
|
||||||
Vector<float> vertices;
|
Array<float> vertices;
|
||||||
if (!Json::asArray(Json::getItem(map, "vertices"), vertices)) return;
|
if (!Json::asArray(Json::getItem(map, "vertices"), vertices)) return;
|
||||||
if (verticesLength == vertices.size()) {
|
if (verticesLength == vertices.size()) {
|
||||||
if (_scale != 1) {
|
if (_scale != 1) {
|
||||||
@ -774,7 +774,7 @@ void SkeletonJson::readVertices(Json *map, VertexAttachment *attachment, size_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
||||||
Vector<Timeline *> timelines;
|
Array<Timeline *> timelines;
|
||||||
|
|
||||||
// Slot timelines.
|
// Slot timelines.
|
||||||
for (Json *slotMap = Json::getItem(map, "slots") ? Json::getItem(map, "slots")->_child : NULL; slotMap; slotMap = slotMap->_next) {
|
for (Json *slotMap = Json::getItem(map, "slots") ? Json::getItem(map, "slots")->_child : NULL; slotMap; slotMap = slotMap->_next) {
|
||||||
@ -957,7 +957,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
}
|
}
|
||||||
timelines.add(timeline);
|
timelines.add(timeline);
|
||||||
} else {
|
} else {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -965,9 +965,9 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
|
|
||||||
// Bone timelines.
|
// Bone timelines.
|
||||||
for (Json *boneMap = Json::getItem(map, "bones") ? Json::getItem(map, "bones")->_child : NULL; boneMap; boneMap = boneMap->_next) {
|
for (Json *boneMap = Json::getItem(map, "bones") ? Json::getItem(map, "bones")->_child : NULL; boneMap; boneMap = boneMap->_next) {
|
||||||
int boneIndex = ContainerUtil::findIndexWithName(skeletonData->_bones, boneMap->_name);
|
int boneIndex = ArrayUtils::findIndexWithName(skeletonData->_bones, boneMap->_name);
|
||||||
if (boneIndex == -1) {
|
if (boneIndex == -1) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,7 +1006,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
}
|
}
|
||||||
timelines.add(timeline);
|
timelines.add(timeline);
|
||||||
} else {
|
} else {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1018,7 +1018,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
if (keyMap == NULL) continue;
|
if (keyMap == NULL) continue;
|
||||||
IkConstraintData *constraint = skeletonData->findIkConstraint(timelineMap->_name);
|
IkConstraintData *constraint = skeletonData->findIkConstraint(timelineMap->_name);
|
||||||
if (!constraint) {
|
if (!constraint) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int constraintIndex = skeletonData->_ikConstraints.indexOf(constraint);
|
int constraintIndex = skeletonData->_ikConstraints.indexOf(constraint);
|
||||||
@ -1058,7 +1058,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
if (keyMap == NULL) continue;
|
if (keyMap == NULL) continue;
|
||||||
TransformConstraintData *constraint = skeletonData->findTransformConstraint(timelineMap->_name);
|
TransformConstraintData *constraint = skeletonData->findTransformConstraint(timelineMap->_name);
|
||||||
if (!constraint) {
|
if (!constraint) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int constraintIndex = skeletonData->_transformConstraints.indexOf(constraint);
|
int constraintIndex = skeletonData->_transformConstraints.indexOf(constraint);
|
||||||
@ -1107,7 +1107,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
for (Json *constraintMap = Json::getItem(map, "path") ? Json::getItem(map, "path")->_child : NULL; constraintMap; constraintMap = constraintMap->_next) {
|
for (Json *constraintMap = Json::getItem(map, "path") ? Json::getItem(map, "path")->_child : NULL; constraintMap; constraintMap = constraintMap->_next) {
|
||||||
PathConstraintData *constraint = skeletonData->findPathConstraint(constraintMap->_name);
|
PathConstraintData *constraint = skeletonData->findPathConstraint(constraintMap->_name);
|
||||||
if (!constraint) {
|
if (!constraint) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int index = skeletonData->_pathConstraints.indexOf(constraint);
|
int index = skeletonData->_pathConstraints.indexOf(constraint);
|
||||||
@ -1168,7 +1168,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
if (constraintMap->_name && strlen(constraintMap->_name) > 0) {
|
if (constraintMap->_name && strlen(constraintMap->_name) > 0) {
|
||||||
PhysicsConstraintData *constraint = skeletonData->findConstraint<PhysicsConstraintData>(constraintMap->_name);
|
PhysicsConstraintData *constraint = skeletonData->findConstraint<PhysicsConstraintData>(constraintMap->_name);
|
||||||
if (!constraint) {
|
if (!constraint) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
index = skeletonData->_physicsConstraints.indexOf(constraint);
|
index = skeletonData->_physicsConstraints.indexOf(constraint);
|
||||||
@ -1215,7 +1215,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
for (Json *constraintMap = Json::getItem(map, "slider") ? Json::getItem(map, "slider")->_child : NULL; constraintMap; constraintMap = constraintMap->_next) {
|
for (Json *constraintMap = Json::getItem(map, "slider") ? Json::getItem(map, "slider")->_child : NULL; constraintMap; constraintMap = constraintMap->_next) {
|
||||||
SliderData *constraint = skeletonData->findConstraint<SliderData>(constraintMap->_name);
|
SliderData *constraint = skeletonData->findConstraint<SliderData>(constraintMap->_name);
|
||||||
if (!constraint) {
|
if (!constraint) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
int index = skeletonData->_constraints.indexOf(constraint);
|
int index = skeletonData->_constraints.indexOf(constraint);
|
||||||
@ -1236,7 +1236,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
for (Json *attachmentsMap = Json::getItem(map, "attachments") ? Json::getItem(map, "attachments")->_child : NULL; attachmentsMap; attachmentsMap = attachmentsMap->_next) {
|
for (Json *attachmentsMap = Json::getItem(map, "attachments") ? Json::getItem(map, "attachments")->_child : NULL; attachmentsMap; attachmentsMap = attachmentsMap->_next) {
|
||||||
Skin *skin = skeletonData->findSkin(attachmentsMap->_name);
|
Skin *skin = skeletonData->findSkin(attachmentsMap->_name);
|
||||||
if (!skin) {
|
if (!skin) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (Json *slotMap = attachmentsMap->_child; slotMap; slotMap = slotMap->_next) {
|
for (Json *slotMap = attachmentsMap->_child; slotMap; slotMap = slotMap->_next) {
|
||||||
@ -1245,7 +1245,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
for (Json *attachmentMap = slotMap->_child; attachmentMap; attachmentMap = attachmentMap->_next) {
|
for (Json *attachmentMap = slotMap->_child; attachmentMap; attachmentMap = attachmentMap->_next) {
|
||||||
Attachment *attachment = skin->getAttachment(slotIndex, attachmentMap->_name);
|
Attachment *attachment = skin->getAttachment(slotIndex, attachmentMap->_name);
|
||||||
if (!attachment) {
|
if (!attachment) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (Json *timelineMap = attachmentMap->_child; timelineMap; timelineMap = timelineMap->_next) {
|
for (Json *timelineMap = attachmentMap->_child; timelineMap; timelineMap = timelineMap->_next) {
|
||||||
@ -1255,14 +1255,14 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
if (timelineName == "deform") {
|
if (timelineName == "deform") {
|
||||||
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
|
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
|
||||||
bool weighted = vertexAttachment->_bones.size() != 0;
|
bool weighted = vertexAttachment->_bones.size() != 0;
|
||||||
Vector<float> &vertices = vertexAttachment->_vertices;
|
Array<float> &vertices = vertexAttachment->_vertices;
|
||||||
int deformLength = weighted ? (int) vertices.size() / 3 * 2 : (int) vertices.size();
|
int deformLength = weighted ? (int) vertices.size() / 3 * 2 : (int) vertices.size();
|
||||||
|
|
||||||
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frames,
|
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frames,
|
||||||
frames, slotIndex, vertexAttachment);
|
frames, slotIndex, vertexAttachment);
|
||||||
float time = Json::getFloat(keyMap, "time", 0);
|
float time = Json::getFloat(keyMap, "time", 0);
|
||||||
for (int frame = 0, bezier = 0;; frame++) {
|
for (int frame = 0, bezier = 0;; frame++) {
|
||||||
Vector<float> deform;
|
Array<float> deform;
|
||||||
Json *verticesValue = Json::getItem(keyMap, "vertices");
|
Json *verticesValue = Json::getItem(keyMap, "vertices");
|
||||||
if (!verticesValue) {
|
if (!verticesValue) {
|
||||||
if (weighted) {
|
if (weighted) {
|
||||||
@ -1324,19 +1324,19 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
int slotCount = skeletonData->_slots.size();
|
int slotCount = skeletonData->_slots.size();
|
||||||
int frame = 0;
|
int frame = 0;
|
||||||
for (Json *keyMap = drawOrder->_child; keyMap; keyMap = keyMap->_next, ++frame) {
|
for (Json *keyMap = drawOrder->_child; keyMap; keyMap = keyMap->_next, ++frame) {
|
||||||
Vector<int> drawOrder2;
|
Array<int> drawOrder2;
|
||||||
Json *offsets = Json::getItem(keyMap, "offsets");
|
Json *offsets = Json::getItem(keyMap, "offsets");
|
||||||
if (offsets) {
|
if (offsets) {
|
||||||
drawOrder2.setSize(slotCount, 0);
|
drawOrder2.setSize(slotCount, 0);
|
||||||
for (int i = slotCount - 1; i >= 0; i--)
|
for (int i = slotCount - 1; i >= 0; i--)
|
||||||
drawOrder2[i] = -1;
|
drawOrder2[i] = -1;
|
||||||
Vector<int> unchanged;
|
Array<int> unchanged;
|
||||||
unchanged.setSize(slotCount - offsets->_size, 0);
|
unchanged.setSize(slotCount - offsets->_size, 0);
|
||||||
int originalIndex = 0, unchangedIndex = 0;
|
int originalIndex = 0, unchangedIndex = 0;
|
||||||
for (Json *offsetMap = offsets->_child; offsetMap; offsetMap = offsetMap->_next) {
|
for (Json *offsetMap = offsets->_child; offsetMap; offsetMap = offsetMap->_next) {
|
||||||
SlotData *slot = skeletonData->findSlot(Json::getString(offsetMap, "slot", 0));
|
SlotData *slot = skeletonData->findSlot(Json::getString(offsetMap, "slot", 0));
|
||||||
if (!slot) {
|
if (!slot) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* Collect unchanged items. */
|
/* Collect unchanged items. */
|
||||||
@ -1366,7 +1366,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
for (Json *keyMap = events->_child; keyMap; keyMap = keyMap->_next, ++frame) {
|
for (Json *keyMap = events->_child; keyMap; keyMap = keyMap->_next, ++frame) {
|
||||||
EventData *eventData = skeletonData->findEvent(Json::getString(keyMap, "name", 0));
|
EventData *eventData = skeletonData->findEvent(Json::getString(keyMap, "name", 0));
|
||||||
if (!eventData) {
|
if (!eventData) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Event *event = new (__FILE__, __LINE__) Event(Json::getFloat(keyMap, "time", 0), *eventData);
|
Event *event = new (__FILE__, __LINE__) Event(Json::getFloat(keyMap, "time", 0), *eventData);
|
||||||
@ -1388,7 +1388,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
|
|||||||
return new (__FILE__, __LINE__) Animation(String(map->_name), timelines, duration);
|
return new (__FILE__, __LINE__) Animation(String(map->_name), timelines, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonJson::readTimeline(Vector<Timeline *> &timelines, Json *keyMap, CurveTimeline1 *timeline, float defaultValue, float scale) {
|
void SkeletonJson::readTimeline(Array<Timeline *> &timelines, Json *keyMap, CurveTimeline1 *timeline, float defaultValue, float scale) {
|
||||||
float time = Json::getFloat(keyMap, "time", 0), value = Json::getFloat(keyMap, "value", defaultValue) * scale;
|
float time = Json::getFloat(keyMap, "time", 0), value = Json::getFloat(keyMap, "value", defaultValue) * scale;
|
||||||
for (int frame = 0, bezier = 0;; frame++) {
|
for (int frame = 0, bezier = 0;; frame++) {
|
||||||
timeline->setFrame(frame, time, value);
|
timeline->setFrame(frame, time, value);
|
||||||
@ -1407,7 +1407,7 @@ void SkeletonJson::readTimeline(Vector<Timeline *> &timelines, Json *keyMap, Cur
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonJson::readTimeline(Vector<Timeline *> &timelines, Json *keyMap, CurveTimeline2 *timeline, const char *name1, const char *name2,
|
void SkeletonJson::readTimeline(Array<Timeline *> &timelines, Json *keyMap, CurveTimeline2 *timeline, const char *name1, const char *name2,
|
||||||
float defaultValue, float scale) {
|
float defaultValue, float scale) {
|
||||||
float time = Json::getFloat(keyMap, "time", 0);
|
float time = Json::getFloat(keyMap, "time", 0);
|
||||||
float value1 = Json::getFloat(keyMap, name1, defaultValue) * scale, value2 = Json::getFloat(keyMap, name2, defaultValue) * scale;
|
float value1 = Json::getFloat(keyMap, name1, defaultValue) * scale, value2 = Json::getFloat(keyMap, name2, defaultValue) * scale;
|
||||||
@ -1457,10 +1457,10 @@ void SkeletonJson::setBezier(CurveTimeline *timeline, int frame, int value, int
|
|||||||
timeline->setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2);
|
timeline->setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkeletonJson::findSlotIndex(SkeletonData *skeletonData, const String &slotName, Vector<Timeline *> timelines) {
|
int SkeletonJson::findSlotIndex(SkeletonData *skeletonData, const String &slotName, Array<Timeline *> timelines) {
|
||||||
int slotIndex = ContainerUtil::findIndexWithName(skeletonData->getSlots(), slotName);
|
int slotIndex = ArrayUtils::findIndexWithName(skeletonData->getSlots(), slotName);
|
||||||
if (slotIndex == -1) {
|
if (slotIndex == -1) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ArrayUtils::deleteElements(timelines);
|
||||||
setError(NULL, "Slot not found: ", slotName);
|
setError(NULL, "Slot not found: ", slotName);
|
||||||
}
|
}
|
||||||
return slotIndex;
|
return slotIndex;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ static RenderCommand *createRenderCommand(BlockAllocator &allocator, int numVert
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RenderCommand *batchSubCommands(BlockAllocator &allocator, Vector<RenderCommand *> &commands, int first, int last, int numVertices, int numIndices) {
|
static RenderCommand *batchSubCommands(BlockAllocator &allocator, Array<RenderCommand *> &commands, int first, int last, int numVertices, int numIndices) {
|
||||||
RenderCommand *batched = createRenderCommand(allocator, numVertices, numIndices, commands[first]->blendMode, commands[first]->texture);
|
RenderCommand *batched = createRenderCommand(allocator, numVertices, numIndices, commands[first]->blendMode, commands[first]->texture);
|
||||||
float *positions = batched->positions;
|
float *positions = batched->positions;
|
||||||
float *uvs = batched->uvs;
|
float *uvs = batched->uvs;
|
||||||
@ -91,7 +91,7 @@ static RenderCommand *batchSubCommands(BlockAllocator &allocator, Vector<RenderC
|
|||||||
return batched;
|
return batched;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RenderCommand *batchCommands(BlockAllocator &allocator, Vector<RenderCommand *> &commands) {
|
static RenderCommand *batchCommands(BlockAllocator &allocator, Array<RenderCommand *> &commands) {
|
||||||
if (commands.size() == 0) return nullptr;
|
if (commands.size() == 0) return nullptr;
|
||||||
|
|
||||||
RenderCommand *root = nullptr;
|
RenderCommand *root = nullptr;
|
||||||
@ -156,12 +156,12 @@ RenderCommand *SkeletonRenderer::render(Skeleton &skeleton) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<float> *worldVertices = &_worldVertices;
|
Array<float> *worldVertices = &_worldVertices;
|
||||||
Vector<unsigned short> *quadIndices = &_quadIndices;
|
Array<unsigned short> *quadIndices = &_quadIndices;
|
||||||
Vector<float> *vertices = worldVertices;
|
Array<float> *vertices = worldVertices;
|
||||||
int32_t verticesCount;
|
int32_t verticesCount;
|
||||||
Vector<float> *uvs;
|
Array<float> *uvs;
|
||||||
Vector<unsigned short> *indices;
|
Array<unsigned short> *indices;
|
||||||
int32_t indicesCount;
|
int32_t indicesCount;
|
||||||
Color *attachmentColor;
|
Color *attachmentColor;
|
||||||
void *texture;
|
void *texture;
|
||||||
|
|||||||
@ -51,8 +51,8 @@ static void disposeAttachment(Attachment *attachment) {
|
|||||||
|
|
||||||
void Skin::AttachmentMap::put(size_t slotIndex, const String &attachmentName, Attachment *attachment) {
|
void Skin::AttachmentMap::put(size_t slotIndex, const String &attachmentName, Attachment *attachment) {
|
||||||
if (slotIndex >= _buckets.size())
|
if (slotIndex >= _buckets.size())
|
||||||
_buckets.setSize(slotIndex + 1, Vector<Entry>());
|
_buckets.setSize(slotIndex + 1, Array<Entry>());
|
||||||
Vector<Entry> &bucket = _buckets[slotIndex];
|
Array<Entry> &bucket = _buckets[slotIndex];
|
||||||
int existing = findInBucket(bucket, attachmentName);
|
int existing = findInBucket(bucket, attachmentName);
|
||||||
attachment->reference();
|
attachment->reference();
|
||||||
if (existing >= 0) {
|
if (existing >= 0) {
|
||||||
@ -78,7 +78,7 @@ void Skin::AttachmentMap::remove(size_t slotIndex, const String &attachmentName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Skin::AttachmentMap::findInBucket(Vector<Entry> &bucket, const String &attachmentName) {
|
int Skin::AttachmentMap::findInBucket(Array<Entry> &bucket, const String &attachmentName) {
|
||||||
for (size_t i = 0; i < bucket.size(); i++)
|
for (size_t i = 0; i < bucket.size(); i++)
|
||||||
if (bucket[i]._name == attachmentName) return (int) i;
|
if (bucket[i]._name == attachmentName) return (int) i;
|
||||||
return -1;
|
return -1;
|
||||||
@ -113,7 +113,7 @@ void Skin::removeAttachment(size_t slotIndex, const String &name) {
|
|||||||
_attachments.remove(slotIndex, name);
|
_attachments.remove(slotIndex, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skin::findNamesForSlot(size_t slotIndex, Vector<String> &names) {
|
void Skin::findNamesForSlot(size_t slotIndex, Array<String> &names) {
|
||||||
Skin::AttachmentMap::Entries entries = _attachments.getEntries();
|
Skin::AttachmentMap::Entries entries = _attachments.getEntries();
|
||||||
while (entries.hasNext()) {
|
while (entries.hasNext()) {
|
||||||
Skin::AttachmentMap::Entry &entry = entries.next();
|
Skin::AttachmentMap::Entry &entry = entries.next();
|
||||||
@ -123,7 +123,7 @@ void Skin::findNamesForSlot(size_t slotIndex, Vector<String> &names) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skin::findAttachmentsForSlot(size_t slotIndex, Vector<Attachment *> &attachments) {
|
void Skin::findAttachmentsForSlot(size_t slotIndex, Array<Attachment *> &attachments) {
|
||||||
Skin::AttachmentMap::Entries entries = _attachments.getEntries();
|
Skin::AttachmentMap::Entries entries = _attachments.getEntries();
|
||||||
while (entries.hasNext()) {
|
while (entries.hasNext()) {
|
||||||
Skin::AttachmentMap::Entry &entry = entries.next();
|
Skin::AttachmentMap::Entry &entry = entries.next();
|
||||||
@ -140,7 +140,7 @@ Skin::AttachmentMap::Entries Skin::getAttachments() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) {
|
void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) {
|
||||||
Vector<Slot *> &slots = skeleton.getSlots();
|
Array<Slot *> &slots = skeleton.getSlots();
|
||||||
Skin::AttachmentMap::Entries entries = oldSkin.getAttachments();
|
Skin::AttachmentMap::Entries entries = oldSkin.getAttachments();
|
||||||
while (entries.hasNext()) {
|
while (entries.hasNext()) {
|
||||||
Skin::AttachmentMap::Entry &entry = entries.next();
|
Skin::AttachmentMap::Entry &entry = entries.next();
|
||||||
@ -186,10 +186,10 @@ void Skin::copySkin(Skin *other) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<ConstraintData *> &Skin::getConstraints() {
|
Array<ConstraintData *> &Skin::getConstraints() {
|
||||||
return _constraints;
|
return _constraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<BoneData *> &Skin::getBones() {
|
Array<BoneData *> &Skin::getBones() {
|
||||||
return _bones;
|
return _bones;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,8 +78,8 @@ void Slider::update(Skeleton &skeleton, Physics physics) {
|
|||||||
p._time = MathUtil::max(0.0f, p._time);
|
p._time = MathUtil::max(0.0f, p._time);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Bone *> &bones = skeleton._bones;
|
Array<Bone *> &bones = skeleton._bones;
|
||||||
const Vector<int> &indices = animation->getBones();
|
const Array<int> &indices = animation->getBones();
|
||||||
for (size_t i = 0, n = indices.size(); i < n; i++)
|
for (size_t i = 0, n = indices.size(); i < n; i++)
|
||||||
bones[indices[i]]->_applied->modifyLocal(skeleton);
|
bones[indices[i]]->_applied->modifyLocal(skeleton);
|
||||||
|
|
||||||
@ -91,8 +91,8 @@ void Slider::sort(Skeleton &skeleton) {
|
|||||||
if (_bone != NULL && !_data._local) skeleton.sortBone(_bone);
|
if (_bone != NULL && !_data._local) skeleton.sortBone(_bone);
|
||||||
skeleton._updateCache.add(this);
|
skeleton._updateCache.add(this);
|
||||||
|
|
||||||
Vector<Bone *> &bones = skeleton._bones;
|
Array<Bone *> &bones = skeleton._bones;
|
||||||
const Vector<int> &indices = _data._animation->getBones();
|
const Array<int> &indices = _data._animation->getBones();
|
||||||
for (size_t i = 0, n = indices.size(); i < n; i++) {
|
for (size_t i = 0, n = indices.size(); i < n; i++) {
|
||||||
Bone *bone = bones[indices[i]];
|
Bone *bone = bones[indices[i]];
|
||||||
bone->_sorted = false;
|
bone->_sorted = false;
|
||||||
@ -100,10 +100,10 @@ void Slider::sort(Skeleton &skeleton) {
|
|||||||
skeleton.constrained(*bone);
|
skeleton.constrained(*bone);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<Timeline *> &timelines = _data._animation->getTimelines();
|
Array<Timeline *> &timelines = _data._animation->getTimelines();
|
||||||
Vector<Slot *> &slots = skeleton._slots;
|
Array<Slot *> &slots = skeleton._slots;
|
||||||
Vector<Constraint *> &constraints = skeleton._constraints;
|
Array<Constraint *> &constraints = skeleton._constraints;
|
||||||
Vector<PhysicsConstraint *> &physics = skeleton._physics;
|
Array<PhysicsConstraint *> &physics = skeleton._physics;
|
||||||
size_t physicsCount = physics.size();
|
size_t physicsCount = physics.size();
|
||||||
for (size_t i = 0, n = timelines.size(); i < n; i++) {
|
for (size_t i = 0, n = timelines.size(); i < n; i++) {
|
||||||
Timeline *t = timelines[i];
|
Timeline *t = timelines[i];
|
||||||
|
|||||||
@ -54,7 +54,7 @@ SliderMixTimeline::SliderMixTimeline(size_t frameCount, size_t bezierCount,
|
|||||||
SliderMixTimeline::~SliderMixTimeline() {
|
SliderMixTimeline::~SliderMixTimeline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderMixTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents,
|
void SliderMixTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents,
|
||||||
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ SliderTimeline::SliderTimeline(size_t frameCount, size_t bezierCount,
|
|||||||
SliderTimeline::~SliderTimeline() {
|
SliderTimeline::~SliderTimeline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector<Event *> *pEvents,
|
void SliderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array<Event *> *pEvents,
|
||||||
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
float alpha, MixBlend blend, MixDirection direction, bool appliedPose) {
|
||||||
SP_UNUSED(lastTime);
|
SP_UNUSED(lastTime);
|
||||||
SP_UNUSED(pEvents);
|
SP_UNUSED(pEvents);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user