mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
wip
This commit is contained in:
parent
19687d9957
commit
8b53400425
@ -46,7 +46,7 @@ namespace Spine
|
|||||||
///
|
///
|
||||||
class AtlasAttachmentLoader : public AttachmentLoader
|
class AtlasAttachmentLoader : public AttachmentLoader
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AtlasAttachmentLoader(Vector<Atlas*>& inAtlasArray);
|
AtlasAttachmentLoader(Vector<Atlas*>& inAtlasArray);
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#ifndef Spine_Attachment_h
|
#ifndef Spine_Attachment_h
|
||||||
#define Spine_Attachment_h
|
#define Spine_Attachment_h
|
||||||
|
|
||||||
#include <spine/SpineRTTI.h>
|
#include <spine/RTTI.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class Attachment
|
class Attachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Attachment(std::string name);
|
Attachment(std::string name);
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#ifndef Spine_AttachmentLoader_h
|
#ifndef Spine_AttachmentLoader_h
|
||||||
#define Spine_AttachmentLoader_h
|
#define Spine_AttachmentLoader_h
|
||||||
|
|
||||||
#include <spine/SpineRTTI.h>
|
#include <spine/RTTI.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ namespace Spine
|
|||||||
|
|
||||||
class AttachmentLoader
|
class AttachmentLoader
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
AttachmentLoader();
|
AttachmentLoader();
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace Spine
|
|||||||
|
|
||||||
class AttachmentTimeline : public Timeline
|
class AttachmentTimeline : public Timeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AttachmentTimeline(int frameCount);
|
AttachmentTimeline(int frameCount);
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace Spine
|
|||||||
/// constraint or application code modifies the world transform after it was computed from the local transform.
|
/// constraint or application code modifies the world transform after it was computed from the local transform.
|
||||||
class Bone : public Updatable
|
class Bone : public Updatable
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
friend class RotateTimeline;
|
friend class RotateTimeline;
|
||||||
friend class IkConstraint;
|
friend class IkConstraint;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace Spine
|
|||||||
/// Attachment that has a polygon for bounds checking.
|
/// Attachment that has a polygon for bounds checking.
|
||||||
class BoundingBoxAttachment : public VertexAttachment
|
class BoundingBoxAttachment : public VertexAttachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
BoundingBoxAttachment(std::string name);
|
BoundingBoxAttachment(std::string name);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace Spine
|
|||||||
|
|
||||||
class ClippingAttachment : public VertexAttachment
|
class ClippingAttachment : public VertexAttachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
friend class SkeletonClipping;
|
friend class SkeletonClipping;
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class ColorTimeline : public CurveTimeline
|
class ColorTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int ENTRIES;
|
static const int ENTRIES;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace Spine
|
|||||||
/// The interface for all constraints.
|
/// The interface for all constraints.
|
||||||
class Constraint : public Updatable
|
class Constraint : public Updatable
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Constraint();
|
Constraint();
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace Spine
|
|||||||
/// Base class for frames that use an interpolation bezier curve.
|
/// Base class for frames that use an interpolation bezier curve.
|
||||||
class CurveTimeline : public Timeline
|
class CurveTimeline : public Timeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CurveTimeline(int frameCount);
|
CurveTimeline(int frameCount);
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace Spine
|
|||||||
|
|
||||||
class DeformTimeline : public CurveTimeline
|
class DeformTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DeformTimeline(int frameCount);
|
DeformTimeline(int frameCount);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class DrawOrderTimeline : public Timeline
|
class DrawOrderTimeline : public Timeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DrawOrderTimeline(int frameCount);
|
DrawOrderTimeline(int frameCount);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class EventTimeline : public Timeline
|
class EventTimeline : public Timeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
friend class Skeleton;
|
friend class Skeleton;
|
||||||
|
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified
|
/// Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class IkConstraintTimeline : public CurveTimeline
|
class IkConstraintTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int ENTRIES;
|
static const int ENTRIES;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Spine
|
|||||||
/// Attachment that displays a texture region using a mesh.
|
/// Attachment that displays a texture region using a mesh.
|
||||||
class MeshAttachment : public VertexAttachment
|
class MeshAttachment : public VertexAttachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
friend class AtlasAttachmentLoader;
|
friend class AtlasAttachmentLoader;
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class PathAttachment : public VertexAttachment
|
class PathAttachment : public VertexAttachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PathAttachment(std::string name);
|
PathAttachment(std::string name);
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
friend class Skeleton;
|
friend class Skeleton;
|
||||||
|
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PathConstraint(PathConstraintData& data, Skeleton& skeleton);
|
PathConstraint(PathConstraintData& data, Skeleton& skeleton);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class PathConstraintMixTimeline : public CurveTimeline
|
class PathConstraintMixTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class PathConstraintPositionTimeline : public CurveTimeline
|
class PathConstraintPositionTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int ENTRIES;
|
static const int ENTRIES;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class PathConstraintSpacingTimeline : public PathConstraintPositionTimeline
|
class PathConstraintSpacingTimeline : public PathConstraintPositionTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PathConstraintSpacingTimeline(int frameCount);
|
PathConstraintSpacingTimeline(int frameCount);
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace Spine
|
|||||||
///
|
///
|
||||||
class PointAttachment : public Attachment
|
class PointAttachment : public Attachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PointAttachment(std::string name);
|
PointAttachment(std::string name);
|
||||||
|
|||||||
@ -28,48 +28,48 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef Spine_SPINE_RTTI_h
|
#ifndef Spine_RTTI_h
|
||||||
#define Spine_SPINE_RTTI_h
|
#define Spine_RTTI_h
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
class SPINE_RTTI
|
class RTTI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SPINE_RTTI(const std::string& className);
|
RTTI(const std::string& className);
|
||||||
|
|
||||||
SPINE_RTTI(const std::string& className, const SPINE_RTTI& baseSPINE_RTTI);
|
RTTI(const std::string& className, const RTTI& baseRTTI);
|
||||||
|
|
||||||
const std::string& getClassName() const;
|
const std::string& getClassName() const;
|
||||||
|
|
||||||
bool isExactly(const SPINE_RTTI& rtti) const;
|
bool isExactly(const RTTI& rtti) const;
|
||||||
|
|
||||||
bool derivesFrom(const SPINE_RTTI& rtti) const;
|
bool derivesFrom(const RTTI& rtti) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Prevent copying
|
// Prevent copying
|
||||||
SPINE_RTTI(const SPINE_RTTI& obj);
|
RTTI(const RTTI& obj);
|
||||||
SPINE_RTTI& operator=(const SPINE_RTTI& obj);
|
RTTI& operator=(const RTTI& obj);
|
||||||
|
|
||||||
const std::string m_className;
|
const std::string m_className;
|
||||||
const SPINE_RTTI *m_pBaseSPINE_RTTI;
|
const RTTI *m_pBaseRTTI;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SPINE_RTTI_DECL \
|
#define RTTI_DECL \
|
||||||
public: \
|
public: \
|
||||||
static const Spine::SPINE_RTTI rtti; \
|
static const Spine::RTTI rtti; \
|
||||||
virtual const Spine::SPINE_RTTI& getRTTI();
|
virtual const Spine::RTTI& getRTTI();
|
||||||
|
|
||||||
#define SPINE_RTTI_IMPL_NOPARENT(name) \
|
#define RTTI_IMPL_NOPARENT(name) \
|
||||||
const Spine::SPINE_RTTI name::rtti(#name); \
|
const Spine::RTTI name::rtti(#name); \
|
||||||
const Spine::SPINE_RTTI& name::getRTTI() { return rtti; }
|
const Spine::RTTI& name::getRTTI() { return rtti; }
|
||||||
|
|
||||||
#define SPINE_RTTI_IMPL(name,parent) \
|
#define RTTI_IMPL(name,parent) \
|
||||||
const Spine::SPINE_RTTI name::rtti(#name, parent::rtti); \
|
const Spine::RTTI name::rtti(#name, parent::rtti); \
|
||||||
const Spine::SPINE_RTTI& name::getRTTI() { return rtti; }
|
const Spine::RTTI& name::getRTTI() { return rtti; }
|
||||||
|
|
||||||
#endif /* Spine_SPINE_RTTI_h */
|
#endif /* Spine_RTTI_h */
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ namespace Spine
|
|||||||
/// Attachment that displays a texture region.
|
/// Attachment that displays a texture region.
|
||||||
class RegionAttachment : public Attachment
|
class RegionAttachment : public Attachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
friend class AtlasAttachmentLoader;
|
friend class AtlasAttachmentLoader;
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class RotateTimeline : public CurveTimeline
|
class RotateTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int ENTRIES = 2;
|
static const int ENTRIES = 2;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class ScaleTimeline : public TranslateTimeline
|
class ScaleTimeline : public TranslateTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class ShearTimeline : public TranslateTimeline
|
class ShearTimeline : public TranslateTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
||||||
|
|||||||
@ -51,6 +51,9 @@ namespace Spine
|
|||||||
|
|
||||||
class Skeleton
|
class Skeleton
|
||||||
{
|
{
|
||||||
|
friend class SkeletonBounds;
|
||||||
|
friend class SkeletonClipping;
|
||||||
|
|
||||||
friend class AttachmentTimeline;
|
friend class AttachmentTimeline;
|
||||||
friend class ColorTimeline;
|
friend class ColorTimeline;
|
||||||
friend class DeformTimeline;
|
friend class DeformTimeline;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ namespace Spine
|
|||||||
bool aabbIntersectsSkeleton(SkeletonBounds bounds);
|
bool aabbIntersectsSkeleton(SkeletonBounds bounds);
|
||||||
|
|
||||||
/// Returns true if the polygon contains the point.
|
/// Returns true if the polygon contains the point.
|
||||||
bool containsPoint(Polygon polygon, float x, float y);
|
bool containsPoint(Polygon* polygon, float x, float y);
|
||||||
|
|
||||||
/// Returns the first bounding box attachment that contains the point, or NULL. When doing many checks, it is usually more
|
/// Returns the first bounding box attachment that contains the point, or NULL. When doing many checks, it is usually more
|
||||||
/// efficient to only call this method if {@link #aabbcontainsPoint(float, float)} returns true.
|
/// efficient to only call this method if {@link #aabbcontainsPoint(float, float)} returns true.
|
||||||
|
|||||||
@ -63,7 +63,7 @@ namespace Spine
|
|||||||
Vector<float> _clippedUVs;
|
Vector<float> _clippedUVs;
|
||||||
Vector<float> _scratch;
|
Vector<float> _scratch;
|
||||||
ClippingAttachment* _clipAttachment;
|
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
|
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
|
||||||
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
||||||
|
|||||||
@ -46,6 +46,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
friend class VertexAttachment;
|
friend class VertexAttachment;
|
||||||
friend class Skeleton;
|
friend class Skeleton;
|
||||||
|
friend class SkeletonBounds;
|
||||||
friend class SkeletonClipping;
|
friend class SkeletonClipping;
|
||||||
|
|
||||||
friend class AttachmentTimeline;
|
friend class AttachmentTimeline;
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
#ifndef Spine_Timeline_h
|
#ifndef Spine_Timeline_h
|
||||||
#define Spine_Timeline_h
|
#define Spine_Timeline_h
|
||||||
|
|
||||||
#include <spine/SpineRTTI.h>
|
#include <spine/RTTI.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/MixPose.h>
|
#include <spine/MixPose.h>
|
||||||
#include <spine/MixDirection.h>
|
#include <spine/MixDirection.h>
|
||||||
@ -43,7 +43,7 @@ namespace Spine
|
|||||||
|
|
||||||
class Timeline
|
class Timeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Timeline();
|
Timeline();
|
||||||
|
|||||||
@ -45,7 +45,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
friend class Skeleton;
|
friend class Skeleton;
|
||||||
|
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TransformConstraint(TransformConstraintData& data, Skeleton& skeleton);
|
TransformConstraint(TransformConstraintData& data, Skeleton& skeleton);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class TransformConstraintTimeline : public CurveTimeline
|
class TransformConstraintTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int ENTRIES;
|
static const int ENTRIES;
|
||||||
|
|||||||
@ -40,7 +40,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class TranslateTimeline : public CurveTimeline
|
class TranslateTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Spine
|
|||||||
{
|
{
|
||||||
class TwoColorTimeline : public CurveTimeline
|
class TwoColorTimeline : public CurveTimeline
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
virtual void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction);
|
||||||
|
|||||||
@ -31,13 +31,13 @@
|
|||||||
#ifndef Spine_Updatable_h
|
#ifndef Spine_Updatable_h
|
||||||
#define Spine_Updatable_h
|
#define Spine_Updatable_h
|
||||||
|
|
||||||
#include <spine/SpineRTTI.h>
|
#include <spine/RTTI.h>
|
||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
class Updatable
|
class Updatable
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Updatable();
|
Updatable();
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Spine
|
|||||||
/// An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's vertices.
|
/// An attachment with vertices that are transformed by one or more bones and can be deformed by a slot's vertices.
|
||||||
class VertexAttachment : public Attachment
|
class VertexAttachment : public Attachment
|
||||||
{
|
{
|
||||||
SPINE_RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
friend class DeformTimeline;
|
friend class DeformTimeline;
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(AtlasAttachmentLoader, AttachmentLoader);
|
RTTI_IMPL(AtlasAttachmentLoader, AttachmentLoader);
|
||||||
|
|
||||||
AtlasAttachmentLoader::AtlasAttachmentLoader(Vector<Atlas*>& inAtlasArray) : AttachmentLoader(), _atlasArray(inAtlasArray)
|
AtlasAttachmentLoader::AtlasAttachmentLoader(Vector<Atlas*>& inAtlasArray) : AttachmentLoader(), _atlasArray(inAtlasArray)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL_NOPARENT(Attachment);
|
RTTI_IMPL_NOPARENT(Attachment);
|
||||||
|
|
||||||
Attachment::Attachment(std::string name) : _name(name)
|
Attachment::Attachment(std::string name) : _name(name)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL_NOPARENT(AttachmentLoader);
|
RTTI_IMPL_NOPARENT(AttachmentLoader);
|
||||||
|
|
||||||
AttachmentLoader::AttachmentLoader()
|
AttachmentLoader::AttachmentLoader()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(AttachmentTimeline, Timeline);
|
RTTI_IMPL(AttachmentTimeline, Timeline);
|
||||||
|
|
||||||
AttachmentTimeline::AttachmentTimeline(int frameCount) : Timeline(), _slotIndex(0)
|
AttachmentTimeline::AttachmentTimeline(int frameCount) : Timeline(), _slotIndex(0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(Bone, Updatable);
|
RTTI_IMPL(Bone, Updatable);
|
||||||
|
|
||||||
bool Bone::yDown = false;
|
bool Bone::yDown = false;
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(BoundingBoxAttachment, VertexAttachment);
|
RTTI_IMPL(BoundingBoxAttachment, VertexAttachment);
|
||||||
|
|
||||||
BoundingBoxAttachment::BoundingBoxAttachment(std::string name) : VertexAttachment(name)
|
BoundingBoxAttachment::BoundingBoxAttachment(std::string name) : VertexAttachment(name)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(ClippingAttachment, VertexAttachment);
|
RTTI_IMPL(ClippingAttachment, VertexAttachment);
|
||||||
|
|
||||||
ClippingAttachment::ClippingAttachment(std::string name) : VertexAttachment(name)
|
ClippingAttachment::ClippingAttachment(std::string name) : VertexAttachment(name)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(ColorTimeline, CurveTimeline);
|
RTTI_IMPL(ColorTimeline, CurveTimeline);
|
||||||
|
|
||||||
const int ColorTimeline::ENTRIES = 5;
|
const int ColorTimeline::ENTRIES = 5;
|
||||||
const int ColorTimeline::PREV_TIME = -5;
|
const int ColorTimeline::PREV_TIME = -5;
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(Constraint, Updatable);
|
RTTI_IMPL(Constraint, Updatable);
|
||||||
|
|
||||||
Constraint::Constraint()
|
Constraint::Constraint()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(CurveTimeline, Timeline);
|
RTTI_IMPL(CurveTimeline, Timeline);
|
||||||
|
|
||||||
const float CurveTimeline::LINEAR = 0;
|
const float CurveTimeline::LINEAR = 0;
|
||||||
const float CurveTimeline::STEPPED = 1;
|
const float CurveTimeline::STEPPED = 1;
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(DeformTimeline, CurveTimeline);
|
RTTI_IMPL(DeformTimeline, CurveTimeline);
|
||||||
|
|
||||||
DeformTimeline::DeformTimeline(int frameCount) : CurveTimeline(frameCount), _slotIndex(0), _attachment(NULL)
|
DeformTimeline::DeformTimeline(int frameCount) : CurveTimeline(frameCount), _slotIndex(0), _attachment(NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(DrawOrderTimeline, Timeline);
|
RTTI_IMPL(DrawOrderTimeline, Timeline);
|
||||||
|
|
||||||
DrawOrderTimeline::DrawOrderTimeline(int frameCount) : Timeline()
|
DrawOrderTimeline::DrawOrderTimeline(int frameCount) : Timeline()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(EventTimeline, Timeline);
|
RTTI_IMPL(EventTimeline, Timeline);
|
||||||
|
|
||||||
void EventTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
void EventTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(IkConstraint, Constraint);
|
RTTI_IMPL(IkConstraint, Constraint);
|
||||||
|
|
||||||
void IkConstraint::apply(Bone& bone, float targetX, float targetY, float alpha)
|
void IkConstraint::apply(Bone& bone, float targetX, float targetY, float alpha)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(IkConstraintTimeline, CurveTimeline);
|
RTTI_IMPL(IkConstraintTimeline, CurveTimeline);
|
||||||
|
|
||||||
const int IkConstraintTimeline::ENTRIES = 3;
|
const int IkConstraintTimeline::ENTRIES = 3;
|
||||||
const int IkConstraintTimeline::PREV_TIME = -3;
|
const int IkConstraintTimeline::PREV_TIME = -3;
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(MeshAttachment, VertexAttachment);
|
RTTI_IMPL(MeshAttachment, VertexAttachment);
|
||||||
|
|
||||||
MeshAttachment::MeshAttachment(std::string name) : VertexAttachment(name),
|
MeshAttachment::MeshAttachment(std::string name) : VertexAttachment(name),
|
||||||
_regionOffsetX(0),
|
_regionOffsetX(0),
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(PathAttachment, VertexAttachment);
|
RTTI_IMPL(PathAttachment, VertexAttachment);
|
||||||
|
|
||||||
PathAttachment::PathAttachment(std::string name) : VertexAttachment(name)
|
PathAttachment::PathAttachment(std::string name) : VertexAttachment(name)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(PathConstraint, Constraint);
|
RTTI_IMPL(PathConstraint, Constraint);
|
||||||
|
|
||||||
const float PathConstraint::EPSILON = 0.00001f;
|
const float PathConstraint::EPSILON = 0.00001f;
|
||||||
const int PathConstraint::NONE = -1;
|
const int PathConstraint::NONE = -1;
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(PathConstraintMixTimeline, CurveTimeline);
|
RTTI_IMPL(PathConstraintMixTimeline, CurveTimeline);
|
||||||
|
|
||||||
void PathConstraintMixTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
void PathConstraintMixTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(PathConstraintPositionTimeline, CurveTimeline);
|
RTTI_IMPL(PathConstraintPositionTimeline, CurveTimeline);
|
||||||
|
|
||||||
const int PathConstraintPositionTimeline::ENTRIES = 2;
|
const int PathConstraintPositionTimeline::ENTRIES = 2;
|
||||||
const int PathConstraintPositionTimeline::PREV_TIME = -2;
|
const int PathConstraintPositionTimeline::PREV_TIME = -2;
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(PathConstraintSpacingTimeline, PathConstraintPositionTimeline);
|
RTTI_IMPL(PathConstraintSpacingTimeline, PathConstraintPositionTimeline);
|
||||||
|
|
||||||
PathConstraintSpacingTimeline::PathConstraintSpacingTimeline(int frameCount) : PathConstraintPositionTimeline(frameCount)
|
PathConstraintSpacingTimeline::PathConstraintSpacingTimeline(int frameCount) : PathConstraintPositionTimeline(frameCount)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(PointAttachment, Attachment);
|
RTTI_IMPL(PointAttachment, Attachment);
|
||||||
|
|
||||||
PointAttachment::PointAttachment(std::string name) : Attachment(name)
|
PointAttachment::PointAttachment(std::string name) : Attachment(name)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -28,33 +28,33 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <spine/SpineRTTI.h>
|
#include <spine/RTTI.h>
|
||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI::SPINE_RTTI(const std::string& className) : m_className(className), m_pBaseSPINE_RTTI(NULL)
|
RTTI::RTTI(const std::string& className) : m_className(className), m_pBaseRTTI(NULL)
|
||||||
{
|
{
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
SPINE_RTTI::SPINE_RTTI(const std::string& className, const SPINE_RTTI& baseSPINE_RTTI) : m_className(className), m_pBaseSPINE_RTTI(&baseSPINE_RTTI)
|
RTTI::RTTI(const std::string& className, const RTTI& baseRTTI) : m_className(className), m_pBaseRTTI(&baseRTTI)
|
||||||
{
|
{
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& SPINE_RTTI::getClassName() const
|
const std::string& RTTI::getClassName() const
|
||||||
{
|
{
|
||||||
return m_className;
|
return m_className;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SPINE_RTTI::isExactly(const SPINE_RTTI& rtti) const
|
bool RTTI::isExactly(const RTTI& rtti) const
|
||||||
{
|
{
|
||||||
return (this == &rtti);
|
return (this == &rtti);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SPINE_RTTI::derivesFrom(const SPINE_RTTI& rtti) const
|
bool RTTI::derivesFrom(const RTTI& rtti) const
|
||||||
{
|
{
|
||||||
const SPINE_RTTI * pCompare = this;
|
const RTTI * pCompare = this;
|
||||||
|
|
||||||
while (pCompare)
|
while (pCompare)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ namespace Spine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCompare = pCompare->m_pBaseSPINE_RTTI;
|
pCompare = pCompare->m_pBaseRTTI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(RegionAttachment, Attachment);
|
RTTI_IMPL(RegionAttachment, Attachment);
|
||||||
|
|
||||||
const int RegionAttachment::BLX = 0;
|
const int RegionAttachment::BLX = 0;
|
||||||
const int RegionAttachment::BLY = 1;
|
const int RegionAttachment::BLY = 1;
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(RotateTimeline, CurveTimeline);
|
RTTI_IMPL(RotateTimeline, CurveTimeline);
|
||||||
|
|
||||||
RotateTimeline::RotateTimeline(int frameCount) : CurveTimeline(frameCount), _boneIndex(0)
|
RotateTimeline::RotateTimeline(int frameCount) : CurveTimeline(frameCount), _boneIndex(0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(ScaleTimeline, TranslateTimeline);
|
RTTI_IMPL(ScaleTimeline, TranslateTimeline);
|
||||||
|
|
||||||
void ScaleTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
void ScaleTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(ShearTimeline, TranslateTimeline);
|
RTTI_IMPL(ShearTimeline, TranslateTimeline);
|
||||||
|
|
||||||
void ShearTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
void ShearTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -33,6 +33,9 @@
|
|||||||
#include <spine/Skeleton.h>
|
#include <spine/Skeleton.h>
|
||||||
#include <spine/BoundingBoxAttachment.h>
|
#include <spine/BoundingBoxAttachment.h>
|
||||||
|
|
||||||
|
#include <spine/Slot.h>
|
||||||
|
#include <spine/MathUtil.h>
|
||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0)
|
SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0)
|
||||||
@ -42,63 +45,65 @@ namespace Spine
|
|||||||
|
|
||||||
void SkeletonBounds::update(Skeleton& skeleton, bool updateAabb)
|
void SkeletonBounds::update(Skeleton& skeleton, bool updateAabb)
|
||||||
{
|
{
|
||||||
// Vector<Slot> slots = skeleton._slots;
|
Vector<Slot*>& slots = skeleton._slots;
|
||||||
// int slotCount = slots.Count;
|
int slotCount = static_cast<int>(slots.size());
|
||||||
//
|
|
||||||
// _boundingBoxes.clear();
|
_boundingBoxes.clear();
|
||||||
// for (int i = 0, n = _polygons.size(); i < n; ++i)
|
for (int i = 0, n = static_cast<int>(_polygons.size()); i < n; ++i)
|
||||||
// {
|
{
|
||||||
// _polygonPool.push_back(_polygons[i]);
|
_polygonPool.push_back(_polygons[i]);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// _polygons.clear();
|
_polygons.clear();
|
||||||
//
|
|
||||||
// for (int i = 0; i < slotCount; i++)
|
for (int i = 0; i < slotCount; i++)
|
||||||
// {
|
{
|
||||||
// Slot slot = slots.Items[i];
|
Slot* slot = slots[i];
|
||||||
// BoundingBoxAttachment boundingBox = slot.attachment as BoundingBoxAttachment;
|
Attachment* attachment = slot->_attachment;
|
||||||
// if (boundingBox == NULL)
|
if (attachment == NULL || !attachment->getRTTI().derivesFrom(BoundingBoxAttachment::rtti))
|
||||||
// {
|
{
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
// _boundingBoxes.push_back(boundingBox);
|
BoundingBoxAttachment* boundingBox = static_cast<BoundingBoxAttachment*>(attachment);
|
||||||
//
|
_boundingBoxes.push_back(boundingBox);
|
||||||
// Polygon* polygonP = NULL;
|
|
||||||
// int poolCount = _polygonPool.size();
|
Polygon* polygonP = NULL;
|
||||||
// if (poolCount > 0)
|
int poolCount = static_cast<int>(_polygonPool.size());
|
||||||
// {
|
if (poolCount > 0)
|
||||||
// polygonP = _polygonPool[poolCount - 1];
|
{
|
||||||
// _polygonPool.erase(poolCount - 1);
|
polygonP = _polygonPool[poolCount - 1];
|
||||||
// }
|
_polygonPool.erase(poolCount - 1);
|
||||||
// else
|
}
|
||||||
// {
|
else
|
||||||
// polygonP = new Polygon();
|
{
|
||||||
// }
|
Polygon* polygonP = MALLOC(Polygon, 1);
|
||||||
//
|
new (polygonP) Polygon();
|
||||||
// _polygons.push_back(polygonP);
|
}
|
||||||
//
|
|
||||||
// Polygon& polygon = *polygonP;
|
_polygons.push_back(polygonP);
|
||||||
//
|
|
||||||
// int count = boundingBox.worldVerticesLength;
|
Polygon& polygon = *polygonP;
|
||||||
// polygon._count = count;
|
|
||||||
// if (polygon._vertices.size() < count)
|
int count = boundingBox->getWorldVerticesLength();
|
||||||
// {
|
polygon._count = count;
|
||||||
// polygon._vertices.reserve(count);
|
if (polygon._vertices.size() < count)
|
||||||
// }
|
{
|
||||||
// boundingBox.computeWorldVertices(slot, polygon._vertices);
|
polygon._vertices.reserve(count);
|
||||||
// }
|
}
|
||||||
//
|
boundingBox->computeWorldVertices(*slot, polygon._vertices);
|
||||||
// if (updateAabb)
|
}
|
||||||
// {
|
|
||||||
// aabbCompute();
|
if (updateAabb)
|
||||||
// }
|
{
|
||||||
// else
|
aabbCompute();
|
||||||
// {
|
}
|
||||||
// minX = int.MinValue;
|
else
|
||||||
// minY = int.MinValue;
|
{
|
||||||
// maxX = int.MaxValue;
|
_minX = std::numeric_limits<int>::min();
|
||||||
// maxY = int.MaxValue;
|
_minY = std::numeric_limits<int>::min();
|
||||||
// }
|
_maxX = std::numeric_limits<int>::max();
|
||||||
|
_maxY = std::numeric_limits<int>::max();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonBounds::aabbcontainsPoint(float x, float y)
|
bool SkeletonBounds::aabbcontainsPoint(float x, float y)
|
||||||
@ -147,80 +152,82 @@ namespace Spine
|
|||||||
return _minX < bounds._maxX && _maxX > bounds._minX && _minY < bounds._maxY && _maxY > bounds._minY;
|
return _minX < bounds._maxX && _maxX > bounds._minX && _minY < bounds._maxY && _maxY > bounds._minY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonBounds::containsPoint(Polygon polygon, float x, float y)
|
bool SkeletonBounds::containsPoint(Polygon* polygon, float x, float y)
|
||||||
{
|
{
|
||||||
// float[] vertices = polygon.Vertices;
|
Vector<float>& vertices = polygon->_vertices;
|
||||||
// int nn = polygon.Count;
|
int nn = polygon->_count;
|
||||||
//
|
|
||||||
// int prevIndex = nn - 2;
|
int prevIndex = nn - 2;
|
||||||
bool inside = false;
|
bool inside = false;
|
||||||
// for (int ii = 0; ii < nn; ii += 2)
|
for (int ii = 0; ii < nn; ii += 2)
|
||||||
// {
|
{
|
||||||
// float vertexY = vertices[ii + 1];
|
float vertexY = vertices[ii + 1];
|
||||||
// float prevY = vertices[prevIndex + 1];
|
float prevY = vertices[prevIndex + 1];
|
||||||
// if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y))
|
if ((vertexY < y && prevY >= y) || (prevY < y && vertexY >= y))
|
||||||
// {
|
{
|
||||||
// float vertexX = vertices[ii];
|
float vertexX = vertices[ii];
|
||||||
// if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
|
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
|
||||||
// {
|
{
|
||||||
// inside = !inside;
|
inside = !inside;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// prevIndex = ii;
|
prevIndex = ii;
|
||||||
// }
|
}
|
||||||
return inside;
|
return inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingBoxAttachment* SkeletonBounds::containsPoint(float x, float y)
|
BoundingBoxAttachment* SkeletonBounds::containsPoint(float x, float y)
|
||||||
{
|
{
|
||||||
// for (int i = 0, n = _polygons.size(); i < n; ++i)
|
for (int i = 0, n = static_cast<int>(_polygons.size()); i < n; ++i)
|
||||||
// {
|
{
|
||||||
// if (containsPoint(_polygons[i], x, y))
|
if (containsPoint(_polygons[i], x, y))
|
||||||
// {
|
{
|
||||||
// return _boundingBoxes[i];
|
return _boundingBoxes[i];
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingBoxAttachment* SkeletonBounds::intersectsSegment(float x1, float y1, float x2, float y2)
|
BoundingBoxAttachment* SkeletonBounds::intersectsSegment(float x1, float y1, float x2, float y2)
|
||||||
{
|
{
|
||||||
// for (int i = 0, n = _polygons.size(); i < n; ++i)
|
for (int i = 0, n = static_cast<int>(_polygons.size()); i < n; ++i)
|
||||||
// {
|
{
|
||||||
// if (intersectsSegment(_polygons[i], x1, y1, x2, y2))
|
if (intersectsSegment(_polygons[i], x1, y1, x2, y2))
|
||||||
// {
|
{
|
||||||
// return _boundingBoxes[i];
|
return _boundingBoxes[i];
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonBounds::intersectsSegment(Polygon* polygon, float x1, float y1, float x2, float y2)
|
bool SkeletonBounds::intersectsSegment(Polygon* polygon, float x1, float y1, float x2, float y2)
|
||||||
{
|
{
|
||||||
// Vector<float>& vertices = polygon->_vertices;
|
Vector<float>& vertices = polygon->_vertices;
|
||||||
// int nn = polygon.Count;
|
int nn = polygon->_count;
|
||||||
//
|
|
||||||
// float width12 = x1 - x2, height12 = y1 - y2;
|
float width12 = x1 - x2, height12 = y1 - y2;
|
||||||
// float det1 = x1 * y2 - y1 * x2;
|
float det1 = x1 * y2 - y1 * x2;
|
||||||
// float x3 = vertices[nn - 2], y3 = vertices[nn - 1];
|
float x3 = vertices[nn - 2], y3 = vertices[nn - 1];
|
||||||
// for (int ii = 0; ii < nn; ii += 2)
|
for (int ii = 0; ii < nn; ii += 2)
|
||||||
// {
|
{
|
||||||
// float x4 = vertices[ii], y4 = vertices[ii + 1];
|
float x4 = vertices[ii], y4 = vertices[ii + 1];
|
||||||
// float det2 = x3 * y4 - y3 * x4;
|
float det2 = x3 * y4 - y3 * x4;
|
||||||
// float width34 = x3 - x4, height34 = y3 - y4;
|
float width34 = x3 - x4, height34 = y3 - y4;
|
||||||
// float det3 = width12 * height34 - height12 * width34;
|
float det3 = width12 * height34 - height12 * width34;
|
||||||
// float x = (det1 * width34 - width12 * det2) / det3;
|
float x = (det1 * width34 - width12 * det2) / det3;
|
||||||
// if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1)))
|
if (((x >= x3 && x <= x4) || (x >= x4 && x <= x3)) && ((x >= x1 && x <= x2) || (x >= x2 && x <= x1)))
|
||||||
// {
|
{
|
||||||
// float y = (det1 * height34 - height12 * det2) / det3;
|
float y = (det1 * height34 - height12 * det2) / det3;
|
||||||
// if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1)))
|
if (((y >= y3 && y <= y4) || (y >= y4 && y <= y3)) && ((y >= y1 && y <= y2) || (y >= y2 && y <= y1)))
|
||||||
// {
|
{
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// x3 = x4;
|
x3 = x4;
|
||||||
// y3 = y4;
|
y3 = y4;
|
||||||
// }
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,25 +250,29 @@ namespace Spine
|
|||||||
|
|
||||||
void SkeletonBounds::aabbCompute()
|
void SkeletonBounds::aabbCompute()
|
||||||
{
|
{
|
||||||
// float minX = int.MaxValue, minY = int.MaxValue, maxX = int.MinValue, maxY = int.MinValue;
|
float minX = std::numeric_limits<int>::min();
|
||||||
// for (int i = 0, n = _polygons.size(); i < n; i++)
|
float minY = std::numeric_limits<int>::min();
|
||||||
// {
|
float maxX = std::numeric_limits<int>::max();
|
||||||
// Polygon* polygon = _polygons[i];
|
float maxY = std::numeric_limits<int>::max();
|
||||||
// Vector<float>& vertices = polygon->_vertices;
|
|
||||||
// for (int ii = 0, nn = polygon.Count; ii < nn; ii += 2)
|
for (int i = 0, n = static_cast<int>(_polygons.size()); i < n; ++i)
|
||||||
// {
|
{
|
||||||
// float x = vertices[ii];
|
Polygon* polygon = _polygons[i];
|
||||||
// float y = vertices[ii + 1];
|
Vector<float>& vertices = polygon->_vertices;
|
||||||
// minX = Math.Min(minX, x);
|
for (int ii = 0, nn = polygon->_count; ii < nn; ii += 2)
|
||||||
// minY = Math.Min(minY, y);
|
{
|
||||||
// maxX = Math.Max(maxX, x);
|
float x = vertices[ii];
|
||||||
// maxY = Math.Max(maxY, y);
|
float y = vertices[ii + 1];
|
||||||
// }
|
minX = MIN(minX, x);
|
||||||
// }
|
minY = MIN(minY, y);
|
||||||
// _minX = minX;
|
maxX = MAX(maxX, x);
|
||||||
// _minY = minY;
|
maxY = MAX(maxY, y);
|
||||||
// _maxX = maxX;
|
}
|
||||||
// _maxY = maxY;
|
}
|
||||||
|
_minX = minX;
|
||||||
|
_minY = minY;
|
||||||
|
_maxX = maxX;
|
||||||
|
_maxY = maxY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,19 +45,28 @@ namespace Spine
|
|||||||
|
|
||||||
int SkeletonClipping::clipStart(Slot& slot, ClippingAttachment* clip)
|
int SkeletonClipping::clipStart(Slot& slot, ClippingAttachment* clip)
|
||||||
{
|
{
|
||||||
// if (clipAttachment != NULL) return 0;
|
if (_clipAttachment != NULL)
|
||||||
// clipAttachment = clip;
|
{
|
||||||
//
|
return 0;
|
||||||
// int n = clip.worldVerticesLength;
|
}
|
||||||
// float[] vertices = clippingPolygon.Resize(n).Items;
|
|
||||||
// clip.ComputeWorldVertices(slot, 0, n, vertices, 0, 2);
|
_clipAttachment = clip;
|
||||||
// makeClockwise(clippingPolygon);
|
|
||||||
// clippingPolygons = triangulator.Decompose(clippingPolygon, triangulator.Triangulate(clippingPolygon));
|
int n = clip->getWorldVerticesLength();
|
||||||
// foreach (var polygon in clippingPolygons) {
|
_clippingPolygon.reserve(n);
|
||||||
// makeClockwise(polygon);
|
clip->computeWorldVertices(slot, 0, n, _clippingPolygon, 0, 2);
|
||||||
// polygon.push_back(polygon.Items[0]);
|
makeClockwise(_clippingPolygon);
|
||||||
// polygon.push_back(polygon.Items[1]);
|
_clippingPolygons = _triangulator.decompose(_clippingPolygon, _triangulator.triangulate(_clippingPolygon));
|
||||||
// }
|
|
||||||
|
for (Vector<float>** i = _clippingPolygons.begin(); i != _clippingPolygons.end(); ++i)
|
||||||
|
{
|
||||||
|
Vector<float>* polygonP = (*i);
|
||||||
|
Vector<float>& polygon = *polygonP;
|
||||||
|
makeClockwise(polygon);
|
||||||
|
polygon.push_back(polygon[0]);
|
||||||
|
polygon.push_back(polygon[1]);
|
||||||
|
}
|
||||||
|
|
||||||
return static_cast<int>(_clippingPolygons.size());
|
return static_cast<int>(_clippingPolygons.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,34 +94,41 @@ namespace Spine
|
|||||||
|
|
||||||
void SkeletonClipping::clipTriangles(Vector<float>& vertices, int verticesLength, Vector<int>& triangles, int trianglesLength, Vector<float>& uvs)
|
void SkeletonClipping::clipTriangles(Vector<float>& vertices, int verticesLength, Vector<int>& triangles, int trianglesLength, Vector<float>& uvs)
|
||||||
{
|
{
|
||||||
// Vector<float> clipOutput = _clipOutput, clippedVertices = _clippedVertices;
|
Vector<float>& clipOutput = _clipOutput, clippedVertices = _clippedVertices;
|
||||||
// var clippedTriangles = _clippedTriangles;
|
Vector<int>& clippedTriangles = _clippedTriangles;
|
||||||
// var polygons = clippingPolygons.Items;
|
Vector< Vector<float>* >& polygons = _clippingPolygons;
|
||||||
// int polygonsCount = clippingPolygons.Count;
|
int polygonsCount = _clippingPolygons.size();
|
||||||
//
|
|
||||||
// int index = 0;
|
int index = 0;
|
||||||
// clippedVertices.Clear();
|
clippedVertices.clear();
|
||||||
// clippedUVs.Clear();
|
_clippedUVs.clear();
|
||||||
// clippedTriangles.Clear();
|
clippedTriangles.clear();
|
||||||
// //outer:
|
|
||||||
// for (int i = 0; i < trianglesLength; i += 3) {
|
//outer:
|
||||||
// int vertexOffset = triangles[i] << 1;
|
for (int i = 0; i < trianglesLength; i += 3)
|
||||||
// float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
|
{
|
||||||
// float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
|
int vertexOffset = triangles[i] << 1;
|
||||||
//
|
float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1];
|
||||||
// vertexOffset = triangles[i + 1] << 1;
|
float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1];
|
||||||
// float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
|
|
||||||
// float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
|
vertexOffset = triangles[i + 1] << 1;
|
||||||
//
|
float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1];
|
||||||
// vertexOffset = triangles[i + 2] << 1;
|
float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1];
|
||||||
// float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
|
|
||||||
// float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
|
vertexOffset = triangles[i + 2] << 1;
|
||||||
//
|
float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1];
|
||||||
// for (int p = 0; p < polygonsCount; p++) {
|
float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1];
|
||||||
// int s = clippedVertices.Count;
|
|
||||||
// if (clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
for (int p = 0; p < polygonsCount; p++)
|
||||||
|
{
|
||||||
|
int s = clippedVertices.size();
|
||||||
|
// if (clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput))
|
||||||
|
// {
|
||||||
// int clipOutputLength = clipOutput.Count;
|
// int clipOutputLength = clipOutput.Count;
|
||||||
// if (clipOutputLength == 0) continue;
|
// if (clipOutputLength == 0)
|
||||||
|
// {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
// float d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
// float d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
||||||
// float d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
// float d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
||||||
//
|
//
|
||||||
@ -120,7 +136,8 @@ namespace Spine
|
|||||||
// float[] clipOutputItems = clipOutput.Items;
|
// float[] clipOutputItems = clipOutput.Items;
|
||||||
// float[] clippedVerticesItems = clippedVertices.Resize(s + clipOutputCount * 2).Items;
|
// float[] clippedVerticesItems = clippedVertices.Resize(s + clipOutputCount * 2).Items;
|
||||||
// float[] clippedUVsItems = clippedUVs.Resize(s + clipOutputCount * 2).Items;
|
// float[] clippedUVsItems = clippedUVs.Resize(s + clipOutputCount * 2).Items;
|
||||||
// for (int ii = 0; ii < clipOutputLength; ii += 2) {
|
// for (int ii = 0; ii < clipOutputLength; ii += 2)
|
||||||
|
// {
|
||||||
// float x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
|
// float x = clipOutputItems[ii], y = clipOutputItems[ii + 1];
|
||||||
// clippedVerticesItems[s] = x;
|
// clippedVerticesItems[s] = x;
|
||||||
// clippedVerticesItems[s + 1] = y;
|
// clippedVerticesItems[s + 1] = y;
|
||||||
@ -136,7 +153,8 @@ namespace Spine
|
|||||||
// s = clippedTriangles.Count;
|
// s = clippedTriangles.Count;
|
||||||
// int[] clippedTrianglesItems = clippedTriangles.Resize(s + 3 * (clipOutputCount - 2)).Items;
|
// int[] clippedTrianglesItems = clippedTriangles.Resize(s + 3 * (clipOutputCount - 2)).Items;
|
||||||
// clipOutputCount--;
|
// clipOutputCount--;
|
||||||
// for (int ii = 1; ii < clipOutputCount; ii++) {
|
// for (int ii = 1; ii < clipOutputCount; ii++)
|
||||||
|
// {
|
||||||
// clippedTrianglesItems[s] = index;
|
// clippedTrianglesItems[s] = index;
|
||||||
// clippedTrianglesItems[s + 1] = index + ii;
|
// clippedTrianglesItems[s + 1] = index + ii;
|
||||||
// clippedTrianglesItems[s + 2] = index + ii + 1;
|
// clippedTrianglesItems[s + 2] = index + ii + 1;
|
||||||
@ -144,7 +162,8 @@ namespace Spine
|
|||||||
// }
|
// }
|
||||||
// index += clipOutputCount + 1;
|
// index += clipOutputCount + 1;
|
||||||
// }
|
// }
|
||||||
// else {
|
// else
|
||||||
|
// {
|
||||||
// float[] clippedVerticesItems = clippedVertices.Resize(s + 3 * 2).Items;
|
// float[] clippedVerticesItems = clippedVertices.Resize(s + 3 * 2).Items;
|
||||||
// float[] clippedUVsItems = clippedUVs.Resize(s + 3 * 2).Items;
|
// float[] clippedUVsItems = clippedUVs.Resize(s + 3 * 2).Items;
|
||||||
// clippedVerticesItems[s] = x1;
|
// clippedVerticesItems[s] = x1;
|
||||||
@ -169,8 +188,8 @@ namespace Spine
|
|||||||
// index += 3;
|
// index += 3;
|
||||||
// break; //continue outer;
|
// break; //continue outer;
|
||||||
// }
|
// }
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkeletonClipping::isClipping()
|
bool SkeletonClipping::isClipping()
|
||||||
@ -180,15 +199,18 @@ namespace Spine
|
|||||||
|
|
||||||
bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, float y3, Vector<float>& clippingArea, Vector<float>& output)
|
bool SkeletonClipping::clip(float x1, float y1, float x2, float y2, float x3, float y3, Vector<float>& clippingArea, Vector<float>& output)
|
||||||
{
|
{
|
||||||
// var originalOutput = output;
|
Vector<float> originalOutput = output;
|
||||||
bool clipped = false;
|
bool clipped = false;
|
||||||
//
|
//
|
||||||
// // Avoid copy at the end.
|
// // Avoid copy at the end.
|
||||||
// Vector<float> input = NULL;
|
// Vector<float> input = NULL;
|
||||||
// if (clippingArea.Count % 4 >= 2) {
|
// if (clippingArea.Count % 4 >= 2)
|
||||||
|
// {
|
||||||
// input = output;
|
// input = output;
|
||||||
// output = scratch;
|
// output = scratch;
|
||||||
// } else {
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
// input = scratch;
|
// input = scratch;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -205,19 +227,24 @@ namespace Spine
|
|||||||
//
|
//
|
||||||
// Vector<float> clippingVertices = clippingArea.Items;
|
// Vector<float> clippingVertices = clippingArea.Items;
|
||||||
// int clippingVerticesLast = clippingArea.Count - 4;
|
// int clippingVerticesLast = clippingArea.Count - 4;
|
||||||
// for (int i = 0; ; i += 2) {
|
// for (int i = 0; ; i += 2)
|
||||||
|
// {
|
||||||
// float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
|
// float edgeX = clippingVertices[i], edgeY = clippingVertices[i + 1];
|
||||||
// float edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3];
|
// float edgeX2 = clippingVertices[i + 2], edgeY2 = clippingVertices[i + 3];
|
||||||
// float deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2;
|
// float deltaX = edgeX - edgeX2, deltaY = edgeY - edgeY2;
|
||||||
//
|
//
|
||||||
// Vector<float> inputVertices = input.Items;
|
// Vector<float> inputVertices = input.Items;
|
||||||
// int inputVerticesLength = input.Count - 2, outputStart = output.Count;
|
// int inputVerticesLength = input.Count - 2, outputStart = output.Count;
|
||||||
// for (int ii = 0; ii < inputVerticesLength; ii += 2) {
|
// for (int ii = 0; ii < inputVerticesLength; ii += 2)
|
||||||
|
// {
|
||||||
// float inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
|
// float inputX = inputVertices[ii], inputY = inputVertices[ii + 1];
|
||||||
// float inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3];
|
// float inputX2 = inputVertices[ii + 2], inputY2 = inputVertices[ii + 3];
|
||||||
// bool side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0;
|
// bool side2 = deltaX * (inputY2 - edgeY2) - deltaY * (inputX2 - edgeX2) > 0;
|
||||||
// if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0) {
|
// if (deltaX * (inputY - edgeY2) - deltaY * (inputX - edgeX2) > 0)
|
||||||
// if (side2) { // v1 inside, v2 inside
|
// {
|
||||||
|
// if (side2)
|
||||||
|
// {
|
||||||
|
// // v1 inside, v2 inside
|
||||||
// output.push_back(inputX2);
|
// output.push_back(inputX2);
|
||||||
// output.push_back(inputY2);
|
// output.push_back(inputY2);
|
||||||
// continue;
|
// continue;
|
||||||
@ -228,7 +255,9 @@ namespace Spine
|
|||||||
// output.push_back(edgeX + (edgeX2 - edgeX) * ua);
|
// output.push_back(edgeX + (edgeX2 - edgeX) * ua);
|
||||||
// output.push_back(edgeY + (edgeY2 - edgeY) * ua);
|
// output.push_back(edgeY + (edgeY2 - edgeY) * ua);
|
||||||
// }
|
// }
|
||||||
// else if (side2) { // v1 outside, v2 inside
|
// else if (side2)
|
||||||
|
// {
|
||||||
|
// // v1 outside, v2 inside
|
||||||
// float c0 = inputY2 - inputY, c2 = inputX2 - inputX;
|
// float c0 = inputY2 - inputY, c2 = inputX2 - inputX;
|
||||||
// float ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY));
|
// float ua = (c2 * (edgeY - inputY) - c0 * (edgeX - inputX)) / (c0 * (edgeX2 - edgeX) - c2 * (edgeY2 - edgeY));
|
||||||
// output.push_back(edgeX + (edgeX2 - edgeX) * ua);
|
// output.push_back(edgeX + (edgeX2 - edgeX) * ua);
|
||||||
@ -239,7 +268,9 @@ namespace Spine
|
|||||||
// clipped = true;
|
// clipped = true;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (outputStart == output.Count) { // All edges outside.
|
// if (outputStart == output.Count)
|
||||||
|
// {
|
||||||
|
// // All edges outside.
|
||||||
// originalOutput.Clear();
|
// originalOutput.Clear();
|
||||||
// return true;
|
// return true;
|
||||||
// }
|
// }
|
||||||
@ -247,19 +278,26 @@ namespace Spine
|
|||||||
// output.push_back(output.Items[0]);
|
// output.push_back(output.Items[0]);
|
||||||
// output.push_back(output.Items[1]);
|
// output.push_back(output.Items[1]);
|
||||||
//
|
//
|
||||||
// if (i == clippingVerticesLast) break;
|
// if (i == clippingVerticesLast)
|
||||||
|
// {
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
// var temp = output;
|
// var temp = output;
|
||||||
// output = input;
|
// output = input;
|
||||||
// output.Clear();
|
// output.Clear();
|
||||||
// input = temp;
|
// input = temp;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (originalOutput != output) {
|
// if (originalOutput != output)
|
||||||
|
// {
|
||||||
// originalOutput.Clear();
|
// originalOutput.Clear();
|
||||||
// for (int i = 0, n = output.Count - 2; i < n; i++) {
|
// for (int i = 0, n = output.Count - 2; i < n; i++)
|
||||||
|
// {
|
||||||
// originalOutput.push_back(output.Items[i]);
|
// originalOutput.push_back(output.Items[i]);
|
||||||
// }
|
// }
|
||||||
// } else {
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
// originalOutput.Resize(originalOutput.Count - 2);
|
// originalOutput.Resize(originalOutput.Count - 2);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -268,26 +306,32 @@ namespace Spine
|
|||||||
|
|
||||||
void SkeletonClipping::makeClockwise(Vector<float>& polygon)
|
void SkeletonClipping::makeClockwise(Vector<float>& polygon)
|
||||||
{
|
{
|
||||||
// Vector<float> vertices = polygon.Items;
|
int verticeslength = static_cast<int>(polygon.size());
|
||||||
// int verticeslength = polygon.Count;
|
|
||||||
//
|
float area = polygon[verticeslength - 2] * polygon[1] - polygon[0] * polygon[verticeslength - 1], p1x, p1y, p2x, p2y;
|
||||||
// float area = vertices[verticeslength - 2] * vertices[1] - vertices[0] * vertices[verticeslength - 1], p1x, p1y, p2x, p2y;
|
|
||||||
// for (int i = 0, n = verticeslength - 3; i < n; i += 2) {
|
for (int i = 0, n = verticeslength - 3; i < n; i += 2)
|
||||||
// p1x = vertices[i];
|
{
|
||||||
// p1y = vertices[i + 1];
|
p1x = polygon[i];
|
||||||
// p2x = vertices[i + 2];
|
p1y = polygon[i + 1];
|
||||||
// p2y = vertices[i + 3];
|
p2x = polygon[i + 2];
|
||||||
// area += p1x * p2y - p2x * p1y;
|
p2y = polygon[i + 3];
|
||||||
// }
|
area += p1x * p2y - p2x * p1y;
|
||||||
// if (area < 0) return;
|
}
|
||||||
//
|
|
||||||
// for (int i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
|
if (area < 0)
|
||||||
// float x = vertices[i], y = vertices[i + 1];
|
{
|
||||||
// int other = lastX - i;
|
return;
|
||||||
// vertices[i] = vertices[other];
|
}
|
||||||
// vertices[i + 1] = vertices[other + 1];
|
|
||||||
// vertices[other] = x;
|
for (int i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2)
|
||||||
// vertices[other + 1] = y;
|
{
|
||||||
// }
|
float x = polygon[i], y = polygon[i + 1];
|
||||||
|
int other = lastX - i;
|
||||||
|
polygon[i] = polygon[other];
|
||||||
|
polygon[i + 1] = polygon[other + 1];
|
||||||
|
polygon[other] = x;
|
||||||
|
polygon[other + 1] = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL_NOPARENT(Timeline);
|
RTTI_IMPL_NOPARENT(Timeline);
|
||||||
|
|
||||||
Timeline::Timeline()
|
Timeline::Timeline()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(TransformConstraint, Constraint);
|
RTTI_IMPL(TransformConstraint, Constraint);
|
||||||
|
|
||||||
TransformConstraint::TransformConstraint(TransformConstraintData& data, Skeleton& skeleton) : Constraint(),
|
TransformConstraint::TransformConstraint(TransformConstraintData& data, Skeleton& skeleton) : Constraint(),
|
||||||
_data(data),
|
_data(data),
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(TransformConstraintTimeline, CurveTimeline);
|
RTTI_IMPL(TransformConstraintTimeline, CurveTimeline);
|
||||||
|
|
||||||
const int TransformConstraintTimeline::ENTRIES = 5;
|
const int TransformConstraintTimeline::ENTRIES = 5;
|
||||||
const int TransformConstraintTimeline::PREV_TIME = -5;
|
const int TransformConstraintTimeline::PREV_TIME = -5;
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(TranslateTimeline, CurveTimeline);
|
RTTI_IMPL(TranslateTimeline, CurveTimeline);
|
||||||
|
|
||||||
void TranslateTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
void TranslateTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(TwoColorTimeline, CurveTimeline);
|
RTTI_IMPL(TwoColorTimeline, CurveTimeline);
|
||||||
|
|
||||||
void TwoColorTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
void TwoColorTimeline::apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*>& events, float alpha, MixPose pose, MixDirection direction)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL_NOPARENT(Updatable);
|
RTTI_IMPL_NOPARENT(Updatable);
|
||||||
|
|
||||||
Updatable::Updatable()
|
Updatable::Updatable()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
namespace Spine
|
namespace Spine
|
||||||
{
|
{
|
||||||
SPINE_RTTI_IMPL(VertexAttachment, Attachment);
|
RTTI_IMPL(VertexAttachment, Attachment);
|
||||||
|
|
||||||
VertexAttachment::VertexAttachment(std::string name) : Attachment(name), _worldVerticesLength(0), _id(getNextID())
|
VertexAttachment::VertexAttachment(std::string name) : Attachment(name), _worldVerticesLength(0), _id(getNextID())
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user