[cpp] Rename Vector -> Array, ContainerUtil > ArrayUtils

This commit is contained in:
Mario Zechner 2025-07-08 20:38:45 +02:00
parent c75fd64189
commit 9d384c50ed
108 changed files with 667 additions and 644 deletions

2
.gitignore vendored
View File

@ -240,3 +240,5 @@ docs/
out.json
spine-cpp/extraction.log
extraction.log
spine-c-new/codegen/dist
spine-c-new/codegen/all-spine-types.json

View File

@ -30,7 +30,7 @@
#ifndef Spine_Animation_h
#define Spine_Animation_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/HashMap.h>
#include <spine/MixBlend.h>
#include <spine/MixDirection.h>
@ -101,17 +101,17 @@ namespace spine {
friend class Slider;
public:
Animation(const String &name, Vector<Timeline *> &timelines, float duration);
Animation(const String &name, Array<Timeline *> &timelines, float duration);
~Animation();
/// 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.
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
/// 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 direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions,
/// 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);
/// The animation's name, which is unique across all animations in the skeleton.
const String &getName();
/// 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.
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:
Vector<Timeline *> _timelines;
Array<Timeline *> _timelines;
HashMap<PropertyId, bool> _timelineIds;
Vector<int> _bones;
Array<int> _bones;
float _duration;
String _name;
};

View File

