mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[cpp] First Clang-Tidy run.
This commit is contained in:
parent
895407b69d
commit
a8af3fa07e
@ -3,8 +3,8 @@ project(spine_cpp_unit_test)
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "./")
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
||||
|
||||
include_directories(../spine-cpp/include teamcity minicppunit tests memory)
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ void Spine::TestSpineExtension::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);
|
||||
}
|
||||
if (allocated.size() == 0) printf("No leaks detected");
|
||||
if (allocated.empty()) printf("No leaks detected");
|
||||
}
|
||||
|
||||
void Spine::TestSpineExtension::clearAllocations() {
|
||||
|
||||
@ -42,7 +42,7 @@ namespace Spine {
|
||||
const char* fileName;
|
||||
int line;
|
||||
|
||||
Allocation() : address(0), size(0), fileName(0), line(0) {
|
||||
Allocation() : address(NULL), size(0), fileName(NULL), line(0) {
|
||||
}
|
||||
|
||||
Allocation(void* a, size_t s, const char* f, int l) : address(a), size(s), fileName(f), line(l) {
|
||||
|
||||
@ -45,36 +45,36 @@
|
||||
using namespace Spine;
|
||||
|
||||
void loadBinary(const char* binaryFile, const char* atlasFile, Atlas* &atlas, SkeletonData* &skeletonData, AnimationStateData* &stateData, Skeleton* &skeleton, AnimationState* &state) {
|
||||
atlas = new (__FILE__, __LINE__) Atlas(atlasFile, 0);
|
||||
assert(atlas != 0);
|
||||
atlas = new (__FILE__, __LINE__) Atlas(atlasFile, NULL);
|
||||
assert(atlas != NULL);
|
||||
|
||||
SkeletonBinary binary(atlas);
|
||||
skeletonData = binary.readSkeletonDataFile(binaryFile);
|
||||
assert(skeletonData);
|
||||
|
||||
skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData);
|
||||
assert(skeleton != 0);
|
||||
assert(skeleton != NULL);
|
||||
|
||||
stateData = new (__FILE__, __LINE__) AnimationStateData(skeletonData);
|
||||
assert(stateData != 0);
|
||||
assert(stateData != NULL);
|
||||
stateData->setDefaultMix(0.4f);
|
||||
|
||||
state = new (__FILE__, __LINE__) AnimationState(stateData);
|
||||
}
|
||||
|
||||
void loadJson(const char* jsonFile, const char* atlasFile, Atlas* &atlas, SkeletonData* &skeletonData, AnimationStateData* &stateData, Skeleton* &skeleton, AnimationState* &state) {
|
||||
atlas = new (__FILE__, __LINE__) Atlas(atlasFile, 0);
|
||||
assert(atlas != 0);
|
||||
atlas = new (__FILE__, __LINE__) Atlas(atlasFile, NULL);
|
||||
assert(atlas != NULL);
|
||||
|
||||
SkeletonJson json(atlas);
|
||||
skeletonData = json.readSkeletonDataFile(jsonFile);
|
||||
assert(skeletonData);
|
||||
|
||||
skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData);
|
||||
assert(skeleton != 0);
|
||||
assert(skeleton != NULL);
|
||||
|
||||
stateData = new (__FILE__, __LINE__) AnimationStateData(skeletonData);
|
||||
assert(stateData != 0);
|
||||
assert(stateData != NULL);
|
||||
stateData->setDefaultMix(0.4f);
|
||||
|
||||
state = new (__FILE__, __LINE__) AnimationState(stateData);
|
||||
@ -89,11 +89,11 @@ void dispose(Atlas* atlas, SkeletonData* skeletonData, AnimationStateData* state
|
||||
}
|
||||
|
||||
void reproduceIssue_776() {
|
||||
Atlas* atlas = 0;
|
||||
SkeletonData* skeletonData = 0;
|
||||
AnimationStateData* stateData = 0;
|
||||
Skeleton* skeleton = 0;
|
||||
AnimationState* state = 0;
|
||||
Atlas* atlas = NULL;
|
||||
SkeletonData* skeletonData = NULL;
|
||||
AnimationStateData* stateData = NULL;
|
||||
Skeleton* skeleton = NULL;
|
||||
AnimationState* state = NULL;
|
||||
|
||||
loadJson(R_JSON, R_ATLAS, atlas, skeletonData, stateData, skeleton, state);
|
||||
dispose(atlas, skeletonData, stateData, skeleton, state);
|
||||
|
||||
@ -289,7 +289,7 @@ namespace Spine {
|
||||
friend class EventQueue;
|
||||
|
||||
public:
|
||||
AnimationState(AnimationStateData* data);
|
||||
explicit AnimationState(AnimationStateData* data);
|
||||
|
||||
~AnimationState();
|
||||
|
||||
|
||||
@ -52,8 +52,8 @@ namespace Spine {
|
||||
/// The mix duration to use when no mix duration has been specifically defined between two animations.
|
||||
float getDefaultMix();
|
||||
void setDefaultMix(float inValue);
|
||||
|
||||
AnimationStateData(SkeletonData* skeletonData);
|
||||
|
||||
explicit AnimationStateData(SkeletonData* skeletonData);
|
||||
|
||||
/// Sets a mix duration by animation names.
|
||||
void setMix(const String& fromName, const String& toName, float duration);
|
||||
@ -73,8 +73,8 @@ namespace Spine {
|
||||
public:
|
||||
Animation* _a1;
|
||||
Animation* _a2;
|
||||
|
||||
AnimationPair(Animation* a1 = NULL, Animation* a2 = NULL);
|
||||
|
||||
explicit AnimationPair(Animation* a1 = NULL, Animation* a2 = NULL);
|
||||
|
||||
bool operator==(const AnimationPair &other) const;
|
||||
};
|
||||
|
||||
@ -73,8 +73,11 @@ namespace Spine {
|
||||
TextureWrap vWrap;
|
||||
void* rendererObject;
|
||||
int width, height;
|
||||
|
||||
AtlasPage(const String& inName) : name(inName) {}
|
||||
|
||||
explicit AtlasPage(const String& inName) : name(inName), format(Format_RGBA8888), minFilter(TextureFilter_Nearest),
|
||||
magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge),
|
||||
vWrap(TextureWrap_ClampToEdge) {
|
||||
}
|
||||
};
|
||||
|
||||
class AtlasRegion : public SpineObject {
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
AtlasAttachmentLoader(Atlas* atlas);
|
||||
explicit AtlasAttachmentLoader(Atlas* atlas);
|
||||
|
||||
virtual RegionAttachment* newRegionAttachment(Skin& skin, const String& name, const String& path);
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
Attachment(const String& name);
|
||||
explicit Attachment(const String& name);
|
||||
virtual ~Attachment();
|
||||
|
||||
const String& getName();
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
AttachmentTimeline(int frameCount);
|
||||
explicit AttachmentTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ namespace Spine {
|
||||
class BoundingBoxAttachment : public VertexAttachment {
|
||||
RTTI_DECL
|
||||
|
||||
BoundingBoxAttachment(const String& name);
|
||||
explicit BoundingBoxAttachment(const String& name);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ClippingAttachment(const String& name);
|
||||
explicit ClippingAttachment(const String& name);
|
||||
|
||||
SlotData* getEndSlot();
|
||||
void setEndSlot(SlotData* inValue);
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Spine {
|
||||
public:
|
||||
static const int ENTRIES;
|
||||
|
||||
ColorTimeline (int frameCount);
|
||||
explicit ColorTimeline (int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -34,15 +34,13 @@
|
||||
#include <spine/Timeline.h>
|
||||
#include <spine/Vector.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace Spine {
|
||||
/// Base class for frames that use an interpolation bezier curve.
|
||||
class CurveTimeline : public Timeline {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
CurveTimeline(int frameCount);
|
||||
explicit CurveTimeline(int frameCount);
|
||||
|
||||
virtual ~CurveTimeline();
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
DeformTimeline(int frameCount);
|
||||
explicit DeformTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
DrawOrderTimeline(int frameCount);
|
||||
explicit DrawOrderTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ namespace Spine {
|
||||
friend class Event;
|
||||
|
||||
public:
|
||||
EventData(const String& name);
|
||||
explicit EventData(const String& name);
|
||||
|
||||
/// The name of the event, which is unique within the skeleton.
|
||||
const String& getName();
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
EventTimeline(int frameCount);
|
||||
explicit EventTimeline(int frameCount);
|
||||
|
||||
~EventTimeline();
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ namespace Spine {
|
||||
friend class HashMap;
|
||||
|
||||
public:
|
||||
Iterator(Entry* entry = NULL) : _entry(entry) {
|
||||
explicit Iterator(Entry* entry = NULL) : _entry(entry) {
|
||||
// Empty
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ namespace Spine {
|
||||
friend class IkConstraintTimeline;
|
||||
|
||||
public:
|
||||
IkConstraintData(const String& name);
|
||||
explicit IkConstraintData(const String& name);
|
||||
|
||||
/// The IK constraint's name, which is unique within the skeleton.
|
||||
const String& getName();
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Spine {
|
||||
public:
|
||||
static const int ENTRIES;
|
||||
|
||||
IkConstraintTimeline(int frameCount);
|
||||
explicit IkConstraintTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ namespace Spine {
|
||||
static const char* getError();
|
||||
|
||||
/* Supply a block of JSON, and this returns a Json object you can interrogate. Call Json_dispose when finished. */
|
||||
Json(const char* value);
|
||||
explicit Json(const char* value);
|
||||
|
||||
~Json();
|
||||
|
||||
|
||||
@ -37,18 +37,18 @@
|
||||
#include <float.h>
|
||||
|
||||
#define SPINE_PI 3.1415927f
|
||||
#define SPINE_PI_2 SPINE_PI * 2
|
||||
#define RadDeg 180.0f / SPINE_PI
|
||||
#define DegRad SPINE_PI / 180.0f
|
||||
#define SPINE_PI_2 (SPINE_PI * 2)
|
||||
#define RadDeg (180.0f / SPINE_PI)
|
||||
#define DegRad (SPINE_PI / 180.0f)
|
||||
#define SIN_BITS 14 // 16KB. Adjust for accuracy.
|
||||
#define SIN_MASK ~(-(1 << SIN_BITS))
|
||||
#define SIN_COUNT SIN_MASK + 1
|
||||
#define RadFull SPINE_PI * 2
|
||||
#define SIN_MASK (~(-(1 << SIN_BITS)))
|
||||
#define SIN_COUNT (SIN_MASK + 1)
|
||||
#define RadFull (SPINE_PI * 2)
|
||||
#define DegFull 360
|
||||
#define RadToIndex SIN_COUNT / RadFull
|
||||
#define DegToIndex SIN_COUNT / DegFull
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define RadToIndex (SIN_COUNT / RadFull)
|
||||
#define DegToIndex (SIN_COUNT / DegFull)
|
||||
#define MAX(a, b) ((((a) > (b)) ? (a) : (b)))
|
||||
#define MIN(a, b) ((((a) < (b)) ? (a) : (b)))
|
||||
|
||||
namespace Spine {
|
||||
template <typename T>
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
MeshAttachment(const String& name);
|
||||
explicit MeshAttachment(const String& name);
|
||||
|
||||
void updateUVs();
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
PathAttachment(const String& name);
|
||||
explicit PathAttachment(const String& name);
|
||||
|
||||
/// The length in the setup pose from the start of the path to the end of each curve.
|
||||
Vector<float>& getLengths();
|
||||
|
||||
@ -53,7 +53,7 @@ namespace Spine {
|
||||
friend class PathConstraintSpacingTimeline;
|
||||
|
||||
public:
|
||||
PathConstraintData(const String& name);
|
||||
explicit PathConstraintData(const String& name);
|
||||
|
||||
const String& getName();
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Spine {
|
||||
public:
|
||||
static const int ENTRIES;
|
||||
|
||||
PathConstraintMixTimeline(int frameCount);
|
||||
explicit PathConstraintMixTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ namespace Spine {
|
||||
public:
|
||||
static const int ENTRIES;
|
||||
|
||||
PathConstraintPositionTimeline(int frameCount);
|
||||
explicit PathConstraintPositionTimeline(int frameCount);
|
||||
|
||||
virtual ~PathConstraintPositionTimeline();
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
PathConstraintSpacingTimeline(int frameCount);
|
||||
explicit PathConstraintSpacingTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
PointAttachment(const String& name);
|
||||
explicit PointAttachment(const String& name);
|
||||
|
||||
void computeWorldPosition(Bone& bone, float& ox, float& oy);
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
namespace Spine {
|
||||
class RTTI : public SpineObject {
|
||||
public:
|
||||
RTTI(const std::string& className);
|
||||
explicit RTTI(const std::string& className);
|
||||
|
||||
RTTI(const std::string& className, const RTTI& baseRTTI);
|
||||
|
||||
@ -53,7 +53,7 @@ namespace Spine {
|
||||
RTTI(const RTTI& obj);
|
||||
RTTI& operator=(const RTTI& obj);
|
||||
|
||||
const std::string& _className;
|
||||
const std::string _className;
|
||||
const RTTI *_pBaseRTTI;
|
||||
};
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
RegionAttachment(const String& name);
|
||||
explicit RegionAttachment(const String& name);
|
||||
|
||||
void updateOffset();
|
||||
|
||||
|
||||
@ -43,8 +43,8 @@ namespace Spine {
|
||||
|
||||
public:
|
||||
static const int ENTRIES = 2;
|
||||
|
||||
RotateTimeline(int frameCount);
|
||||
|
||||
explicit RotateTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ScaleTimeline(int frameCount);
|
||||
explicit ScaleTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ShearTimeline(int frameCount);
|
||||
explicit ShearTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ namespace Spine {
|
||||
friend class TwoColorTimeline;
|
||||
|
||||
public:
|
||||
Skeleton(SkeletonData* skeletonData);
|
||||
explicit Skeleton(SkeletonData* skeletonData);
|
||||
|
||||
~Skeleton();
|
||||
|
||||
@ -169,9 +169,9 @@ namespace Spine {
|
||||
float getY();
|
||||
void setY(float inValue);
|
||||
bool getFlipX();
|
||||
void setFlipX(float inValue);
|
||||
void setFlipX(bool inValue);
|
||||
bool getFlipY();
|
||||
void setFlipY(float inValue);
|
||||
void setFlipY(bool inValue);
|
||||
|
||||
private:
|
||||
SkeletonData* _data;
|
||||
|
||||
@ -67,14 +67,14 @@ namespace Spine {
|
||||
static const int CURVE_BEZIER;
|
||||
|
||||
static const TransformMode TRANSFORM_MODE_VALUES[5];
|
||||
|
||||
SkeletonBinary(Atlas* atlasArray);
|
||||
|
||||
SkeletonBinary(AttachmentLoader* attachmentLoader);
|
||||
|
||||
explicit SkeletonBinary(Atlas* atlasArray);
|
||||
|
||||
explicit SkeletonBinary(AttachmentLoader* attachmentLoader);
|
||||
|
||||
~SkeletonBinary();
|
||||
|
||||
SkeletonData* readSkeletonData(const unsigned char* binary, const int length);
|
||||
SkeletonData* readSkeletonData(const unsigned char* binary, int length);
|
||||
|
||||
SkeletonData* readSkeletonDataFile(const char* path);
|
||||
|
||||
@ -100,7 +100,7 @@ namespace Spine {
|
||||
|
||||
signed char readSByte(DataInput* input);
|
||||
|
||||
int readBoolean(DataInput* input);
|
||||
bool readBoolean(DataInput* input);
|
||||
|
||||
int readInt(DataInput* input);
|
||||
|
||||
|
||||
@ -47,9 +47,9 @@ namespace Spine {
|
||||
|
||||
class SkeletonJson : public SpineObject {
|
||||
public:
|
||||
SkeletonJson(Atlas* atlas);
|
||||
|
||||
SkeletonJson(AttachmentLoader* attachmentLoader);
|
||||
explicit SkeletonJson(Atlas* atlas);
|
||||
|
||||
explicit SkeletonJson(AttachmentLoader* attachmentLoader);
|
||||
|
||||
~SkeletonJson();
|
||||
|
||||
|
||||
@ -50,8 +50,8 @@ namespace Spine {
|
||||
public:
|
||||
int _slotIndex;
|
||||
String _name;
|
||||
|
||||
AttachmentKey(int slotIndex = 0, const String& name = "");
|
||||
|
||||
explicit AttachmentKey(int slotIndex = 0, const String& name = "");
|
||||
|
||||
AttachmentKey(const AttachmentKey &other) {
|
||||
this->_slotIndex = other._slotIndex;
|
||||
@ -64,8 +64,8 @@ namespace Spine {
|
||||
struct HashAttachmentKey : public SpineObject {
|
||||
std::size_t operator()(const Spine::Skin::AttachmentKey& val) const;
|
||||
};
|
||||
|
||||
Skin(const String& name);
|
||||
|
||||
explicit Skin(const String& name);
|
||||
~Skin();
|
||||
|
||||
/// Adds an attachment to the skin for the specified slot index and name.
|
||||
|
||||
@ -47,7 +47,7 @@ namespace Spine {
|
||||
friend class TransformConstraintTimeline;
|
||||
|
||||
public:
|
||||
TransformConstraintData(const String& name);
|
||||
explicit TransformConstraintData(const String& name);
|
||||
|
||||
const String& getName();
|
||||
int getOrder();
|
||||
|
||||
@ -42,8 +42,8 @@ namespace Spine {
|
||||
|
||||
public:
|
||||
static const int ENTRIES;
|
||||
|
||||
TransformConstraintTimeline(int frameCount);
|
||||
|
||||
explicit TransformConstraintTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -45,8 +45,8 @@ namespace Spine {
|
||||
|
||||
public:
|
||||
static const int ENTRIES;
|
||||
|
||||
TranslateTimeline(int frameCount);
|
||||
|
||||
explicit TranslateTimeline(int frameCount);
|
||||
|
||||
virtual ~TranslateTimeline();
|
||||
|
||||
|
||||
@ -42,8 +42,8 @@ namespace Spine {
|
||||
|
||||
public:
|
||||
static const int ENTRIES;
|
||||
|
||||
TwoColorTimeline(int frameCount);
|
||||
|
||||
explicit TwoColorTimeline(int frameCount);
|
||||
|
||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>* pEvents, float alpha, MixPose pose, MixDirection direction);
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ namespace Spine {
|
||||
}
|
||||
}
|
||||
|
||||
Vector& operator=(Vector& inVector) {
|
||||
Vector& operator=(const Vector& inVector) {
|
||||
if (this != &inVector) {
|
||||
clear();
|
||||
deallocate(_buffer);
|
||||
|
||||
@ -47,7 +47,7 @@ namespace Spine {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
VertexAttachment(const String& name);
|
||||
explicit VertexAttachment(const String& name);
|
||||
|
||||
virtual ~VertexAttachment();
|
||||
|
||||
|
||||
@ -310,7 +310,8 @@ namespace Spine {
|
||||
_queue(EventQueue::newEventQueue(*this, _trackEntryPool)),
|
||||
_animationsChanged(false),
|
||||
_onAnimationEventFunc(dummyOnAnimationEventFunc),
|
||||
_timeScale(1) {
|
||||
_timeScale(1),
|
||||
_rendererObject(NULL){
|
||||
// Empty
|
||||
}
|
||||
|
||||
|
||||
@ -279,7 +279,7 @@ namespace Spine {
|
||||
|
||||
int Atlas::beginPast(Str* str, char c) {
|
||||
const char* begin = str->begin;
|
||||
while (1) {
|
||||
while (true) {
|
||||
char lastSkippedChar = *begin;
|
||||
if (begin == str->end) {
|
||||
return 0;
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
|
||||
namespace Spine {
|
||||
DefaultSpineExtension _defaultExtension;
|
||||
|
||||
@ -51,7 +51,7 @@ namespace Spine {
|
||||
float id = 1 / (p._a * p._d - p._b * p._c);
|
||||
float x = targetX - p._worldX, y = targetY - p._worldY;
|
||||
float tx = (x * p._d - y * p._b) * id - bone._ax, ty = (y * p._a - x * p._c) * id - bone._ay;
|
||||
float rotationIK = (float)atan2(ty, tx) * RadDeg - bone._ashearX - bone._arotation;
|
||||
float rotationIK = atan2(ty, tx) * RadDeg - bone._ashearX - bone._arotation;
|
||||
|
||||
if (bone._ascaleX < 0) {
|
||||
rotationIK += 180;
|
||||
@ -146,7 +146,7 @@ namespace Spine {
|
||||
x = cwx - pp._worldX;
|
||||
y = cwy - pp._worldY;
|
||||
float dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
|
||||
float l1 = (float)sqrt(dx * dx + dy * dy), l2 = child._data.getLength() * csx, a1, a2;
|
||||
float l1 = sqrt(dx * dx + dy * dy), l2 = child._data.getLength() * csx, a1, a2;
|
||||
if (u) {
|
||||
l2 *= psx;
|
||||
float cos = (tx * tx + ty * ty - l1 * l1 - l2 * l2) / (2 * l1 * l2);
|
||||
@ -157,30 +157,30 @@ namespace Spine {
|
||||
cos = 1;
|
||||
}
|
||||
|
||||
a2 = (float)acos(cos) * bendDir;
|
||||
a2 = acos(cos) * bendDir;
|
||||
a = l1 + l2 * cos;
|
||||
b = l2 * (float)sin(a2);
|
||||
a1 = (float)atan2(ty * a - tx * b, tx * a + ty * b);
|
||||
b = l2 * sin(a2);
|
||||
a1 = atan2(ty * a - tx * b, tx * a + ty * b);
|
||||
}
|
||||
else {
|
||||
a = psx * l2;
|
||||
b = psy * l2;
|
||||
float aa = a * a, bb = b * b, dd = tx * tx + ty * ty, ta = (float)atan2(ty, tx);
|
||||
float aa = a * a, bb = b * b, dd = tx * tx + ty * ty, ta = atan2(ty, tx);
|
||||
c = bb * l1 * l1 + aa * dd - aa * bb;
|
||||
float c1 = -2 * bb * l1, c2 = bb - aa;
|
||||
d = c1 * c1 - 4 * c2 * c;
|
||||
if (d >= 0) {
|
||||
float q = (float)sqrt(d);
|
||||
float q = sqrt(d);
|
||||
if (c1 < 0) q = -q;
|
||||
q = -(c1 + q) / 2;
|
||||
float r0 = q / c2, r1 = c / q;
|
||||
float r = fabs(r0) < fabs(r1) ? r0 : r1;
|
||||
if (r * r <= dd) {
|
||||
y = (float)sqrt(dd - r * r) * bendDir;
|
||||
a1 = ta - (float)atan2(y, r);
|
||||
a2 = (float)atan2(y / psy, (r - l1) / psx);
|
||||
y = sqrt(dd - r * r) * bendDir;
|
||||
a1 = ta - atan2(y, r);
|
||||
a2 = atan2(y / psy, (r - l1) / psx);
|
||||
|
||||
float os = (float)atan2(cy, cx) * s2;
|
||||
float os = atan2(cy, cx) * s2;
|
||||
float rotation = parent._arotation;
|
||||
a1 = (a1 - os) * RadDeg + os1 - rotation;
|
||||
if (a1 > 180) {
|
||||
@ -211,8 +211,8 @@ namespace Spine {
|
||||
float maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0;
|
||||
c = -a * l1 / (aa - bb);
|
||||
if (c >= -1 && c <= 1) {
|
||||
c = (float)acos(c);
|
||||
x = a * (float)cos(c) + l1;
|
||||
c = acos(c);
|
||||
x = a * cos(c) + l1;
|
||||
y = b * (float)sin(c);
|
||||
d = x * x + y * y;
|
||||
|
||||
@ -232,11 +232,11 @@ namespace Spine {
|
||||
}
|
||||
|
||||
if (dd <= (minDist + maxDist) / 2) {
|
||||
a1 = ta - (float)atan2(minY * bendDir, minX);
|
||||
a1 = ta - atan2(minY * bendDir, minX);
|
||||
a2 = minAngle * bendDir;
|
||||
}
|
||||
else {
|
||||
a1 = ta - (float)atan2(maxY * bendDir, maxX);
|
||||
a1 = ta - atan2(maxY * bendDir, maxX);
|
||||
a2 = maxAngle * bendDir;
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,9 +114,7 @@ namespace Spine {
|
||||
}
|
||||
|
||||
Json::~Json() {
|
||||
if (_child) {
|
||||
delete _child;
|
||||
}
|
||||
delete _child;
|
||||
|
||||
if (_valueString) {
|
||||
SpineExtension::free(_valueString, __FILE__, __LINE__);
|
||||
@ -125,10 +123,8 @@ namespace Spine {
|
||||
if (_name) {
|
||||
SpineExtension::free(_name, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
if (_next) {
|
||||
delete _next;
|
||||
}
|
||||
|
||||
delete _next;
|
||||
}
|
||||
|
||||
const char* Json::skip(const char* inValue) {
|
||||
@ -223,7 +219,7 @@ namespace Spine {
|
||||
}
|
||||
}
|
||||
|
||||
out = (char*)SpineExtension::alloc<char>(len + 1, __FILE__, __LINE__); /* The length needed for the string, roughly. */
|
||||
out = SpineExtension::alloc<char>(len + 1, __FILE__, __LINE__); /* The length needed for the string, roughly. */
|
||||
if (!out) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -35,11 +35,11 @@ namespace Spine {
|
||||
|
||||
MathUtil::MathUtil() {
|
||||
for (int i = 0; i < SIN_COUNT; ++i) {
|
||||
SIN_TABLE[i] = (float)sin((i + 0.5f) / SIN_COUNT * RadFull);
|
||||
SIN_TABLE[i] = sin((i + 0.5f) / SIN_COUNT * RadFull);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 360; i += 90) {
|
||||
SIN_TABLE[(int)(i * DegToIndex) & SIN_MASK] = (float)sin(i * DegRad);
|
||||
SIN_TABLE[i * DegToIndex & SIN_MASK] = sin(i * DegRad);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ namespace Spine {
|
||||
else {
|
||||
float x = setupLength * bone._a;
|
||||
float y = setupLength * bone._c;
|
||||
float length = (float)sqrt(x * x + y * y);
|
||||
float length = sqrt(x * x + y * y);
|
||||
if (scale) {
|
||||
_lengths[i] = length;
|
||||
}
|
||||
@ -159,7 +159,7 @@ namespace Spine {
|
||||
if (scale) {
|
||||
float length = _lengths[i];
|
||||
if (length >= PathConstraint::EPSILON) {
|
||||
float s = ((float)sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;
|
||||
float s = (sqrt(dx * dx + dy * dy) / length - 1) * rotateMix + 1;
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
}
|
||||
@ -398,18 +398,18 @@ namespace Spine {
|
||||
ddfy = tmpy * 2 + dddfy;
|
||||
dfx = (cx1 - x1) * 0.75f + tmpx + dddfx * 0.16666667f;
|
||||
dfy = (cy1 - y1) * 0.75f + tmpy + dddfy * 0.16666667f;
|
||||
pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
pathLength += sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
pathLength += sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
pathLength += sqrt(dfx * dfx + dfy * dfy);
|
||||
dfx += ddfx + dddfx;
|
||||
dfy += ddfy + dddfy;
|
||||
pathLength += (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
pathLength += sqrt(dfx * dfx + dfy * dfy);
|
||||
_curves[i] = pathLength;
|
||||
x1 = x2;
|
||||
y1 = y2;
|
||||
@ -485,23 +485,23 @@ namespace Spine {
|
||||
ddfy = tmpy * 2 + dddfy;
|
||||
dfx = (cx1 - x1) * 0.3f + tmpx + dddfx * 0.16666667f;
|
||||
dfy = (cy1 - y1) * 0.3f + tmpy + dddfy * 0.16666667f;
|
||||
curveLength = (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
curveLength = sqrt(dfx * dfx + dfy * dfy);
|
||||
_segments[0] = curveLength;
|
||||
for (ii = 1; ii < 8; ii++) {
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
ddfx += dddfx;
|
||||
ddfy += dddfy;
|
||||
curveLength += (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
curveLength += sqrt(dfx * dfx + dfy * dfy);
|
||||
_segments[ii] = curveLength;
|
||||
}
|
||||
dfx += ddfx;
|
||||
dfy += ddfy;
|
||||
curveLength += (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
curveLength += sqrt(dfx * dfx + dfy * dfy);
|
||||
_segments[8] = curveLength;
|
||||
dfx += ddfx + dddfx;
|
||||
dfy += ddfy + dddfy;
|
||||
curveLength += (float)sqrt(dfx * dfx + dfy * dfy);
|
||||
curveLength += sqrt(dfx * dfx + dfy * dfy);
|
||||
_segments[9] = curveLength;
|
||||
segment = 0;
|
||||
}
|
||||
@ -563,7 +563,7 @@ namespace Spine {
|
||||
output[o] = x;
|
||||
output[o + 1] = y;
|
||||
if (tangents) {
|
||||
output[o + 2] = (float)atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
|
||||
output[o + 2] = atan2(y - (y1 * uu + cy1 * ut * 2 + cy2 * tt), x - (x1 * uu + cx1 * ut * 2 + cx2 * tt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -550,7 +550,7 @@ namespace Spine {
|
||||
return _flipX;
|
||||
}
|
||||
|
||||
void Skeleton::setFlipX(float inValue) {
|
||||
void Skeleton::setFlipX(bool inValue) {
|
||||
_flipX = inValue;
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ namespace Spine {
|
||||
return _flipY;
|
||||
}
|
||||
|
||||
void Skeleton::setFlipY(float inValue) {
|
||||
void Skeleton::setFlipY(bool inValue) {
|
||||
_flipY = inValue;
|
||||
}
|
||||
|
||||
|
||||
@ -153,14 +153,14 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/* Bones. */
|
||||
int bonesCount = readVarint(input, 1);
|
||||
int bonesCount = readVarint(input, true);
|
||||
skeletonData->_bones.reserve(bonesCount);
|
||||
skeletonData->_bones.setSize(bonesCount);
|
||||
for (i = 0; i < bonesCount; ++i) {
|
||||
BoneData* data;
|
||||
int mode;
|
||||
const char* name = readString(input);
|
||||
BoneData* parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, 1)];
|
||||
BoneData* parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, true)];
|
||||
|
||||
data = new (__FILE__, __LINE__) BoneData(i, String(name, true), parent);
|
||||
data->_rotation = readFloat(input);
|
||||
@ -172,7 +172,7 @@ namespace Spine {
|
||||
data->_shearY = readFloat(input);
|
||||
data->_length = readFloat(input) * _scale;
|
||||
|
||||
mode = readVarint(input, 1);
|
||||
mode = readVarint(input, true);
|
||||
switch (mode) {
|
||||
case 0:
|
||||
data->_transformMode = TransformMode_Normal;
|
||||
@ -200,13 +200,13 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/* Slots. */
|
||||
int slotsCount = readVarint(input, 1);
|
||||
int slotsCount = readVarint(input, true);
|
||||
skeletonData->_slots.reserve(slotsCount);
|
||||
skeletonData->_slots.setSize(slotsCount);
|
||||
for (i = 0; i < slotsCount; ++i) {
|
||||
int r, g, b, a;
|
||||
const char* slotName = readString(input);
|
||||
BoneData* boneData = skeletonData->_bones[readVarint(input, 1)];
|
||||
BoneData* boneData = skeletonData->_bones[readVarint(input, true)];
|
||||
|
||||
SlotData* slotData = new (__FILE__, __LINE__) SlotData(i, String(slotName, true), *boneData);
|
||||
|
||||
@ -221,13 +221,13 @@ namespace Spine {
|
||||
slotData->_b2 = b / 255.0f;
|
||||
}
|
||||
slotData->_attachmentName.own(readString(input));
|
||||
slotData->_blendMode = static_cast<BlendMode>(readVarint(input, 1));
|
||||
slotData->_blendMode = static_cast<BlendMode>(readVarint(input, true));
|
||||
|
||||
skeletonData->_slots[i] = slotData;
|
||||
}
|
||||
|
||||
/* IK constraints. */
|
||||
int ikConstraintsCount = readVarint(input, 1);
|
||||
int ikConstraintsCount = readVarint(input, true);
|
||||
skeletonData->_ikConstraints.reserve(ikConstraintsCount);
|
||||
skeletonData->_ikConstraints.setSize(ikConstraintsCount);
|
||||
for (i = 0; i < ikConstraintsCount; ++i) {
|
||||
@ -235,15 +235,15 @@ namespace Spine {
|
||||
|
||||
IkConstraintData* data = new (__FILE__, __LINE__) IkConstraintData(String(name, true));
|
||||
|
||||
data->_order = readVarint(input, 1);
|
||||
data->_order = readVarint(input, true);
|
||||
|
||||
int bonesCount = readVarint(input, 1);
|
||||
int bonesCount = readVarint(input, true);
|
||||
data->_bones.reserve(bonesCount);
|
||||
data->_bones.setSize(bonesCount);
|
||||
for (ii = 0; ii < bonesCount; ++ii) {
|
||||
data->_bones[ii] = skeletonData->_bones[readVarint(input, 1)];
|
||||
data->_bones[ii] = skeletonData->_bones[readVarint(input, true)];
|
||||
}
|
||||
data->_target = skeletonData->_bones[readVarint(input, 1)];
|
||||
data->_target = skeletonData->_bones[readVarint(input, true)];
|
||||
data->_mix = readFloat(input);
|
||||
data->_bendDirection = readSByte(input);
|
||||
|
||||
@ -251,7 +251,7 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/* Transform constraints. */
|
||||
int transformConstraintsCount = readVarint(input, 1);
|
||||
int transformConstraintsCount = readVarint(input, true);
|
||||
skeletonData->_transformConstraints.reserve(transformConstraintsCount);
|
||||
skeletonData->_transformConstraints.setSize(transformConstraintsCount);
|
||||
for (i = 0; i < transformConstraintsCount; ++i) {
|
||||
@ -259,14 +259,14 @@ namespace Spine {
|
||||
|
||||
TransformConstraintData* data = new (__FILE__, __LINE__) TransformConstraintData(String(name, true));
|
||||
|
||||
data->_order = readVarint(input, 1);
|
||||
int bonesCount = readVarint(input, 1);
|
||||
data->_order = readVarint(input, true);
|
||||
int bonesCount = readVarint(input, true);
|
||||
data->_bones.reserve(bonesCount);
|
||||
data->_bones.setSize(bonesCount);
|
||||
for (ii = 0; ii < bonesCount; ++ii) {
|
||||
data->_bones[ii] = skeletonData->_bones[readVarint(input, 1)];
|
||||
data->_bones[ii] = skeletonData->_bones[readVarint(input, true)];
|
||||
}
|
||||
data->_target = skeletonData->_bones[readVarint(input, 1)];
|
||||
data->_target = skeletonData->_bones[readVarint(input, true)];
|
||||
data->_local = readBoolean(input);
|
||||
data->_relative = readBoolean(input);
|
||||
data->_offsetRotation = readFloat(input);
|
||||
@ -284,7 +284,7 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/* Path constraints */
|
||||
int pathConstraintsCount = readVarint(input, 1);
|
||||
int pathConstraintsCount = readVarint(input, true);
|
||||
skeletonData->_pathConstraints.reserve(pathConstraintsCount);
|
||||
skeletonData->_pathConstraints.setSize(pathConstraintsCount);
|
||||
for (i = 0; i < pathConstraintsCount; ++i) {
|
||||
@ -292,18 +292,18 @@ namespace Spine {
|
||||
|
||||
PathConstraintData* data = new (__FILE__, __LINE__) PathConstraintData(String(name, true));
|
||||
|
||||
data->_order = readVarint(input, 1);
|
||||
data->_order = readVarint(input, true);
|
||||
|
||||
int bonesCount = readVarint(input, 1);
|
||||
int bonesCount = readVarint(input, true);
|
||||
data->_bones.reserve(bonesCount);
|
||||
data->_bones.setSize(bonesCount);
|
||||
for (ii = 0; ii < bonesCount; ++ii) {
|
||||
data->_bones[ii] = skeletonData->_bones[readVarint(input, 1)];
|
||||
data->_bones[ii] = skeletonData->_bones[readVarint(input, true)];
|
||||
}
|
||||
data->_target = skeletonData->_slots[readVarint(input, 1)];
|
||||
data->_positionMode = static_cast<PositionMode>(readVarint(input, 1));
|
||||
data->_spacingMode = static_cast<SpacingMode>(readVarint(input, 1));
|
||||
data->_rotateMode = static_cast<RotateMode>(readVarint(input, 1));
|
||||
data->_target = skeletonData->_slots[readVarint(input, true)];
|
||||
data->_positionMode = static_cast<PositionMode>(readVarint(input, true));
|
||||
data->_spacingMode = static_cast<SpacingMode>(readVarint(input, true));
|
||||
data->_rotateMode = static_cast<RotateMode>(readVarint(input, true));
|
||||
data->_offsetRotation = readFloat(input);
|
||||
data->_position = readFloat(input);
|
||||
if (data->_positionMode == PositionMode_Fixed) {
|
||||
@ -322,7 +322,7 @@ namespace Spine {
|
||||
|
||||
/* Default skin. */
|
||||
skeletonData->_defaultSkin = readSkin(input, "default", skeletonData, nonessential);
|
||||
int skinsCount = readVarint(input, 1);
|
||||
int skinsCount = readVarint(input, true);
|
||||
|
||||
if (skeletonData->_defaultSkin) {
|
||||
++skinsCount;
|
||||
@ -365,13 +365,13 @@ namespace Spine {
|
||||
_linkedMeshes.clear();
|
||||
|
||||
/* Events. */
|
||||
int eventsCount = readVarint(input, 1);
|
||||
int eventsCount = readVarint(input, true);
|
||||
skeletonData->_events.reserve(eventsCount);
|
||||
skeletonData->_events.setSize(eventsCount);
|
||||
for (i = 0; i < eventsCount; ++i) {
|
||||
const char* name = readString(input);
|
||||
EventData* eventData = new (__FILE__, __LINE__) EventData(String(name, true));
|
||||
eventData->_intValue = readVarint(input, 0);
|
||||
eventData->_intValue = readVarint(input, false);
|
||||
eventData->_floatValue = readFloat(input);
|
||||
eventData->_stringValue.own(readString(input));
|
||||
SpineExtension::free(readString(input), __FILE__, __LINE__); // skip audio path
|
||||
@ -379,7 +379,7 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/* Animations. */
|
||||
int animationsCount = readVarint(input, 1);
|
||||
int animationsCount = readVarint(input, true);
|
||||
skeletonData->_animations.reserve(animationsCount);
|
||||
skeletonData->_animations.setSize(animationsCount);
|
||||
for (i = 0; i < animationsCount; ++i) {
|
||||
@ -421,11 +421,11 @@ namespace Spine {
|
||||
strncat(message + length, value2, 255 - length);
|
||||
}
|
||||
|
||||
_error = message;
|
||||
_error = String(message);
|
||||
}
|
||||
|
||||
char* SkeletonBinary::readString(DataInput* input) {
|
||||
int length = readVarint(input, 1);
|
||||
int length = readVarint(input, true);
|
||||
char* string;
|
||||
if (length == 0) {
|
||||
return NULL;
|
||||
@ -456,7 +456,7 @@ namespace Spine {
|
||||
return (signed char)readByte(input);
|
||||
}
|
||||
|
||||
int SkeletonBinary::readBoolean(DataInput* input) {
|
||||
bool SkeletonBinary::readBoolean(DataInput* input) {
|
||||
return readByte(input) != 0;
|
||||
}
|
||||
|
||||
@ -504,7 +504,7 @@ namespace Spine {
|
||||
|
||||
Skin* SkeletonBinary::readSkin(DataInput* input, const char* skinName, SkeletonData* skeletonData, bool nonessential) {
|
||||
Skin* skin = NULL;
|
||||
int slotCount = readVarint(input, 1);
|
||||
int slotCount = readVarint(input, true);
|
||||
int i, ii, nn;
|
||||
if (slotCount == 0) {
|
||||
return NULL;
|
||||
@ -513,8 +513,8 @@ namespace Spine {
|
||||
skin = new (__FILE__, __LINE__) Skin(String(skinName));
|
||||
|
||||
for (i = 0; i < slotCount; ++i) {
|
||||
int slotIndex = readVarint(input, 1);
|
||||
for (ii = 0, nn = readVarint(input, 1); ii < nn; ++ii) {
|
||||
int slotIndex = readVarint(input, true);
|
||||
for (ii = 0, nn = readVarint(input, true); ii < nn; ++ii) {
|
||||
const char* name = readString(input);
|
||||
Attachment* attachment = readAttachment(input, skin, slotIndex, name, skeletonData, nonessential);
|
||||
if (attachment) {
|
||||
@ -565,7 +565,7 @@ namespace Spine {
|
||||
return region;
|
||||
}
|
||||
case AttachmentType_Boundingbox: {
|
||||
int vertexCount = readVarint(input, 1);
|
||||
int vertexCount = readVarint(input, true);
|
||||
BoundingBoxAttachment* box = _attachmentLoader->newBoundingBoxAttachment(*skin, String(name));
|
||||
readVertices(input, static_cast<VertexAttachment*>(box), vertexCount);
|
||||
if (nonessential) {
|
||||
@ -588,14 +588,14 @@ namespace Spine {
|
||||
mesh = _attachmentLoader->newMeshAttachment(*skin, String(name), String(path));
|
||||
mesh->_path = String(path);
|
||||
readColor(input, &mesh->_r, &mesh->_g, &mesh->_b, &mesh->_a);
|
||||
vertexCount = readVarint(input, 1);
|
||||
vertexCount = readVarint(input, true);
|
||||
Vector<float> float_array = readFloatArray(input, vertexCount << 1, 1);
|
||||
mesh->setRegionUVs(float_array);
|
||||
Vector<short> triangles = readShortArray(input);
|
||||
mesh->setTriangles(triangles);
|
||||
readVertices(input, static_cast<VertexAttachment*>(mesh), vertexCount);
|
||||
mesh->updateUVs();
|
||||
mesh->_hullLength = readVarint(input, 1) << 1;
|
||||
mesh->_hullLength = readVarint(input, true) << 1;
|
||||
if (nonessential) {
|
||||
Vector<short> edges = readShortArray(input);
|
||||
mesh->setEdges(edges);
|
||||
@ -650,7 +650,7 @@ namespace Spine {
|
||||
int vertexCount = 0;
|
||||
path->_closed = readBoolean(input);
|
||||
path->_constantSpeed = readBoolean(input);
|
||||
vertexCount = readVarint(input, 1);
|
||||
vertexCount = readVarint(input, true);
|
||||
readVertices(input, static_cast<VertexAttachment*>(path), vertexCount);
|
||||
int lengthsLength = vertexCount / 3;
|
||||
path->_lengths.reserve(lengthsLength);
|
||||
@ -684,8 +684,8 @@ namespace Spine {
|
||||
return point;
|
||||
}
|
||||
case AttachmentType_Clipping: {
|
||||
int endSlotIndex = readVarint(input, 1);
|
||||
int vertexCount = readVarint(input, 1);
|
||||
int endSlotIndex = readVarint(input, true);
|
||||
int vertexCount = readVarint(input, true);
|
||||
ClippingAttachment* clip = _attachmentLoader->newClippingAttachment(*skin, name);
|
||||
readVertices(input, static_cast<VertexAttachment*>(clip), vertexCount);
|
||||
|
||||
@ -760,7 +760,7 @@ namespace Spine {
|
||||
}
|
||||
|
||||
Vector<short> SkeletonBinary::readShortArray(DataInput *input) {
|
||||
int n = readVarint(input, 1);
|
||||
int n = readVarint(input, true);
|
||||
|
||||
Vector<short> array;
|
||||
array.reserve(n);
|
||||
|
||||
@ -1226,8 +1226,6 @@ namespace Spine {
|
||||
|
||||
_error = String(message);
|
||||
|
||||
if (root) {
|
||||
delete root;
|
||||
}
|
||||
delete root;
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,17 +171,17 @@ namespace Spine {
|
||||
}
|
||||
|
||||
if (scaleMix > 0) {
|
||||
float s = (float)sqrt(bone._a * bone._a + bone._c * bone._c);
|
||||
float s = sqrt(bone._a * bone._a + bone._c * bone._c);
|
||||
|
||||
if (s > 0.00001f) {
|
||||
s = (s + ((float)sqrt(ta * ta + tc * tc) - s + _data._offsetScaleX) * scaleMix) / s;
|
||||
s = (s + (sqrt(ta * ta + tc * tc) - s + _data._offsetScaleX) * scaleMix) / s;
|
||||
}
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
s = (float)sqrt(bone._b * bone._b + bone._d * bone._d);
|
||||
s = sqrt(bone._b * bone._b + bone._d * bone._d);
|
||||
|
||||
if (s > 0.00001f) {
|
||||
s = (s + ((float)sqrt(tb * tb + td * td) - s + _data._offsetScaleY) * scaleMix) / s;
|
||||
s = (s + (sqrt(tb * tb + td * td) - s + _data._offsetScaleY) * scaleMix) / s;
|
||||
}
|
||||
bone._b *= s;
|
||||
bone._d *= s;
|
||||
@ -200,7 +200,7 @@ namespace Spine {
|
||||
}
|
||||
|
||||
r = by + (r + offsetShearY) * shearMix;
|
||||
float s = (float)sqrt(b * b + d * d);
|
||||
float s = sqrt(b * b + d * d);
|
||||
bone._b = MathUtil::cos(r) * s;
|
||||
bone._d = MathUtil::sin(r) * s;
|
||||
modified = true;
|
||||
@ -252,10 +252,10 @@ namespace Spine {
|
||||
}
|
||||
|
||||
if (scaleMix > 0) {
|
||||
float s = ((float)sqrt(ta * ta + tc * tc) - 1 + _data._offsetScaleX) * scaleMix + 1;
|
||||
float s = (sqrt(ta * ta + tc * tc) - 1 + _data._offsetScaleX) * scaleMix + 1;
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
s = ((float)sqrt(tb * tb + td * td) - 1 + _data._offsetScaleY) * scaleMix + 1;
|
||||
s = (sqrt(tb * tb + td * td) - 1 + _data._offsetScaleY) * scaleMix + 1;
|
||||
bone._b *= s;
|
||||
bone._d *= s;
|
||||
modified = true;
|
||||
@ -272,7 +272,7 @@ namespace Spine {
|
||||
|
||||
float b = bone._b, d = bone._d;
|
||||
r = MathUtil::atan2(d, b) + (r - SPINE_PI / 2 + offsetShearY) * shearMix;
|
||||
float s = (float)sqrt(b * b + d * d);
|
||||
float s = sqrt(b * b + d * d);
|
||||
bone._b = MathUtil::cos(r) * s;
|
||||
bone._d = MathUtil::sin(r) * s;
|
||||
modified = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user