mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 16:48:43 +08:00
[cpp] Removed toString, fixed up remaining memory leaks in clipping and animation state code.
This commit is contained in:
parent
9cdf4c69ed
commit
9ceec41432
@ -101,7 +101,7 @@ public:
|
||||
|
||||
void setDuration(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
Vector<Timeline *> _timelines;
|
||||
|
||||
@ -214,7 +214,7 @@ namespace Spine {
|
||||
|
||||
void setOnAnimationEventFunc(OnAnimationEventFunc inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
Animation* _animation;
|
||||
|
||||
@ -251,7 +251,7 @@ namespace Spine {
|
||||
|
||||
EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL);
|
||||
|
||||
String toString() const;
|
||||
|
||||
};
|
||||
|
||||
class EventQueue : public SpineObject {
|
||||
@ -285,8 +285,6 @@ namespace Spine {
|
||||
|
||||
/// Raises all events in the queue and drains the queue.
|
||||
void drain();
|
||||
|
||||
String toString() const ;
|
||||
};
|
||||
|
||||
class AnimationState : public SpineObject {
|
||||
@ -379,7 +377,7 @@ namespace Spine {
|
||||
void setRendererObject(void* inValue);
|
||||
void* getRendererObject();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
static const int Subsequent, First, Dip, DipMix;
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Spine {
|
||||
///
|
||||
float getMix(Animation* from, Animation* to);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
class AnimationPair : public SpineObject {
|
||||
@ -80,7 +80,7 @@ namespace Spine {
|
||||
|
||||
bool operator==(const AnimationPair &other) const;
|
||||
|
||||
String toString() const;
|
||||
|
||||
};
|
||||
|
||||
struct HashAnimationPair : public SpineObject {
|
||||
|
||||
@ -78,15 +78,6 @@ public:
|
||||
magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge),
|
||||
vWrap(TextureWrap_ClampToEdge) {
|
||||
}
|
||||
|
||||
String toString() const {
|
||||
String str;
|
||||
str.append("AtlasPage { name: ").appendString(name)
|
||||
.append(", width: ").append(width)
|
||||
.append(", height: ").append(height)
|
||||
.append(" }");
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
class AtlasRegion : public SpineObject {
|
||||
@ -101,12 +92,6 @@ public:
|
||||
bool rotate;
|
||||
Vector<int> splits;
|
||||
Vector<int> pads;
|
||||
|
||||
String toString() const {
|
||||
String str;
|
||||
str.append("AtlasRegion { name: ").appendString(name).append(" }");
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
class TextureLoader;
|
||||
@ -128,7 +113,7 @@ public:
|
||||
|
||||
void dispose();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
Vector<AtlasPage *> _pages;
|
||||
|
||||
@ -64,7 +64,7 @@ namespace Spine {
|
||||
|
||||
AtlasRegion* findRegion(const String& name);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
Atlas* _atlas;
|
||||
|
||||
@ -221,7 +221,7 @@ public:
|
||||
/// Returns the magnitide (always positive) of the world scale Y.
|
||||
float getWorldScaleY();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
static bool yDown;
|
||||
|
||||
@ -107,7 +107,7 @@ public:
|
||||
|
||||
void setTransformMode(TransformMode inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
const int _index;
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Spine {
|
||||
|
||||
explicit BoundingBoxAttachment(const String& name);
|
||||
|
||||
String toString() const;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Spine {
|
||||
SlotData* getEndSlot();
|
||||
void setEndSlot(SlotData* inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
SlotData* _endSlot;
|
||||
|
||||
@ -87,13 +87,6 @@ public:
|
||||
}
|
||||
|
||||
float _r, _g, _b, _a;
|
||||
|
||||
inline String toString() const {
|
||||
String str;
|
||||
str.append("Color { r: ").append(_r).append(", g: ").append(_g).append(", b: ").append(_b).append(
|
||||
", a: ").append(_a).append(" }");
|
||||
return str;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,9 @@ class DebugExtension : public DefaultSpineExtension {
|
||||
};
|
||||
|
||||
public:
|
||||
DebugExtension(): _allocations(0), _reallocations(0), _frees(0) {
|
||||
}
|
||||
|
||||
void reportLeaks() {
|
||||
for (std::vector<Allocation>::iterator it = _allocated.begin(); it != _allocated.end(); it++) {
|
||||
printf("\"%s:%i (%zu bytes at %p)\n", it->fileName, it->line, it->size, it->address);
|
||||
|
||||
@ -65,7 +65,7 @@ public:
|
||||
|
||||
void setStringValue(const String &inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
const EventData &_data;
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
|
||||
void setStringValue(const String &inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
const String _name;
|
||||
|
||||
@ -150,22 +150,6 @@ public:
|
||||
return Entries(_head);
|
||||
}
|
||||
|
||||
String toString() const {
|
||||
String str;
|
||||
|
||||
str.append("{");
|
||||
Entries entries = getEntries();
|
||||
|
||||
while (entries.hasNext()) {
|
||||
Pair pair = entries.next();
|
||||
str.append(pair.key);
|
||||
str.append("->");
|
||||
str.append(pair.value);
|
||||
}
|
||||
str.append("}");
|
||||
return str;
|
||||
}
|
||||
|
||||
private:
|
||||
Entry *find(const K &key) {
|
||||
for (Entry *entry = _head; entry != NULL; entry = entry->next) {
|
||||
@ -183,12 +167,6 @@ private:
|
||||
Entry *prev;
|
||||
|
||||
Entry() : next(NULL), prev(NULL) {}
|
||||
|
||||
String toString() const {
|
||||
String str;
|
||||
str.append("Entry { key: ").append(_key).append(" -> ").append(_value);
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
Entry *_head;
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
|
||||
void setMix(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
IkConstraintData &_data;
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Spine {
|
||||
float getMix();
|
||||
void setMix(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
const String _name;
|
||||
|
||||
@ -69,7 +69,7 @@ public:
|
||||
|
||||
~Json();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
static const char *_error;
|
||||
|
||||
@ -45,7 +45,7 @@ class LinkedMesh : public SpineObject {
|
||||
public:
|
||||
LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex, const String &parent);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
MeshAttachment *_mesh;
|
||||
|
||||
@ -122,7 +122,7 @@ namespace Spine {
|
||||
float getHeight();
|
||||
void setHeight(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
float _regionOffsetX, _regionOffsetY, _regionWidth, _regionHeight, _regionOriginalWidth, _regionOriginalHeight;
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Spine {
|
||||
bool isConstantSpeed();
|
||||
void setConstantSpeed(bool inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
Vector<float> _lengths;
|
||||
|
||||
@ -79,7 +79,7 @@ namespace Spine {
|
||||
|
||||
PathConstraintData& getData();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
static const float EPSILON;
|
||||
|
||||
@ -89,7 +89,7 @@ namespace Spine {
|
||||
float getTranslateMix();
|
||||
void setTranslateMix(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
const String _name;
|
||||
int _order;
|
||||
|
||||
@ -65,7 +65,7 @@ namespace Spine {
|
||||
float getRotation();
|
||||
void setRotation(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
float _x, _y, _rotation;
|
||||
|
||||
@ -67,12 +67,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
String toString() const {
|
||||
String str;
|
||||
str.append("Pool { size: ").append((int) _objects.size()).append(" }");
|
||||
return str;
|
||||
}
|
||||
|
||||
private:
|
||||
Vector<T *> _objects;
|
||||
};
|
||||
|
||||
@ -48,7 +48,7 @@ public:
|
||||
|
||||
bool instanceOf(const RTTI &rtti) const;
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
// Prevent copying
|
||||
|
||||
@ -107,7 +107,7 @@ namespace Spine {
|
||||
Vector<float>& getOffset();
|
||||
Vector<float>& getUVs();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
static const int BLX;
|
||||
|
||||
@ -212,7 +212,7 @@ public:
|
||||
|
||||
void setFlipY(bool inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
SkeletonData *_data;
|
||||
|
||||
@ -81,14 +81,12 @@ namespace Spine {
|
||||
|
||||
String& getError() { return _error; }
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
struct DataInput : public SpineObject {
|
||||
const unsigned char* cursor;
|
||||
const unsigned char* end;
|
||||
|
||||
String toString() const { return String("DataInput"); }
|
||||
};
|
||||
|
||||
AttachmentLoader* _attachmentLoader;
|
||||
|
||||
@ -86,7 +86,7 @@ namespace Spine {
|
||||
float getWidth();
|
||||
float getHeight();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
Vector<Polygon*> _polygonPool;
|
||||
@ -106,7 +106,7 @@ namespace Spine {
|
||||
_vertices.ensureCapacity(16);
|
||||
}
|
||||
|
||||
String toString() const;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ namespace Spine {
|
||||
Vector<unsigned short>& getClippedTriangles();
|
||||
Vector<float>& getClippedUVs();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
Triangulator _triangulator;
|
||||
@ -67,7 +67,7 @@ namespace Spine {
|
||||
Vector<float> _clippedUVs;
|
||||
Vector<float> _scratch;
|
||||
ClippingAttachment* _clipAttachment;
|
||||
Vector< Vector<float>* > _clippingPolygons;
|
||||
Vector< Vector<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. */
|
||||
|
||||
@ -167,7 +167,7 @@ public:
|
||||
|
||||
void setFps(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
String _name;
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
|
||||
String &getError() { return _error; }
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
AttachmentLoader *_attachmentLoader;
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
|
||||
bool operator==(const AttachmentKey &other) const;
|
||||
|
||||
String toString() const;
|
||||
|
||||
};
|
||||
|
||||
struct HashAttachmentKey : public SpineObject {
|
||||
@ -93,7 +93,7 @@ public:
|
||||
|
||||
HashMap<AttachmentKey, Attachment *> &getAttachments();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
const String _name;
|
||||
|
||||
@ -115,7 +115,7 @@ public:
|
||||
|
||||
void setAttachmentVertices(Vector<float> &inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
SlotData &_data;
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
|
||||
void setBlendMode(BlendMode inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
const int _index;
|
||||
|
||||
@ -45,8 +45,6 @@ public:
|
||||
void operator delete(void *p);
|
||||
|
||||
virtual ~SpineObject();
|
||||
|
||||
virtual String toString() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
String &appendString(const String &other) {
|
||||
String &append(const String &other) {
|
||||
size_t len = other.length();
|
||||
size_t thisLen = _length;
|
||||
_length = _length + len;
|
||||
@ -173,16 +173,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
String &append(const SpineObject &object) {
|
||||
appendString(object.toString());
|
||||
return *this;
|
||||
}
|
||||
|
||||
String &append(const SpineObject *object) {
|
||||
appendString(object->toString());
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend bool operator==(const String &a, const String &b) {
|
||||
if (a._buffer == b._buffer) return true;
|
||||
if (a._length != b._length) return false;
|
||||
@ -203,10 +193,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
String toString() const {
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable size_t _length;
|
||||
mutable char *_buffer;
|
||||
|
||||
@ -66,8 +66,6 @@ public:
|
||||
MixDirection direction) = 0;
|
||||
|
||||
virtual int getPropertyId() = 0;
|
||||
|
||||
virtual String toString() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ namespace Spine {
|
||||
float getShearMix();
|
||||
void setShearMix(float inValue);
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
TransformConstraintData& _data;
|
||||
|
||||
@ -68,7 +68,7 @@ namespace Spine {
|
||||
bool isRelative();
|
||||
bool isLocal();
|
||||
|
||||
String toString() const;
|
||||
|
||||
|
||||
private:
|
||||
const String _name;
|
||||
|
||||
@ -37,28 +37,24 @@
|
||||
namespace Spine {
|
||||
class Triangulator : public SpineObject {
|
||||
public:
|
||||
~Triangulator();
|
||||
|
||||
Vector<int> &triangulate(Vector<float> &vertices);
|
||||
|
||||
Vector<Vector < float>* >
|
||||
decompose(Vector<float>
|
||||
& vertices,
|
||||
Vector<int> &triangles
|
||||
);
|
||||
Vector< Vector<float>* > &decompose(Vector<float> &vertices, Vector<int> &triangles);
|
||||
|
||||
|
||||
String toString() const;
|
||||
|
||||
private:
|
||||
Vector<Vector < float>* >
|
||||
_convexPolygons;
|
||||
Vector<Vector < int>* >
|
||||
_convexPolygonsIndices;
|
||||
Vector<Vector < float>* > _convexPolygons;
|
||||
Vector<Vector < int>* > _convexPolygonsIndices;
|
||||
|
||||
Vector<int> _indices;
|
||||
Vector<bool> _isConcaveArray;
|
||||
Vector<int> _triangles;
|
||||
|
||||
Pool <Vector<float>> _polygonPool;
|
||||
Pool <Vector<int>> _polygonIndicesPool;
|
||||
Pool <Vector<float> > _polygonPool;
|
||||
Pool <Vector<int> > _polygonIndicesPool;
|
||||
|
||||
static bool isConcave(int index, int vertexCount, Vector<float> &vertices, Vector<int> &indices);
|
||||
|
||||
|
||||
@ -196,18 +196,6 @@ public:
|
||||
return _buffer;
|
||||
}
|
||||
|
||||
String toString() const {
|
||||
String str;
|
||||
str.append("Vector { size: ").append((int) _size).append(", items: [\n");
|
||||
for (size_t i = 0; i < _size; i++) {
|
||||
str.append(" ").append(_buffer[i]);
|
||||
if (i != _size - 1) str.append(",\n");
|
||||
else str.append("\n");
|
||||
}
|
||||
str.append("] }");
|
||||
return str;
|
||||
}
|
||||
|
||||
private:
|
||||
size_t _size;
|
||||
size_t _capacity;
|
||||
|
||||
@ -38,10 +38,6 @@ class Vertices : public SpineObject {
|
||||
public:
|
||||
Vector<int> _bones;
|
||||
Vector<float> _vertices;
|
||||
|
||||
String toString() const {
|
||||
return String("Vertices");
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -140,12 +140,4 @@ int Animation::linearSearch(Vector<float> &values, float target, int step) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
String Animation::toString() const {
|
||||
String str;
|
||||
str.append("Animation { name: ").appendString(_name).append(", duration: ").append(_duration);
|
||||
str.append(",\n timelines: ").appendString(_timelines.toString());
|
||||
str.append("}");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,20 +212,12 @@ void TrackEntry::reset() {
|
||||
_onAnimationEventFunc = dummyOnAnimationEventFunc;
|
||||
}
|
||||
|
||||
String TrackEntry::toString() const {
|
||||
return String("TrackEntry");
|
||||
}
|
||||
|
||||
EventQueueEntry::EventQueueEntry(EventType eventType, TrackEntry *trackEntry, Event *event) :
|
||||
_type(eventType),
|
||||
_entry(trackEntry),
|
||||
_event(event) {
|
||||
}
|
||||
|
||||
String EventQueueEntry::toString() const {
|
||||
return String("EventQueueEntry");
|
||||
}
|
||||
|
||||
EventQueue *EventQueue::newEventQueue(AnimationState &state, Pool<TrackEntry> &trackEntryPool) {
|
||||
return new(__FILE__, __LINE__) EventQueue(state, trackEntryPool);
|
||||
}
|
||||
@ -311,10 +303,6 @@ void EventQueue::drain() {
|
||||
_drainDisabled = false;
|
||||
}
|
||||
|
||||
String EventQueue::toString() const {
|
||||
return String("EventQueue");
|
||||
}
|
||||
|
||||
const int AnimationState::Subsequent = 0;
|
||||
const int AnimationState::First = 1;
|
||||
const int AnimationState::Dip = 2;
|
||||
@ -330,6 +318,24 @@ AnimationState::AnimationState(AnimationStateData *data) :
|
||||
}
|
||||
|
||||
AnimationState::~AnimationState() {
|
||||
for (int i = 0; i < _tracks.size(); i++) {
|
||||
TrackEntry* entry = _tracks[i];
|
||||
if (entry) {
|
||||
TrackEntry* from = entry->_mixingFrom;
|
||||
while (from) {
|
||||
TrackEntry* curr = from;
|
||||
from = curr->_mixingFrom;
|
||||
delete curr;
|
||||
}
|
||||
TrackEntry* next = entry->_next;
|
||||
while (next) {
|
||||
TrackEntry* curr = next;
|
||||
next = curr->_next;
|
||||
delete curr;
|
||||
}
|
||||
delete entry;
|
||||
}
|
||||
}
|
||||
delete _queue;
|
||||
}
|
||||
|
||||
@ -975,7 +981,4 @@ void AnimationState::animationsChanged() {
|
||||
}
|
||||
}
|
||||
|
||||
String AnimationState::toString() const {
|
||||
return String("AnimationState");
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,10 +74,6 @@ void AnimationStateData::setDefaultMix(float inValue) {
|
||||
_defaultMix = inValue;
|
||||
}
|
||||
|
||||
String AnimationStateData::toString() const {
|
||||
return String("AnimationStateData");
|
||||
}
|
||||
|
||||
AnimationStateData::AnimationPair::AnimationPair(Animation *a1, Animation *a2) : _a1(a1), _a2(a2) {
|
||||
}
|
||||
|
||||
@ -85,12 +81,6 @@ bool AnimationStateData::AnimationPair::operator==(const AnimationPair &other) c
|
||||
return _a1->_name == other._a1->_name && _a2->_name == other._a2->_name;
|
||||
}
|
||||
|
||||
String AnimationStateData::AnimationPair::toString() const {
|
||||
String str;
|
||||
str.append("AnimationPair { ").append(_a1->_name).append(" -> ").append(_a2->_name).append(" } ");
|
||||
return str;
|
||||
}
|
||||
|
||||
std::size_t
|
||||
AnimationStateData::HashAnimationPair::operator()(const Spine::AnimationStateData::AnimationPair &val) const {
|
||||
std::size_t h1 = 7;
|
||||
|
||||
@ -349,7 +349,4 @@ int Atlas::toInt(Str *str) {
|
||||
return (int) strtol(str->begin, (char **) &str->end, 10);
|
||||
}
|
||||
|
||||
String Atlas::toString() const {
|
||||
return String("Atlas");
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,4 @@ AtlasRegion *AtlasAttachmentLoader::findRegion(const String &name) {
|
||||
return _atlas->findRegion(name);
|
||||
}
|
||||
|
||||
String AtlasAttachmentLoader::toString() const {
|
||||
return String("AtlasAttachmentLoader");
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,11 +545,4 @@ void Bone::updateAppliedTransform() {
|
||||
}
|
||||
}
|
||||
|
||||
String Bone::toString() const {
|
||||
String str;
|
||||
str.append("Bone { name: ").appendString(_data.getName());
|
||||
str.append(", a: ").append(_a).append(", b: ").append(_b).append(", c").append(_c).append(", d: ").append(_d);
|
||||
str.append(", worldX: ").append(_worldX).append(", worldY: ").append(_worldY).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,4 @@ void BoneData::setTransformMode(TransformMode inValue) {
|
||||
_transformMode = inValue;
|
||||
}
|
||||
|
||||
String BoneData::toString() const {
|
||||
return String("BoneData");
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,12 +35,4 @@ RTTI_IMPL(BoundingBoxAttachment, VertexAttachment);
|
||||
|
||||
BoundingBoxAttachment::BoundingBoxAttachment(const String &name) : VertexAttachment(name) {
|
||||
}
|
||||
|
||||
String BoundingBoxAttachment::toString() const {
|
||||
String str;
|
||||
str.append("BoundingBoxAttachment { name: ").appendString(getName()).append(", worldVerticesLength: ").append(
|
||||
_worldVerticesLength);
|
||||
str.append(",\n bones: ").append(_bones).append(",\n weights: ").append(_vertices).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,12 +45,4 @@ SlotData *ClippingAttachment::getEndSlot() {
|
||||
void ClippingAttachment::setEndSlot(SlotData *inValue) {
|
||||
_endSlot = inValue;
|
||||
}
|
||||
|
||||
String ClippingAttachment::toString() const {
|
||||
String str;
|
||||
str.append("Clipping { name: ").appendString(getName());
|
||||
str.append(", worldVerticesLength: ").append(_worldVerticesLength);
|
||||
str.append(", bones: ").append(_bones).append(", weights: ").append(_vertices).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,4 @@ void Event::setStringValue(const String &inValue) {
|
||||
_stringValue = inValue;
|
||||
}
|
||||
|
||||
String Event::toString() const {
|
||||
return String("Event");
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,4 @@ void EventData::setStringValue(const String &inValue) {
|
||||
_stringValue = inValue;
|
||||
}
|
||||
|
||||
String EventData::toString() const {
|
||||
return String("EventData");
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,10 +258,4 @@ void IkConstraint::setMix(float inValue) {
|
||||
_mix = inValue;
|
||||
}
|
||||
|
||||
String IkConstraint::toString() const {
|
||||
String str;
|
||||
str.append("IkConstraint { name: ").appendString(_data.getName());
|
||||
str.append("}");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,7 +81,4 @@ void IkConstraintData::setMix(float inValue) {
|
||||
_mix = inValue;
|
||||
}
|
||||
|
||||
String IkConstraintData::toString() const {
|
||||
return String("IkConstraintData");
|
||||
}
|
||||
}
|
||||
|
||||
@ -538,7 +538,4 @@ int Json::json_strcasecmp(const char *s1, const char *s2) {
|
||||
}
|
||||
}
|
||||
|
||||
String Json::toString() const {
|
||||
return String("Json");
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,4 @@ LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, int slotIndex,
|
||||
_parent(parent) {
|
||||
}
|
||||
|
||||
String LinkedMesh::toString() const {
|
||||
return String("LinkedMesh");
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,9 +272,4 @@ Spine::Color &MeshAttachment::getColor() {
|
||||
return _color;
|
||||
}
|
||||
|
||||
String MeshAttachment::toString() const {
|
||||
String str;
|
||||
str.append("RegionAttachment { name: ").appendString(getName()).append(", path: ").appendString(_path).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,12 +61,4 @@ void PathAttachment::setConstantSpeed(bool inValue) {
|
||||
_constantSpeed = inValue;
|
||||
}
|
||||
|
||||
String PathAttachment::toString() const {
|
||||
String str;
|
||||
str.append("PathAttachment { name: ").appendString(getName()).append(", closed: ").append(_closed).append(
|
||||
", constantSpeed: ").append(_constantSpeed);
|
||||
str.append(", worldVerticesLength: ").append(_worldVerticesLength);
|
||||
str.append(", bones: ").append(_bones).append(", weights: ").append(_vertices).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -547,9 +547,4 @@ void PathConstraint::addCurvePosition(float p, float x1, float y1, float cx1, fl
|
||||
}
|
||||
}
|
||||
|
||||
String PathConstraint::toString() const {
|
||||
String str;
|
||||
str.append("TransformConstraint { name: ").appendString(_data.getName()).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,9 +139,4 @@ void PathConstraintData::setTranslateMix(float inValue) {
|
||||
_translateMix = inValue;
|
||||
}
|
||||
|
||||
String PathConstraintData::toString() const {
|
||||
String str;
|
||||
str.append("PathConstraintData { name: ").appendString(_name).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,9 +77,4 @@ void PointAttachment::setRotation(float inValue) {
|
||||
_rotation = inValue;
|
||||
}
|
||||
|
||||
String PointAttachment::toString() const {
|
||||
String str;
|
||||
str.append("PointAttachment { name: ").appendString(getName()).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,9 +60,4 @@ bool RTTI::instanceOf(const RTTI &rtti) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
String RTTI::toString() const {
|
||||
String str;
|
||||
str.append("RTTI { name: ").append(_className.c_str()).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,10 +283,4 @@ Vector<float> &RegionAttachment::getUVs() {
|
||||
Spine::Color &RegionAttachment::getColor() {
|
||||
return _color;
|
||||
}
|
||||
|
||||
String RegionAttachment::toString() const {
|
||||
String str;
|
||||
str.append("RegionAttachment { name: ").appendString(getName()).append(", path: ").appendString(_path).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -644,16 +644,4 @@ void Skeleton::sortReset(Vector<Bone *> &bones) {
|
||||
bone->_sorted = false;
|
||||
}
|
||||
}
|
||||
|
||||
String Skeleton::toString() const {
|
||||
String str;
|
||||
|
||||
str.append("Skeleton {\n");
|
||||
str.append(" bones: ").append(_bones);
|
||||
str.append(",\n slots: ").append(_slots);
|
||||
str.append(",\n drawOrder: ").append(_drawOrder);
|
||||
str.append(",\n animations: ").append(_data->getAnimations());
|
||||
str.append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1008,8 +1008,4 @@ void SkeletonBinary::readCurve(DataInput *input, int frameIndex, CurveTimeline *
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String SkeletonBinary::toString() const {
|
||||
return String("SkeletonBinary");
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,14 +232,5 @@ void SkeletonBounds::aabbCompute() {
|
||||
_maxY = maxY;
|
||||
}
|
||||
|
||||
String SkeletonBounds::toString() const {
|
||||
return String("SkeletonBounds");
|
||||
}
|
||||
|
||||
String Polygon::toString() const {
|
||||
String str;
|
||||
str.append("Polygon { count: ").append(_count).append(", vertices: ").append(_vertices).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -52,20 +52,17 @@ int SkeletonClipping::clipStart(Slot &slot, ClippingAttachment *clip) {
|
||||
_clippingPolygon.setSize(n, 0);
|
||||
clip->computeWorldVertices(slot, 0, n, _clippingPolygon, 0, 2);
|
||||
makeClockwise(_clippingPolygon);
|
||||
Vector<Vector<float> *> clippingPolygons = _triangulator.decompose(_clippingPolygon,
|
||||
_triangulator.triangulate(_clippingPolygon));
|
||||
_clippingPolygons = &_triangulator.decompose(_clippingPolygon, _triangulator.triangulate(_clippingPolygon));
|
||||
|
||||
_clippingPolygons.clearAndAddAll(clippingPolygons);
|
||||
|
||||
for (size_t i = 0; i < _clippingPolygons.size(); ++i) {
|
||||
Vector<float> *polygonP = _clippingPolygons[i];
|
||||
for (size_t i = 0; i < _clippingPolygons->size(); ++i) {
|
||||
Vector<float> *polygonP = (*_clippingPolygons)[i];
|
||||
Vector<float> &polygon = *polygonP;
|
||||
makeClockwise(polygon);
|
||||
polygon.add(polygon[0]);
|
||||
polygon.add(polygon[1]);
|
||||
}
|
||||
|
||||
return static_cast<int>(_clippingPolygons.size());
|
||||
return static_cast<int>((*_clippingPolygons).size());
|
||||
}
|
||||
|
||||
void SkeletonClipping::clipEnd(Slot &slot) {
|
||||
@ -80,8 +77,9 @@ void SkeletonClipping::clipEnd() {
|
||||
}
|
||||
|
||||
_clipAttachment = NULL;
|
||||
_clippingPolygons.clear();
|
||||
_clippingPolygons = NULL;
|
||||
_clippedVertices.clear();
|
||||
_clippedUVs.clear();
|
||||
_clippedTriangles.clear();
|
||||
_clippingPolygon.clear();
|
||||
}
|
||||
@ -91,8 +89,8 @@ void SkeletonClipping::clipTriangles(Vector<float> &vertices, int verticesLength
|
||||
Vector<float> &clipOutput = _clipOutput;
|
||||
Vector<float> &clippedVertices = _clippedVertices;
|
||||
Vector<unsigned short> &clippedTriangles = _clippedTriangles;
|
||||
Vector<Vector<float> *> &polygons = _clippingPolygons;
|
||||
int polygonsCount = static_cast<int>(_clippingPolygons.size());
|
||||
Vector<Vector<float> *> &polygons = *_clippingPolygons;
|
||||
int polygonsCount = static_cast<int>((*_clippingPolygons).size());
|
||||
|
||||
int index = 0;
|
||||
clippedVertices.clear();
|
||||
@ -318,7 +316,4 @@ void SkeletonClipping::makeClockwise(Vector<float> &polygon) {
|
||||
}
|
||||
}
|
||||
|
||||
String SkeletonClipping::toString() const {
|
||||
return String("SkeletonClipping");
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,8 +230,4 @@ float SkeletonData::getFps() {
|
||||
void SkeletonData::setFps(float inValue) {
|
||||
_fps = inValue;
|
||||
}
|
||||
|
||||
String SkeletonData::toString() const {
|
||||
return String("SkeletonData");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1213,8 +1213,4 @@ void SkeletonJson::setError(Json *root, const String &value1, const String &valu
|
||||
|
||||
delete root;
|
||||
}
|
||||
|
||||
String SkeletonJson::toString() const {
|
||||
return String("SkeletonJson");
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,12 +47,6 @@ bool Skin::AttachmentKey::operator==(const AttachmentKey &other) const {
|
||||
return _slotIndex == other._slotIndex && _name == other._name;
|
||||
}
|
||||
|
||||
String Skin::AttachmentKey::toString() const {
|
||||
String str;
|
||||
str.append("AttachmentKey { slotIndex: ").append(_slotIndex).append(", name: ").appendString(_name).append(" }");
|
||||
return str;
|
||||
}
|
||||
|
||||
std::size_t Skin::HashAttachmentKey::operator()(const Spine::Skin::AttachmentKey &val) const {
|
||||
std::size_t h1 = val._slotIndex;
|
||||
return h1;
|
||||
@ -128,12 +122,4 @@ void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String Skin::toString() const {
|
||||
String str;
|
||||
str.append("Skin { name: ").appendString(_name);
|
||||
str.append(",\n attachments: ").append(_attachments);
|
||||
str.append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,12 +118,4 @@ void Slot::setAttachmentVertices(Vector<float> &inValue) {
|
||||
_attachmentVertices.clearAndAddAll(inValue);
|
||||
}
|
||||
|
||||
String Slot::toString() const {
|
||||
String str;
|
||||
str.append("Slot { name: ").appendString(_data.getName());
|
||||
str.append(", color: ").appendString(_color.toString());
|
||||
if (_hasDarkColor) str.append(", darkColor: ").appendString(_darkColor.toString());
|
||||
str.append("}");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +90,4 @@ void SlotData::setBlendMode(BlendMode inValue) {
|
||||
_blendMode = inValue;
|
||||
}
|
||||
|
||||
String SlotData::toString() const {
|
||||
return String("SlotData");
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,9 +42,4 @@ Timeline::Timeline() {
|
||||
Timeline::~Timeline() {
|
||||
}
|
||||
|
||||
String Timeline::toString() const {
|
||||
String str;
|
||||
str.appendString(getRTTI().toString());
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,10 +376,4 @@ void TransformConstraint::applyRelativeLocal() {
|
||||
bone.updateWorldTransform(x, y, rotation, scaleX, scaleY, bone._ashearX, shearY);
|
||||
}
|
||||
}
|
||||
|
||||
String TransformConstraint::toString() const {
|
||||
String str;
|
||||
str.append("TransformConstraint { name: ").appendString(_data.getName()).append(" }");
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,7 +118,4 @@ bool TransformConstraintData::isLocal() {
|
||||
return _local;
|
||||
}
|
||||
|
||||
String TransformConstraintData::toString() const {
|
||||
return String("TransformConstraintData");
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,12 @@
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
namespace Spine {
|
||||
|
||||
Triangulator::~Triangulator() {
|
||||
ContainerUtil::cleanUpVectorOfPointers(_convexPolygons);
|
||||
ContainerUtil::cleanUpVectorOfPointers(_convexPolygonsIndices);
|
||||
}
|
||||
|
||||
Vector<int> &Triangulator::triangulate(Vector<float> &vertices) {
|
||||
int vertexCount = static_cast<int>(vertices.size() >> 1);
|
||||
|
||||
@ -123,14 +129,14 @@ Vector<int> &Triangulator::triangulate(Vector<float> &vertices) {
|
||||
return triangles;
|
||||
}
|
||||
|
||||
Vector<Vector<float> *> Triangulator::decompose(Vector<float> &vertices, Vector<int> &triangles) {
|
||||
Vector<Vector<float> *> &Triangulator::decompose(Vector<float> &vertices, Vector<int> &triangles) {
|
||||
Vector<Vector<float> *> &convexPolygons = _convexPolygons;
|
||||
for (size_t i = 0, n = convexPolygons.size(); i < n; ++i) {
|
||||
_polygonPool.free(convexPolygons[i]);
|
||||
}
|
||||
convexPolygons.clear();
|
||||
|
||||
Vector<Vector<int> *> convexPolygonsIndices = _convexPolygonsIndices;
|
||||
Vector<Vector<int> *> &convexPolygonsIndices = _convexPolygonsIndices;
|
||||
for (size_t i = 0, n = convexPolygonsIndices.size(); i < n; ++i) {
|
||||
_polygonIndicesPool.free(convexPolygonsIndices[i]);
|
||||
}
|
||||
@ -291,7 +297,4 @@ int Triangulator::winding(float p1x, float p1y, float p2x, float p2y, float p3x,
|
||||
return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
String Triangulator::toString() const {
|
||||
return String("Triangulator");
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,6 +197,8 @@ void goblins (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
window.draw(*drawable);
|
||||
window.display();
|
||||
}
|
||||
|
||||
delete drawable;
|
||||
}
|
||||
|
||||
void raptor (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
@ -238,6 +240,8 @@ void raptor (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
window.display();
|
||||
}
|
||||
// BOZO spSwirlVertexEffect_dispose(effect);
|
||||
|
||||
delete drawable;
|
||||
}
|
||||
|
||||
void tank (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
@ -266,6 +270,8 @@ void tank (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
window.draw(*drawable);
|
||||
window.display();
|
||||
}
|
||||
|
||||
delete drawable;
|
||||
}
|
||||
|
||||
void vine (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
@ -295,6 +301,8 @@ void vine (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
window.draw(*drawable);
|
||||
window.display();
|
||||
}
|
||||
|
||||
delete drawable;
|
||||
}
|
||||
|
||||
void stretchyman (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
@ -360,6 +368,8 @@ void coin (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
window.draw(*drawable);
|
||||
window.display();
|
||||
}
|
||||
|
||||
delete drawable;
|
||||
}
|
||||
|
||||
void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
@ -413,6 +423,8 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
window.draw(*drawable);
|
||||
window.display();
|
||||
}
|
||||
|
||||
delete drawable;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -429,8 +441,6 @@ void test (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
animState->update(d);
|
||||
animState->apply(*skeleton);
|
||||
skeleton->updateWorldTransform();
|
||||
printf("%s\n", skeleton->toString().buffer());
|
||||
printf("========================================\n");
|
||||
d += 0.1f;
|
||||
}
|
||||
|
||||
@ -441,9 +451,8 @@ void test (SkeletonData* skeletonData, Atlas* atlas) {
|
||||
|
||||
int main () {
|
||||
DebugExtension dbgExtension;
|
||||
// SpineExtension::setInstance(&dbgExtension);
|
||||
SpineExtension::setInstance(&dbgExtension);
|
||||
testcase(test, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 1.0f);
|
||||
testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f);
|
||||
testcase(spineboy, "data/spineboy-ess.json", "data/spineboy-ess.skel", "data/spineboy.atlas", 0.6f);
|
||||
testcase(owl, "data/owl-pro.json", "data/owl-pro.skel", "data/owl.atlas", 0.5f);
|
||||
testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user