mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Merge branch '3.8' into 3.9-beta
This commit is contained in:
commit
0ca78b6756
@ -32,16 +32,14 @@
|
|||||||
|
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class SP_API RTTI : public SpineObject {
|
class SP_API RTTI : public SpineObject {
|
||||||
public:
|
public:
|
||||||
explicit RTTI(const std::string &className);
|
explicit RTTI(const char *className);
|
||||||
|
|
||||||
RTTI(const std::string &className, const RTTI &baseRTTI);
|
RTTI(const char *className, const RTTI &baseRTTI);
|
||||||
|
|
||||||
const std::string &getClassName() const;
|
const char *getClassName() const;
|
||||||
|
|
||||||
bool isExactly(const RTTI &rtti) const;
|
bool isExactly(const RTTI &rtti) const;
|
||||||
|
|
||||||
@ -53,7 +51,7 @@ private:
|
|||||||
|
|
||||||
RTTI &operator=(const RTTI &obj);
|
RTTI &operator=(const RTTI &obj);
|
||||||
|
|
||||||
const std::string _className;
|
const char* _className;
|
||||||
const RTTI *_pBaseRTTI;
|
const RTTI *_pBaseRTTI;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,6 @@
|
|||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <spine/HasRendererObject.h>
|
#include <spine/HasRendererObject.h>
|
||||||
|
|
||||||
#define NUM_UVS 8
|
#define NUM_UVS 8
|
||||||
|
|||||||
@ -36,8 +36,6 @@
|
|||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
|
|
||||||
#include <limits> // std::numeric_limits
|
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class SkeletonData;
|
class SkeletonData;
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,6 @@
|
|||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/Color.h>
|
#include <spine/Color.h>
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
class SlotData;
|
class SlotData;
|
||||||
|
|
||||||
|
|||||||
@ -33,8 +33,6 @@
|
|||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/SpineObject.h>
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/SpineString.h>
|
#include <spine/SpineString.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <memory>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace spine {
|
namespace spine {
|
||||||
@ -131,7 +129,9 @@ public:
|
|||||||
|
|
||||||
if (inIndex != _size) {
|
if (inIndex != _size) {
|
||||||
for (size_t i = inIndex; i < _size; ++i) {
|
for (size_t i = inIndex; i < _size; ++i) {
|
||||||
std::swap(_buffer[i], _buffer[i + 1]);
|
T tmp(_buffer[i]);
|
||||||
|
_buffer[i] = _buffer[i + 1];
|
||||||
|
_buffer[i + 1] = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,6 @@
|
|||||||
#include <spine/ConstraintData.h>
|
#include <spine/ConstraintData.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ContainerUtil.h>
|
||||||
#include <spine/CurveTimeline.h>
|
#include <spine/CurveTimeline.h>
|
||||||
#include <spine/Debug.h>
|
|
||||||
#include <spine/DeformTimeline.h>
|
#include <spine/DeformTimeline.h>
|
||||||
#include <spine/DrawOrderTimeline.h>
|
#include <spine/DrawOrderTimeline.h>
|
||||||
#include <spine/Event.h>
|
#include <spine/Event.h>
|
||||||
|
|||||||
@ -44,6 +44,8 @@
|
|||||||
#include <spine/DrawOrderTimeline.h>
|
#include <spine/DrawOrderTimeline.h>
|
||||||
#include <spine/EventTimeline.h>
|
#include <spine/EventTimeline.h>
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
void dummyOnAnimationEventFunc(AnimationState *state, spine::EventType type, TrackEntry *entry, Event *event = NULL) {
|
void dummyOnAnimationEventFunc(AnimationState *state, spine::EventType type, TrackEntry *entry, Event *event = NULL) {
|
||||||
@ -914,7 +916,7 @@ TrackEntry *AnimationState::newTrackEntry(size_t trackIndex, Animation *animatio
|
|||||||
entry._trackTime = 0;
|
entry._trackTime = 0;
|
||||||
entry._trackLast = -1;
|
entry._trackLast = -1;
|
||||||
entry._nextTrackLast = -1; // nextTrackLast == -1 signifies a TrackEntry that wasn't applied yet.
|
entry._nextTrackLast = -1; // nextTrackLast == -1 signifies a TrackEntry that wasn't applied yet.
|
||||||
entry._trackEnd = std::numeric_limits<float>::max(); // loop ? float.MaxValue : animation.Duration;
|
entry._trackEnd = FLT_MAX; // loop ? float.MaxValue : animation.Duration;
|
||||||
entry._timeScale = 1;
|
entry._timeScale = 1;
|
||||||
|
|
||||||
entry._alpha = 1;
|
entry._alpha = 1;
|
||||||
|
|||||||
@ -43,6 +43,8 @@
|
|||||||
#include <spine/EventData.h>
|
#include <spine/EventData.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ContainerUtil.h>
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
RTTI_IMPL(EventTimeline, Timeline)
|
RTTI_IMPL(EventTimeline, Timeline)
|
||||||
@ -67,7 +69,7 @@ void EventTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector
|
|||||||
|
|
||||||
if (lastTime > time) {
|
if (lastTime > time) {
|
||||||
// Fire events after last time for looped animations.
|
// Fire events after last time for looped animations.
|
||||||
apply(skeleton, lastTime, std::numeric_limits<float>::max(), pEvents, alpha, blend, direction);
|
apply(skeleton, lastTime, FLT_MAX, pEvents, alpha, blend, direction);
|
||||||
lastTime = -1.0f;
|
lastTime = -1.0f;
|
||||||
} else if (lastTime >= _frames[frameCount - 1]) {
|
} else if (lastTime >= _frames[frameCount - 1]) {
|
||||||
// Last time is after last frame.
|
// Last time is after last frame.
|
||||||
|
|||||||
@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
#include <spine/MathUtil.h>
|
#include <spine/MathUtil.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <random>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Required for division by 0 in _isNaN on MSVC
|
// Required for division by 0 in _isNaN on MSVC
|
||||||
|
|||||||
@ -36,24 +36,24 @@
|
|||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
RTTI::RTTI(const std::string &className) : _className(className), _pBaseRTTI(NULL) {
|
RTTI::RTTI(const char *className) : _className(className), _pBaseRTTI(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
RTTI::RTTI(const std::string &className, const RTTI &baseRTTI) : _className(className), _pBaseRTTI(&baseRTTI) {
|
RTTI::RTTI(const char *className, const RTTI &baseRTTI) : _className(className), _pBaseRTTI(&baseRTTI) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &RTTI::getClassName() const {
|
const char *RTTI::getClassName() const {
|
||||||
return _className;
|
return _className;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTTI::isExactly(const RTTI &rtti) const {
|
bool RTTI::isExactly(const RTTI &rtti) const {
|
||||||
return (this->_className == rtti._className);
|
return !strcmp(this->_className, rtti._className);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RTTI::instanceOf(const RTTI &rtti) const {
|
bool RTTI::instanceOf(const RTTI &rtti) const {
|
||||||
const RTTI *pCompare = this;
|
const RTTI *pCompare = this;
|
||||||
while (pCompare) {
|
while (pCompare) {
|
||||||
if (pCompare->_className == rtti._className) return true;
|
if (!strcmp(pCompare->_className, rtti._className)) return true;
|
||||||
pCompare = pCompare->_pBaseRTTI;
|
pCompare = pCompare->_pBaseRTTI;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -53,6 +53,8 @@
|
|||||||
|
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ContainerUtil.h>
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
Skeleton::Skeleton(SkeletonData *skeletonData) :
|
Skeleton::Skeleton(SkeletonData *skeletonData) :
|
||||||
@ -417,10 +419,10 @@ void Skeleton::update(float delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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, Vector<float> &outVertexBuffer) {
|
||||||
float minX = std::numeric_limits<float>::max();
|
float minX = FLT_MAX;
|
||||||
float minY = std::numeric_limits<float>::max();
|
float minY = FLT_MAX;
|
||||||
float maxX = std::numeric_limits<float>::min();
|
float maxX = FLT_MIN;
|
||||||
float maxY = std::numeric_limits<float>::min();
|
float maxY = FLT_MIN;
|
||||||
|
|
||||||
for (size_t i = 0; i < _drawOrder.size(); ++i) {
|
for (size_t i = 0; i < _drawOrder.size(); ++i) {
|
||||||
Slot *slot = _drawOrder[i];
|
Slot *slot = _drawOrder[i];
|
||||||
|
|||||||
@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
#include <spine/Slot.h>
|
#include <spine/Slot.h>
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0) {
|
SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0) {
|
||||||
@ -87,10 +89,10 @@ void SkeletonBounds::update(Skeleton &skeleton, bool updateAabb) {
|
|||||||
if (updateAabb)
|
if (updateAabb)
|
||||||
aabbCompute();
|
aabbCompute();
|
||||||
else {
|
else {
|
||||||
_minX = std::numeric_limits<float>::min();
|
_minX = FLT_MIN;
|
||||||
_minY = std::numeric_limits<float>::min();
|
_minY = FLT_MIN;
|
||||||
_maxX = std::numeric_limits<float>::max();
|
_maxX = FLT_MAX;
|
||||||
_maxY = std::numeric_limits<float>::max();
|
_maxY = FLT_MAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,10 +199,10 @@ float SkeletonBounds::getHeight() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonBounds::aabbCompute() {
|
void SkeletonBounds::aabbCompute() {
|
||||||
float minX = std::numeric_limits<float>::min();
|
float minX = FLT_MIN;
|
||||||
float minY = std::numeric_limits<float>::min();
|
float minY = FLT_MIN;
|
||||||
float maxX = std::numeric_limits<float>::max();
|
float maxX = FLT_MAX;
|
||||||
float maxY = std::numeric_limits<float>::max();
|
float maxY = FLT_MAX;
|
||||||
|
|
||||||
for (size_t i = 0, n = _polygons.size(); i < n; ++i) {
|
for (size_t i = 0, n = _polygons.size(); i < n; ++i) {
|
||||||
Polygon *polygon = _polygons[i];
|
Polygon *polygon = _polygons[i];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user