@ -30,7 +30,7 @@
#ifndef Spine_AnimationState_h
#define Spine_AnimationState_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Pool.h>
#include <spine/Property.h>
#include <spine/MixBlend.h>
@ -339,9 +339,9 @@ namespace spine {
float _delay, _trackTime, _trackLast, _nextTrackLast, _trackEnd, _timeScale;
float _alpha, _mixTime, _mixDuration, _interruptAlpha, _totalAlpha;
MixBlend _mixBlend;
Vector<int> _timelineMode;
Vector<TrackEntry *> _timelineHoldMix;
Vector<float> _timelinesRotation;
Array<int> _timelineMode;
Array<TrackEntry *> _timelineHoldMix;
Array<float> _timelinesRotation;
AnimationStateListener _listener;
AnimationStateListenerObject *_listenerObject;
@ -363,7 +363,7 @@ namespace spine {
friend class AnimationState;
private:
Vector<EventQueueEntry> _eventQueueEntries;
Array<EventQueueEntry> _eventQueueEntries;
AnimationState &_state;
bool _drainDisabled;
@ -410,24 +410,24 @@ namespace spine {
bool apply(Skeleton &skeleton);
/// Removes all animations from all tracks, leaving skeletons in their current pose.
///
///
/// It may be desired to use AnimationState::setEmptyAnimations(float) to mix the skeletons back to the setup pose,
/// rather than leaving them in their current pose.
void clearTracks();
/// Removes all animations from the track, leaving skeletons in their current pose.
///
///
/// It may be desired to use AnimationState::setEmptyAnimation(int, float) to mix the skeletons back to the setup pose,
/// rather than leaving them in their current pose.
void clearTrack(size_t trackIndex);
/// Sets an animation by name.
///
///
/// See setAnimation(int, Animation, bool).
TrackEntry *setAnimation(size_t trackIndex, const String &animationName, bool loop);
/// Sets the current animation for a track, discarding any queued animations.
///
///
/// If the formerly current track entry is for the same animation and was never applied to a skeleton, it is replaced (not mixed
/// from).
/// @param loop If true, the animation will repeat.
@ -439,7 +439,7 @@ namespace spine {
TrackEntry *setAnimation(size_t trackIndex, Animation *animation, bool loop);
/// Queues an animation by name.
///
///
/// See addAnimation(int, Animation, bool, float).
TrackEntry *addAnimation(size_t trackIndex, const String &animationName, bool loop, float delay);
@ -455,19 +455,19 @@ namespace spine {
/// Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
/// TrackEntry::getMixDuration(). An empty animation has no timelines and serves as a placeholder for mixing in or out.
///
///
/// Mixing out is done by setting an empty animation with a mix duration using either setEmptyAnimation(int, float),
/// setEmptyAnimations(float), or addEmptyAnimation(int, float, float). Mixing to an empty animation causes
/// the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
/// transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
/// 0 still mixes out over one frame.
///
///
/// Mixing in is done by first setting an empty animation, then adding an animation using
/// addAnimation(int, Animation, bool, float) with the desired delay (an empty animation has a duration of 0) and on
/// the returned track entry, set the TrackEntry::setMixDuration(float). Mixing from an empty animation causes the new
/// animation to be applied more and more over the mix duration. Properties keyed in the new animation transition from the value
/// from lower tracks or from the setup pose value if no lower tracks key the property to the value keyed in the new animation.
///
///
/// See <a href='https://esotericsoftware.com/spine-applying-animations/#Empty-animations'>Empty animations</a> in the Spine
/// Runtimes Guide.
TrackEntry *setEmptyAnimation(size_t trackIndex, float mixDuration);
@ -475,7 +475,7 @@ namespace spine {
/// Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
/// TrackEntry::getMixDuration(). If the track has no entries, it is equivalent to calling
/// setEmptyAnimation(int, float).
///
///
/// See setEmptyAnimation(int, float) and
/// <a href='https://esotericsoftware.com/spine-applying-animations/#Empty-animations'>Empty animations</a> in the Spine
/// Runtimes Guide.
@ -488,7 +488,7 @@ namespace spine {
TrackEntry *addEmptyAnimation(size_t trackIndex, float mixDuration, float delay);
/// Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration.
///
///
/// See <a href='https://esotericsoftware.com/spine-applying-animations/#Empty-animations'>Empty animations</a> in the Spine
/// Runtimes Guide.
void setEmptyAnimations(float mixDuration);
@ -500,11 +500,11 @@ namespace spine {
AnimationStateData *getData();
/// 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
/// or faster. Defaults to 1.
///
///
/// See TrackEntry TrackEntry::getTimeScale() for affecting a single animation.
float getTimeScale();
@ -539,8 +539,8 @@ namespace spine {
AnimationStateData *_data;
Pool<TrackEntry> _trackEntryPool;
Vector<TrackEntry *> _tracks;
Vector<Event *> _events;
Array<TrackEntry *> _tracks;
Array<Event *> _events;
EventQueue *_queue;
HashMap<PropertyId, bool> _propertyIDs;
@ -561,7 +561,7 @@ namespace spine {
/// the first time the mixing was applied.
static void
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.
/// @param attachments False when: 1) the attachment timeline is mixing out, 2) mix < attachmentThreshold, and 3) the timeline

View File

@ -27,8 +27,8 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#ifndef Spine_Vector_h
#define Spine_Vector_h
#ifndef Spine_Array_h
#define Spine_Array_h
#include <spine/Extension.h>
#include <spine/SpineObject.h>
@ -37,24 +37,24 @@
namespace spine {
template<typename T>
class SP_API Vector : public SpineObject {
class SP_API Array : public SpineObject {
public:
using size_type = size_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) {
_buffer = allocate(_capacity);
for (size_t i = 0; i < _size; ++i) {
construct(_buffer + i, inVector._buffer[i]);
construct(_buffer + i, inArray._buffer[i]);
}
}
}
~Vector() {
~Array() {
clear();
deallocate(_buffer);
}
@ -75,7 +75,7 @@ namespace spine {
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);
size_t oldSize = _size;
_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());
for (size_t i = 0; i < inValue.size(); i++) {
add(inValue[i]);
}
}
inline void clearAndAddAll(const Vector<T> &inValue) {
inline void clearAndAddAll(const Array<T> &inValue) {
ensureCapacity(inValue.size());
for (size_t i = 0; i < inValue.size(); i++)
_buffer[i] = inValue[i];
@ -184,7 +184,7 @@ namespace spine {
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()) {
return false;
}
@ -198,13 +198,13 @@ namespace spine {
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);
}
Vector &operator=(const Vector &inVector) {
if (this != &inVector) {
clearAndAddAll(inVector);
Array &operator=(const Array &inArray) {
if (this != &inArray) {
clearAndAddAll(inArray);
}
return *this;
}
@ -245,4 +245,4 @@ namespace spine {
};
}
#endif /* Spine_Vector_h */
#endif /* Spine_Array_h */

View File

@ -31,7 +31,7 @@
#define Spine_ContainerUtil_h
#include <spine/Extension.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/HashMap.h>
#include <spine/SpineObject.h>
#include <spine/SpineString.h>
@ -39,13 +39,13 @@
#include <assert.h>
namespace spine {
class SP_API ContainerUtil : public SpineObject {
class SP_API ArrayUtils : public SpineObject {
public:
/// 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.
/// @return May be NULL.
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);
for (size_t i = 0; i < items.size(); ++i) {
@ -60,7 +60,7 @@ namespace spine {
/// @return -1 if the item was not found.
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);
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.
/// @return May be NULL.
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);
for (size_t i = 0; i < items.size(); ++i) {
@ -92,7 +92,7 @@ namespace spine {
/// @return -1 if the item was not found.
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);
for (size_t i = 0, len = items.size(); i < len; ++i) {
@ -106,7 +106,7 @@ namespace spine {
}
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--) {
T *item = items[i];
@ -118,11 +118,11 @@ namespace spine {
private:
// 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 &);
};
}

View File

@ -30,7 +30,7 @@
#ifndef Spine_Atlas_h
#define Spine_Atlas_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Extension.h>
#include <spine/SpineObject.h>
#include <spine/SpineString.h>
@ -112,10 +112,10 @@ namespace spine {
String name;
int index;
int x, y;
Vector<int> splits;
Vector<int> pads;
Vector <String> names;
Vector<float> values;
Array<int> splits;
Array<int> pads;
Array <String> names;
Array<float> values;
};
class TextureLoader;
@ -135,13 +135,13 @@ namespace spine {
/// @return The region, or NULL.
AtlasRegion *findRegion(const String &name);
Vector<AtlasPage *> &getPages();
Array<AtlasPage *> &getPages();
Vector<AtlasRegion *> &getRegions();
Array<AtlasRegion *> &getRegions();
private:
Vector<AtlasPage *> _pages;
Vector<AtlasRegion *> _regions;
Array<AtlasPage *> _pages;
Array<AtlasRegion *> _regions;
TextureLoader *_textureLoader;
void load(const char *begin, int length, const char *dir, bool createTexture);

View File

@ -31,7 +31,7 @@
#define Spine_AtlasAttachmentLoader_h
#include <spine/AttachmentLoader.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineString.h>

View File

@ -32,7 +32,7 @@
#include <spine/Timeline.h>
#include <spine/SpineObject.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/MixBlend.h>
#include <spine/MixDirection.h>
#include <spine/SpineString.h>
@ -61,7 +61,7 @@ namespace spine {
virtual ~AttachmentTimeline();
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;
/// 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);
/// The attachment name for each frame. May contain null values to clear the attachment.
Vector<String> &getAttachmentNames();
Array<String> &getAttachmentNames();
protected:
Vector<String> _attachmentNames;
Array<String> _attachmentNames;
void setAttachment(Skeleton &skeleton, SlotPose &pose, String *attachmentName);
};

View File

@ -34,7 +34,7 @@
#include <spine/SpineObject.h>
#include <spine/Extension.h>
#include <spine/MathUtil.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
struct Block {
@ -59,7 +59,7 @@ namespace spine {
class BlockAllocator : public SpineObject {
int initialBlockSize;
Vector <Block> blocks;
Array <Block> blocks;
public:
BlockAllocator(int initialBlockSize) : initialBlockSize(initialBlockSize) {

View File

@ -35,7 +35,7 @@
#include <spine/BoneData.h>
#include <spine/BoneLocal.h>
#include <spine/BonePose.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
/// The current pose for a bone, before constraints are applied.
@ -85,7 +85,7 @@ namespace spine {
Bone* getParent();
/// The immediate children of this bone.
Vector<Bone*>& getChildren();
Array<Bone*>& getChildren();
static bool isYDown() { return yDown; }
static void setYDown(bool value) { yDown = value; }
@ -93,7 +93,7 @@ namespace spine {
private:
static bool yDown;
Bone* const _parent;
Vector<Bone*> _children;
Array<Bone*> _children;
bool _sorted;
};
}

View File

@ -42,24 +42,39 @@ namespace spine {
/// Skeleton::updateWorldTransform(Physics).
class SP_API BonePose : public BoneLocal, public Update {
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:
Bone* _bone;
float _a, _b, _worldX;
float _c, _d, _worldY;
int _world, _local;
BonePose();
virtual ~BonePose();
/// 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.
///
/// See <a href="https://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
/// Runtimes Guide.
void updateWorldTransform(Skeleton& skeleton);
void updateWorldTransform(Skeleton &skeleton);
/// 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
/// 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.
void validateLocalTransform(Skeleton& skeleton);
void validateLocalTransform(Skeleton &skeleton);
void modifyLocal(Skeleton& skeleton);
void modifyLocal(Skeleton &skeleton);
void modifyWorld(int update);
void resetWorld(int update);
@ -115,16 +130,16 @@ namespace spine {
float getWorldScaleY();
/// 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.
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.
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.
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.
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
/// child bones, recursively.
void rotateWorld(float degrees);
protected:
Bone *_bone;
float _a, _b, _worldX;
float _c, _d, _worldY;
int _world, _local;
};
}
}// namespace spine
#endif /* SPINE_BONEPOSE_H_ */

View File

@ -67,7 +67,7 @@ namespace spine {
BoneTimeline1(size_t frameCount, size_t bezierCount, int boneIndex, Property property);
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;
protected:
@ -88,7 +88,7 @@ namespace spine {
BoneTimeline2(size_t frameCount, size_t bezierCount, int boneIndex, Property property1, Property property2);
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;
protected:

View File

@ -102,7 +102,7 @@ namespace spine {
virtual ~AlphaTimeline();
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;
};

View File

@ -31,7 +31,7 @@
#define Spine_CurveTimeline_h
#include <spine/Timeline.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
/// 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);
Vector<float> &getCurves();
Array<float> &getCurves();
protected:
static const int LINEAR = 0;
@ -61,7 +61,7 @@ namespace spine {
static const int BEZIER = 2;
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.

View File

@ -31,7 +31,7 @@
#define SPINE_LOG_H
#include <spine/Extension.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/HashMap.h>
namespace spine {

View File

@ -47,10 +47,10 @@ namespace spine {
explicit DeformTimeline(size_t frameCount, size_t bezierCount, int slotIndex, VertexAttachment *attachment);
/// 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.
Vector <Vector<float>> &getVertices();
Array <Array<float>> &getVertices();
/// The attachment that will be deformed.
VertexAttachment *getAttachment();
@ -69,7 +69,7 @@ namespace spine {
void apply(Slot &slot, SlotPose &pose, float time, float alpha, MixBlend blend) override;
private:
Vector <Vector<float>> _vertices;
Array <Array<float>> _vertices;
VertexAttachment *_attachment;
};

View File

@ -45,22 +45,22 @@ namespace spine {
explicit DrawOrderTimeline(size_t frameCount);
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;
size_t getFrameCount();
/// 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.
/// @param frame Between 0 and frameCount, inclusive.
/// @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.
void setFrame(size_t frame, float time, Vector<int> *drawOrder);
void setFrame(size_t frame, float time, Array<int> *drawOrder);
private:
Vector <Vector<int>> _drawOrders;
Array <Array<int>> _drawOrders;
};
}

View File

@ -48,20 +48,20 @@ namespace spine {
/// Fires events for frames > lastTime and <= time.
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;
size_t getFrameCount();
/// The event for each frame.
Vector<Event *> &getEvents();
Array<Event *> &getEvents();
/// Sets the time and event for the specified frame.
/// @param frame Between 0 and frameCount, inclusive.
void setFrame(size_t frame, Event *event);
private:
Vector<Event *> _events;
Array<Event *> _events;
};
}

View File

@ -30,7 +30,7 @@
#ifndef Spine_HashMap_h
#define Spine_HashMap_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineObject.h>
// 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;
for (size_t i = 0; i < keys.size(); i++) {
put(keys[i], value);

View File

@ -34,7 +34,7 @@
#include <spine/ConstraintData.h>
#include <spine/IkConstraintData.h>
#include <spine/IkConstraintPose.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
class Skeleton;
@ -61,7 +61,7 @@ namespace spine {
IkConstraintData &getData() override;
Vector<BonePose *> &getBones();
Array<BonePose *> &getBones();
Bone *getTarget();
@ -80,7 +80,7 @@ namespace spine {
float softness, float mix);
private:
Vector<BonePose *> _bones;
Array<BonePose *> _bones;
Bone *_target;
};
}

View File

@ -30,7 +30,7 @@
#ifndef Spine_IkConstraintData_h
#define Spine_IkConstraintData_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineObject.h>
#include <spine/SpineString.h>
#include <spine/ConstraintData.h>
@ -60,7 +60,7 @@ namespace spine {
virtual Constraint* create(Skeleton& skeleton) override;
/// The bones that are constrained by this IK Constraint.
Vector<BoneData *> &getBones();
Array<BoneData *> &getBones();
/// The bone that is the IK target.
BoneData *getTarget();
@ -73,7 +73,7 @@ namespace spine {
void setUniform(bool uniform);
private:
Vector<BoneData *> _bones;
Array<BoneData *> _bones;
BoneData *_target;
bool _uniform;
};

View File

@ -50,7 +50,7 @@ namespace spine {
virtual ~IkConstraintTimeline();
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;
/// Sets the time, mix, softness, bend direction, compress, and stretch for the specified frame.

View File

@ -57,7 +57,7 @@ namespace spine {
void setFrame(int frame, float time, Inherit inherit);
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;
private:

View File

@ -31,7 +31,7 @@
#define Spine_Json_h
#include <spine/SpineObject.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#ifndef SPINE_JSON_HAVE_PREV
/* spine doesn't use the "prev" link in the Json sibling lists. */
@ -53,7 +53,7 @@ namespace spine {
static const int JSON_OBJECT;
template <typename T>
static bool asArray(Json *value, Vector<T> &array) {
static bool asArray(Json *value, Array<T> &array) {
if (value == NULL) return false;
array.setSize(value->_size, 0);
Json *vertex = value->_child;

View File

@ -39,19 +39,19 @@ namespace spine {
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_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_printFloats(float *values, int numFloats);
SP_API void spDebug_printFloats(Vector<float> &values);
SP_API void spDebug_printFloats(Array<float> &values);
}
#endif

View File

@ -33,7 +33,7 @@
#include <spine/VertexAttachment.h>
#include <spine/TextureRegion.h>
#include <spine/Sequence.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Color.h>
#include <spine/HasRendererObject.h>
@ -64,16 +64,16 @@ namespace spine {
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
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();
@ -94,9 +94,9 @@ namespace spine {
void setParentMesh(MeshAttachment *inValue);
// Nonessential.
Vector<unsigned short> &getEdges();
Array<unsigned short> &getEdges();
void setEdges(Vector<unsigned short> &inValue);
void setEdges(Array<unsigned short> &inValue);
float getWidth();
@ -112,10 +112,10 @@ namespace spine {
private:
MeshAttachment *_parentMesh;
Vector<float> _uvs;
Vector<float> _regionUVs;
Vector<unsigned short> _triangles;
Vector<unsigned short> _edges;
Array<float> _uvs;
Array<float> _regionUVs;
Array<unsigned short> _triangles;
Array<unsigned short> _edges;
String _path;
Color _color;
int _hullLength;

View File

@ -45,9 +45,9 @@ namespace spine {
explicit PathAttachment(const String &name);
/// 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();
@ -62,7 +62,7 @@ namespace spine {
virtual Attachment *copy() override;
private:
Vector<float> _lengths;
Array<float> _lengths;
bool _closed;
bool _constantSpeed;
Color _color;

View File

@ -34,7 +34,7 @@
#include <spine/ConstraintData.h>
#include <spine/PathConstraintData.h>
#include <spine/PathConstraintPose.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
class Skeleton;
@ -74,7 +74,7 @@ namespace spine {
virtual bool isSourceActive() override;
/// 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.
Slot *getSlot();
@ -86,24 +86,24 @@ namespace spine {
private:
Vector<BonePose *> _bones;
Array<BonePose *> _bones;
Slot *_slot;
Vector<float> _spaces;
Vector<float> _positions;
Vector<float> _world;
Vector<float> _curves;
Vector<float> _lengths;
Vector<float> _segments;
Array<float> _spaces;
Array<float> _positions;
Array<float> _world;
Array<float> _curves;
Array<float> _lengths;
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,
Vector<float> &output, int o, bool tangents);
Array<float> &output, int o, bool tangents);
void sortPathSlot(Skeleton& skeleton, Skin& skin, int slotIndex, Bone& slotBone);

View File

@ -32,7 +32,7 @@
#include <spine/ConstraintData.h>
#include <spine/PosedData.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/PathConstraintPose.h>
#include <spine/dll.h>
#include <spine/PositionMode.h>
@ -72,7 +72,7 @@ namespace spine {
/// 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.
SlotData *getSlot();
@ -100,7 +100,7 @@ namespace spine {
void setOffsetRotation(float offsetRotation);
private:
Vector<BoneData *> _bones;
Array<BoneData *> _bones;
SlotData *_slot;
PositionMode _positionMode;
SpacingMode _spacingMode;

View File

@ -50,7 +50,7 @@ namespace spine {
virtual ~PathConstraintMixTimeline();
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;
/// Sets the time and color for the specified frame.

View File

@ -50,7 +50,7 @@ namespace spine {
virtual ~PathConstraintPositionTimeline();
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;
};
}

View File

@ -47,7 +47,7 @@ namespace spine {
virtual ~PathConstraintSpacingTimeline();
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;
};
}

View File

@ -34,7 +34,7 @@
#include <spine/PhysicsConstraintData.h>
#include <spine/PhysicsConstraintPose.h>
#include <spine/BonePose.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
class Skeleton;

View File

@ -51,7 +51,7 @@ namespace spine {
explicit PhysicsConstraintTimeline(size_t frameCount, size_t bezierCount, int constraintIndex, Property property);
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;
protected:
@ -254,7 +254,7 @@ namespace spine {
}
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;
int getFrameCount() { return (int)_frames.size(); }

View File

@ -31,8 +31,8 @@
#define Spine_Pool_h
#include <spine/Extension.h>
#include <spine/Vector.h>
#include <spine/ContainerUtil.h>
#include <spine/Array.h>
#include <spine/ArrayUtils.h>
#include <spine/SpineObject.h>
namespace spine {
@ -43,7 +43,7 @@ namespace spine {
}
~Pool() {
ContainerUtil::cleanUpVectorOfPointers(_objects);
ArrayUtils::deleteElements(_objects);
}
T *obtain() {
@ -67,7 +67,7 @@ namespace spine {
}
private:
Vector<T *> _objects;
Array<T *> _objects;
};
}

View File

@ -31,7 +31,7 @@
#define Spine_RegionAttachment_h
#include <spine/Attachment.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Color.h>
#include <spine/Sequence.h>
#include <spine/TextureRegion.h>
@ -68,7 +68,7 @@ namespace spine {
/// @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, 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();
@ -112,9 +112,9 @@ namespace spine {
void setSequence(Sequence *sequence);
Vector<float> &getOffset();
Array<float> &getOffset();
Vector<float> &getUVs();
Array<float> &getUVs();
virtual Attachment *copy() override;
@ -129,8 +129,8 @@ namespace spine {
static const int BRY;
float _x, _y, _rotation, _scaleX, _scaleY, _width, _height;
Vector<float> _vertexOffset;
Vector<float> _uvs;
Array<float> _vertexOffset;
Array<float> _uvs;
String _path;
Color _color;
TextureRegion *_region;

View File

@ -30,7 +30,7 @@
#ifndef Spine_Sequence_h
#define Spine_Sequence_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineString.h>
#include <spine/TextureRegion.h>
#include <spine/RTTI.h>
@ -74,12 +74,12 @@ namespace spine {
void setSetupIndex(int setupIndex) { _setupIndex = setupIndex; }
Vector<TextureRegion *> &getRegions() { return _regions; }
Array<TextureRegion *> &getRegions() { return _regions; }
private:
static int _nextID;
int _id;
Vector<TextureRegion *> _regions;
Array<TextureRegion *> _regions;
int _start;
int _digits;
int _setupIndex;

View File

@ -52,7 +52,7 @@ namespace spine {
virtual ~SequenceTimeline();
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;
/// Sets the time, mode, index, and frame time for the specified frame.

View File

@ -30,7 +30,7 @@
#ifndef Spine_Skeleton_h
#define Spine_Skeleton_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/MathUtil.h>
#include <spine/SpineObject.h>
#include <spine/SpineString.h>
@ -165,7 +165,7 @@ namespace spine {
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.
///
@ -185,21 +185,21 @@ namespace spine {
SkeletonData *getData();
Vector<Bone *> &getBones();
Array<Bone *> &getBones();
Vector<Update *> &getUpdateCache();
Array<Update *> &getUpdateCache();
Bone *getRootBone();
/// @return May be NULL.
Bone *findBone(const String &boneName);
Vector<Slot *> &getSlots();
Array<Slot *> &getSlots();
/// @return May be NULL.
Slot *findSlot(const String &slotName);
Vector<Slot *> &getDrawOrder();
Array<Slot *> &getDrawOrder();
Skin *getSkin();
@ -224,9 +224,9 @@ namespace spine {
/// @param attachmentName May be empty.
void setAttachment(const String &slotName, const String &attachmentName);
Vector<Constraint *> &getConstraints();
Array<Constraint *> &getConstraints();
Vector<PhysicsConstraint *> &getPhysicsConstraints();
Array<PhysicsConstraint *> &getPhysicsConstraints();
template<class T>
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 outWidth The width 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.
void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Vector<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);
void getBounds(float &outX, float &outY, float &outWidth, float &outHeight, Array<float> &outVertexBuffer, SkeletonClipping *clipper);
Color &getColor();
@ -309,13 +309,13 @@ namespace spine {
protected:
SkeletonData &_data;
Vector<Bone *> _bones;
Vector<Slot *> _slots;
Vector<Slot *> _drawOrder;
Vector<Constraint *> _constraints;
Vector<PhysicsConstraint *> _physics;
Vector<Update *> _updateCache;
Vector<Posed *> _resetCache;
Array<Bone *> _bones;
Array<Slot *> _slots;
Array<Slot *> _drawOrder;
Array<Constraint *> _constraints;
Array<PhysicsConstraint *> _physics;
Array<Update *> _updateCache;
Array<Posed *> _resetCache;
Skin *_skin;
Color _color;
float _x, _y;

View File

@ -31,7 +31,7 @@
#define Spine_SkeletonBinary_h
#include <spine/Inherit.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineObject.h>
#include <spine/SpineString.h>
#include <spine/Color.h>
@ -225,7 +225,7 @@ namespace spine {
};
AttachmentLoader *_attachmentLoader;
Vector<LinkedMesh *> _linkedMeshes;
Array<LinkedMesh *> _linkedMeshes;
String _error;
float _scale;
const bool _ownsLoader;
@ -239,17 +239,17 @@ namespace spine {
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);
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
setBezier(DataInput &input, CurveTimeline &timeline, int bezier, int frame, int value, float time1, float time2,

View File

@ -30,7 +30,7 @@
#ifndef Spine_SkeletonBounds_h
#define Spine_SkeletonBounds_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Pool.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.
BoundingBoxAttachment * getBoundingBox(Polygon *polygon);
/// Returns all polygons or an empty vector. Requires a call to update() first.
Vector<Polygon *> &getPolygons();
/// Returns all polygons or an empty array. Requires a call to update() first.
Array<Polygon *> &getPolygons();
/// 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.
float getMinX();
@ -114,8 +114,8 @@ namespace spine {
private:
Pool <Polygon> _polygonPool;
Vector<BoundingBoxAttachment *> _boundingBoxes;
Vector<Polygon *> _polygons;
Array<BoundingBoxAttachment *> _boundingBoxes;
Array<Polygon *> _polygons;
float _minX, _minY, _maxX, _maxY;
void aabbCompute();
@ -123,7 +123,7 @@ namespace spine {
class Polygon : public SpineObject {
public:
Vector<float> _vertices;
Array<float> _vertices;
int _count;
Polygon() : _count(0) {

View File

@ -30,7 +30,7 @@
#ifndef Spine_SkeletonClipping_h
#define Spine_SkeletonClipping_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Triangulator.h>
namespace spine {
@ -55,33 +55,33 @@ namespace spine {
clipTriangles(float *vertices, unsigned short *triangles, size_t trianglesLength, float *uvs, size_t stride);
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();
Vector<float> &getClippedVertices();
Array<float> &getClippedVertices();
Vector<unsigned short> &getClippedTriangles();
Array<unsigned short> &getClippedTriangles();
Vector<float> &getClippedUVs();
Array<float> &getClippedUVs();
private:
Triangulator _triangulator;
Vector<float> _clippingPolygon;
Vector<float> _clipOutput;
Vector<float> _clippedVertices;
Vector<unsigned short> _clippedTriangles;
Vector<float> _clippedUVs;
Vector<float> _scratch;
Array<float> _clippingPolygon;
Array<float> _clipOutput;
Array<float> _clippedVertices;
Array<unsigned short> _clippedTriangles;
Array<float> _clippedUVs;
Array<float> _scratch;
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
* 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,
Vector<float> *output);
bool clip(float x1, float y1, float x2, float y2, float x3, float y3, Array<float> *clippingArea,
Array<float> *output);
static void makeClockwise(Vector<float> &polygon);
static void makeClockwise(Array<float> &polygon);
};
}

View File

@ -30,7 +30,7 @@
#ifndef Spine_SkeletonData_h
#define Spine_SkeletonData_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineString.h>
#include <spine/ConstraintData.h>
@ -107,13 +107,13 @@ namespace spine {
void setName(const String &inValue);
/// 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.
Vector<SlotData *> &getSlots();
Array<SlotData *> &getSlots();
/// All skins, including the default skin.
Vector<Skin *> &getSkins();
Array<Skin *> &getSkins();
/// The skeleton's default skin.
/// 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);
/// The skeleton's events.
Vector<spine::EventData *> &getEvents();
Array<spine::EventData *> &getEvents();
/// 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.
Vector<ConstraintData *> &getConstraints();
Array<ConstraintData *> &getConstraints();
/// Finds a constraint by name and type.
/// @return May be NULL.
@ -206,22 +206,22 @@ namespace spine {
private:
String _name;
Vector<BoneData *> _bones; // Ordered parents first
Vector<SlotData *> _slots; // Setup pose draw order.
Vector<Skin *> _skins;
Array<BoneData *> _bones; // Ordered parents first
Array<SlotData *> _slots; // Setup pose draw order.
Array<Skin *> _skins;
Skin *_defaultSkin;
Vector<EventData *> _events;
Vector<Animation *> _animations;
Vector<IkConstraintData *> _ikConstraints;
Vector<TransformConstraintData *> _transformConstraints;
Vector<PathConstraintData *> _pathConstraints;
Vector<PhysicsConstraintData *> _physicsConstraints;
Vector<ConstraintData *> _constraints;
Array<EventData *> _events;
Array<Animation *> _animations;
Array<IkConstraintData *> _ikConstraints;
Array<TransformConstraintData *> _transformConstraints;
Array<PathConstraintData *> _pathConstraints;
Array<PhysicsConstraintData *> _physicsConstraints;
Array<ConstraintData *> _constraints;
float _x, _y, _width, _height;
float _referenceScale;
String _version;
String _hash;
Vector<char *> _strings;
Array<char *> _strings;
// Nonessential.
float _fps;

View File

@ -30,7 +30,7 @@
#ifndef Spine_SkeletonJson_h
#define Spine_SkeletonJson_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineObject.h>
#include <spine/SpineString.h>
@ -83,7 +83,7 @@ namespace spine {
private:
AttachmentLoader *_attachmentLoader;
Vector<LinkedMesh *> _linkedMeshes;
Array<LinkedMesh *> _linkedMeshes;
float _scale;
const bool _ownsLoader;
String _error;
@ -99,10 +99,10 @@ namespace spine {
readCurve(Json *curve, CurveTimeline *timeline, int bezier, int frame, int value, float time1, float time2,
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
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);
Animation *readAnimation(Json *root, SkeletonData *skeletonData);
@ -113,7 +113,7 @@ namespace spine {
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);
};
}

View File

@ -59,10 +59,10 @@ namespace spine {
RenderCommand *render(Skeleton &skeleton);
private:
BlockAllocator _allocator;
Vector<float> _worldVertices;
Vector<unsigned short> _quadIndices;
Array<float> _worldVertices;
Array<unsigned short> _quadIndices;
SkeletonClipping _clipping;
Vector<RenderCommand *> _renderCommands;
Array<RenderCommand *> _renderCommands;
};
}

View File

@ -30,7 +30,7 @@
#ifndef Spine_Skin_h
#define Spine_Skin_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/SpineString.h>
#include <spine/Color.h>
@ -89,11 +89,11 @@ namespace spine {
}
protected:
Entries(Vector <Vector<Entry>> &buckets) : _buckets(buckets), _slotIndex(0), _bucketIndex(0) {
Entries(Array <Array<Entry>> &buckets) : _buckets(buckets), _slotIndex(0), _bucketIndex(0) {
}
private:
Vector <Vector<Entry>> &_buckets;
Array <Array<Entry>> &_buckets;
size_t _slotIndex;
size_t _bucketIndex;
};
@ -111,9 +111,9 @@ namespace spine {
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);
@ -133,12 +133,12 @@ namespace spine {
/// 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 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.
/// @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.
void findAttachmentsForSlot(size_t slotIndex, Vector<Attachment *> &attachments);
void findAttachmentsForSlot(size_t slotIndex, Array<Attachment *> &attachments);
const String &getName();
@ -150,17 +150,17 @@ namespace spine {
AttachmentMap::Entries getAttachments();
Vector<BoneData *> &getBones();
Array<BoneData *> &getBones();
Vector<ConstraintData *> &getConstraints();
Array<ConstraintData *> &getConstraints();
Color &getColor() { return _color; }
private:
const String _name;
AttachmentMap _attachments;
Vector<BoneData *> _bones;
Vector<ConstraintData *> _constraints;
Array<BoneData *> _bones;
Array<ConstraintData *> _constraints;
Color _color;
/// Attach all attachments from this skin if the corresponding attachment from the old skin is currently attached.

View File

@ -46,7 +46,7 @@ namespace spine {
virtual ~SliderMixTimeline();
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;
};
}

View File

@ -46,7 +46,7 @@ namespace spine {
virtual ~SliderTimeline();
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;
};
}

View File

@ -33,7 +33,7 @@
#include <spine/Posed.h>
#include <spine/SlotData.h>
#include <spine/SlotPose.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Color.h>
namespace spine {

View File

@ -49,7 +49,7 @@ namespace spine {
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;
protected:

View File

@ -34,7 +34,7 @@
#include <spine/RTTI.h>
#include <spine/Pose.h>
#include <spine/Color.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
class Attachment;
@ -60,7 +60,7 @@ namespace spine {
bool _hasDarkColor;
Attachment* _attachment;
int _sequenceIndex;
Vector<float> _deform;
Array<float> _deform;
public:
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.
///
/// See VertexAttachment::computeWorldVertices() and DeformTimeline.
Vector<float>& getDeform();
Array<float>& getDeform();
};
}

View File

@ -30,7 +30,7 @@
#ifndef Spine_TextureRegion_h
#define Spine_TextureRegion_h
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
class SP_API TextureRegion : public SpineObject {

View File

@ -31,7 +31,7 @@
#define Spine_Timeline_h
#include <spine/RTTI.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/MixBlend.h>
#include <spine/MixDirection.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 appliedPose True to modify the applied pose.
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;
size_t getFrameEntries();
size_t getFrameCount();
Vector<float> &getFrames();
Array<float> &getFrames();
float getDuration();
virtual Vector <PropertyId> &getPropertyIds();
virtual Array <PropertyId> &getPropertyIds();
protected:
void setPropertyIds(PropertyId propertyIds[], size_t propertyIdsCount);
Vector <PropertyId> _propertyIds;
Vector<float> _frames;
Array <PropertyId> _propertyIds;
Array<float> _frames;
size_t _frameEntries;
};
}

View File

@ -33,7 +33,7 @@
#include <spine/Constraint.h>
#include <spine/TransformConstraintData.h>
#include <spine/TransformConstraintPose.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
class Skeleton;
@ -59,7 +59,7 @@ namespace spine {
bool isSourceActive() override;
/// 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.
Bone* getSource();
@ -67,7 +67,7 @@ namespace spine {
void setSource(Bone* source);
private:
Vector<BonePose*> _bones;
Array<BonePose*> _bones;
Bone* _source;
};
}

View File

@ -32,7 +32,7 @@
#include <spine/ConstraintData.h>
#include <spine/PosedData.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/TransformConstraintPose.h>
namespace spine {
@ -50,7 +50,7 @@ namespace spine {
float _offset;
/// Constrained properties.
Vector<class ToProperty*> _to;
Array<class ToProperty*> _to;
FromProperty();
virtual ~FromProperty();
@ -169,7 +169,7 @@ namespace spine {
virtual Constraint* create(Skeleton& skeleton) override;
/// 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.
BoneData* getSource();
@ -216,14 +216,14 @@ namespace spine {
void setClamp(bool clamp);
/// The mapping of transform properties to other transform properties.
Vector<class FromProperty*>& getProperties();
Array<class FromProperty*>& getProperties();
private:
Vector<BoneData*> _bones;
Array<BoneData*> _bones;
BoneData* _source;
float _offsets[6]; // [rotation, x, y, scaleX, scaleY, shearY]
bool _localSource, _localTarget, _additive, _clamp;
Vector<class FromProperty*> _properties;
Array<class FromProperty*> _properties;
};
}

View File

@ -51,7 +51,7 @@ namespace spine {
virtual ~TransformConstraintTimeline();
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;
/// Sets the time, rotate mix, translate mix, scale mix, and shear mix for the specified frame.

View File

@ -30,7 +30,7 @@
#ifndef Spine_Triangulator_h
#define Spine_Triangulator_h
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/Pool.h>
namespace spine {
@ -38,28 +38,28 @@ namespace spine {
public:
~Triangulator();
Vector<int> &triangulate(Vector<float> &vertices);
Array<int> &triangulate(Array<float> &vertices);
Vector<Vector < float>* > &
decompose(Vector<float>
Array<Array < float>* > &
decompose(Array<float>
&vertices,
Vector<int> &triangles
Array<int> &triangles
);
private:
Vector<Vector < float>* >
Array<Array < float>* >
_convexPolygons;
Vector<Vector < int>* >
Array<Array < int>* >
_convexPolygonsIndices;
Vector<int> _indices;
Vector<bool> _isConcaveArray;
Vector<int> _triangles;
Array<int> _indices;
Array<bool> _isConcaveArray;
Array<int> _triangles;
Pool <Vector<float>> _polygonPool;
Pool <Vector<int>> _polygonIndicesPool;
Pool <Array<float>> _polygonPool;
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);

View File

@ -32,7 +32,7 @@
#include <spine/Attachment.h>
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
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,
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);
/// Gets a unique ID for this attachment.
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();
@ -93,8 +93,8 @@ namespace spine {
void copyTo(VertexAttachment *other);
protected:
Vector <int> _bones;
Vector<float> _vertices;
Array <int> _bones;
Array<float> _vertices;
size_t _worldVerticesLength;
Attachment *_timelineAttachment;

View File

@ -30,13 +30,13 @@
#ifndef Spine_Vertices_h
#define Spine_Vertices_h
#include <spine/Vector.h>
#include <spine/Array.h>
namespace spine {
class SP_API Vertices : public SpineObject {
public:
Vector <int> _bones;
Vector<float> _weights;
Array <int> _bones;
Array<float> _weights;
};
}

View File

@ -52,7 +52,7 @@
#include <spine/ConstraintData.h>
#include <spine/ConstraintTimeline.h>
#include <spine/ConstraintTimeline1.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
#include <spine/CurveTimeline.h>
#include <spine/DeformTimeline.h>
#include <spine/DrawOrderTimeline.h>
@ -128,7 +128,7 @@
#include <spine/TranslateTimeline.h>
#include <spine/Triangulator.h>
#include <spine/Update.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <spine/VertexAttachment.h>
#include <spine/Vertices.h>

View File

@ -35,13 +35,13 @@
#include <spine/RotateTimeline.h>
#include <spine/TranslateTimeline.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
#include <stdint.h>
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(),
_bones(),
_duration(duration),
@ -49,7 +49,7 @@ Animation::Animation(const String &name, Vector<Timeline *> &timelines, float du
setTimelines(timelines);
}
bool Animation::hasTimeline(Vector<PropertyId> &ids) {
bool Animation::hasTimeline(Array<PropertyId> &ids) {
for (size_t i = 0; i < ids.size(); i++) {
if (_timelineIds.containsKey(ids[i])) return true;
}
@ -57,10 +57,10 @@ bool Animation::hasTimeline(Vector<PropertyId> &ids) {
}
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) {
if (loop && _duration != 0) {
time = MathUtil::fmod(time, _duration);
@ -78,11 +78,11 @@ const String &Animation::getName() {
return _name;
}
const Vector<int> &Animation::getBones() {
const Array<int> &Animation::getBones() {
return _bones;
}
Vector<Timeline *> &Animation::getTimelines() {
Array<Timeline *> &Animation::getTimelines() {
return _timelines;
}
@ -94,7 +94,7 @@ void Animation::setDuration(float 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();
for (size_t i = 1; i < n; i++) {
if (frames[i] > target) return (int) (i - 1);
@ -102,14 +102,14 @@ int Animation::search(Vector<float> &frames, float target) {
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();
for (size_t i = step; i < n; i += step)
if (frames[i] > target) return (int) (i - step);
return (int) (n - step);
}
void Animation::setTimelines(Vector<Timeline *> &timelines) {
void Animation::setTimelines(Array<Timeline *> &timelines) {
_timelines = timelines;
size_t n = timelines.size();
@ -119,7 +119,7 @@ void Animation::setTimelines(Vector<Timeline *> &timelines) {
HashMap<int, bool> boneSet;
for (size_t i = 0; i < n; i++) {
Timeline *timeline = timelines[i];
Vector<PropertyId> &propertyIds = timeline->getPropertyIds();
Array<PropertyId> &propertyIds = timeline->getPropertyIds();
for (size_t ii = 0; ii < propertyIds.size(); ii++) {
_timelineIds.put(propertyIds[ii], true);
}

View File

@ -477,13 +477,13 @@ bool AnimationState::apply(Skeleton &skeleton) {
// apply current entry.
float animationLast = current._animationLast, animationTime = current.getAnimationTime();
float applyTime = animationTime;
Vector<Event *> *applyEvents = &_events;
Array<Event *> *applyEvents = &_events;
if (current._reverse) {
applyTime = current._animation->getDuration() - applyTime;
applyEvents = NULL;
}
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) attachments = true;
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);
}
} else {
Vector<int> &timelineMode = current._timelineMode;
Array<int> &timelineMode = current._timelineMode;
bool shortestRotation = current._shortestRotation;
bool firstFrame = !shortestRotation && current._timelinesRotation.size() != timelines.size() << 1;
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) {
Timeline *timeline = timelines[ii];
@ -527,7 +527,7 @@ bool AnimationState::apply(Skeleton &skeleton) {
}
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++) {
Slot *slot = slots[i];
if (slot->_attachmentState == setupState) {
@ -676,7 +676,7 @@ AnimationStateData *AnimationState::getData() {
return _data;
}
Vector<TrackEntry *> &AnimationState::getTracks() {
Array<TrackEntry *> &AnimationState::getTracks() {
return _tracks;
}
@ -720,7 +720,7 @@ void AnimationState::disposeTrackEntry(TrackEntry *entry) {
}
Animation *AnimationState::getEmptyAnimation() {
static Vector<Timeline *> timelines;
static Array<Timeline *> timelines;
static Animation ret(String("<empty>"), timelines, 0);
return &ret;
}
@ -730,7 +730,7 @@ void AnimationState::applyAttachmentTimeline(AttachmentTimeline *attachmentTimel
Slot *slot = skeleton.getSlots()[attachmentTimeline->getSlotIndex()];
if (!slot->getBone().isActive()) return;
Vector<float> &frames = attachmentTimeline->getFrames();
Array<float> &frames = attachmentTimeline->getFrames();
if (time < frames[0]) {
if (blend == MixBlend_Setup || blend == MixBlend_First)
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,
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 (alpha == 1) {
@ -757,7 +757,7 @@ void AnimationState::applyRotateTimeline(RotateTimeline *rotateTimeline, Skeleto
if (!bone->isActive()) return;
BoneLocal &pose = bone->_pose;
BoneLocal &setup = bone->_data._setup;
Vector<float> &frames = rotateTimeline->_frames;
Array<float> &frames = rotateTimeline->_frames;
float r1, r2;
if (time < frames[0]) {
switch (blend) {
@ -856,12 +856,12 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
}
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();
float alphaHold = from->_alpha * to->_interruptAlpha, alphaMix = alphaHold * (1 - mix);
float animationLast = from->_animationLast, animationTime = from->getAnimationTime();
float applyTime = animationTime;
Vector<Event *> *events = NULL;
Array<Event *> *events = NULL;
if (from->_reverse) {
applyTime = from->_animation->_duration - applyTime;
} else {
@ -872,14 +872,14 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle
for (size_t i = 0; i < timelineCount; i++)
timelines[i]->apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection_Out, false);
} else {
Vector<int> &timelineMode = from->_timelineMode;
Vector<TrackEntry *> &timelineHoldMix = from->_timelineHoldMix;
Array<int> &timelineMode = from->_timelineMode;
Array<TrackEntry *> &timelineHoldMix = from->_timelineHoldMix;
bool shortestRotation = from->_shortestRotation;
bool firstFrame = !shortestRotation && from->_timelinesRotation.size() != timelines.size() << 1;
if (firstFrame) from->_timelinesRotation.setSize(timelines.size() << 1, 0);
Vector<float> &timelinesRotation = from->_timelinesRotation;
Array<float> &timelinesRotation = from->_timelinesRotation;
from->_totalAlpha = 0;
for (size_t i = 0; i < timelineCount; i++) {
@ -1079,11 +1079,11 @@ void AnimationState::animationsChanged() {
void AnimationState::computeHold(TrackEntry *entry) {
TrackEntry *to = entry->_mixingTo;
Vector<Timeline *> &timelines = entry->_animation->_timelines;
Array<Timeline *> &timelines = entry->_animation->_timelines;
size_t timelinesCount = timelines.size();
Vector<int> &timelineMode = entry->_timelineMode;
Array<int> &timelineMode = entry->_timelineMode;
timelineMode.setSize(timelinesCount, 0);
Vector<TrackEntry *> &timelineHoldMix = entry->_timelineHoldMix;
Array<TrackEntry *> &timelineHoldMix = entry->_timelineHoldMix;
timelineHoldMix.setSize(timelinesCount, 0);
if (to != NULL && to->_holdPrevious) {
@ -1098,7 +1098,7 @@ void AnimationState::computeHold(TrackEntry *entry) {
continue_outer:
for (; i < timelinesCount; ++i) {
Timeline *timeline = timelines[i];
Vector<PropertyId> &ids = timeline->getPropertyIds();
Array<PropertyId> &ids = timeline->getPropertyIds();
if (!_propertyIDs.addAll(ids, true)) {
timelineMode[i] = Subsequent;
} else {

View File

@ -28,7 +28,7 @@
*****************************************************************************/
#include <spine/Atlas.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
#include <spine/TextureLoader.h>
#include <ctype.h>
@ -72,8 +72,8 @@ Atlas::~Atlas() {
_textureLoader->unload(_pages[i]->texture);
}
}
ContainerUtil::cleanUpVectorOfPointers(_pages);
ContainerUtil::cleanUpVectorOfPointers(_regions);
ArrayUtils::deleteElements(_pages);
ArrayUtils::deleteElements(_regions);
}
void Atlas::flipV() {
@ -91,11 +91,11 @@ AtlasRegion *Atlas::findRegion(const String &name) {
return NULL;
}
Vector<AtlasPage *> &Atlas::getPages() {
Array<AtlasPage *> &Atlas::getPages() {
return _pages;
}
Vector<AtlasRegion *> &Atlas::getRegions() {
Array<AtlasRegion *> &Atlas::getRegions() {
return _regions;
}

View File

@ -44,7 +44,7 @@ AtlasAttachmentLoader::AtlasAttachmentLoader(Atlas *atlas) : AttachmentLoader(),
}
bool loadSequence(Atlas *atlas, const String &basePath, Sequence *sequence) {
Vector<TextureRegion *> &regions = sequence->getRegions();
Array<TextureRegion *> &regions = sequence->getRegions();
for (int i = 0, n = (int) regions.size(); i < n; i++) {
String path = sequence->getPath(basePath, i);
regions[i] = atlas->findRegion(path);

View File

@ -60,7 +60,7 @@ void AttachmentTimeline::setAttachment(Skeleton &skeleton, SlotPose &pose, Strin
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);
@ -84,6 +84,6 @@ void AttachmentTimeline::setFrame(int frame, float time, const String &attachmen
_attachmentNames[frame] = attachmentName;
}
Vector<String> &AttachmentTimeline::getAttachmentNames() {
Array<String> &AttachmentTimeline::getAttachmentNames() {
return _attachmentNames;
}

View File

@ -61,6 +61,6 @@ Bone *Bone::getParent() {
return _parent;
}
Vector<Bone *> &Bone::getChildren() {
Array<Bone *> &Bone::getChildren() {
return _children;
}

View File

@ -257,7 +257,7 @@ void BonePose::modifyWorld(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++) {
BonePose &child = children[i]->getAppliedPose();
if (child._world == update) {

View File

@ -47,7 +47,7 @@ BoneTimeline1::BoneTimeline1(size_t frameCount, size_t bezierCount, int boneInde
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);
@ -65,7 +65,7 @@ BoneTimeline2::BoneTimeline2(size_t frameCount, size_t bezierCount, int boneInde
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -216,7 +216,7 @@ AlphaTimeline::AlphaTimeline(size_t frameCount, size_t bezierCount, int slotInde
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -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);
}
Vector<float> &CurveTimeline::getCurves() {
Array<float> &CurveTimeline::getCurves() {
return _curves;
}

View File

@ -50,7 +50,7 @@ DeformTimeline::DeformTimeline(size_t frameCount, size_t bezierCount, int slotIn
_vertices.ensureCapacity(frameCount);
for (size_t i = 0; i < frameCount; ++i) {
Vector<float> vec;
Array<float> vec;
_vertices.add(vec);
}
}
@ -67,15 +67,15 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
return;
}
Vector<float> &deformArray = pose._deform;
Array<float> &deformArray = pose._deform;
if (deformArray.size() == 0) {
blend = MixBlend_Setup;
}
Vector<Vector<float>> &vertices = _vertices;
Array<Array<float>> &vertices = _vertices;
size_t vertexCount = vertices[0].size();
Vector<float> &frames = _frames;
Array<float> &frames = _frames;
if (time < frames[0]) {
switch (blend) {
case MixBlend_Setup:
@ -87,10 +87,10 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
return;
}
deformArray.setSize(vertexCount, 0);
Vector<float> &deform = deformArray;
Array<float> &deform = deformArray;
if (vertexAttachment->getBones().size() == 0) {
// Unweighted vertex positions.
Vector<float> &setupVertices = vertexAttachment->getVertices();
Array<float> &setupVertices = vertexAttachment->getVertices();
for (size_t i = 0; i < vertexCount; i++)
deform[i] += (setupVertices[i] - deform[i]) * alpha;
} else {
@ -109,15 +109,15 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
}
deformArray.setSize(vertexCount, 0);
Vector<float> &deform = deformArray;
Array<float> &deform = deformArray;
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 (blend == MixBlend_Add) {
if (vertexAttachment->getBones().size() == 0) {
// Unweighted vertex positions, no alpha.
Vector<float> &setupVertices = vertexAttachment->getVertices();
Array<float> &setupVertices = vertexAttachment->getVertices();
for (size_t i = 0; i < vertexCount; i++)
deform[i] += lastVertices[i] - setupVertices[i];
} else {
@ -134,7 +134,7 @@ void DeformTimeline::apply(Slot &slot, SlotPose &pose, float time, float alpha,
case MixBlend_Setup: {
if (vertexAttachment->getBones().size() == 0) {
// Unweighted vertex positions, with alpha.
Vector<float> &setupVertices = vertexAttachment->getVertices();
Array<float> &setupVertices = vertexAttachment->getVertices();
for (size_t i = 0; i < vertexCount; i++) {
float setup = setupVertices[i];
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:
if (vertexAttachment->getBones().size() == 0) {
// Unweighted vertex positions, with alpha.
Vector<float> &setupVertices = vertexAttachment->getVertices();
Array<float> &setupVertices = vertexAttachment->getVertices();
for (size_t i = 0; i < vertexCount; i++)
deform[i] += (lastVertices[i] - setupVertices[i]) * alpha;
} 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.
int frame = Animation::search(frames, time);
float percent = getCurvePercent(time, frame);
Vector<float> &prevVertices = vertices[frame];
Vector<float> &nextVertices = vertices[frame + 1];
Array<float> &prevVertices = vertices[frame];
Array<float> &nextVertices = vertices[frame + 1];
if (alpha == 1) {
if (blend == MixBlend_Add) {
if (vertexAttachment->getBones().size() == 0) {
// Unweighted vertex positions, no alpha.
Vector<float> &setupVertices = vertexAttachment->getVertices();
Array<float> &setupVertices = vertexAttachment->getVertices();
for (size_t i = 0; i < vertexCount; i++) {
float prev = prevVertices[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: {
if (vertexAttachment->getBones().size() == 0) {
// Unweighted vertex positions, with alpha.
Vector<float> &setupVertices = vertexAttachment->getVertices();
Array<float> &setupVertices = vertexAttachment->getVertices();
for (size_t i = 0; i < vertexCount; i++) {
float prev = prevVertices[i], setup = setupVertices[i];
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:
if (vertexAttachment->getBones().size() == 0) {
// Unweighted vertex positions, with alpha.
Vector<float> &setupVertices = vertexAttachment->getVertices();
Array<float> &setupVertices = vertexAttachment->getVertices();
for (size_t i = 0; i < vertexCount; i++) {
float prev = prevVertices[i];
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) {
SP_UNUSED(value1);
SP_UNUSED(value2);
Vector<float> &curves = _curves;
Array<float> &curves = _curves;
size_t i = getFrameCount() + bezier * BEZIER_SIZE;
if (value == 0) curves[frame] = BEZIER + (float) i;
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) {
Vector<float> &curves = _curves;
Array<float> &curves = _curves;
int i = (int) curves[frame];
switch (i) {
case LINEAR: {
@ -299,13 +299,13 @@ float DeformTimeline::getCurvePercent(float time, int frame) {
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;
_vertices[frame].clear();
_vertices[frame].addAll(vertices);
}
Vector<Vector<float>> &DeformTimeline::getVertices() {
Array<Array<float>> &DeformTimeline::getVertices() {
return _vertices;
}

View File

@ -47,20 +47,20 @@ DrawOrderTimeline::DrawOrderTimeline(size_t frameCount) : Timeline(frameCount, 1
_drawOrders.ensureCapacity(frameCount);
for (size_t i = 0; i < frameCount; ++i) {
Vector<int> vec;
Array<int> 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) {
SP_UNUSED(appliedPose);
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);
SP_UNUSED(alpha);
Vector<Slot *> &drawOrder = skeleton._drawOrder;
Vector<Slot *> &slots = skeleton._slots;
Array<Slot *> &drawOrder = skeleton._drawOrder;
Array<Slot *> &slots = skeleton._slots;
if (direction == MixDirection_Out) {
if (blend == MixBlend_Setup) {
drawOrder.clear();
@ -81,7 +81,7 @@ void DrawOrderTimeline::apply(Skeleton &skeleton, float lastTime, float time, Ve
return;
}
Vector<int> &drawOrderToSetupIndex = _drawOrders[Animation::search(_frames, time)];
Array<int> &drawOrderToSetupIndex = _drawOrders[Animation::search(_frames, time)];
if (drawOrderToSetupIndex.size() == 0) {
drawOrder.clear();
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;
_drawOrders[frame].clear();
if (drawOrder != NULL) {
@ -107,6 +107,6 @@ size_t DrawOrderTimeline::getFrameCount() {
return _frames.size();
}
Vector<Vector<int>> &DrawOrderTimeline::getDrawOrders() {
Array<Array<int>> &DrawOrderTimeline::getDrawOrders() {
return _drawOrders;
}

View File

@ -33,7 +33,7 @@
#include <spine/Skeleton.h>
#include <spine/Animation.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
#include <spine/EventData.h>
#include <spine/Property.h>
#include <spine/Slot.h>
@ -52,14 +52,14 @@ EventTimeline::EventTimeline(size_t frameCount) : Timeline(frameCount, 1) {
}
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) {
if (pEvents == NULL) return;
Vector<Event *> &events = *pEvents;
Array<Event *> &events = *pEvents;
size_t frameCount = _frames.size();
@ -100,6 +100,6 @@ size_t EventTimeline::getFrameCount() {
return _frames.size();
}
Vector<Event *> &EventTimeline::getEvents() {
Array<Event *> &EventTimeline::getEvents() {
return _events;
}

View File

@ -87,7 +87,7 @@ IkConstraintData &IkConstraint::getData() {
return _data;
}
Vector<BonePose *> &IkConstraint::getBones() {
Array<BonePose *> &IkConstraint::getBones() {
return _bones;
}

View File

@ -41,7 +41,7 @@ IkConstraintData::IkConstraintData(const String &name) : ConstraintDataGeneric<I
_uniform(false) {
}
Vector<BoneData *> &IkConstraintData::getBones() {
Array<BoneData *> &IkConstraintData::getBones() {
return _bones;
}

View File

@ -53,7 +53,7 @@ IkConstraintTimeline::IkConstraintTimeline(size_t frameCount, size_t bezierCount
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -37,7 +37,7 @@ THE SOFTWARE.
#include <spine/Json.h>
#include <spine/Extension.h>
#include <spine/SpineString.h>
#include <spine/Vector.h>
#include <spine/Array.h>
#include <assert.h>
#include <math.h>

View File

@ -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;
for (i = 0, n = (int) boneDatas.size(); i < n; i++) {
spDebug_printBoneData(boneDatas[i]);
@ -93,7 +93,7 @@ void spine::spDebug_printSkeleton(Skeleton *skeleton) {
spDebug_printBones(skeleton->getBones());
}
void spine::spDebug_printBones(Vector<Bone *> &bones) {
void spine::spDebug_printBones(Array<Bone *> &bones) {
int i, n;
for (i = 0, n = (int) bones.size(); i < n; i++) {
spDebug_printBone(bones[i]);
@ -115,7 +115,7 @@ void spine::spDebug_printFloats(float *values, int numFloats) {
printf("]");
}
void spine::spDebug_printFloats(Vector<float> &values) {
void spine::spDebug_printFloats(Array<float> &values) {
int i, n;
printf("(%zu) [", values.size());
for (i = 0, n = (int) values.size(); i < n; i++) {

View File

@ -123,23 +123,23 @@ void MeshAttachment::setHullLength(int inValue) {
_hullLength = inValue;
}
Vector<float> &MeshAttachment::getRegionUVs() {
Array<float> &MeshAttachment::getRegionUVs() {
return _regionUVs;
}
void MeshAttachment::setRegionUVs(Vector<float> &inValue) {
void MeshAttachment::setRegionUVs(Array<float> &inValue) {
_regionUVs.clearAndAddAll(inValue);
}
Vector<float> &MeshAttachment::getUVs() {
Array<float> &MeshAttachment::getUVs() {
return _uvs;
}
Vector<unsigned short> &MeshAttachment::getTriangles() {
Array<unsigned short> &MeshAttachment::getTriangles() {
return _triangles;
}
void MeshAttachment::setTriangles(Vector<unsigned short> &inValue) {
void MeshAttachment::setTriangles(Array<unsigned short> &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;
}
void MeshAttachment::setEdges(Vector<unsigned short> &inValue) {
void MeshAttachment::setEdges(Array<unsigned short> &inValue) {
_edges.clearAndAddAll(inValue);
}

View File

@ -37,11 +37,11 @@ PathAttachment::PathAttachment(const String &name) : VertexAttachment(name), _cl
_color() {
}
Vector<float> &PathAttachment::getLengths() {
Array<float> &PathAttachment::getLengths() {
return _lengths;
}
void PathAttachment::setLengths(Vector<float> &inValue) {
void PathAttachment::setLengths(Array<float> &inValue) {
_lengths.clearAndAddAll(inValue);
}

View File

@ -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 boneX = positionsBuffer[0], boneY = positionsBuffer[1], offsetRotation = data._offsetRotation;
bool tip;
@ -241,7 +241,7 @@ PathConstraintData &PathConstraint::getData() {
return _data;
}
Vector<BonePose *> &PathConstraint::getBones() {
Array<BonePose *> &PathConstraint::getBones() {
return _bones;
}
@ -253,13 +253,13 @@ void PathConstraint::setSlot(Slot *slot) {
_slot = slot;
}
Vector<float> &
Array<float> &
PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path, int spacesCount, bool tangents) {
float position = _applied->_position;
float *spaces = _spaces.buffer();
_positions.setSize(spacesCount * 3 + 2, 0);
Vector<float> &out = _positions;
Vector<float> &world = _world;
Array<float> &out = _positions;
Array<float> &world = _world;
bool closed = path.isClosed();
int verticesLength = (int) path.getWorldVerticesLength();
int curveCount = verticesLength / 6;
@ -267,7 +267,7 @@ PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path,
float pathLength;
if (!path.isConstantSpeed()) {
Vector<float> &lengths = path.getLengths();
Array<float> &lengths = path.getLengths();
float *lengthsBuffer = lengths.buffer();
curveCount -= closed ? 1 : 2;
pathLength = lengthsBuffer[curveCount];
@ -500,14 +500,14 @@ PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path,
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);
output[o] = x1 + p * MathUtil::cos(r);
output[o + 1] = y1 + p * MathUtil::sin(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);
output[o] = x1 + p * MathUtil::cos(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,
float y2, Vector<float> &output, int o, bool tangents) {
float y2, Array<float> &output, int o, bool tangents) {
if (p < epsilon || MathUtil::isNan(p)) {
output[o] = x1;
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) {
if (attachment == NULL || !attachment->getRTTI().instanceOf(PathAttachment::rtti)) return;
PathAttachment *pathAttachment = static_cast<PathAttachment *>(attachment);
Vector<int> &pathBones = pathAttachment->getBones();
Array<int> &pathBones = pathAttachment->getBones();
if (pathBones.size() == 0)
skeleton.sortBone(&slotBone);
else {
Vector<Bone *> &bones = skeleton._bones;
Array<Bone *> &bones = skeleton._bones;
for (size_t i = 0, n = pathBones.size(); i < n;) {
int nn = pathBones[i++];
nn += i;

View File

@ -46,7 +46,7 @@ PathConstraintData::PathConstraintData(const String &name) : ConstraintDataGener
}
Vector<BoneData *> &PathConstraintData::getBones() {
Array<BoneData *> &PathConstraintData::getBones() {
return _bones;
}

View File

@ -54,7 +54,7 @@ PathConstraintMixTimeline::PathConstraintMixTimeline(size_t frameCount, size_t b
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -53,7 +53,7 @@ PathConstraintPositionTimeline::PathConstraintPositionTimeline(size_t frameCount
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -53,7 +53,7 @@ PathConstraintSpacingTimeline::PathConstraintSpacingTimeline(size_t frameCount,
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -58,12 +58,12 @@ PhysicsConstraintTimeline::PhysicsConstraintTimeline(size_t frameCount, size_t b
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) {
if (_constraintIndex == -1) {
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++) {
PhysicsConstraint *constraint = physicsConstraints[i];
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;
if (_constraintIndex != -1) {
constraint = static_cast<PhysicsConstraint *>(skeleton.getConstraints()[_constraintIndex]);
@ -98,7 +98,7 @@ void PhysicsConstraintResetTimeline::apply(Skeleton &skeleton, float lastTime, f
if (constraint != nullptr)
constraint->reset(skeleton);
else {
Vector<PhysicsConstraint *> &physicsConstraints = skeleton.getPhysicsConstraints();
Array<PhysicsConstraint *> &physicsConstraints = skeleton.getPhysicsConstraints();
for (size_t i = 0; i < physicsConstraints.size(); i++) {
constraint = physicsConstraints[i];
if (constraint->isActive()) constraint->reset(skeleton);

View File

@ -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));
computeWorldVertices(slot, worldVertices.buffer(), offset, stride);
}
@ -244,11 +244,11 @@ void RegionAttachment::setSequence(Sequence *sequence) {
_sequence = sequence;
}
Vector<float> &RegionAttachment::getOffset() {
Array<float> &RegionAttachment::getOffset() {
return _vertexOffset;
}
Vector<float> &RegionAttachment::getUVs() {
Array<float> &RegionAttachment::getUVs() {
return _uvs;
}

View File

@ -55,14 +55,14 @@ SequenceTimeline::~SequenceTimeline() {
}
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;
frames[frame] = time;
frames[frame + MODE] = mode | (index << 4);
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) {
SP_UNUSED(alpha);
SP_UNUSED(lastTime);
@ -86,7 +86,7 @@ void SequenceTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vec
return;
}
Vector<float> &frames = this->_frames;
Array<float> &frames = this->_frames;
if (time < frames[0]) {
if (blend == MixBlend_Setup || blend == MixBlend_First) pose.setSequenceIndex(-1);
return;

View File

@ -52,7 +52,7 @@
#include <spine/TransformConstraintData.h>
#include <spine/SkeletonClipping.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
#include <float.h>
@ -101,9 +101,9 @@ Skeleton::Skeleton(SkeletonData &skeletonData) : _data(skeletonData), _skin(NULL
}
Skeleton::~Skeleton() {
ContainerUtil::cleanUpVectorOfPointers(_bones);
ContainerUtil::cleanUpVectorOfPointers(_slots);
ContainerUtil::cleanUpVectorOfPointers(_constraints);
ArrayUtils::deleteElements(_bones);
ArrayUtils::deleteElements(_slots);
ArrayUtils::deleteElements(_constraints);
}
void Skeleton::updateCache() {
@ -125,7 +125,7 @@ void Skeleton::updateCache() {
}
if (_skin) {
Vector<BoneData *> &skinBones = _skin->getBones();
Array<BoneData *> &skinBones = _skin->getBones();
for (size_t i = 0, n = skinBones.size(); i < n; i++) {
Bone *bone = _bones[skinBones[i]->getIndex()];
do {
@ -198,7 +198,7 @@ void Skeleton::sortBone(Bone *bone) {
_updateCache.add((Update *)bone);
}
void Skeleton::sortReset(Vector<Bone *> &bones) {
void Skeleton::sortReset(Array<Bone *> &bones) {
Bone **items = bones.buffer();
for (size_t i = 0, n = bones.size(); i < n; i++) {
Bone *bone = items[i];
@ -293,11 +293,11 @@ SkeletonData *Skeleton::getData() {
return &_data;
}
Vector<Bone *> &Skeleton::getBones() {
Array<Bone *> &Skeleton::getBones() {
return _bones;
}
Vector<Update *> &Skeleton::getUpdateCache() {
Array<Update *> &Skeleton::getUpdateCache() {
return _updateCache;
}
@ -314,7 +314,7 @@ Bone *Skeleton::findBone(const String &boneName) {
return NULL;
}
Vector<Slot *> &Skeleton::getSlots() {
Array<Slot *> &Skeleton::getSlots() {
return _slots;
}
@ -327,7 +327,7 @@ Slot *Skeleton::findSlot(const String &slotName) {
return NULL;
}
Vector<Slot *> &Skeleton::getDrawOrder() {
Array<Slot *> &Skeleton::getDrawOrder() {
return _drawOrder;
}
@ -392,19 +392,19 @@ void Skeleton::setAttachment(const String &slotName, const String &attachmentNam
slot->_pose.setAttachment(attachment);
}
Vector<Constraint *> &Skeleton::getConstraints() {
Array<Constraint *> &Skeleton::getConstraints() {
return _constraints;
}
Vector<PhysicsConstraint *> &Skeleton::getPhysicsConstraints() {
Array<PhysicsConstraint *> &Skeleton::getPhysicsConstraints() {
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);
}
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};
float minX = FLT_MAX;
float minY = FLT_MAX;

View File

@ -45,7 +45,7 @@
#include <spine/BoundingBoxAttachment.h>
#include <spine/ClippingAttachment.h>
#include <spine/ColorTimeline.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
#include <spine/DeformTimeline.h>
#include <spine/DrawOrderTimeline.h>
#include <spine/Event.h>
@ -93,7 +93,7 @@ SkeletonBinary::SkeletonBinary(AttachmentLoader *attachmentLoader, bool ownsLoad
}
SkeletonBinary::~SkeletonBinary() {
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
ArrayUtils::deleteElements(_linkedMeshes);
_linkedMeshes.clear();
if (_ownsLoader) delete _attachmentLoader;
@ -136,7 +136,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
return NULL;
}
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
ArrayUtils::deleteElements(_linkedMeshes);
_linkedMeshes.clear();
SkeletonData *skeletonData = new (__FILE__, __LINE__) SkeletonData();
@ -177,12 +177,12 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
}
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++)
strings[i] = input.readString();
/* 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) {
const char *name = input.readString();
BoneData *parent = i == 0 ? 0 : bones[input.readInt(true)];
@ -207,7 +207,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
}
/* 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) {
String slotName = String(input.readString(), true);
BoneData *boneData = bones[input.readInt(true)];
@ -228,14 +228,14 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
/* Constraints. */
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++) {
String name(input.readString(), true);
int nn;
switch (input.readByte()) {
case CONSTRAINT_IK: {
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++)
constraintBones[ii] = 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: {
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++)
constraintBones[ii] = 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->_additive = (flags & 8) != 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++) {
float fromScale = 1;
FromProperty *from = NULL;
@ -290,7 +290,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
break;
}
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++) {
float toScale = 1;
ToProperty *to = NULL;
@ -343,7 +343,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
}
case CONSTRAINT_PATH: {
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++)
constraintBones[ii] = bones[input.readInt(true)];
data->_slot = slots[input.readInt(true)];
@ -459,7 +459,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
/* Skins. */
{
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++) {
Skin *skin = readSkin(input, *skeletonData, false, nonessential);
if (skin)
@ -472,7 +472,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
}
/* Linked meshes. */
Vector<LinkedMesh *> &items = _linkedMeshes;
Array<LinkedMesh *> &items = _linkedMeshes;
for (int i = 0, n = items.size(); i < n; i++) {
LinkedMesh *linkedMesh = items[i];
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));
if (linkedMesh->_mesh->getSequence() == NULL) linkedMesh->_mesh->updateRegion();
}
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
ArrayUtils::deleteElements(_linkedMeshes);
_linkedMeshes.clear();
/* Events. */
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) {
EventData *eventData = new (__FILE__, __LINE__) EventData(String(input.readString(), true));
eventData->_intValue = input.readInt(false);
@ -508,7 +508,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons
/* Animations. */
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) {
Animation *animation = readAnimation(input, String(input.readString(), true), *skeletonData);
if (!animation) {
@ -552,13 +552,13 @@ Skin *SkeletonBinary::readSkin(DataInput &input, SkeletonData &skeletonData, boo
if (nonessential) Color::rgba8888ToColor(skin->getColor(), input.readInt());
int n;
Vector<BoneData *> &from = skeletonData._bones;
Vector<BoneData *> &bones = skin->getBones().setSize(n = input.readInt(true), NULL);
Array<BoneData *> &from = skeletonData._bones;
Array<BoneData *> &bones = skin->getBones().setSize(n = input.readInt(true), NULL);
for (int i = 0; i < n; i++)
bones[i] = from[input.readInt(true)];
Vector<ConstraintData *> &fromConstraints = skeletonData._constraints;
Vector<ConstraintData *> &constraints = skin->getConstraints().setSize(n = input.readInt(true), NULL);
Array<ConstraintData *> &fromConstraints = skeletonData._constraints;
Array<ConstraintData *> &constraints = skin->getConstraints().setSize(n = input.readInt(true), NULL);
for (int i = 0; i < n; i++)
constraints[i] = fromConstraints[input.readInt(true)];
@ -618,8 +618,8 @@ Attachment *SkeletonBinary::readAttachment(DataInput &input, Skin &skin, int slo
return region;
}
case AttachmentType_Boundingbox: {
Vector<float> vertices;
Vector<int> bones;
Array<float> vertices;
Array<int> bones;
int verticesLength = readVertices(input, vertices, bones, (flags & 16) != 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;
Sequence *sequence = (flags & 64) != 0 ? readSequence(input) : nullptr;
int hullLength = input.readInt(true);
Vector<float> vertices;
Vector<int> bones;
Array<float> vertices;
Array<int> bones;
int verticesLength = readVertices(input, vertices, bones, (flags & 128) != 0);
Vector<float> uvs;
Array<float> uvs;
readFloatArray(input, verticesLength, 1, uvs);
Vector<unsigned short> triangles;
Array<unsigned short> triangles;
readShortArray(input, triangles, (verticesLength - hullLength - 2) * 3);
Vector<unsigned short> edges;
Array<unsigned short> edges;
float width = 0, height = 0;
if (nonessential) {
readShortArray(input, edges, input.readInt(true));
@ -699,10 +699,10 @@ Attachment *SkeletonBinary::readAttachment(DataInput &input, Skin &skin, int slo
case AttachmentType_Path: {
bool closed = (flags & 16) != 0;
bool constantSpeed = (flags & 32) != 0;
Vector<float> vertices;
Vector<int> bones;
Array<float> vertices;
Array<int> bones;
int verticesLength = readVertices(input, vertices, bones, (flags & 64) != 0);
Vector<float> lengths;
Array<float> lengths;
lengths.setSize(verticesLength / 6, 0);
for (int i = 0, n = lengths.size(); i < n; i++)
lengths[i] = input.readFloat() * scale;
@ -735,8 +735,8 @@ Attachment *SkeletonBinary::readAttachment(DataInput &input, Skin &skin, int slo
}
case AttachmentType_Clipping: {
int endSlotIndex = input.readInt(true);
Vector<float> vertices;
Vector<int> bones;
Array<float> vertices;
Array<int> bones;
int verticesLength = readVertices(input, vertices, bones, (flags & 16) != 0);
int color = nonessential ? input.readInt() : 0;
@ -761,7 +761,7 @@ Sequence *SkeletonBinary::readSequence(DataInput &input) {
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;
int vertexCount = input.readInt(true);
int verticesLength = vertexCount << 1;
@ -784,7 +784,7 @@ int SkeletonBinary::readVertices(DataInput &input, Vector<float> &vertices, Vect
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);
int i;
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);
for (int i = 0; i < n; ++i) {
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) {
Vector<Timeline *> timelines;
Array<Timeline *> timelines;
timelines.ensureCapacity(input.readInt(true));
float scale = _scale;
@ -986,7 +986,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
break;
}
default: {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError("Invalid slot timeline type: ", String().append(timelineType).buffer());
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);
break;
default: {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError("Invalid bone timeline type: ", String().append(timelineType).buffer());
return NULL;
}
@ -1161,7 +1161,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
break;
}
default: {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError("Invalid path constraint timeline type: ", String().append(type).buffer());
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);
break;
default: {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError("Invalid physics constraint timeline type: ", String().append(type).buffer());
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);
break;
default: {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError("Invalid slider timeline type: ", String().append(type).buffer());
return NULL;
}
@ -1243,7 +1243,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
const char *attachmentName = input.readStringRef();
Attachment *attachment = skin->getAttachment(slotIndex, String(attachmentName));
if (!attachment) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError("Timeline attachment not found: ", attachmentName);
return NULL;
}
@ -1252,7 +1252,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
case ATTACHMENT_DEFORM: {
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
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();
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();
for (int frame = 0, bezier = 0;; ++frame) {
Vector<float> deform;
Array<float> deform;
size_t end = (size_t) input.readInt(true);
if (end == 0) {
if (weighted) {
@ -1315,7 +1315,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
break;
}
default: {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError("Invalid attachment timeline type: ", String().append(timelineType).buffer());
return NULL;
}
@ -1332,11 +1332,11 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S
for (size_t i = 0; i < drawOrderCount; ++i) {
float time = input.readFloat();
size_t offsetCount = (size_t) input.readInt(true);
Vector<int> drawOrder;
Array<int> drawOrder;
drawOrder.setSize(slotCount, 0);
for (int ii = (int) slotCount - 1; ii >= 0; --ii)
drawOrder[ii] = -1;
Vector<int> unchanged;
Array<int> unchanged;
unchanged.setSize(slotCount - offsetCount, 0);
size_t originalIndex = 0, unchangedIndex = 0;
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);
}
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;
for (int frame = 0, bezier = 0, frameLast = (int) timeline.getFrameCount() - 1;; frame++) {
timeline.setFrame(frame, time, value);
@ -1411,7 +1411,7 @@ void SkeletonBinary::readTimeline(DataInput &input, Vector<Timeline *> &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;
for (int frame = 0, bezier = 0, frameLast = (int) timeline.getFrameCount() - 1;; frame++) {
timeline.setFrame(frame, time, value1, value2);

View File

@ -49,7 +49,7 @@ SkeletonBounds::~SkeletonBounds() {
}
void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) {
Vector<Slot *> &slots = skeleton.getSlots();
Array<Slot *> &slots = skeleton.getSlots();
size_t slotCount = slots.size();
_boundingBoxes.clear();
@ -123,7 +123,7 @@ bool SkeletonBounds::aabbIntersectsSkeleton(SkeletonBounds &bounds) {
}
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 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) {
Vector<float> &vertices = polygon->_vertices;
Array<float> &vertices = polygon->_vertices;
size_t nn = polygon->_count;
float width12 = x1 - x2, height12 = y1 - y2;
@ -190,11 +190,11 @@ BoundingBoxAttachment *SkeletonBounds::getBoundingBox(Polygon *polygon) {
return index == -1 ? NULL : _boundingBoxes[index];
}
Vector<spine::Polygon *> &SkeletonBounds::getPolygons() {
Array<spine::Polygon *> &SkeletonBounds::getPolygons() {
return _polygons;
}
Vector<BoundingBoxAttachment *> &SkeletonBounds::getBoundingBoxes() {
Array<BoundingBoxAttachment *> &SkeletonBounds::getBoundingBoxes() {
return _boundingBoxes;
}
@ -230,7 +230,7 @@ void SkeletonBounds::aabbCompute() {
for (size_t i = 0, n = _polygons.size(); i < n; ++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) {
float x = vertices[ii];
float y = vertices[ii + 1];

View File

@ -58,8 +58,8 @@ size_t SkeletonClipping::clipStart(Skeleton &skeleton, Slot &slot, ClippingAttac
_clippingPolygons = &_triangulator.decompose(_clippingPolygon, _triangulator.triangulate(_clippingPolygon));
for (size_t i = 0; i < _clippingPolygons->size(); ++i) {
Vector<float> *polygonP = (*_clippingPolygons)[i];
Vector<float> &polygon = *polygonP;
Array<float> *polygonP = (*_clippingPolygons)[i];
Array<float> &polygon = *polygonP;
makeClockwise(polygon);
polygon.add(polygon[0]);
polygon.add(polygon[1]);
@ -87,10 +87,10 @@ void SkeletonClipping::clipEnd() {
bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
size_t trianglesLength) {
Vector<float> &clipOutput = _clipOutput;
Vector<float> &clippedVertices = _clippedVertices;
Vector<unsigned short> &clippedTriangles = _clippedTriangles;
Vector<Vector<float> *> &polygons = *_clippingPolygons;
Array<float> &clipOutput = _clipOutput;
Array<float> &clippedVertices = _clippedVertices;
Array<unsigned short> &clippedTriangles = _clippedTriangles;
Array<Array<float> *> &polygons = *_clippingPolygons;
size_t polygonsCount = (*_clippingPolygons).size();
size_t index = 0;
@ -159,17 +159,17 @@ bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
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) {
return clipTriangles(vertices.buffer(), triangles.buffer(), triangles.size(), uvs.buffer(), stride);
}
bool SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles,
size_t trianglesLength, float *uvs, size_t stride) {
Vector<float> &clipOutput = _clipOutput;
Vector<float> &clippedVertices = _clippedVertices;
Vector<unsigned short> &clippedTriangles = _clippedTriangles;
Vector<Vector<float> *> &polygons = *_clippingPolygons;
Array<float> &clipOutput = _clipOutput;
Array<float> &clippedVertices = _clippedVertices;
Array<unsigned short> &clippedTriangles = _clippedTriangles;
Array<Array<float> *> &polygons = *_clippingPolygons;
size_t polygonsCount = (*_clippingPolygons).size();
size_t index = 0;
@ -261,25 +261,25 @@ bool SkeletonClipping::isClipping() {
return _clipAttachment != NULL;
}
Vector<float> &SkeletonClipping::getClippedVertices() {
Array<float> &SkeletonClipping::getClippedVertices() {
return _clippedVertices;
}
Vector<unsigned short> &SkeletonClipping::getClippedTriangles() {
Array<unsigned short> &SkeletonClipping::getClippedTriangles() {
return _clippedTriangles;
}
Vector<float> &SkeletonClipping::getClippedUVs() {
Array<float> &SkeletonClipping::getClippedUVs() {
return _clippedUVs;
}
bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, float y3, Vector<float> *clippingArea,
Vector<float> *output) {
Vector<float> *originalOutput = output;
bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, float y3, Array<float> *clippingArea,
Array<float> *output) {
Array<float> *originalOutput = output;
bool clipped = false;
// Avoid copy at the end.
Vector<float> *input;
Array<float> *input;
if (clippingArea->size() % 4 >= 2) {
input = output;
output = &_scratch;
@ -298,13 +298,13 @@ bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, fl
output->clear();
size_t clippingVerticesLast = clippingArea->size() - 4;
Vector<float> &clippingVertices = *clippingArea;
Array<float> &clippingVertices = *clippingArea;
for (size_t i = 0;; i += 2) {
float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
float ex = edgeX - clippingVertices[i + 2], ey = edgeY - clippingVertices[i + 3];
size_t outputStart = output->size();
Vector<float> &inputVertices = *input;
Array<float> &inputVertices = *input;
for (size_t ii = 0, nn = input->size() - 2; ii < nn;) {
float inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
ii += 2;
@ -355,7 +355,7 @@ bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, fl
if (i == clippingVerticesLast) {
break;
}
Vector<float> *temp = output;
Array<float> *temp = output;
output = input;
output->clear();
input = temp;
@ -375,7 +375,7 @@ bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, fl
return clipped;
}
void SkeletonClipping::makeClockwise(Vector<float> &polygon) {
void SkeletonClipping::makeClockwise(Array<float> &polygon) {
size_t verticeslength = polygon.size();
float area = polygon[verticeslength - 2] * polygon[1] - polygon[0] * polygon[verticeslength - 1];

View File

@ -40,7 +40,7 @@
#include <spine/SlotData.h>
#include <spine/TransformConstraintData.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
using namespace spine;
@ -59,18 +59,18 @@ SkeletonData::SkeletonData() : _name(),
}
SkeletonData::~SkeletonData() {
ContainerUtil::cleanUpVectorOfPointers(_bones);
ContainerUtil::cleanUpVectorOfPointers(_slots);
ContainerUtil::cleanUpVectorOfPointers(_skins);
ArrayUtils::deleteElements(_bones);
ArrayUtils::deleteElements(_slots);
ArrayUtils::deleteElements(_skins);
_defaultSkin = NULL;
ContainerUtil::cleanUpVectorOfPointers(_events);
ContainerUtil::cleanUpVectorOfPointers(_animations);
ContainerUtil::cleanUpVectorOfPointers(_ikConstraints);
ContainerUtil::cleanUpVectorOfPointers(_transformConstraints);
ContainerUtil::cleanUpVectorOfPointers(_pathConstraints);
ContainerUtil::cleanUpVectorOfPointers(_physicsConstraints);
ArrayUtils::deleteElements(_events);
ArrayUtils::deleteElements(_animations);
ArrayUtils::deleteElements(_ikConstraints);
ArrayUtils::deleteElements(_transformConstraints);
ArrayUtils::deleteElements(_pathConstraints);
ArrayUtils::deleteElements(_physicsConstraints);
// Note: _constraints contains pointers to objects already cleaned up above, so just clear
_constraints.clear();
for (size_t i = 0; i < _strings.size(); i++) {
@ -79,39 +79,39 @@ SkeletonData::~SkeletonData() {
}
BoneData *SkeletonData::findBone(const String &boneName) {
return ContainerUtil::findWithName(_bones, boneName);
return ArrayUtils::findWithName(_bones, boneName);
}
SlotData *SkeletonData::findSlot(const String &slotName) {
return ContainerUtil::findWithName(_slots, slotName);
return ArrayUtils::findWithName(_slots, slotName);
}
Skin *SkeletonData::findSkin(const String &skinName) {
return ContainerUtil::findWithName(_skins, skinName);
return ArrayUtils::findWithName(_skins, skinName);
}
spine::EventData *SkeletonData::findEvent(const String &eventDataName) {
return ContainerUtil::findWithName(_events, eventDataName);
return ArrayUtils::findWithName(_events, eventDataName);
}
Animation *SkeletonData::findAnimation(const String &animationName) {
return ContainerUtil::findWithName(_animations, animationName);
return ArrayUtils::findWithName(_animations, animationName);
}
IkConstraintData *SkeletonData::findIkConstraint(const String &constraintName) {
return ContainerUtil::findWithName(_ikConstraints, constraintName);
return ArrayUtils::findWithName(_ikConstraints, constraintName);
}
TransformConstraintData *SkeletonData::findTransformConstraint(const String &constraintName) {
return ContainerUtil::findWithName(_transformConstraints, constraintName);
return ArrayUtils::findWithName(_transformConstraints, constraintName);
}
PathConstraintData *SkeletonData::findPathConstraint(const String &constraintName) {
return ContainerUtil::findWithName(_pathConstraints, constraintName);
return ArrayUtils::findWithName(_pathConstraints, constraintName);
}
PhysicsConstraintData *SkeletonData::findPhysicsConstraint(const String &constraintName) {
return ContainerUtil::findWithName(_physicsConstraints, constraintName);
return ArrayUtils::findWithName(_physicsConstraints, constraintName);
}
const String &SkeletonData::getName() {
@ -122,15 +122,15 @@ void SkeletonData::setName(const String &inValue) {
_name = inValue;
}
Vector<BoneData *> &SkeletonData::getBones() {
Array<BoneData *> &SkeletonData::getBones() {
return _bones;
}
Vector<SlotData *> &SkeletonData::getSlots() {
Array<SlotData *> &SkeletonData::getSlots() {
return _slots;
}
Vector<Skin *> &SkeletonData::getSkins() {
Array<Skin *> &SkeletonData::getSkins() {
return _skins;
}
@ -142,27 +142,27 @@ void SkeletonData::setDefaultSkin(Skin *inValue) {
_defaultSkin = inValue;
}
Vector<spine::EventData *> &SkeletonData::getEvents() {
Array<spine::EventData *> &SkeletonData::getEvents() {
return _events;
}
Vector<Animation *> &SkeletonData::getAnimations() {
Array<Animation *> &SkeletonData::getAnimations() {
return _animations;
}
Vector<IkConstraintData *> &SkeletonData::getIkConstraints() {
Array<IkConstraintData *> &SkeletonData::getIkConstraints() {
return _ikConstraints;
}
Vector<TransformConstraintData *> &SkeletonData::getTransformConstraints() {
Array<TransformConstraintData *> &SkeletonData::getTransformConstraints() {
return _transformConstraints;
}
Vector<PathConstraintData *> &SkeletonData::getPathConstraints() {
Array<PathConstraintData *> &SkeletonData::getPathConstraints() {
return _pathConstraints;
}
Vector<PhysicsConstraintData *> &SkeletonData::getPhysicsConstraints() {
Array<PhysicsConstraintData *> &SkeletonData::getPhysicsConstraints() {
return _physicsConstraints;
}
@ -247,7 +247,7 @@ void SkeletonData::setFps(float inValue) {
_fps = inValue;
}
Vector<ConstraintData *> &SkeletonData::getConstraints() {
Array<ConstraintData *> &SkeletonData::getConstraints() {
// Build unified constraints array by aggregating all constraint types
_constraints.clear();
for (size_t i = 0, n = _ikConstraints.size(); i < n; i++) {

View File

@ -45,7 +45,7 @@
#include <spine/BoundingBoxAttachment.h>
#include <spine/ClippingAttachment.h>
#include <spine/ColorTimeline.h>
#include <spine/ContainerUtil.h>
#include <spine/ArrayUtils.h>
#include <spine/DeformTimeline.h>
#include <spine/DrawOrderTimeline.h>
#include <spine/Event.h>
@ -117,7 +117,7 @@ SkeletonJson::SkeletonJson(AttachmentLoader *attachmentLoader, bool ownsLoader)
}
SkeletonJson::~SkeletonJson() {
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
ArrayUtils::deleteElements(_linkedMeshes);
if (_ownsLoader) delete _attachmentLoader;
}
@ -554,7 +554,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
linkedMesh->_mesh->setParentMesh(static_cast<MeshAttachment *>(parent));
if (linkedMesh->_mesh->_region != NULL) linkedMesh->_mesh->updateRegion();
}
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
ArrayUtils::deleteElements(_linkedMeshes);
_linkedMeshes.clear();
/* Events. */
@ -669,17 +669,17 @@ Attachment *SkeletonJson::readAttachment(Json *map, Skin *skin, int slotIndex, c
return mesh;
}
Vector<float> uvs;
Array<float> uvs;
if (!Json::asArray(Json::getItem(map, "uvs"), uvs)) return NULL;
readVertices(map, mesh, uvs.size());
Vector<unsigned short> triangles;
Array<unsigned short> triangles;
if (!Json::asArray(Json::getItem(map, "triangles"), triangles)) return NULL;
mesh->_triangles.clearAndAddAll(triangles);
mesh->_regionUVs.clearAndAddAll(uvs);
if (mesh->_region != NULL) mesh->updateRegion();
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);
if (edges.size() > 0) mesh->_edges.clearAndAddAll(edges);
return mesh;
@ -745,7 +745,7 @@ Sequence *SkeletonJson::readSequence(Json *item) {
void SkeletonJson::readVertices(Json *map, VertexAttachment *attachment, size_t verticesLength) {
attachment->setWorldVerticesLength(verticesLength);
Vector<float> vertices;
Array<float> vertices;
if (!Json::asArray(Json::getItem(map, "vertices"), vertices)) return;
if (verticesLength == vertices.size()) {
if (_scale != 1) {
@ -774,7 +774,7 @@ void SkeletonJson::readVertices(Json *map, VertexAttachment *attachment, size_t
}
Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
Vector<Timeline *> timelines;
Array<Timeline *> timelines;
// Slot timelines.
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);
} else {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
}
@ -965,9 +965,9 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
// Bone timelines.
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) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
@ -1006,7 +1006,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
}
timelines.add(timeline);
} else {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
}
@ -1018,7 +1018,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
if (keyMap == NULL) continue;
IkConstraintData *constraint = skeletonData->findIkConstraint(timelineMap->_name);
if (!constraint) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
int constraintIndex = skeletonData->_ikConstraints.indexOf(constraint);
@ -1058,7 +1058,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
if (keyMap == NULL) continue;
TransformConstraintData *constraint = skeletonData->findTransformConstraint(timelineMap->_name);
if (!constraint) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
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) {
PathConstraintData *constraint = skeletonData->findPathConstraint(constraintMap->_name);
if (!constraint) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
int index = skeletonData->_pathConstraints.indexOf(constraint);
@ -1168,7 +1168,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
if (constraintMap->_name && strlen(constraintMap->_name) > 0) {
PhysicsConstraintData *constraint = skeletonData->findConstraint<PhysicsConstraintData>(constraintMap->_name);
if (!constraint) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
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) {
SliderData *constraint = skeletonData->findConstraint<SliderData>(constraintMap->_name);
if (!constraint) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
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) {
Skin *skin = skeletonData->findSkin(attachmentsMap->_name);
if (!skin) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
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) {
Attachment *attachment = skin->getAttachment(slotIndex, attachmentMap->_name);
if (!attachment) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
for (Json *timelineMap = attachmentMap->_child; timelineMap; timelineMap = timelineMap->_next) {
@ -1255,14 +1255,14 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
if (timelineName == "deform") {
VertexAttachment *vertexAttachment = static_cast<VertexAttachment *>(attachment);
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();
DeformTimeline *timeline = new (__FILE__, __LINE__) DeformTimeline(frames,
frames, slotIndex, vertexAttachment);
float time = Json::getFloat(keyMap, "time", 0);
for (int frame = 0, bezier = 0;; frame++) {
Vector<float> deform;
Array<float> deform;
Json *verticesValue = Json::getItem(keyMap, "vertices");
if (!verticesValue) {
if (weighted) {
@ -1324,19 +1324,19 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
int slotCount = skeletonData->_slots.size();
int frame = 0;
for (Json *keyMap = drawOrder->_child; keyMap; keyMap = keyMap->_next, ++frame) {
Vector<int> drawOrder2;
Array<int> drawOrder2;
Json *offsets = Json::getItem(keyMap, "offsets");
if (offsets) {
drawOrder2.setSize(slotCount, 0);
for (int i = slotCount - 1; i >= 0; i--)
drawOrder2[i] = -1;
Vector<int> unchanged;
Array<int> unchanged;
unchanged.setSize(slotCount - offsets->_size, 0);
int originalIndex = 0, unchangedIndex = 0;
for (Json *offsetMap = offsets->_child; offsetMap; offsetMap = offsetMap->_next) {
SlotData *slot = skeletonData->findSlot(Json::getString(offsetMap, "slot", 0));
if (!slot) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
/* Collect unchanged items. */
@ -1366,7 +1366,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) {
for (Json *keyMap = events->_child; keyMap; keyMap = keyMap->_next, ++frame) {
EventData *eventData = skeletonData->findEvent(Json::getString(keyMap, "name", 0));
if (!eventData) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
return NULL;
}
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);
}
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;
for (int frame = 0, bezier = 0;; frame++) {
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 time = Json::getFloat(keyMap, "time", 0);
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);
}
int SkeletonJson::findSlotIndex(SkeletonData *skeletonData, const String &slotName, Vector<Timeline *> timelines) {
int slotIndex = ContainerUtil::findIndexWithName(skeletonData->getSlots(), slotName);
int SkeletonJson::findSlotIndex(SkeletonData *skeletonData, const String &slotName, Array<Timeline *> timelines) {
int slotIndex = ArrayUtils::findIndexWithName(skeletonData->getSlots(), slotName);
if (slotIndex == -1) {
ContainerUtil::cleanUpVectorOfPointers(timelines);
ArrayUtils::deleteElements(timelines);
setError(NULL, "Slot not found: ", slotName);
}
return slotIndex;

View File

@ -65,7 +65,7 @@ static RenderCommand *createRenderCommand(BlockAllocator &allocator, int numVert
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);
float *positions = batched->positions;
float *uvs = batched->uvs;
@ -91,7 +91,7 @@ static RenderCommand *batchSubCommands(BlockAllocator &allocator, Vector<RenderC
return batched;
}
static RenderCommand *batchCommands(BlockAllocator &allocator, Vector<RenderCommand *> &commands) {
static RenderCommand *batchCommands(BlockAllocator &allocator, Array<RenderCommand *> &commands) {
if (commands.size() == 0) return nullptr;
RenderCommand *root = nullptr;
@ -156,12 +156,12 @@ RenderCommand *SkeletonRenderer::render(Skeleton &skeleton) {
continue;
}
Vector<float> *worldVertices = &_worldVertices;
Vector<unsigned short> *quadIndices = &_quadIndices;
Vector<float> *vertices = worldVertices;
Array<float> *worldVertices = &_worldVertices;
Array<unsigned short> *quadIndices = &_quadIndices;
Array<float> *vertices = worldVertices;
int32_t verticesCount;
Vector<float> *uvs;
Vector<unsigned short> *indices;
Array<float> *uvs;
Array<unsigned short> *indices;
int32_t indicesCount;
Color *attachmentColor;
void *texture;

View File

@ -51,8 +51,8 @@ static void disposeAttachment(Attachment *attachment) {
void Skin::AttachmentMap::put(size_t slotIndex, const String &attachmentName, Attachment *attachment) {
if (slotIndex >= _buckets.size())
_buckets.setSize(slotIndex + 1, Vector<Entry>());
Vector<Entry> &bucket = _buckets[slotIndex];
_buckets.setSize(slotIndex + 1, Array<Entry>());
Array<Entry> &bucket = _buckets[slotIndex];
int existing = findInBucket(bucket, attachmentName);
attachment->reference();
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++)
if (bucket[i]._name == attachmentName) return (int) i;
return -1;
@ -113,7 +113,7 @@ void Skin::removeAttachment(size_t slotIndex, const String &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();
while (entries.hasNext()) {
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();
while (entries.hasNext()) {
Skin::AttachmentMap::Entry &entry = entries.next();
@ -140,7 +140,7 @@ Skin::AttachmentMap::Entries Skin::getAttachments() {
}
void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) {
Vector<Slot *> &slots = skeleton.getSlots();
Array<Slot *> &slots = skeleton.getSlots();
Skin::AttachmentMap::Entries entries = oldSkin.getAttachments();
while (entries.hasNext()) {
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;
}
Vector<BoneData *> &Skin::getBones() {
Array<BoneData *> &Skin::getBones() {
return _bones;
}

View File

@ -78,8 +78,8 @@ void Slider::update(Skeleton &skeleton, Physics physics) {
p._time = MathUtil::max(0.0f, p._time);
}
Vector<Bone *> &bones = skeleton._bones;
const Vector<int> &indices = animation->getBones();
Array<Bone *> &bones = skeleton._bones;
const Array<int> &indices = animation->getBones();
for (size_t i = 0, n = indices.size(); i < n; i++)
bones[indices[i]]->_applied->modifyLocal(skeleton);
@ -91,8 +91,8 @@ void Slider::sort(Skeleton &skeleton) {
if (_bone != NULL && !_data._local) skeleton.sortBone(_bone);
skeleton._updateCache.add(this);
Vector<Bone *> &bones = skeleton._bones;
const Vector<int> &indices = _data._animation->getBones();
Array<Bone *> &bones = skeleton._bones;
const Array<int> &indices = _data._animation->getBones();
for (size_t i = 0, n = indices.size(); i < n; i++) {
Bone *bone = bones[indices[i]];
bone->_sorted = false;
@ -100,10 +100,10 @@ void Slider::sort(Skeleton &skeleton) {
skeleton.constrained(*bone);
}
Vector<Timeline *> &timelines = _data._animation->getTimelines();
Vector<Slot *> &slots = skeleton._slots;
Vector<Constraint *> &constraints = skeleton._constraints;
Vector<PhysicsConstraint *> &physics = skeleton._physics;
Array<Timeline *> &timelines = _data._animation->getTimelines();
Array<Slot *> &slots = skeleton._slots;
Array<Constraint *> &constraints = skeleton._constraints;
Array<PhysicsConstraint *> &physics = skeleton._physics;
size_t physicsCount = physics.size();
for (size_t i = 0, n = timelines.size(); i < n; i++) {
Timeline *t = timelines[i];

View File

@ -54,7 +54,7 @@ SliderMixTimeline::SliderMixTimeline(size_t frameCount, size_t bezierCount,
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

View File

@ -54,7 +54,7 @@ SliderTimeline::SliderTimeline(size_t frameCount, size_t bezierCount,
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) {
SP_UNUSED(lastTime);
SP_UNUSED(pEvents);

Some files were not shown because too many files have changed in this diff Show More