diff --git a/spine-cpp/LICENSE b/spine-cpp/LICENSE index daceab94a..9ea5ef41c 100644 --- a/spine-cpp/LICENSE +++ b/spine-cpp/LICENSE @@ -1,15 +1,15 @@ -Spine Runtimes Software License v2.5 +spine Runtimes Software License v2.5 Copyright (c) 2013-2016, Esoteric Software All rights reserved. You are granted a perpetual, non-exclusive, non-sublicensable, and -non-transferable license to use, install, execute, and perform the Spine +non-transferable license to use, install, execute, and perform the spine Runtimes software and derivative works solely for personal or internal use. Without the written permission of Esoteric Software (see Section 2 of -the Spine Software License Agreement), you may not (a) modify, translate, -adapt, or develop new applications using the Spine Runtimes or otherwise -create derivative works or improvements of the Spine Runtimes or (b) remove, +the spine Software License Agreement), you may not (a) modify, translate, +adapt, or develop new applications using the spine Runtimes or otherwise +create derivative works or improvements of the spine Runtimes or (b) remove, delete, alter, or obscure any trademarks or any copyright, trademark, patent, or other intellectual property or proprietary rights notices on or in the Software, including any copy thereof. Redistributions in binary or source diff --git a/spine-cpp/README.md b/spine-cpp/README.md index 498677724..f4f5a523e 100644 --- a/spine-cpp/README.md +++ b/spine-cpp/README.md @@ -1,39 +1,47 @@ # spine-cpp -The spine-cpp runtime provides basic functionality to load and manipulate [Spine](http://esotericsoftware.com) skeletal animation data using C++. It does not perform rendering but can be extended to enable Spine animations for other projects that utilize C++. Note, this library uses C++03 for maximum portability and therefore does not take advantage of any C++11 or newer features such as std::unique_ptr. +The spine-cpp runtime provides basic functionality to load and manipulate [spine](http://esotericsoftware.com) skeletal animation data using C++. It does not perform rendering but can be extended to enable spine animations for other projects that utilize C++. Note, this library uses C++03 for maximum portability and therefore does not take advantage of any C++11 or newer features such as std::unique_ptr. ## Licensing -This Spine Runtime may only be used for personal or internal use, typically to evaluate Spine before purchasing. If you would like to incorporate a Spine Runtime into your applications, distribute software containing a Spine Runtime, or modify a Spine Runtime, then you will need a valid [Spine license](https://esotericsoftware.com/spine-purchase). Please see the [Spine Runtimes Software License](http://esotericsoftware.com/git/spine-runtimes/blob/LICENSE) for detailed information. +This spine Runtime may only be used for personal or internal use, typically to evaluate spine before purchasing. If you would like to incorporate a spine Runtime into your applications, distribute software containing a spine Runtime, or modify a spine Runtime, then you will need a valid [spine license](https://esotericsoftware.com/spine-purchase). Please see the [spine Runtimes Software License](http://esotericsoftware.com/git/spine-runtimes/blob/LICENSE) for detailed information. -The Spine Runtimes are developed with the intent to be used with data exported from Spine. By purchasing Spine, `Section 2` of the [Spine Software License](https://esotericsoftware.com/files/license.txt) grants the right to create and distribute derivative works of the Spine Runtimes. +The spine Runtimes are developed with the intent to be used with data exported from spine. By purchasing spine, `Section 2` of the [spine Software License](https://esotericsoftware.com/files/license.txt) grants the right to create and distribute derivative works of the spine Runtimes. -## Spine version +## spine version -spine-cpp works with data exported from Spine 3.6.xx. +spine-cpp works with data exported from spine 3.7.xx. -spine-cpp supports all Spine features. +spine-cpp supports all spine features. ## Setup -1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above. -2. Create a new project and import the source. - -Alternatively, the contents of the `spine-cpp/spine-cpp/src` and `spine-cpp/spine-cpp/include` directories can be copied into your project. Be sure your header search is configured to find the contents of the `spine-cpp/spine-cpp/include` directory. Note that the includes use `spine/Xxx.h`, so the `spine` directory cannot be omitted when copying the files. +1. Download the spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above. +2. Copy the contents of the `spine-cpp/spine-cpp/src` and `spine-cpp/spine-cpp/include` directories into your project. Be sure your header search is configured to find the contents of the `spine-cpp/spine-cpp/include` directory. Note that the includes use `spine/Xxx.h`, so the `spine` directory cannot be omitted when copying the files. ## Extension -Extending spine-cpp requires implementing both the SpineExtension class (which has a handy default instance) and the TextureLoader class: +Extending spine-cpp requires implementing both the `SpineExtension` class and the TextureLoader class: -Spine::SpineExtension::setInstance(Spine::DefaultSpineExtension::getInstance()); +``` +#include +void spine::SpineExtension *spine::getDefaultExtension() { + return new spine::DefaultExtension(); +} -class MyTextureLoader : public TextureLoader +class MyTextureLoader : public spine::TextureLoader { - virtual void load(AtlasPage& page, const String& path) { // TODO } + virtual void load(spine::AtlasPage& page, const spine::String& path) { + void* texture = ... load the texture based on path ... + page->setRendererObject(texture); // use the texture later in your rendering code + } virtual void unload(void* texture) { // TODO } }; +``` ## Runtimes extending spine-cpp -- Coming Soon! +- [spine-sfml](../spine-sfml/cpp) +- [spine-cocos2dx](../spine-cocos2dx) +- [spine-ue4](../spine-ue4) diff --git a/spine-cpp/spine-cpp-unit-tests/README.md b/spine-cpp/spine-cpp-unit-tests/README.md index bfe38c489..a7d6efb7c 100755 --- a/spine-cpp/spine-cpp-unit-tests/README.md +++ b/spine-cpp/spine-cpp-unit-tests/README.md @@ -1,6 +1,6 @@ # spine-cpp-unit-tests -The spine-cpp-unit-tests project is to test the [Spine](http://esotericsoftware.com) skeletal animation system. It does not perform rendering. It is primarily used for regression testing and leak detection. It is designed to be run from a Continuous Integration server and to passively verify changes automatically on check-in. +The spine-cpp-unit-tests project is to test the [spine](http://esotericsoftware.com) skeletal animation system. It does not perform rendering. It is primarily used for regression testing and leak detection. It is designed to be run from a Continuous Integration server and to passively verify changes automatically on check-in. ## Mini CPP Unit Testing [MiniCppUnit](https://sourceforge.net/p/minicppunit/wiki/Home/) is a minimal unit testing framework similar to JUnit. It is used here to avoid large dependancies. @@ -42,9 +42,9 @@ msbuild spine_unit_test.sln /t:spine_unit_test /p:Configuration="Debug" /p:Platf ## Licensing -This Spine Runtime may only be used for personal or internal use, typically to evaluate Spine before purchasing. If you would like to incorporate a Spine Runtime into your applications, distribute software containing a Spine Runtime, or modify a Spine Runtime, then you will need a valid [Spine license](https://esotericsoftware.com/spine-purchase). Please see the [Spine Runtimes Software License](https://github.com/EsotericSoftware/spine-runtimes/blob/master/LICENSE) for detailed information. +This spine Runtime may only be used for personal or internal use, typically to evaluate spine before purchasing. If you would like to incorporate a spine Runtime into your applications, distribute software containing a spine Runtime, or modify a spine Runtime, then you will need a valid [spine license](https://esotericsoftware.com/spine-purchase). Please see the [spine Runtimes Software License](https://github.com/EsotericSoftware/spine-runtimes/blob/master/LICENSE) for detailed information. -The Spine Runtimes are developed with the intent to be used with data exported from Spine. By purchasing Spine, `Section 2` of the [Spine Software License](https://esotericsoftware.com/files/license.txt) grants the right to create and distribute derivative works of the Spine Runtimes. +The spine Runtimes are developed with the intent to be used with data exported from spine. By purchasing spine, `Section 2` of the [spine Software License](https://esotericsoftware.com/files/license.txt) grants the right to create and distribute derivative works of the spine Runtimes. original "walk"": 330 second "walk": 0d0 diff --git a/spine-cpp/spine-cpp-unit-tests/src/main.cpp b/spine-cpp/spine-cpp-unit-tests/src/main.cpp index 023ad4661..dcd2f96dd 100644 --- a/spine-cpp/spine-cpp-unit-tests/src/main.cpp +++ b/spine-cpp/spine-cpp-unit-tests/src/main.cpp @@ -34,7 +34,7 @@ #pragma warning ( disable : 4710 ) -using namespace Spine; +using namespace spine; void loadBinary(const String &binaryFile, const String &atlasFile, Atlas *&atlas, SkeletonData *&skeletonData, AnimationStateData *&stateData, Skeleton *&skeleton, AnimationState *&state) { @@ -123,11 +123,17 @@ void testLoading() { } } +namespace spine { + SpineExtension* getDefaultExtension() { + return new DefaultSpineExtension(); + } +} + int main(int argc, char **argv) { - DebugExtension *ext = new DebugExtension(); - SpineExtension::setInstance(ext); + DebugExtension debug(SpineExtension::getInstance()); + SpineExtension::setInstance(&debug); testLoading(); - ext->reportLeaks(); + debug.reportLeaks(); } diff --git a/spine-cpp/spine-cpp/include/spine/Animation.h b/spine-cpp/spine-cpp/include/spine/Animation.h index b623cc287..4cb9fdc98 100644 --- a/spine-cpp/spine-cpp/include/spine/Animation.h +++ b/spine-cpp/spine-cpp/include/spine/Animation.h @@ -35,16 +35,16 @@ #include #include #include -#include +#include -namespace Spine { +namespace spine { class Timeline; class Skeleton; class Event; -class Animation : public SpineObject { +class SP_API Animation : public SpineObject { friend class AnimationState; friend class TrackEntry; diff --git a/spine-cpp/spine-cpp/include/spine/AnimationState.h b/spine-cpp/spine-cpp/include/spine/AnimationState.h index 994b24944..92d577815 100644 --- a/spine-cpp/spine-cpp/include/spine/AnimationState.h +++ b/spine-cpp/spine-cpp/include/spine/AnimationState.h @@ -35,9 +35,10 @@ #include #include #include -#include +#include +#include -namespace Spine { +namespace spine { enum EventType { EventType_Start, EventType_Interrupt, @@ -56,15 +57,17 @@ namespace Spine { class Skeleton; class RotateTimeline; - typedef void (*OnAnimationEventFunc) (AnimationState* state, EventType type, TrackEntry* entry, Event* event); + typedef void (*AnimationStateListener) (AnimationState* state, EventType type, TrackEntry* entry, Event* event); /// State for the playback of an animation - class TrackEntry : public SpineObject { + class SP_API TrackEntry : public SpineObject, public HasRendererObject { friend class EventQueue; friend class AnimationState; public: TrackEntry(); + + virtual ~TrackEntry(); /// The index of the track where this entry is either current or queued. int getTrackIndex(); @@ -236,8 +239,7 @@ namespace Spine { /// TrackEntry chooses the short way the first time it is applied and remembers that direction. void resetRotationDirections(); - void setOnAnimationEventFunc(OnAnimationEventFunc inValue); - + void setListener(AnimationStateListener listener); private: Animation* _animation; @@ -256,12 +258,12 @@ namespace Spine { Vector _timelineMode; Vector _timelineHoldMix; Vector _timelinesRotation; - OnAnimationEventFunc _onAnimationEventFunc; + AnimationStateListener _listener; void reset(); }; - class EventQueueEntry : public SpineObject { + class SP_API EventQueueEntry : public SpineObject { friend class EventQueue; public: @@ -272,7 +274,7 @@ namespace Spine { EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL); }; - class EventQueue : public SpineObject { + class SP_API EventQueue : public SpineObject { friend class AnimationState; private: @@ -305,7 +307,7 @@ namespace Spine { void drain(); }; - class AnimationState : public SpineObject { + class SP_API AnimationState : public SpineObject, public HasRendererObject { friend class TrackEntry; friend class EventQueue; @@ -393,13 +395,12 @@ namespace Spine { float getTimeScale(); void setTimeScale(float inValue); - void setOnAnimationEventFunc(OnAnimationEventFunc inValue); + void setListener(AnimationStateListener listener); - void setRendererObject(void* inValue); - void* getRendererObject(); + void disableQueue(); + void enableQueue(); private: - static const int Subsequent, First, Hold, HoldMix; AnimationStateData* _data; @@ -410,10 +411,8 @@ namespace Spine { Vector _propertyIDs; bool _animationsChanged; - - void* _rendererObject; - OnAnimationEventFunc _onAnimationEventFunc; + AnimationStateListener _listener; float _timeScale; diff --git a/spine-cpp/spine-cpp/include/spine/AnimationStateData.h b/spine-cpp/spine-cpp/include/spine/AnimationStateData.h index ad745c448..94a008e11 100644 --- a/spine-cpp/spine-cpp/include/spine/AnimationStateData.h +++ b/spine-cpp/spine-cpp/include/spine/AnimationStateData.h @@ -33,27 +33,27 @@ #include #include -#include +#include #include -namespace Spine { +namespace spine { class SkeletonData; class Animation; /// Stores mix (crossfade) durations to be applied when AnimationState animations are changed. - class AnimationStateData : public SpineObject { + class SP_API AnimationStateData : public SpineObject { friend class AnimationState; public: + explicit AnimationStateData(SkeletonData* skeletonData); + /// The SkeletonData to look up animations when they are specified by name. SkeletonData* getSkeletonData(); /// The mix duration to use when no mix duration has been specifically defined between two animations. float getDefaultMix(); void setDefaultMix(float inValue); - - explicit AnimationStateData(SkeletonData* skeletonData); /// Sets a mix duration by animation names. void setMix(const String& fromName, const String& toName, float duration); diff --git a/spine-cpp/spine-cpp/include/spine/Atlas.h b/spine-cpp/spine-cpp/include/spine/Atlas.h index eebbd25a2..6b49518c3 100644 --- a/spine-cpp/spine-cpp/include/spine/Atlas.h +++ b/spine-cpp/spine-cpp/include/spine/Atlas.h @@ -34,9 +34,10 @@ #include #include #include -#include +#include +#include -namespace Spine { +namespace spine { enum Format { Format_Alpha, Format_Intensity, @@ -64,7 +65,7 @@ enum TextureWrap { TextureWrap_Repeat }; -class AtlasPage : public SpineObject { +class SP_API AtlasPage : public SpineObject, public HasRendererObject { public: String name; Format format; @@ -72,16 +73,17 @@ public: TextureFilter magFilter; TextureWrap uWrap; TextureWrap vWrap; - void *rendererObject; int width, height; explicit AtlasPage(const String &inName) : name(inName), format(Format_RGBA8888), minFilter(TextureFilter_Nearest), magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge), vWrap(TextureWrap_ClampToEdge) { } + + virtual ~AtlasPage() { } }; -class AtlasRegion : public SpineObject { +class SP_API AtlasRegion : public SpineObject { public: AtlasPage *page; String name; @@ -97,7 +99,7 @@ public: class TextureLoader; -class Atlas : public SpineObject { +class SP_API Atlas : public SpineObject { public: Atlas(const String &path, TextureLoader *textureLoader); @@ -112,6 +114,8 @@ public: /// @return The region, or NULL. AtlasRegion *findRegion(const String &name); + Vector &getPages(); + private: Vector _pages; Vector _regions; diff --git a/spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h b/spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h index c01725da1..bb1a5a5d0 100644 --- a/spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h +++ b/spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h @@ -33,10 +33,10 @@ #include #include -#include +#include -namespace Spine { +namespace spine { class Atlas; class AtlasRegion; @@ -44,10 +44,10 @@ namespace Spine { /// An AttachmentLoader that configures attachments using texture regions from an Atlas. /// See http://esotericsoftware.com/spine-loading-skeleton-data#JSON-and-binary-data about Loading Skeleton Data in the Spine Runtimes Guide. /// - class AtlasAttachmentLoader : public AttachmentLoader { - RTTI_DECL - + class SP_API AtlasAttachmentLoader : public AttachmentLoader { public: + RTTI_DECL + explicit AtlasAttachmentLoader(Atlas* atlas); virtual RegionAttachment* newRegionAttachment(Skin& skin, const String& name, const String& path); @@ -61,6 +61,8 @@ namespace Spine { virtual PointAttachment* newPointAttachment(Skin& skin, const String& name); virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name); + + virtual void configureAttachment(Attachment* attachment); AtlasRegion* findRegion(const String& name); diff --git a/spine-cpp/spine-cpp/include/spine/Attachment.h b/spine-cpp/spine-cpp/include/spine/Attachment.h index 16a17c704..0a0c00018 100644 --- a/spine-cpp/spine-cpp/include/spine/Attachment.h +++ b/spine-cpp/spine-cpp/include/spine/Attachment.h @@ -33,10 +33,10 @@ #include #include -#include +#include -namespace Spine { -class Attachment : public SpineObject { +namespace spine { +class SP_API Attachment : public SpineObject { RTTI_DECL public: diff --git a/spine-cpp/spine-cpp/include/spine/AttachmentLoader.h b/spine-cpp/spine-cpp/include/spine/AttachmentLoader.h index 42408209b..730083d1e 100644 --- a/spine-cpp/spine-cpp/include/spine/AttachmentLoader.h +++ b/spine-cpp/spine-cpp/include/spine/AttachmentLoader.h @@ -33,10 +33,11 @@ #include #include -#include +#include -namespace Spine { +namespace spine { class Skin; + class Attachment; class RegionAttachment; class MeshAttachment; class BoundingBoxAttachment; @@ -44,7 +45,8 @@ namespace Spine { class PointAttachment; class ClippingAttachment; - class AttachmentLoader : public SpineObject { + class SP_API AttachmentLoader : public SpineObject { + public: RTTI_DECL AttachmentLoader(); @@ -66,6 +68,8 @@ namespace Spine { virtual PointAttachment* newPointAttachment(Skin& skin, const String& name) = 0; virtual ClippingAttachment* newClippingAttachment(Skin& skin, const String& name) = 0; + + virtual void configureAttachment(Attachment* attachment) = 0; }; } diff --git a/spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h b/spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h index ac356df5d..b281c043d 100644 --- a/spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h @@ -36,13 +36,14 @@ #include #include #include -#include +#include + +namespace spine { -namespace Spine { class Skeleton; class Event; - class AttachmentTimeline : public Timeline { + class SP_API AttachmentTimeline : public Timeline { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/AttachmentType.h b/spine-cpp/spine-cpp/include/spine/AttachmentType.h index 76ecb42d9..c77f36b8c 100644 --- a/spine-cpp/spine-cpp/include/spine/AttachmentType.h +++ b/spine-cpp/spine-cpp/include/spine/AttachmentType.h @@ -31,7 +31,7 @@ #ifndef Spine_AttachmentType_h #define Spine_AttachmentType_h -namespace Spine { +namespace spine { enum AttachmentType { AttachmentType_Region, AttachmentType_Boundingbox, diff --git a/spine-cpp/spine-cpp/include/spine/BlendMode.h b/spine-cpp/spine-cpp/include/spine/BlendMode.h index 38c6b0821..729fdcf06 100644 --- a/spine-cpp/spine-cpp/include/spine/BlendMode.h +++ b/spine-cpp/spine-cpp/include/spine/BlendMode.h @@ -31,7 +31,7 @@ #ifndef Spine_BlendMode_h #define Spine_BlendMode_h -namespace Spine { +namespace spine { enum BlendMode { BlendMode_Normal = 0, BlendMode_Additive, diff --git a/spine-cpp/spine-cpp/include/spine/Bone.h b/spine-cpp/spine-cpp/include/spine/Bone.h index 1950e6250..dbb837445 100644 --- a/spine-cpp/spine-cpp/include/spine/Bone.h +++ b/spine-cpp/spine-cpp/include/spine/Bone.h @@ -35,7 +35,7 @@ #include #include -namespace Spine { +namespace spine { class BoneData; class Skeleton; @@ -45,7 +45,7 @@ class Skeleton; /// A bone has a local transform which is used to compute its world transform. A bone also has an applied transform, which is a /// local transform that can be applied to compute the world transform. The local transform and applied transform may differ if a /// constraint or application code modifies the world transform after it was computed from the local transform. -class Bone : public Updatable { +class SP_API Bone : public Updatable { friend class AnimationState; friend class RotateTimeline; @@ -221,6 +221,9 @@ public: /// Returns the magnitide (always positive) of the world scale Y. float getWorldScaleY(); + bool isAppliedValid(); + void setAppliedValid(bool valid); + private: static bool yDown; diff --git a/spine-cpp/spine-cpp/include/spine/BoneData.h b/spine-cpp/spine-cpp/include/spine/BoneData.h index 903679384..d0487b7e6 100644 --- a/spine-cpp/spine-cpp/include/spine/BoneData.h +++ b/spine-cpp/spine-cpp/include/spine/BoneData.h @@ -33,10 +33,10 @@ #include #include -#include +#include -namespace Spine { -class BoneData : public SpineObject { +namespace spine { +class SP_API BoneData : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h b/spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h index 066aa0487..fd7be209c 100644 --- a/spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h +++ b/spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h @@ -34,9 +34,9 @@ #include #include -namespace Spine { +namespace spine { /// Attachment that has a polygon for bounds checking. - class BoundingBoxAttachment : public VertexAttachment { + class SP_API BoundingBoxAttachment : public VertexAttachment { RTTI_DECL explicit BoundingBoxAttachment(const String& name); diff --git a/spine-cpp/spine-cpp/include/spine/ClippingAttachment.h b/spine-cpp/spine-cpp/include/spine/ClippingAttachment.h index 7d69efc8f..64187745c 100644 --- a/spine-cpp/spine-cpp/include/spine/ClippingAttachment.h +++ b/spine-cpp/spine-cpp/include/spine/ClippingAttachment.h @@ -33,10 +33,10 @@ #include -namespace Spine { +namespace spine { class SlotData; - class ClippingAttachment : public VertexAttachment { + class SP_API ClippingAttachment : public VertexAttachment { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/Color.h b/spine-cpp/spine-cpp/include/spine/Color.h index 745e9cb39..0f0817f1b 100644 --- a/spine-cpp/spine-cpp/include/spine/Color.h +++ b/spine-cpp/spine-cpp/include/spine/Color.h @@ -32,8 +32,8 @@ #include -namespace Spine { -class Color : public SpineObject { +namespace spine { +class SP_API Color : public SpineObject { public: Color() : r(0), g(0), b(0), a(0) { } diff --git a/spine-cpp/spine-cpp/include/spine/ColorTimeline.h b/spine-cpp/spine-cpp/include/spine/ColorTimeline.h index bd32dd853..49a6bbbb9 100644 --- a/spine-cpp/spine-cpp/include/spine/ColorTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/ColorTimeline.h @@ -33,8 +33,8 @@ #include -namespace Spine { -class ColorTimeline : public CurveTimeline { +namespace spine { +class SP_API ColorTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; @@ -62,8 +62,15 @@ public: Vector &getFrames(); protected: - static const int PREV_TIME, PREV_R, PREV_G, PREV_B, PREV_A; - static const int R, G, B, A; + static const int PREV_TIME; + static const int PREV_R; + static const int PREV_G; + static const int PREV_B; + static const int PREV_A; + static const int R; + static const int G; + static const int B; + static const int A; private: int _slotIndex; diff --git a/spine-cpp/spine-cpp/include/spine/Constraint.h b/spine-cpp/spine-cpp/include/spine/Constraint.h index 028f2f151..3d42586eb 100644 --- a/spine-cpp/spine-cpp/include/spine/Constraint.h +++ b/spine-cpp/spine-cpp/include/spine/Constraint.h @@ -33,9 +33,9 @@ #include -namespace Spine { +namespace spine { /// The interface for all constraints. -class Constraint : public Updatable { +class SP_API Constraint : public Updatable { RTTI_DECL public: diff --git a/spine-cpp/spine-cpp/include/spine/ContainerUtil.h b/spine-cpp/spine-cpp/include/spine/ContainerUtil.h index c7e8bc125..e16d800bd 100644 --- a/spine-cpp/spine-cpp/include/spine/ContainerUtil.h +++ b/spine-cpp/spine-cpp/include/spine/ContainerUtil.h @@ -35,12 +35,12 @@ #include #include #include -#include +#include #include -namespace Spine { - class ContainerUtil : public SpineObject { +namespace spine { + class SP_API ContainerUtil : public SpineObject { public: /// Finds an item by comparing each item's name. /// It is more efficient to cache the results of this method than to call it multiple times. diff --git a/spine-cpp/spine-cpp/include/spine/CurveTimeline.h b/spine-cpp/spine-cpp/include/spine/CurveTimeline.h index 5169051fc..f78043bb4 100644 --- a/spine-cpp/spine-cpp/include/spine/CurveTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/CurveTimeline.h @@ -34,9 +34,9 @@ #include #include -namespace Spine { +namespace spine { /// Base class for frames that use an interpolation bezier curve. - class CurveTimeline : public Timeline { + class SP_API CurveTimeline : public Timeline { RTTI_DECL public: diff --git a/spine-cpp/spine-cpp/include/spine/Debug.h b/spine-cpp/spine-cpp/include/spine/Debug.h index 19a8c9c9d..436df90b4 100644 --- a/spine-cpp/spine-cpp/include/spine/Debug.h +++ b/spine-cpp/spine-cpp/include/spine/Debug.h @@ -35,8 +35,8 @@ #include -namespace Spine { -class DebugExtension : public DefaultSpineExtension { +namespace spine { +class SP_API DebugExtension : public SpineExtension { struct Allocation { void *address; size_t size; @@ -51,14 +51,14 @@ class DebugExtension : public DefaultSpineExtension { }; public: - DebugExtension(): _allocations(0), _reallocations(0), _frees(0) { + DebugExtension(SpineExtension* extension): _extension(extension), _allocations(0), _reallocations(0), _frees(0) { } void reportLeaks() { for (std::map::iterator it = _allocated.begin(); it != _allocated.end(); it++) { printf("\"%s:%i (%zu bytes at %p)\n", it->second.fileName, it->second.line, it->second.size, it->second.address); } - printf("allocations: %lu, reallocations: %lu, frees: %lu\n", _allocations, _reallocations, _frees); + printf("allocations: %zu, reallocations: %zu, frees: %zu\n", _allocations, _reallocations, _frees); if (_allocated.empty()) printf("No leaks detected"); } @@ -66,16 +66,15 @@ public: _allocated.clear(); } -protected: virtual void *_alloc(size_t size, const char *file, int line) { - void *result = DefaultSpineExtension::_alloc(size, file, line); + void *result = _extension->_alloc(size, file, line); _allocated[result] = Allocation(result, size, file, line); _allocations++; return result; } virtual void *_calloc(size_t size, const char *file, int line) { - void *result = DefaultSpineExtension::_calloc(size, file, line); + void *result = _extension->_calloc(size, file, line); _allocated[result] = Allocation(result, size, file, line); _allocations++; return result; @@ -83,7 +82,7 @@ protected: virtual void *_realloc(void *ptr, size_t size, const char *file, int line) { _allocated.erase(ptr); - void *result = DefaultSpineExtension::_realloc(ptr, size, file, line); + void *result = _extension->_realloc(ptr, size, file, line); _reallocations++; _allocated[result] = Allocation(result, size, file, line); return result; @@ -91,17 +90,22 @@ protected: virtual void _free(void *mem, const char *file, int line) { if (_allocated.count(mem)) { - DefaultSpineExtension::_free(mem, file, line); + _extension->_free(mem, file, line); _frees++; _allocated.erase(mem); return; } printf("%s:%i (address %p): Double free or not allocated through SpineExtension\n", file, line, mem); - DefaultSpineExtension::_free(mem, file, line); + _extension->_free(mem, file, line); + } + + virtual char *_readFile(const String &path, int *length) { + return _extension->_readFile(path, length); } private: + SpineExtension* _extension; std::map _allocated; size_t _allocations; size_t _reallocations; diff --git a/spine-cpp/spine-cpp/include/spine/DeformTimeline.h b/spine-cpp/spine-cpp/include/spine/DeformTimeline.h index 3f05cebbc..ccec3455e 100644 --- a/spine-cpp/spine-cpp/include/spine/DeformTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/DeformTimeline.h @@ -33,10 +33,10 @@ #include -namespace Spine { +namespace spine { class VertexAttachment; - class DeformTimeline : public CurveTimeline { + class SP_API DeformTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h b/spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h index 368e0b922..cdb65e8d6 100644 --- a/spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h @@ -33,8 +33,8 @@ #include -namespace Spine { - class DrawOrderTimeline : public Timeline { +namespace spine { + class SP_API DrawOrderTimeline : public Timeline { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/Event.h b/spine-cpp/spine-cpp/include/spine/Event.h index ac64a368c..1378da9cf 100644 --- a/spine-cpp/spine-cpp/include/spine/Event.h +++ b/spine-cpp/spine-cpp/include/spine/Event.h @@ -32,13 +32,13 @@ #define Spine_Event_h #include -#include +#include -namespace Spine { +namespace spine { class EventData; /// Stores the current pose values for an Event. -class Event : public SpineObject { +class SP_API Event : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/EventData.h b/spine-cpp/spine-cpp/include/spine/EventData.h index aeee869d0..ec5d53329 100644 --- a/spine-cpp/spine-cpp/include/spine/EventData.h +++ b/spine-cpp/spine-cpp/include/spine/EventData.h @@ -32,11 +32,11 @@ #define Spine_EventData_h #include -#include +#include -namespace Spine { +namespace spine { /// Stores the setup pose values for an Event. -class EventData : public SpineObject { +class SP_API EventData : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/EventTimeline.h b/spine-cpp/spine-cpp/include/spine/EventTimeline.h index cd2681716..a3a14bd38 100644 --- a/spine-cpp/spine-cpp/include/spine/EventTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/EventTimeline.h @@ -33,8 +33,8 @@ #include -namespace Spine { - class EventTimeline : public Timeline { +namespace spine { + class SP_API EventTimeline : public Timeline { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/Extension.h b/spine-cpp/spine-cpp/include/spine/Extension.h index 5829d5710..95d9cd9fe 100644 --- a/spine-cpp/spine-cpp/include/spine/Extension.h +++ b/spine-cpp/spine-cpp/include/spine/Extension.h @@ -32,13 +32,14 @@ #define Spine_Extension_h #include +#include #define SP_UNUSED(x) (void)(x) -namespace Spine { +namespace spine { class String; -class SpineExtension { +class SP_API SpineExtension { public: template static T *alloc(size_t num, const char *file, int line) { @@ -70,7 +71,6 @@ public: virtual ~SpineExtension(); -protected: /// Implement this function to use your own memory allocator virtual void *_alloc(size_t size, const char *file, int line) = 0; @@ -83,13 +83,14 @@ protected: virtual char *_readFile(const String &path, int *length) = 0; +protected: SpineExtension(); private: static SpineExtension *_instance; }; -class DefaultSpineExtension : public SpineExtension { +class SP_API DefaultSpineExtension : public SpineExtension { public: DefaultSpineExtension(); @@ -107,18 +108,11 @@ protected: virtual char *_readFile(const String &path, int *length); }; -struct Allocation { - void *address; - size_t size; - const char *fileName; - int line; - - 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) { - } -}; +// This function is to be implemented by engine specific runtimes to provide +// the default extension for that engine. It is called the first time +// SpineExtension::getInstance() is called, when no instance has been set +// yet. +extern SpineExtension *getDefaultExtension(); } #endif /* Spine_Extension_h */ diff --git a/spine-cpp/spine-cpp/include/spine/HasRendererObject.h b/spine-cpp/spine-cpp/include/spine/HasRendererObject.h new file mode 100644 index 000000000..929fee799 --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/HasRendererObject.h @@ -0,0 +1,59 @@ +/****************************************************************************** + * Spine Runtimes Software License v2.5 + * + * Copyright (c) 2013-2016, Esoteric Software + * All rights reserved. + * + * You are granted a perpetual, non-exclusive, non-sublicensable, and + * non-transferable license to use, install, execute, and perform the Spine + * Runtimes software and derivative works solely for personal or internal + * use. Without the written permission of Esoteric Software (see Section 2 of + * the Spine Software License Agreement), you may not (a) modify, translate, + * adapt, or develop new applications using the Spine Runtimes or otherwise + * create derivative works or improvements of the Spine Runtimes or (b) remove, + * delete, alter, or obscure any trademarks or any copyright, trademark, patent, + * or other intellectual property or proprietary rights notices on or in the + * Software, including any copy thereof. Redistributions in binary or source + * form must include this license and terms. + * + * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF + * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#ifndef Spine_HasRendererObject_h +#define Spine_HasRendererObject_h + +namespace spine { + +typedef void (*DisposeRendererObject) (void* rendererObject); + +class SP_API HasRendererObject { +public: + explicit HasRendererObject() : _rendererObject(NULL), _dispose(NULL) {}; + + virtual ~HasRendererObject() { + if (_dispose && _rendererObject) + _dispose(_rendererObject); + } + + void* getRendererObject() { return _rendererObject; } + void setRendererObject(void* rendererObject, DisposeRendererObject dispose = NULL) { + _rendererObject = rendererObject; + _dispose = dispose; + } +private: + void *_rendererObject; + DisposeRendererObject _dispose; +}; + +} + +#endif diff --git a/spine-cpp/spine-cpp/include/spine/HashMap.h b/spine-cpp/spine-cpp/include/spine/HashMap.h index 31c37155c..2aa5a2158 100755 --- a/spine-cpp/spine-cpp/include/spine/HashMap.h +++ b/spine-cpp/spine-cpp/include/spine/HashMap.h @@ -40,14 +40,14 @@ #pragma warning(disable:4291) #endif -namespace Spine { +namespace spine { template -class HashMap : public SpineObject { +class SP_API HashMap : public SpineObject { private: class Entry; public: - class Pair { + class SP_API Pair { public: explicit Pair(K &k, V &v) : key(k), value(v) {} @@ -55,7 +55,7 @@ public: V &value; }; - class Entries { + class SP_API Entries { public: friend class HashMap; @@ -167,7 +167,7 @@ private: return NULL; } - class Entry : public SpineObject { + class SP_API Entry : public SpineObject { public: K _key; V _value; diff --git a/spine-cpp/spine-cpp/include/spine/IkConstraint.h b/spine-cpp/spine-cpp/include/spine/IkConstraint.h index 805c8bc41..fc0cffb84 100644 --- a/spine-cpp/spine-cpp/include/spine/IkConstraint.h +++ b/spine-cpp/spine-cpp/include/spine/IkConstraint.h @@ -35,14 +35,14 @@ #include -namespace Spine { +namespace spine { class IkConstraintData; class Skeleton; class Bone; -class IkConstraint : public Constraint { +class SP_API IkConstraint : public Constraint { friend class Skeleton; friend class IkConstraintTimeline; diff --git a/spine-cpp/spine-cpp/include/spine/IkConstraintData.h b/spine-cpp/spine-cpp/include/spine/IkConstraintData.h index 690824ccc..7432e497a 100644 --- a/spine-cpp/spine-cpp/include/spine/IkConstraintData.h +++ b/spine-cpp/spine-cpp/include/spine/IkConstraintData.h @@ -33,12 +33,12 @@ #include #include -#include +#include -namespace Spine { +namespace spine { class BoneData; - class IkConstraintData : public SpineObject { + class SP_API IkConstraintData : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; friend class IkConstraint; diff --git a/spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h b/spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h index a7197536a..82001b994 100644 --- a/spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h @@ -33,8 +33,9 @@ #include -namespace Spine { - class IkConstraintTimeline : public CurveTimeline { +namespace spine { + + class SP_API IkConstraintTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; @@ -53,9 +54,16 @@ namespace Spine { void setFrame (int frameIndex, float time, float mix, int bendDirection, bool compress, bool stretch); private: - static const int PREV_TIME, PREV_MIX, PREV_BEND_DIRECTION, PREV_COMPRESS, PREV_STRETCH; - static const int MIX, BEND_DIRECTION, COMPRESS, STRETCH; - + static const int PREV_TIME; + static const int PREV_MIX; + static const int PREV_BEND_DIRECTION; + static const int PREV_COMPRESS; + static const int PREV_STRETCH; + static const int MIX; + static const int BEND_DIRECTION; + static const int COMPRESS; + static const int STRETCH; + Vector _frames; int _ikConstraintIndex; }; diff --git a/spine-cpp/spine-cpp/include/spine/Json.h b/spine-cpp/spine-cpp/include/spine/Json.h index b67b2e51f..31d003d70 100644 --- a/spine-cpp/spine-cpp/include/spine/Json.h +++ b/spine-cpp/spine-cpp/include/spine/Json.h @@ -34,12 +34,12 @@ #include #ifndef SPINE_JSON_HAVE_PREV -/* Spine doesn't use the "prev" link in the Json sibling lists. */ +/* spine doesn't use the "prev" link in the Json sibling lists. */ #define SPINE_JSON_HAVE_PREV 0 #endif -namespace Spine { -class Json : public SpineObject { +namespace spine { +class SP_API Json : public SpineObject { friend class SkeletonJson; public: diff --git a/spine-cpp/spine-cpp/include/spine/LinkedMesh.h b/spine-cpp/spine-cpp/include/spine/LinkedMesh.h index d3a2392f4..b2086ac18 100644 --- a/spine-cpp/spine-cpp/include/spine/LinkedMesh.h +++ b/spine-cpp/spine-cpp/include/spine/LinkedMesh.h @@ -32,12 +32,12 @@ #define Spine_LinkedMesh_h #include -#include +#include -namespace Spine { +namespace spine { class MeshAttachment; -class LinkedMesh : public SpineObject { +class SP_API LinkedMesh : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/MathUtil.h b/spine-cpp/spine-cpp/include/spine/MathUtil.h index 99983ad82..44522d5a5 100644 --- a/spine-cpp/spine-cpp/include/spine/MathUtil.h +++ b/spine-cpp/spine-cpp/include/spine/MathUtil.h @@ -33,19 +33,20 @@ #include -#include #include -namespace Spine { -static const float PI = 3.1415926535897932385f; -static const float PI_2 = PI * 2; -static const float DEG_RAD = (PI / 180.0f); -static const float RAD_DEG = (180.0f / PI); +namespace spine { -class MathUtil : public SpineObject { -public: +class SP_API MathUtil : public SpineObject { +private: MathUtil(); +public: + static const float Pi; + static const float Pi_2; + static const float Deg_Rad; + static const float Rad_Deg; + template static inline T min(T a, T b) { return a < b ? a : b; } @@ -91,7 +92,7 @@ public: static float pow(float a, float b); }; -struct Interpolation { +struct SP_API Interpolation { virtual float apply(float a) = 0; virtual float interpolate(float start, float end, float a) { @@ -101,7 +102,7 @@ struct Interpolation { virtual ~Interpolation() {}; }; -struct PowInterpolation: public Interpolation { +struct SP_API PowInterpolation: public Interpolation { PowInterpolation(int power): power(power) { } @@ -113,7 +114,7 @@ struct PowInterpolation: public Interpolation { int power; }; -struct PowOutInterpolation: public Interpolation { +struct SP_API PowOutInterpolation: public Interpolation { PowOutInterpolation(int power): power(power) { } diff --git a/spine-cpp/spine-cpp/include/spine/MeshAttachment.h b/spine-cpp/spine-cpp/include/spine/MeshAttachment.h index 793638cd9..8f42c5518 100644 --- a/spine-cpp/spine-cpp/include/spine/MeshAttachment.h +++ b/spine-cpp/spine-cpp/include/spine/MeshAttachment.h @@ -34,10 +34,11 @@ #include #include #include +#include -namespace Spine { +namespace spine { /// Attachment that displays a texture region using a mesh. - class MeshAttachment : public VertexAttachment { + class SP_API MeshAttachment : public VertexAttachment, public HasRendererObject { friend class SkeletonBinary; friend class SkeletonJson; friend class AtlasAttachmentLoader; @@ -47,6 +48,8 @@ namespace Spine { public: explicit MeshAttachment(const String& name); + virtual ~MeshAttachment(); + void updateUVs(); virtual bool applyDeform(VertexAttachment* sourceAttachment); @@ -65,8 +68,6 @@ namespace Spine { const String& getPath(); void setPath(const String& inValue); - void* getRendererObject(); - void setRendererObject(void* inValue); float getRegionU(); void setRegionU(float inValue); @@ -124,7 +125,6 @@ namespace Spine { Vector _regionUVs; Vector _triangles; Vector _edges; - void* _rendererObject; String _path; float _regionU; float _regionV; diff --git a/spine-cpp/spine-cpp/include/spine/MixBlend.h b/spine-cpp/spine-cpp/include/spine/MixBlend.h index 6354f86e2..937f1d40e 100644 --- a/spine-cpp/spine-cpp/include/spine/MixBlend.h +++ b/spine-cpp/spine-cpp/include/spine/MixBlend.h @@ -31,7 +31,7 @@ #ifndef Spine_MixPose_h #define Spine_MixPose_h -namespace Spine { +namespace spine { /// /// Controls how a timeline is mixed with the setup or current pose. /// See also Timeline::apply(Skeleton&, float, float, Vector&, float, Blend, MixDirection) diff --git a/spine-cpp/spine-cpp/include/spine/MixDirection.h b/spine-cpp/spine-cpp/include/spine/MixDirection.h index a488ff691..6c758d0a8 100644 --- a/spine-cpp/spine-cpp/include/spine/MixDirection.h +++ b/spine-cpp/spine-cpp/include/spine/MixDirection.h @@ -31,7 +31,7 @@ #ifndef Spine_MixDirection_h #define Spine_MixDirection_h -namespace Spine { +namespace spine { /// /// Indicates whether a timeline's alpha is mixing out over time toward 0 (the setup or current pose) or mixing in toward 1 (the timeline's pose). /// See also Timeline::apply(Skeleton&, float, float, Vector&, float, MixPose, MixDirection) diff --git a/spine-cpp/spine-cpp/include/spine/PathAttachment.h b/spine-cpp/spine-cpp/include/spine/PathAttachment.h index 5d927310e..bde874490 100644 --- a/spine-cpp/spine-cpp/include/spine/PathAttachment.h +++ b/spine-cpp/spine-cpp/include/spine/PathAttachment.h @@ -33,8 +33,8 @@ #include -namespace Spine { - class PathAttachment : public VertexAttachment { +namespace spine { + class SP_API PathAttachment : public VertexAttachment { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/PathConstraint.h b/spine-cpp/spine-cpp/include/spine/PathConstraint.h index bfaadbdf8..7a7632b7d 100644 --- a/spine-cpp/spine-cpp/include/spine/PathConstraint.h +++ b/spine-cpp/spine-cpp/include/spine/PathConstraint.h @@ -35,14 +35,14 @@ #include -namespace Spine { +namespace spine { class PathConstraintData; class Skeleton; class PathAttachment; class Bone; class Slot; - class PathConstraint : public Constraint { + class SP_API PathConstraint : public Constraint { friend class Skeleton; friend class PathConstraintMixTimeline; friend class PathConstraintPositionTimeline; diff --git a/spine-cpp/spine-cpp/include/spine/PathConstraintData.h b/spine-cpp/spine-cpp/include/spine/PathConstraintData.h index 1051b8156..ee86ecd5c 100644 --- a/spine-cpp/spine-cpp/include/spine/PathConstraintData.h +++ b/spine-cpp/spine-cpp/include/spine/PathConstraintData.h @@ -36,13 +36,13 @@ #include #include #include -#include +#include -namespace Spine { +namespace spine { class BoneData; class SlotData; - class PathConstraintData : public SpineObject { + class SP_API PathConstraintData : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h b/spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h index e9da5f6bc..0b53ede2c 100644 --- a/spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h @@ -33,8 +33,10 @@ #include -namespace Spine { - class PathConstraintMixTimeline : public CurveTimeline { +namespace spine { +#define SP_PATHCONSTRAINTMIXTIMELINE_ENTRIES 5 + + class SP_API PathConstraintMixTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; @@ -50,8 +52,11 @@ namespace Spine { virtual int getPropertyId(); private: - static const int PREV_TIME, PREV_ROTATE, PREV_TRANSLATE; - static const int ROTATE, TRANSLATE; + static const int PREV_TIME; + static const int PREV_ROTATE; + static const int PREV_TRANSLATE; + static const int ROTATE; + static const int TRANSLATE; Vector _frames; int _pathConstraintIndex; diff --git a/spine-cpp/spine-cpp/include/spine/PathConstraintPositionTimeline.h b/spine-cpp/spine-cpp/include/spine/PathConstraintPositionTimeline.h index e70ad9d8c..a9ae41db9 100644 --- a/spine-cpp/spine-cpp/include/spine/PathConstraintPositionTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/PathConstraintPositionTimeline.h @@ -33,8 +33,9 @@ #include -namespace Spine { - class PathConstraintPositionTimeline : public CurveTimeline { +namespace spine { + + class SP_API PathConstraintPositionTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; @@ -55,7 +56,8 @@ namespace Spine { void setFrame(int frameIndex, float time, float value); protected: - static const int PREV_TIME, PREV_VALUE; + static const int PREV_TIME; + static const int PREV_VALUE; static const int VALUE; Vector _frames; diff --git a/spine-cpp/spine-cpp/include/spine/PathConstraintSpacingTimeline.h b/spine-cpp/spine-cpp/include/spine/PathConstraintSpacingTimeline.h index 69675361a..3dd964919 100644 --- a/spine-cpp/spine-cpp/include/spine/PathConstraintSpacingTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/PathConstraintSpacingTimeline.h @@ -33,8 +33,8 @@ #include -namespace Spine { - class PathConstraintSpacingTimeline : public PathConstraintPositionTimeline { +namespace spine { + class SP_API PathConstraintSpacingTimeline : public PathConstraintPositionTimeline { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/PointAttachment.h b/spine-cpp/spine-cpp/include/spine/PointAttachment.h index 61ae21ba0..6751ed2f7 100644 --- a/spine-cpp/spine-cpp/include/spine/PointAttachment.h +++ b/spine-cpp/spine-cpp/include/spine/PointAttachment.h @@ -33,7 +33,7 @@ #include -namespace Spine { +namespace spine { class Bone; /// @@ -43,7 +43,7 @@ namespace Spine { /// /// See http://esotericsoftware.com/spine-point-attachments for Point Attachments in the Spine User Guide. /// - class PointAttachment : public Attachment { + class SP_API PointAttachment : public Attachment { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/Pool.h b/spine-cpp/spine-cpp/include/spine/Pool.h index 946b6f7bc..01e0cfdb6 100644 --- a/spine-cpp/spine-cpp/include/spine/Pool.h +++ b/spine-cpp/spine-cpp/include/spine/Pool.h @@ -36,9 +36,9 @@ #include #include -namespace Spine { +namespace spine { template -class Pool : public SpineObject { +class SP_API Pool : public SpineObject { public: Pool() { } diff --git a/spine-cpp/spine-cpp/include/spine/PositionMode.h b/spine-cpp/spine-cpp/include/spine/PositionMode.h index 35437dac8..46fb89646 100644 --- a/spine-cpp/spine-cpp/include/spine/PositionMode.h +++ b/spine-cpp/spine-cpp/include/spine/PositionMode.h @@ -31,7 +31,7 @@ #ifndef Spine_PositionMode_h #define Spine_PositionMode_h -namespace Spine { +namespace spine { enum PositionMode { PositionMode_Fixed = 0, PositionMode_Percent diff --git a/spine-cpp/spine-cpp/include/spine/RTTI.h b/spine-cpp/spine-cpp/include/spine/RTTI.h index fd3413eb0..987f5da68 100644 --- a/spine-cpp/spine-cpp/include/spine/RTTI.h +++ b/spine-cpp/spine-cpp/include/spine/RTTI.h @@ -35,8 +35,8 @@ #include -namespace Spine { -class RTTI : public SpineObject { +namespace spine { +class SP_API RTTI : public SpineObject { public: explicit RTTI(const std::string &className); @@ -61,16 +61,16 @@ private: #define RTTI_DECL \ public: \ -static const Spine::RTTI rtti; \ -virtual const Spine::RTTI& getRTTI() const; +static const spine::RTTI rtti; \ +virtual const spine::RTTI& getRTTI() const; #define RTTI_IMPL_NOPARENT(name) \ -const Spine::RTTI name::rtti(#name); \ -const Spine::RTTI& name::getRTTI() const { return rtti; } +const spine::RTTI name::rtti(#name); \ +const spine::RTTI& name::getRTTI() const { return rtti; } #define RTTI_IMPL(name, parent) \ -const Spine::RTTI name::rtti(#name, parent::rtti); \ -const Spine::RTTI& name::getRTTI() const { return rtti; } +const spine::RTTI name::rtti(#name, parent::rtti); \ +const spine::RTTI& name::getRTTI() const { return rtti; } #endif /* Spine_RTTI_h */ diff --git a/spine-cpp/spine-cpp/include/spine/RegionAttachment.h b/spine-cpp/spine-cpp/include/spine/RegionAttachment.h index 58d81353c..995cc3992 100644 --- a/spine-cpp/spine-cpp/include/spine/RegionAttachment.h +++ b/spine-cpp/spine-cpp/include/spine/RegionAttachment.h @@ -36,14 +36,15 @@ #include #include +#include #define NUM_UVS 8 -namespace Spine { +namespace spine { class Bone; /// Attachment that displays a texture region. - class RegionAttachment : public Attachment { + class SP_API RegionAttachment : public Attachment, public HasRendererObject { friend class SkeletonBinary; friend class SkeletonJson; friend class AtlasAttachmentLoader; @@ -62,6 +63,7 @@ namespace Spine { /// @param worldVertices The output world vertices. Must have a length greater than or equal to offset + 8. /// @param offset The worldVertices index to begin writing values. /// @param stride The number of worldVertices entries between the value pairs written. + void computeWorldVertices(Bone& bone, float *worldVertices, size_t offset, size_t stride = 2); void computeWorldVertices(Bone& bone, Vector& worldVertices, size_t offset, size_t stride = 2); float getX(); @@ -83,24 +85,22 @@ namespace Spine { const String& getPath(); void setPath(const String& inValue); - void* getRendererObject(); - void setRendererObject(void* inValue); + float getRegionOffsetX(); void setRegionOffsetX(float inValue); - - // Pixels stripped from the bottom left, unrotated. + float getRegionOffsetY(); void setRegionOffsetY(float inValue); + float getRegionWidth(); void setRegionWidth(float inValue); - - // Unrotated, stripped size. + float getRegionHeight(); void setRegionHeight(float inValue); + float getRegionOriginalWidth(); void setRegionOriginalWidth(float inValue); - - // Unrotated, unstripped size. + float getRegionOriginalHeight(); void setRegionOriginalHeight(float inValue); @@ -121,7 +121,6 @@ namespace Spine { float _regionOffsetX, _regionOffsetY, _regionWidth, _regionHeight, _regionOriginalWidth, _regionOriginalHeight; Vector _vertexOffset; Vector _uvs; - void* _rendererObject; String _path; float _regionU; float _regionV; diff --git a/spine-cpp/spine-cpp/include/spine/RotateMode.h b/spine-cpp/spine-cpp/include/spine/RotateMode.h index ff715b94e..a9a78f665 100644 --- a/spine-cpp/spine-cpp/include/spine/RotateMode.h +++ b/spine-cpp/spine-cpp/include/spine/RotateMode.h @@ -31,7 +31,7 @@ #ifndef Spine_RotateMode_h #define Spine_RotateMode_h -namespace Spine { +namespace spine { enum RotateMode { RotateMode_Tangent = 0, RotateMode_Chain, diff --git a/spine-cpp/spine-cpp/include/spine/RotateTimeline.h b/spine-cpp/spine-cpp/include/spine/RotateTimeline.h index f8c14fbd8..cdc46d507 100644 --- a/spine-cpp/spine-cpp/include/spine/RotateTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/RotateTimeline.h @@ -33,8 +33,8 @@ #include -namespace Spine { - class RotateTimeline : public CurveTimeline { +namespace spine { + class SP_API RotateTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; friend class AnimationState; diff --git a/spine-cpp/spine-cpp/include/spine/ScaleTimeline.h b/spine-cpp/spine-cpp/include/spine/ScaleTimeline.h index 3aeb5731b..fcb75721d 100644 --- a/spine-cpp/spine-cpp/include/spine/ScaleTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/ScaleTimeline.h @@ -33,8 +33,8 @@ #include -namespace Spine { - class ScaleTimeline : public TranslateTimeline { +namespace spine { + class SP_API ScaleTimeline : public TranslateTimeline { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/ShearTimeline.h b/spine-cpp/spine-cpp/include/spine/ShearTimeline.h index ac8b650d0..69631f7ce 100644 --- a/spine-cpp/spine-cpp/include/spine/ShearTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/ShearTimeline.h @@ -33,8 +33,8 @@ #include -namespace Spine { - class ShearTimeline : public TranslateTimeline { +namespace spine { + class SP_API ShearTimeline : public TranslateTimeline { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/Skeleton.h b/spine-cpp/spine-cpp/include/spine/Skeleton.h index c966fda4e..7e33eda11 100644 --- a/spine-cpp/spine-cpp/include/spine/Skeleton.h +++ b/spine-cpp/spine-cpp/include/spine/Skeleton.h @@ -34,12 +34,12 @@ #include #include #include -#include +#include #include #include // std::numeric_limits -namespace Spine { +namespace spine { class SkeletonData; class Bone; @@ -58,7 +58,7 @@ class Skin; class Attachment; -class Skeleton : public SpineObject { +class SP_API Skeleton : public SpineObject { friend class AnimationState; friend class SkeletonBounds; @@ -170,7 +170,7 @@ public: Bone *getRootBone(); - const SkeletonData *getData(); + SkeletonData *getData(); Vector &getBones(); diff --git a/spine-cpp/spine-cpp/include/spine/SkeletonBinary.h b/spine-cpp/spine-cpp/include/spine/SkeletonBinary.h index f58f1390e..a5c508247 100644 --- a/spine-cpp/spine-cpp/include/spine/SkeletonBinary.h +++ b/spine-cpp/spine-cpp/include/spine/SkeletonBinary.h @@ -34,10 +34,10 @@ #include #include #include -#include +#include #include -namespace Spine { +namespace spine { class SkeletonData; class Atlas; class AttachmentLoader; @@ -48,7 +48,7 @@ namespace Spine { class Animation; class CurveTimeline; - class SkeletonBinary : public SpineObject { + class SP_API SkeletonBinary : public SpineObject { public: static const int BONE_ROTATE; static const int BONE_TRANSLATE; diff --git a/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h b/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h index 205198823..28a1a9492 100644 --- a/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h +++ b/spine-cpp/spine-cpp/include/spine/SkeletonBounds.h @@ -34,7 +34,7 @@ #include #include -namespace Spine { +namespace spine { class Skeleton; class BoundingBoxAttachment; class Polygon; @@ -43,7 +43,7 @@ namespace Spine { /// Collects each BoundingBoxAttachment that is visible and computes the world vertices for its polygon. /// The polygon vertices are provided along with convenience methods for doing hit detection. /// - class SkeletonBounds : public SpineObject { + class SP_API SkeletonBounds : public SpineObject { public: SkeletonBounds(); diff --git a/spine-cpp/spine-cpp/include/spine/SkeletonClipping.h b/spine-cpp/spine-cpp/include/spine/SkeletonClipping.h index ec59f5d88..f2b97dcfd 100644 --- a/spine-cpp/spine-cpp/include/spine/SkeletonClipping.h +++ b/spine-cpp/spine-cpp/include/spine/SkeletonClipping.h @@ -34,11 +34,11 @@ #include #include -namespace Spine { +namespace spine { class Slot; class ClippingAttachment; - class SkeletonClipping : public SpineObject { + class SP_API SkeletonClipping : public SpineObject { public: SkeletonClipping(); @@ -47,8 +47,10 @@ namespace Spine { void clipEnd(Slot& slot); void clipEnd(); - - void clipTriangles(Vector& vertices, size_t verticesLength, Vector& triangles, size_t trianglesLength, Vector& uvs); + + void clipTriangles(float* vertices, unsigned short* triangles, size_t trianglesLength, float* uvs, size_t stride); + + void clipTriangles(Vector& vertices, Vector& triangles, Vector& uvs, size_t stride); bool isClipping(); diff --git a/spine-cpp/spine-cpp/include/spine/SkeletonData.h b/spine-cpp/spine-cpp/include/spine/SkeletonData.h index 05160ea41..953223fa6 100644 --- a/spine-cpp/spine-cpp/include/spine/SkeletonData.h +++ b/spine-cpp/spine-cpp/include/spine/SkeletonData.h @@ -32,9 +32,9 @@ #define Spine_SkeletonData_h #include -#include +#include -namespace Spine { +namespace spine { class BoneData; class SlotData; @@ -52,7 +52,7 @@ class TransformConstraintData; class PathConstraintData; /// Stores the setup pose and all of the stateless data for a skeleton. -class SkeletonData : public SpineObject { +class SP_API SkeletonData : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; @@ -82,7 +82,7 @@ public: Skin *findSkin(const String &skinName); /// @return May be NULL. - EventData *findEvent(const String &eventDataName); + spine::EventData *findEvent(const String &eventDataName); /// @return May be NULL. Animation *findAnimation(const String &animationName); @@ -119,7 +119,7 @@ public: void setDefaultSkin(Skin *inValue); - Vector &getEvents(); + Vector &getEvents(); Vector &getAnimations(); diff --git a/spine-cpp/spine-cpp/include/spine/SkeletonJson.h b/spine-cpp/spine-cpp/include/spine/SkeletonJson.h index 948b07feb..5b07c4dff 100644 --- a/spine-cpp/spine-cpp/include/spine/SkeletonJson.h +++ b/spine-cpp/spine-cpp/include/spine/SkeletonJson.h @@ -33,9 +33,9 @@ #include #include -#include +#include -namespace Spine { +namespace spine { class CurveTimeline; class VertexAttachment; @@ -54,7 +54,7 @@ class LinkedMesh; class String; -class SkeletonJson : public SpineObject { +class SP_API SkeletonJson : public SpineObject { public: explicit SkeletonJson(Atlas *atlas); diff --git a/spine-cpp/spine-cpp/include/spine/Skin.h b/spine-cpp/spine-cpp/include/spine/Skin.h index e22256a95..cb0295fe3 100644 --- a/spine-cpp/spine-cpp/include/spine/Skin.h +++ b/spine-cpp/spine-cpp/include/spine/Skin.h @@ -32,9 +32,9 @@ #define Spine_Skin_h #include -#include +#include -namespace Spine { +namespace spine { class Attachment; class Skeleton; @@ -42,15 +42,15 @@ class Skeleton; /// Stores attachments by slot index and attachment name. /// See SkeletonData::getDefaultSkin, Skeleton::getSkin, and /// http://esotericsoftware.com/spine-runtime-skins in the Spine Runtimes Guide. -class Skin : public SpineObject { +class SP_API Skin : public SpineObject { friend class Skeleton; public: - class AttachmentMap : public SpineObject { + class SP_API AttachmentMap : public SpineObject { friend class Skin; public: - struct Entry { + struct SP_API Entry { size_t _slotIndex; String _name; Attachment *_attachment; @@ -62,7 +62,7 @@ public: } }; - class Entries { + class SP_API Entries { friend class AttachmentMap; public: diff --git a/spine-cpp/spine-cpp/include/spine/Slot.h b/spine-cpp/spine-cpp/include/spine/Slot.h index b5248414b..b1f83c869 100644 --- a/spine-cpp/spine-cpp/include/spine/Slot.h +++ b/spine-cpp/spine-cpp/include/spine/Slot.h @@ -37,7 +37,7 @@ #include -namespace Spine { +namespace spine { class SlotData; class Bone; @@ -46,7 +46,7 @@ class Skeleton; class Attachment; -class Slot : public SpineObject { +class SP_API Slot : public SpineObject { friend class VertexAttachment; friend class Skeleton; @@ -100,8 +100,6 @@ public: bool hasDarkColor(); - void setHasDarkColor(bool inValue); - /// May be NULL. Attachment *getAttachment(); diff --git a/spine-cpp/spine-cpp/include/spine/SlotData.h b/spine-cpp/spine-cpp/include/spine/SlotData.h index 7551d30ae..8d7691a8e 100644 --- a/spine-cpp/spine-cpp/include/spine/SlotData.h +++ b/spine-cpp/spine-cpp/include/spine/SlotData.h @@ -33,13 +33,13 @@ #include #include -#include +#include #include -namespace Spine { +namespace spine { class BoneData; -class SlotData : public SpineObject { +class SP_API SlotData : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/SpacingMode.h b/spine-cpp/spine-cpp/include/spine/SpacingMode.h index 333f678ca..0bb5c4ebf 100644 --- a/spine-cpp/spine-cpp/include/spine/SpacingMode.h +++ b/spine-cpp/spine-cpp/include/spine/SpacingMode.h @@ -31,7 +31,7 @@ #ifndef Spine_SpacingMode_h #define Spine_SpacingMode_h -namespace Spine { +namespace spine { enum SpacingMode { SpacingMode_Length = 0, SpacingMode_Fixed, diff --git a/spine-cpp/spine-cpp/include/spine/SpineObject.h b/spine-cpp/spine-cpp/include/spine/SpineObject.h index da5039c09..20ba68ddc 100644 --- a/spine-cpp/spine-cpp/include/spine/SpineObject.h +++ b/spine-cpp/spine-cpp/include/spine/SpineObject.h @@ -32,12 +32,17 @@ #define Spine_Object_h #include +#include -namespace Spine { +#include + +namespace spine { class String; -class SpineObject { +class SP_API SpineObject { public: + void *operator new(size_t sz); + void *operator new(size_t sz, const char *file, int line); void *operator new(size_t sz, void *ptr); diff --git a/spine-cpp/spine-cpp/include/spine/String.h b/spine-cpp/spine-cpp/include/spine/SpineString.h similarity index 98% rename from spine-cpp/spine-cpp/include/spine/String.h rename to spine-cpp/spine-cpp/include/spine/SpineString.h index 08e56f45d..d94f99cff 100644 --- a/spine-cpp/spine-cpp/include/spine/String.h +++ b/spine-cpp/spine-cpp/include/spine/SpineString.h @@ -42,8 +42,8 @@ #pragma warning(disable:4996) #endif -namespace Spine { -class String : public SpineObject { +namespace spine { +class SP_API String : public SpineObject { public: String() : _length(0), _buffer(NULL) { } diff --git a/spine-cpp/spine-cpp/include/spine/TextureLoader.h b/spine-cpp/spine-cpp/include/spine/TextureLoader.h index feb5fbbfc..eb1bc6398 100644 --- a/spine-cpp/spine-cpp/include/spine/TextureLoader.h +++ b/spine-cpp/spine-cpp/include/spine/TextureLoader.h @@ -32,12 +32,12 @@ #define Spine_TextureLoader_h #include -#include +#include -namespace Spine { +namespace spine { class AtlasPage; - class TextureLoader : public SpineObject { + class SP_API TextureLoader : public SpineObject { public: TextureLoader(); diff --git a/spine-cpp/spine-cpp/include/spine/Timeline.h b/spine-cpp/spine-cpp/include/spine/Timeline.h index 41182d6b8..91621fde1 100644 --- a/spine-cpp/spine-cpp/include/spine/Timeline.h +++ b/spine-cpp/spine-cpp/include/spine/Timeline.h @@ -37,12 +37,12 @@ #include #include -namespace Spine { +namespace spine { class Skeleton; class Event; -class Timeline : public SpineObject { +class SP_API Timeline : public SpineObject { RTTI_DECL public: diff --git a/spine-cpp/spine-cpp/include/spine/TimelineType.h b/spine-cpp/spine-cpp/include/spine/TimelineType.h index d64f8427b..0f227cecf 100644 --- a/spine-cpp/spine-cpp/include/spine/TimelineType.h +++ b/spine-cpp/spine-cpp/include/spine/TimelineType.h @@ -31,7 +31,7 @@ #ifndef Spine_TimelineType_h #define Spine_TimelineType_h -namespace Spine { +namespace spine { enum TimelineType { TimelineType_Rotate = 0, TimelineType_Translate, diff --git a/spine-cpp/spine-cpp/include/spine/TransformConstraint.h b/spine-cpp/spine-cpp/include/spine/TransformConstraint.h index 69dc172ff..3204fbaf8 100644 --- a/spine-cpp/spine-cpp/include/spine/TransformConstraint.h +++ b/spine-cpp/spine-cpp/include/spine/TransformConstraint.h @@ -35,12 +35,12 @@ #include -namespace Spine { +namespace spine { class TransformConstraintData; class Skeleton; class Bone; - class TransformConstraint : public Constraint { + class SP_API TransformConstraint : public Constraint { friend class Skeleton; friend class TransformConstraintTimeline; diff --git a/spine-cpp/spine-cpp/include/spine/TransformConstraintData.h b/spine-cpp/spine-cpp/include/spine/TransformConstraintData.h index 7fb0cfcb3..37cc3aa63 100644 --- a/spine-cpp/spine-cpp/include/spine/TransformConstraintData.h +++ b/spine-cpp/spine-cpp/include/spine/TransformConstraintData.h @@ -33,12 +33,12 @@ #include #include -#include +#include -namespace Spine { +namespace spine { class BoneData; - class TransformConstraintData : public SpineObject { + class SP_API TransformConstraintData : public SpineObject { friend class SkeletonBinary; friend class SkeletonJson; diff --git a/spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h b/spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h index 45a435f37..8d3070025 100644 --- a/spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h @@ -33,8 +33,9 @@ #include -namespace Spine { - class TransformConstraintTimeline : public CurveTimeline { +namespace spine { + + class SP_API TransformConstraintTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; @@ -52,8 +53,15 @@ namespace Spine { void setFrame(size_t frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix); private: - static const int PREV_TIME, PREV_ROTATE, PREV_TRANSLATE, PREV_SCALE, PREV_SHEAR; - static const int ROTATE, TRANSLATE, SCALE, SHEAR; + static const int PREV_TIME; + static const int PREV_ROTATE; + static const int PREV_TRANSLATE; + static const int PREV_SCALE; + static const int PREV_SHEAR; + static const int ROTATE; + static const int TRANSLATE; + static const int SCALE; + static const int SHEAR; Vector _frames; int _transformConstraintIndex; diff --git a/spine-cpp/spine-cpp/include/spine/TransformMode.h b/spine-cpp/spine-cpp/include/spine/TransformMode.h index cf7d96c3a..27c4fd5c4 100644 --- a/spine-cpp/spine-cpp/include/spine/TransformMode.h +++ b/spine-cpp/spine-cpp/include/spine/TransformMode.h @@ -31,7 +31,7 @@ #ifndef Spine_TransformMode_h #define Spine_TransformMode_h -namespace Spine { +namespace spine { enum TransformMode { TransformMode_Normal = 0, TransformMode_OnlyTranslation, diff --git a/spine-cpp/spine-cpp/include/spine/TranslateTimeline.h b/spine-cpp/spine-cpp/include/spine/TranslateTimeline.h index 610b5b329..b5f3a103d 100644 --- a/spine-cpp/spine-cpp/include/spine/TranslateTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/TranslateTimeline.h @@ -36,8 +36,9 @@ #include #include -namespace Spine { - class TranslateTimeline : public CurveTimeline { +namespace spine { + + class SP_API TranslateTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; @@ -58,8 +59,11 @@ namespace Spine { void setFrame(int frameIndex, float time, float x, float y); protected: - static const int PREV_TIME, PREV_X, PREV_Y; - static const int X, Y; + static const int PREV_TIME; + static const int PREV_X; + static const int PREV_Y; + static const int X; + static const int Y; Vector _frames; int _boneIndex; diff --git a/spine-cpp/spine-cpp/include/spine/Triangulator.h b/spine-cpp/spine-cpp/include/spine/Triangulator.h index a888677d5..da12785ce 100644 --- a/spine-cpp/spine-cpp/include/spine/Triangulator.h +++ b/spine-cpp/spine-cpp/include/spine/Triangulator.h @@ -34,8 +34,8 @@ #include #include -namespace Spine { -class Triangulator : public SpineObject { +namespace spine { +class SP_API Triangulator : public SpineObject { public: ~Triangulator(); diff --git a/spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h b/spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h index 8c46e37a7..78249043b 100644 --- a/spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h +++ b/spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h @@ -33,8 +33,9 @@ #include -namespace Spine { - class TwoColorTimeline : public CurveTimeline { +namespace spine { + + class SP_API TwoColorTimeline : public CurveTimeline { friend class SkeletonBinary; friend class SkeletonJson; @@ -56,9 +57,21 @@ namespace Spine { void setSlotIndex(int inValue); private: - static const int PREV_TIME, PREV_R, PREV_G, PREV_B, PREV_A; - static const int PREV_R2, PREV_G2, PREV_B2; - static const int R, G, B, A, R2, G2, B2; + static const int PREV_TIME; + static const int PREV_R; + static const int PREV_G; + static const int PREV_B; + static const int PREV_A; + static const int PREV_R2; + static const int PREV_G2; + static const int PREV_B2; + static const int R; + static const int G; + static const int B; + static const int A; + static const int R2; + static const int G2; + static const int B2; Vector _frames; // time, r, g, b, a, r2, g2, b2, ... int _slotIndex; diff --git a/spine-cpp/spine-cpp/include/spine/Updatable.h b/spine-cpp/spine-cpp/include/spine/Updatable.h index 35b629951..9c50d64e5 100644 --- a/spine-cpp/spine-cpp/include/spine/Updatable.h +++ b/spine-cpp/spine-cpp/include/spine/Updatable.h @@ -34,8 +34,8 @@ #include #include -namespace Spine { -class Updatable : public SpineObject { +namespace spine { +class SP_API Updatable : public SpineObject { RTTI_DECL public: diff --git a/spine-cpp/spine-cpp/include/spine/Vector.h b/spine-cpp/spine-cpp/include/spine/Vector.h index 6f65e3a5c..a7806c42d 100644 --- a/spine-cpp/spine-cpp/include/spine/Vector.h +++ b/spine-cpp/spine-cpp/include/spine/Vector.h @@ -33,14 +33,14 @@ #include #include -#include +#include #include #include #include -namespace Spine { +namespace spine { template -class Vector : public SpineObject { +class SP_API Vector : public SpineObject { public: Vector() : _size(0), _capacity(0), _buffer(NULL) { } @@ -67,6 +67,10 @@ public: _size = 0; } + inline size_t getCapacity() const { + return _capacity; + } + inline size_t size() const { return _size; } @@ -78,7 +82,7 @@ public: if (_capacity < newSize) { _capacity = (int) (_size * 1.75f); if (_capacity < 8) _capacity = 8; - _buffer = Spine::SpineExtension::realloc(_buffer, _capacity, __FILE__, __LINE__); + _buffer = spine::SpineExtension::realloc(_buffer, _capacity, __FILE__, __LINE__); } if (oldSize < _size) { for (size_t i = oldSize; i < _size; i++) { @@ -102,7 +106,7 @@ public: T valueCopy = inValue; _capacity = (int) (_size * 1.75f); if (_capacity < 8) _capacity = 8; - _buffer = Spine::SpineExtension::realloc(_buffer, _capacity, __FILE__, __LINE__); + _buffer = spine::SpineExtension::realloc(_buffer, _capacity, __FILE__, __LINE__); construct(_buffer + _size++, valueCopy); } else { construct(_buffer + _size++, inValue); diff --git a/spine-cpp/spine-cpp/include/spine/VertexAttachment.h b/spine-cpp/spine-cpp/include/spine/VertexAttachment.h index c3188d23f..e1cc9d6b9 100644 --- a/spine-cpp/spine-cpp/include/spine/VertexAttachment.h +++ b/spine-cpp/spine-cpp/include/spine/VertexAttachment.h @@ -35,11 +35,11 @@ #include -namespace Spine { +namespace spine { class Slot; /// 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 SP_API VertexAttachment : public Attachment { friend class SkeletonBinary; friend class SkeletonJson; friend class DeformTimeline; @@ -50,7 +50,8 @@ namespace Spine { explicit VertexAttachment(const String& name); virtual ~VertexAttachment(); - + + void computeWorldVertices(Slot& slot, float* worldVertices); void computeWorldVertices(Slot& slot, Vector& worldVertices); /// Transforms local vertices to world coordinates. @@ -59,6 +60,7 @@ namespace Spine { /// @param worldVertices The output world vertices. Must have a length greater than or equal to offset + count. /// @param offset The worldVertices index to begin writing values. /// @param stride The number of worldVertices entries between the value pairs written. + void computeWorldVertices(Slot& slot, size_t start, size_t count, float* worldVertices, size_t offset, size_t stride = 2); void computeWorldVertices(Slot& slot, size_t start, size_t count, Vector& worldVertices, size_t offset, size_t stride = 2); /// @return true if a deform originally applied to the specified attachment should be applied to this attachment. diff --git a/spine-cpp/spine-cpp/include/spine/VertexEffect.h b/spine-cpp/spine-cpp/include/spine/VertexEffect.h index ffbdb97dd..45fffe461 100644 --- a/spine-cpp/spine-cpp/include/spine/VertexEffect.h +++ b/spine-cpp/spine-cpp/include/spine/VertexEffect.h @@ -34,19 +34,19 @@ #include #include -namespace Spine { +namespace spine { class Skeleton; class Color; -class VertexEffect: public SpineObject { +class SP_API VertexEffect: public SpineObject { public: virtual void begin(Skeleton& skeleton) = 0; virtual void transform(float& x, float& y, float &u, float &v, Color &light, Color &dark) = 0; virtual void end() = 0; }; -class JitterVertexEffect: public VertexEffect { +class SP_API JitterVertexEffect: public VertexEffect { public: JitterVertexEffect(float jitterX, float jitterY); @@ -65,7 +65,7 @@ protected: float _jitterY; }; -class SwirlVertexEffect: public VertexEffect { +class SP_API SwirlVertexEffect: public VertexEffect { public: SwirlVertexEffect(float radius, Interpolation &interpolation); diff --git a/spine-cpp/spine-cpp/include/spine/Vertices.h b/spine-cpp/spine-cpp/include/spine/Vertices.h index 0ae9d3b9a..90b4b39c1 100644 --- a/spine-cpp/spine-cpp/include/spine/Vertices.h +++ b/spine-cpp/spine-cpp/include/spine/Vertices.h @@ -33,8 +33,8 @@ #include -namespace Spine { -class Vertices : public SpineObject { +namespace spine { +class SP_API Vertices : public SpineObject { public: Vector _bones; Vector _vertices; diff --git a/spine-cpp/spine-cpp/include/spine/dll.h b/spine-cpp/spine-cpp/include/spine/dll.h new file mode 100644 index 000000000..caae94198 --- /dev/null +++ b/spine-cpp/spine-cpp/include/spine/dll.h @@ -0,0 +1,52 @@ +/****************************************************************************** +* Spine Runtimes Software License v2.5 +* +* Copyright (c) 2013-2016, Esoteric Software +* All rights reserved. +* +* You are granted a perpetual, non-exclusive, non-sublicensable, and +* non-transferable license to use, install, execute, and perform the Spine +* Runtimes software and derivative works solely for personal or internal +* use. Without the written permission of Esoteric Software (see Section 2 of +* the Spine Software License Agreement), you may not (a) modify, translate, +* adapt, or develop new applications using the Spine Runtimes or otherwise +* create derivative works or improvements of the Spine Runtimes or (b) remove, +* delete, alter, or obscure any trademarks or any copyright, trademark, patent, +* or other intellectual property or proprietary rights notices on or in the +* Software, including any copy thereof. Redistributions in binary or source +* form must include this license and terms. +* +* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF +* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*****************************************************************************/ + +#ifndef SPINE_SHAREDLIB_H +#define SPINE_SHAREDLIB_H + +#ifdef _WIN32 +#define DLLIMPORT __declspec(dllimport) +#define DLLEXPORT __declspec(dllexport) +#else +#ifndef DLLIMPORT +#define DLLIMPORT +#endif +#ifndef DLLEXPORT +#define DLLEXPORT +#endif +#endif + +#ifdef SPINEPLUGIN_API +#define SP_API SPINEPLUGIN_API +#else +#define SP_API +#endif + +#endif /* SPINE_SHAREDLIB_H */ diff --git a/spine-cpp/spine-cpp/include/spine/spine.h b/spine-cpp/spine-cpp/include/spine/spine.h index eb06605a9..00ab72c4c 100644 --- a/spine-cpp/spine-cpp/include/spine/spine.h +++ b/spine-cpp/spine-cpp/include/spine/spine.h @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -64,8 +66,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -90,8 +92,9 @@ #include #include #include +#include #include -#include +#include #include #include #include diff --git a/spine-cpp/spine-cpp/src/spine/Animation.cpp b/spine-cpp/spine-cpp/src/spine/Animation.cpp index 7ee8588ea..8ab7ef84c 100644 --- a/spine-cpp/spine-cpp/src/spine/Animation.cpp +++ b/spine-cpp/spine-cpp/src/spine/Animation.cpp @@ -28,15 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif +#include #include #include #include #include -using namespace Spine; +using namespace spine; Animation::Animation(const String &name, Vector &timelines, float duration) : _timelines(timelines), diff --git a/spine-cpp/spine-cpp/src/spine/AnimationState.cpp b/spine-cpp/spine-cpp/src/spine/AnimationState.cpp index 268f93d83..89b886609 100644 --- a/spine-cpp/spine-cpp/src/spine/AnimationState.cpp +++ b/spine-cpp/spine-cpp/src/spine/AnimationState.cpp @@ -28,23 +28,25 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif +#include #include #include #include #include #include - #include #include #include #include #include -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) { SP_UNUSED(state); SP_UNUSED(type); SP_UNUSED(entry); @@ -56,9 +58,11 @@ TrackEntry::TrackEntry() : _animation(NULL), _next(NULL), _mixingFrom(NULL), _mi _animationEnd(0), _animationLast(0), _nextAnimationLast(0), _delay(0), _trackTime(0), _trackLast(0), _nextTrackLast(0), _trackEnd(0), _timeScale(1.0f), _alpha(0), _mixTime(0), _mixDuration(0), _interruptAlpha(0), _totalAlpha(0), _mixBlend(MixBlend_Replace), - _onAnimationEventFunc(dummyOnAnimationEventFunc) { + _listener(dummyOnAnimationEventFunc) { } +TrackEntry::~TrackEntry() { } + int TrackEntry::getTrackIndex() { return _trackIndex; } Animation *TrackEntry::getAnimation() { return _animation; } @@ -157,8 +161,8 @@ void TrackEntry::resetRotationDirections() { _timelinesRotation.clear(); } -void TrackEntry::setOnAnimationEventFunc(OnAnimationEventFunc inValue) { - _onAnimationEventFunc = inValue; +void TrackEntry::setListener(AnimationStateListener inValue) { + _listener = inValue; } void TrackEntry::reset() { @@ -171,7 +175,7 @@ void TrackEntry::reset() { _timelineHoldMix.clear(); _timelinesRotation.clear(); - _onAnimationEventFunc = dummyOnAnimationEventFunc; + _listener = dummyOnAnimationEventFunc; } EventQueueEntry::EventQueueEntry(EventType eventType, TrackEntry *trackEntry, Event *event) : @@ -241,22 +245,22 @@ void EventQueue::drain() { case EventType_Start: case EventType_Interrupt: case EventType_Complete: - trackEntry->_onAnimationEventFunc(&state, queueEntry->_type, trackEntry, NULL); - state._onAnimationEventFunc(&state, queueEntry->_type, trackEntry, NULL); + trackEntry->_listener(&state, queueEntry->_type, trackEntry, NULL); + state._listener(&state, queueEntry->_type, trackEntry, NULL); break; case EventType_End: - trackEntry->_onAnimationEventFunc(&state, queueEntry->_type, trackEntry, NULL); - state._onAnimationEventFunc(&state, queueEntry->_type, trackEntry, NULL); + trackEntry->_listener(&state, queueEntry->_type, trackEntry, NULL); + state._listener(&state, queueEntry->_type, trackEntry, NULL); /* Yes, we want to fall through here */ case EventType_Dispose: - trackEntry->_onAnimationEventFunc(&state, EventType_Dispose, trackEntry, NULL); - state._onAnimationEventFunc(&state, EventType_Dispose, trackEntry, NULL); + trackEntry->_listener(&state, EventType_Dispose, trackEntry, NULL); + state._listener(&state, EventType_Dispose, trackEntry, NULL); trackEntry->reset(); _trackEntryPool.free(trackEntry); break; case EventType_Event: - trackEntry->_onAnimationEventFunc(&state, queueEntry->_type, trackEntry, queueEntry->_event); - state._onAnimationEventFunc(&state, queueEntry->_type, trackEntry, queueEntry->_event); + trackEntry->_listener(&state, queueEntry->_type, trackEntry, queueEntry->_event); + state._listener(&state, queueEntry->_type, trackEntry, queueEntry->_event); break; } } @@ -265,17 +269,16 @@ void EventQueue::drain() { _drainDisabled = false; } -const int AnimationState::Subsequent = 0; -const int AnimationState::First = 1; -const int AnimationState::Hold = 2; -const int AnimationState::HoldMix = 3; +const int Subsequent = 0; +const int First = 1; +const int Hold = 2; +const int HoldMix = 3; AnimationState::AnimationState(AnimationStateData *data) : _data(data), _queue(EventQueue::newEventQueue(*this, _trackEntryPool)), _animationsChanged(false), - _rendererObject(NULL), - _onAnimationEventFunc(dummyOnAnimationEventFunc), + _listener(dummyOnAnimationEventFunc), _timeScale(1) { } @@ -413,7 +416,7 @@ bool AnimationState::apply(Skeleton &skeleton) { Timeline *timeline = timelines[ii]; assert(timeline); - MixBlend timelineBlend = timelineMode[ii] == AnimationState::Subsequent ? blend : MixBlend_Setup; + MixBlend timelineBlend = timelineMode[ii] == Subsequent ? blend : MixBlend_Setup; RotateTimeline *rotateTimeline = NULL; if (timeline->getRTTI().isExactly(RotateTimeline::rtti)) { @@ -609,16 +612,15 @@ void AnimationState::setTimeScale(float inValue) { _timeScale = inValue; } -void AnimationState::setOnAnimationEventFunc(OnAnimationEventFunc inValue) { - _onAnimationEventFunc = inValue; +void AnimationState::setListener(AnimationStateListener inValue) { + _listener = inValue; } -void AnimationState::setRendererObject(void *inValue) { - _rendererObject = inValue; +void AnimationState::disableQueue() { + _queue->_drainDisabled = true; } - -void *AnimationState::getRendererObject() { - return _rendererObject; +void AnimationState::enableQueue() { + _queue->_drainDisabled = false; } Animation *AnimationState::getEmptyAnimation() { @@ -778,17 +780,17 @@ float AnimationState::applyMixingFrom(TrackEntry *to, Skeleton &skeleton, MixBle MixBlend timelineBlend; float alpha; switch (timelineMode[i]) { - case AnimationState::Subsequent: + case Subsequent: if (!attachments && (timeline->getRTTI().isExactly(AttachmentTimeline::rtti))) continue; if (!drawOrder && (timeline->getRTTI().isExactly(DrawOrderTimeline::rtti))) continue; timelineBlend = blend; alpha = alphaMix; break; - case AnimationState::First: + case First: timelineBlend = MixBlend_Setup; alpha = alphaMix; break; - case AnimationState::Hold: + case Hold: timelineBlend = MixBlend_Setup; alpha = alphaHold; break; @@ -944,6 +946,8 @@ void AnimationState::animationsChanged() { for (size_t i = 0, n = _tracks.size(); i < n; ++i) { TrackEntry *entry = _tracks[i]; + if (!entry) continue; + while (entry->_mixingFrom != NULL) entry = entry->_mixingFrom; @@ -967,7 +971,7 @@ void AnimationState::setTimelineModes(TrackEntry *entry) { for (size_t i = 0; i < timelinesCount; i++) { int id = timelines[i]->getPropertyId(); if (!_propertyIDs.contains(id)) _propertyIDs.add(id); - timelineMode[i] = AnimationState::Hold; + timelineMode[i] = Hold; } return; } @@ -978,24 +982,24 @@ void AnimationState::setTimelineModes(TrackEntry *entry) { for (; i < timelinesCount; ++i) { int id = timelines[i]->getPropertyId(); if (_propertyIDs.contains(id)) { - timelineMode[i] = AnimationState::Subsequent; + timelineMode[i] = Subsequent; } else { _propertyIDs.add(id); if (to == NULL || !hasTimeline(to, id)) { - timelineMode[i] = AnimationState::First; + timelineMode[i] = First; } else { for (TrackEntry *next = to->_mixingTo; next != NULL; next = next->_mixingTo) { if (hasTimeline(next, id)) continue; if (entry->_mixDuration > 0) { - timelineMode[i] = AnimationState::HoldMix; + timelineMode[i] = HoldMix; timelineHoldMix[i] = entry; i++; goto continue_outer; // continue outer; } break; } - timelineMode[i] = AnimationState::Hold; + timelineMode[i] = Hold; } } } diff --git a/spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp b/spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp index e89b68090..e7d93ecf9 100644 --- a/spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp +++ b/spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp @@ -28,12 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif +#include #include #include -using namespace Spine; +using namespace spine; AnimationStateData::AnimationStateData(SkeletonData *skeletonData) : _skeletonData(skeletonData), _defaultMix(0) { } diff --git a/spine-cpp/spine-cpp/src/spine/Atlas.cpp b/spine-cpp/spine-cpp/src/spine/Atlas.cpp index 69caca872..6b6595493 100644 --- a/spine-cpp/spine-cpp/src/spine/Atlas.cpp +++ b/spine-cpp/spine-cpp/src/spine/Atlas.cpp @@ -28,15 +28,17 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include - #include - #include #include -using namespace Spine; +using namespace spine; Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(textureLoader) { int dirLength; @@ -71,7 +73,7 @@ Atlas::Atlas(const char *data, int length, const char *dir, TextureLoader *textu Atlas::~Atlas() { if (_textureLoader) { for (size_t i = 0, n = _pages.size(); i < n; ++i) { - _textureLoader->unload(_pages[i]->rendererObject); + _textureLoader->unload(_pages[i]->getRendererObject()); } } ContainerUtil::cleanUpVectorOfPointers(_pages); @@ -97,6 +99,10 @@ AtlasRegion *Atlas::findRegion(const String &name) { return NULL; } +Vector &Atlas::getPages() { + return _pages; +} + void Atlas::load(const char *begin, int length, const char *dir) { static const char *formatNames[] = {"", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888", "RGBA8888"}; @@ -133,15 +139,15 @@ void Atlas::load(const char *begin, int length, const char *dir) { /* size is only optional for an atlas packed with an old TexturePacker. */ page->width = toInt(tuple); page->height = toInt(tuple + 1); - assert(readTuple(&begin, end, tuple)); + readTuple(&begin, end, tuple); page->format = (Format) indexOf(formatNames, 8, tuple); - assert(readTuple(&begin, end, tuple)); + readTuple(&begin, end, tuple); page->minFilter = (TextureFilter) indexOf(textureFilterNames, 8, tuple); page->magFilter = (TextureFilter) indexOf(textureFilterNames, 8, tuple + 1); - assert(readValue(&begin, end, &str)); + readValue(&begin, end, &str); page->uWrap = TextureWrap_ClampToEdge; page->vWrap = TextureWrap_ClampToEdge; @@ -169,14 +175,14 @@ void Atlas::load(const char *begin, int length, const char *dir) { region->page = page; region->name = String(mallocString(&str), true); - assert(readValue(&begin, end, &str)); + readValue(&begin, end, &str); region->rotate = equals(&str, "true") ? true : false; - assert(readTuple(&begin, end, tuple) == 2); + readTuple(&begin, end, tuple); region->x = toInt(tuple); region->y = toInt(tuple + 1); - assert(readTuple(&begin, end, tuple) == 2); + readTuple(&begin, end, tuple); region->width = toInt(tuple); region->height = toInt(tuple + 1); @@ -212,7 +218,7 @@ void Atlas::load(const char *begin, int length, const char *dir) { region->pads[2] = toInt(tuple + 2); region->pads[3] = toInt(tuple + 3); - assert(readTuple(&begin, end, tuple)); + readTuple(&begin, end, tuple); } } @@ -223,7 +229,7 @@ void Atlas::load(const char *begin, int length, const char *dir) { region->offsetX = (float)toInt(tuple); region->offsetY = (float)toInt(tuple + 1); - assert(readValue(&begin, end, &str)); + readValue(&begin, end, &str); region->index = toInt(&str); diff --git a/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp b/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp index a5839f898..ad6c3c519 100644 --- a/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp +++ b/spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp @@ -28,8 +28,11 @@ * POSSIBILITY OF SUCH DAMAGE. ******************************************************S**********************/ -#include +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif +#include #include #include #include @@ -40,7 +43,7 @@ #include -namespace Spine { +namespace spine { RTTI_IMPL(AtlasAttachmentLoader, AttachmentLoader) AtlasAttachmentLoader::AtlasAttachmentLoader(Atlas *atlas) : AttachmentLoader(), _atlas(atlas) { @@ -50,14 +53,14 @@ RegionAttachment *AtlasAttachmentLoader::newRegionAttachment(Skin &skin, const S SP_UNUSED(skin); AtlasRegion *regionP = findRegion(path); - assert(regionP != NULL); + if (!regionP) return NULL; AtlasRegion ®ion = *regionP; RegionAttachment *attachmentP = new(__FILE__, __LINE__) RegionAttachment(name); RegionAttachment &attachment = *attachmentP; - attachment._rendererObject = regionP; + attachment.setRendererObject(regionP); attachment.setUVs(region.u, region.v, region.u2, region.v2, region.rotate); attachment._regionOffsetX = region.offsetX; attachment._regionOffsetY = region.offsetY; @@ -72,14 +75,14 @@ MeshAttachment *AtlasAttachmentLoader::newMeshAttachment(Skin &skin, const Strin SP_UNUSED(skin); AtlasRegion *regionP = findRegion(path); - assert(regionP != NULL); + if (!regionP) return NULL; AtlasRegion ®ion = *regionP; MeshAttachment *attachmentP = new(__FILE__, __LINE__) MeshAttachment(name); MeshAttachment &attachment = *attachmentP; - attachment._rendererObject = regionP; + attachment.setRendererObject(regionP); attachment._regionU = region.u; attachment._regionV = region.v; attachment._regionU2 = region.u2; @@ -115,6 +118,10 @@ ClippingAttachment *AtlasAttachmentLoader::newClippingAttachment(Skin &skin, con return new(__FILE__, __LINE__) ClippingAttachment(name); } +void AtlasAttachmentLoader::configureAttachment(Attachment* attachment) { + SP_UNUSED(attachment); +} + AtlasRegion *AtlasAttachmentLoader::findRegion(const String &name) { return _atlas->findRegion(name); } diff --git a/spine-cpp/spine-cpp/src/spine/Attachment.cpp b/spine-cpp/spine-cpp/src/spine/Attachment.cpp index 48d39eeeb..e3bb6f26c 100644 --- a/spine-cpp/spine-cpp/src/spine/Attachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/Attachment.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL_NOPARENT(Attachment) diff --git a/spine-cpp/spine-cpp/src/spine/AttachmentLoader.cpp b/spine-cpp/spine-cpp/src/spine/AttachmentLoader.cpp index df3824911..1e3011fd6 100644 --- a/spine-cpp/spine-cpp/src/spine/AttachmentLoader.cpp +++ b/spine-cpp/spine-cpp/src/spine/AttachmentLoader.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL_NOPARENT(AttachmentLoader) diff --git a/spine-cpp/spine-cpp/src/spine/AttachmentTimeline.cpp b/spine-cpp/spine-cpp/src/spine/AttachmentTimeline.cpp index d4811fa9a..ad68c17a8 100644 --- a/spine-cpp/spine-cpp/src/spine/AttachmentTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/AttachmentTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(AttachmentTimeline, Timeline) diff --git a/spine-cpp/spine-cpp/src/spine/Bone.cpp b/spine-cpp/spine-cpp/src/spine/Bone.cpp index 62d097e2c..5d65e9b34 100644 --- a/spine-cpp/spine-cpp/src/spine/Bone.cpp +++ b/spine-cpp/spine-cpp/src/spine/Bone.cpp @@ -28,12 +28,16 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(Bone, Updatable) @@ -148,11 +152,11 @@ Bone::updateWorldTransform(float x, float y, float rotation, float scaleX, float s = MathUtil::abs(pa * pd - pb * pc) / s; pb = pc * s; pd = pa * s; - prx = MathUtil::atan2(pc, pa) * RAD_DEG; + prx = MathUtil::atan2(pc, pa) * MathUtil::Rad_Deg; } else { pa = 0; pc = 0; - prx = 90 - MathUtil::atan2(pd, pb) * RAD_DEG; + prx = 90 - MathUtil::atan2(pd, pb) * MathUtil::Rad_Deg; } rx = rotation + shearX - prx; ry = rotation + shearY - prx + 90; @@ -179,7 +183,7 @@ Bone::updateWorldTransform(float x, float y, float rotation, float scaleX, float za *= s; zc *= s; s = MathUtil::sqrt(za * za + zc * zc); - r = PI / 2 + MathUtil::atan2(zc, za); + r = MathUtil::Pi / 2 + MathUtil::atan2(zc, za); zb = MathUtil::cos(r) * s; zd = MathUtil::sin(r) * s; la = MathUtil::cosDeg(shearX) * scaleX; @@ -233,14 +237,14 @@ float Bone::worldToLocalRotation(float worldRotation) { float sin = MathUtil::sinDeg(worldRotation); float cos = MathUtil::cosDeg(worldRotation); - return MathUtil::atan2(_a * sin - _c * cos, _d * cos - _b * sin) * RAD_DEG; + return MathUtil::atan2(_a * sin - _c * cos, _d * cos - _b * sin) * MathUtil::Rad_Deg; } float Bone::localToWorldRotation(float localRotation) { float sin = MathUtil::sinDeg(localRotation); float cos = MathUtil::cosDeg(localRotation); - return MathUtil::atan2(cos * _c + sin * _d, cos * _a + sin * _b) * RAD_DEG; + return MathUtil::atan2(cos * _c + sin * _d, cos * _a + sin * _b) * MathUtil::Rad_Deg; } void Bone::rotateWorld(float degrees) { @@ -273,7 +277,7 @@ float Bone::getWorldToLocalRotationX() { float a = _a; float c = _c; - return MathUtil::atan2(pa * c - pc * a, pd * a - pb * c) * RAD_DEG; + return MathUtil::atan2(pa * c - pc * a, pd * a - pb * c) * MathUtil::Rad_Deg; } float Bone::getWorldToLocalRotationY() { @@ -289,7 +293,7 @@ float Bone::getWorldToLocalRotationY() { float b = _b; float d = _d; - return MathUtil::atan2(pa * d - pc * b, pd * b - pb * d) * RAD_DEG; + return MathUtil::atan2(pa * d - pc * b, pd * b - pb * d) * MathUtil::Rad_Deg; } BoneData &Bone::getData() { @@ -469,11 +473,11 @@ void Bone::setWorldY(float inValue) { } float Bone::getWorldRotationX() { - return MathUtil::atan2(_c, _a) * RAD_DEG; + return MathUtil::atan2(_c, _a) * MathUtil::MathUtil::Rad_Deg; } float Bone::getWorldRotationY() { - return MathUtil::atan2(_d, _b) * RAD_DEG; + return MathUtil::atan2(_d, _b) * MathUtil::Rad_Deg; } float Bone::getWorldScaleX() { @@ -484,17 +488,24 @@ float Bone::getWorldScaleY() { return MathUtil::sqrt(_b * _b + _d * _d); } +bool Bone::isAppliedValid() { + return _appliedValid; +} +void Bone::setAppliedValid(bool valid) { + _appliedValid = valid; +} + void Bone::updateAppliedTransform() { Bone *parent = _parent; _appliedValid = 1; if (!parent) { _ax = _worldX; _ay = _worldY; - _arotation = MathUtil::atan2(_c, _a) * RAD_DEG; + _arotation = MathUtil::atan2(_c, _a) * MathUtil::Rad_Deg; _ascaleX = MathUtil::sqrt(_a * _a + _c * _c); _ascaleY = MathUtil::sqrt(_b * _b + _d * _d); _ashearX = 0; - _ashearY = MathUtil::atan2(_a * _b + _c * _d, _a * _d - _b * _c) * RAD_DEG; + _ashearY = MathUtil::atan2(_a * _b + _c * _d, _a * _d - _b * _c) * MathUtil::Rad_Deg; } else { float pa = parent->_a, pb = parent->_b, pc = parent->_c, pd = parent->_d; float pid = 1 / (pa * pd - pb * pc); @@ -514,13 +525,13 @@ void Bone::updateAppliedTransform() { if (_ascaleX > 0.0001f) { float det = ra * rd - rb * rc; _ascaleY = det / _ascaleX; - _ashearY = MathUtil::atan2(ra * rb + rc * rd, det) * RAD_DEG; - _arotation = MathUtil::atan2(rc, ra) * RAD_DEG; + _ashearY = MathUtil::atan2(ra * rb + rc * rd, det) * MathUtil::Rad_Deg; + _arotation = MathUtil::atan2(rc, ra) * MathUtil::Rad_Deg; } else { _ascaleX = 0; _ascaleY = MathUtil::sqrt(rb * rb + rd * rd); _ashearY = 0; - _arotation = 90 - MathUtil::atan2(rd, rb) * RAD_DEG; + _arotation = 90 - MathUtil::atan2(rd, rb) * MathUtil::Rad_Deg; } } } diff --git a/spine-cpp/spine-cpp/src/spine/BoneData.cpp b/spine-cpp/spine-cpp/src/spine/BoneData.cpp index 584116b9f..bda7d5ed5 100644 --- a/spine-cpp/spine-cpp/src/spine/BoneData.cpp +++ b/spine-cpp/spine-cpp/src/spine/BoneData.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; BoneData::BoneData(int index, const String &name, BoneData *parent) : _index(index), diff --git a/spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp b/spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp index 980133579..9e6ee5ec5 100644 --- a/spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp @@ -28,9 +28,13 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include -using namespace Spine; +using namespace spine; RTTI_IMPL(BoundingBoxAttachment, VertexAttachment) diff --git a/spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp b/spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp index 737f34d7b..7b11101fb 100644 --- a/spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(ClippingAttachment, VertexAttachment) diff --git a/spine-cpp/spine-cpp/src/spine/ColorTimeline.cpp b/spine-cpp/spine-cpp/src/spine/ColorTimeline.cpp index 5f4f06275..604fdd7d9 100644 --- a/spine-cpp/spine-cpp/src/spine/ColorTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/ColorTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(ColorTimeline, CurveTimeline) @@ -71,7 +75,7 @@ void ColorTimeline::apply(Skeleton &skeleton, float lastTime, float time, Vector slot._color.set(slot._data._color); return; case MixBlend_First: { - Color color = slot._color, setup = slot._data._color; + Color &color = slot._color, setup = slot._data._color; color.add((setup.r - color.r) * alpha, (setup.g - color.g) * alpha, (setup.b - color.b) * alpha, (setup.a - color.a) * alpha); } diff --git a/spine-cpp/spine-cpp/src/spine/Constraint.cpp b/spine-cpp/spine-cpp/src/spine/Constraint.cpp index 21327eb95..39ca6656a 100644 --- a/spine-cpp/spine-cpp/src/spine/Constraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/Constraint.cpp @@ -28,9 +28,13 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include -using namespace Spine; +using namespace spine; RTTI_IMPL(Constraint, Updatable) diff --git a/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp b/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp index dd3e4cf04..adb2623ad 100644 --- a/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/CurveTimeline.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(CurveTimeline, Timeline) diff --git a/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp b/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp index d4078a55e..e13180ad7 100644 --- a/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -40,7 +44,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(DeformTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/DrawOrderTimeline.cpp b/spine-cpp/spine-cpp/src/spine/DrawOrderTimeline.cpp index 12168f337..d79d3fc6c 100644 --- a/spine-cpp/spine-cpp/src/spine/DrawOrderTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/DrawOrderTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(DrawOrderTimeline, Timeline) diff --git a/spine-cpp/spine-cpp/src/spine/Event.cpp b/spine-cpp/spine-cpp/src/spine/Event.cpp index 8c6630856..e397b4e68 100644 --- a/spine-cpp/spine-cpp/src/spine/Event.cpp +++ b/spine-cpp/spine-cpp/src/spine/Event.cpp @@ -28,13 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; - -Event::Event(float time, const EventData &data) : +spine::Event::Event(float time, const spine::EventData &data) : _data(data), _time(time), _intValue(0), @@ -44,51 +46,51 @@ Event::Event(float time, const EventData &data) : _balance(0) { } -const EventData &Event::getData() { +const spine::EventData &spine::Event::getData() { return _data; } -float Event::getTime() { +float spine::Event::getTime() { return _time; } -int Event::getIntValue() { +int spine::Event::getIntValue() { return _intValue; } -void Event::setIntValue(int inValue) { +void spine::Event::setIntValue(int inValue) { _intValue = inValue; } -float Event::getFloatValue() { +float spine::Event::getFloatValue() { return _floatValue; } -void Event::setFloatValue(float inValue) { +void spine::Event::setFloatValue(float inValue) { _floatValue = inValue; } -const String &Event::getStringValue() { +const spine::String &spine::Event::getStringValue() { return _stringValue; } -void Event::setStringValue(const String &inValue) { +void spine::Event::setStringValue(const spine::String &inValue) { _stringValue = inValue; } -float Event::getVolume() { +float spine::Event::getVolume() { return _volume; } -void Event::setVolume(float inValue) { +void spine::Event::setVolume(float inValue) { _volume = inValue; } -float Event::getBalance() { +float spine::Event::getBalance() { return _balance; } -void Event::setBalance(float inValue) { +void spine::Event::setBalance(float inValue) { _balance = inValue; } diff --git a/spine-cpp/spine-cpp/src/spine/EventData.cpp b/spine-cpp/spine-cpp/src/spine/EventData.cpp index 467b51bf8..489f185b9 100644 --- a/spine-cpp/spine-cpp/src/spine/EventData.cpp +++ b/spine-cpp/spine-cpp/src/spine/EventData.cpp @@ -28,13 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; - -EventData::EventData(const String &name) : +spine::EventData::EventData(const spine::String &name) : _name(name), _intValue(0), _floatValue(0), @@ -46,55 +48,55 @@ EventData::EventData(const String &name) : } /// The name of the event, which is unique within the skeleton. -const String &EventData::getName() const { +const spine::String &spine::EventData::getName() const { return _name; } -int EventData::getIntValue() { +int spine::EventData::getIntValue() { return _intValue; } -void EventData::setIntValue(int inValue) { +void spine::EventData::setIntValue(int inValue) { _intValue = inValue; } -float EventData::getFloatValue() { +float spine::EventData::getFloatValue() { return _floatValue; } -void EventData::setFloatValue(float inValue) { +void spine::EventData::setFloatValue(float inValue) { _floatValue = inValue; } -const String &EventData::getStringValue() { +const spine::String &spine::EventData::getStringValue() { return _stringValue; } -void EventData::setStringValue(const String &inValue) { - _stringValue = inValue; +void spine::EventData::setStringValue(const spine::String &inValue) { + this->_stringValue = inValue; } -const String &EventData::getAudioPath() { +const spine::String &spine::EventData::getAudioPath() { return _audioPath; } -void EventData::setAudioPath(const String &inValue) { +void spine::EventData::setAudioPath(const spine::String &inValue) { _audioPath = inValue; } -float EventData::getVolume() { +float spine::EventData::getVolume() { return _volume; } -void EventData::setVolume(float inValue) { +void spine::EventData::setVolume(float inValue) { _volume = inValue; } -float EventData::getBalance() { +float spine::EventData::getBalance() { return _balance; } -void EventData::setBalance(float inValue) { +void spine::EventData::setBalance(float inValue) { _balance = inValue; } diff --git a/spine-cpp/spine-cpp/src/spine/EventTimeline.cpp b/spine-cpp/spine-cpp/src/spine/EventTimeline.cpp index 1923e9dd1..d1218380f 100644 --- a/spine-cpp/spine-cpp/src/spine/EventTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/EventTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -40,7 +44,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(EventTimeline, Timeline) diff --git a/spine-cpp/spine-cpp/src/spine/Extension.cpp b/spine-cpp/spine-cpp/src/spine/Extension.cpp index e8131ff89..3766524bb 100644 --- a/spine-cpp/spine-cpp/src/spine/Extension.cpp +++ b/spine-cpp/spine-cpp/src/spine/Extension.cpp @@ -28,15 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include -#include +#include #include -using namespace Spine; +using namespace spine; -DefaultSpineExtension _defaultExtension; -SpineExtension *SpineExtension::_instance = &_defaultExtension; +SpineExtension *SpineExtension::_instance = NULL; void SpineExtension::setInstance(SpineExtension *inValue) { assert(inValue); @@ -45,6 +48,7 @@ void SpineExtension::setInstance(SpineExtension *inValue) { } SpineExtension *SpineExtension::getInstance() { + if (!_instance) _instance = spine::getDefaultExtension(); assert(_instance); return _instance; diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp index b33cb91b7..a32c12953 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -36,7 +40,7 @@ #include -using namespace Spine; +using namespace spine; RTTI_IMPL(IkConstraint, Constraint) @@ -48,7 +52,7 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress x = targetX - p->_worldX, y = targetY - p->_worldY; tx = (x * p->_d - y * p->_b) * id - bone._ax; ty = (y * p->_a - x * p->_c) * id - bone._ay; - rotationIK = MathUtil::atan2(ty, tx) * RAD_DEG - bone._ashearX - bone._arotation; + rotationIK = MathUtil::atan2(ty, tx) * MathUtil::Rad_Deg - bone._ashearX - bone._arotation; if (bone._ascaleX < 0) rotationIK += 180; if (rotationIK > 180) rotationIK -= 360; else if (rotationIK < -180) rotationIK += 360; @@ -159,7 +163,7 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY } } { - float minAngle = PI, minX = l1 - a, minDist = minX * minX, minY = 0; + float minAngle = MathUtil::Pi, minX = l1 - a, minDist = minX * minX, minY = 0; float maxAngle = 0, maxX = l1 + a, maxDist = maxX * maxX, maxY = 0; c0 = -a * l1 / (aa - bb); if (c0 >= -1 && c0 <= 1) { @@ -192,11 +196,11 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY break_outer: { float os = MathUtil::atan2(cy, cx) * s2; - a1 = (a1 - os) * RAD_DEG + o1 - parent._arotation; + a1 = (a1 - os) * MathUtil::Rad_Deg + o1 - parent._arotation; if (a1 > 180) a1 -= 360; else if (a1 < -180) a1 += 360; parent.updateWorldTransform(px, py, parent._rotation + a1 * alpha, sx, parent._ascaleY, 0, 0); - a2 = ((a2 + os) * RAD_DEG - child._ashearX) * s2 + o2 - child._arotation; + a2 = ((a2 + os) * MathUtil::Rad_Deg - child._ashearX) * s2 + o2 - child._arotation; if (a2 > 180) a2 -= 360; else if (a2 < -180) a2 += 360; child.updateWorldTransform(cx, cy, child._arotation + a2 * alpha, child._ascaleX, child._ascaleY, diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp index 3b03b1d98..149ab0e71 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; IkConstraintData::IkConstraintData(const String &name) : _name(name), diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraintTimeline.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraintTimeline.cpp index e3c915bbd..6293964e0 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraintTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraintTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -40,7 +44,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(IkConstraintTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/Json.cpp b/spine-cpp/spine-cpp/src/spine/Json.cpp index 1b8a5bad3..1b71ce8e2 100644 --- a/spine-cpp/spine-cpp/src/spine/Json.cpp +++ b/spine-cpp/spine-cpp/src/spine/Json.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + /* Json */ /* JSON parser in CPP, shamelessly ripped from json.c in the spine-c runtime */ @@ -43,12 +47,12 @@ #include #include -#include +#include #include #include -using namespace Spine; +using namespace spine; const int Json::JSON_FALSE = 0; const int Json::JSON_TRUE = 1; @@ -140,7 +144,7 @@ const char *Json::skip(const char *inValue) { const char *Json::parseValue(Json *item, const char *value) { /* Referenced by constructor, parseArray(), and parseObject(). */ /* Always called with the result of skip(). */ -#if SPINE_JSON_DEBUG /* Checked at entry to graph, constructor, and after every parse call. */ +#ifdef SPINE_JSON_DEBUG /* Checked at entry to graph, constructor, and after every parse call. */ if (!value) { /* Fail on null. */ return NULL; @@ -390,7 +394,7 @@ const char *Json::parseNumber(Json *item, const char *num) { const char *Json::parseArray(Json *item, const char *value) { Json *child; -#if SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ +#ifdef SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ if (*value != '[') { ep = value; return 0; @@ -446,7 +450,7 @@ const char *Json::parseArray(Json *item, const char *value) { const char *Json::parseObject(Json *item, const char *value) { Json *child; -#if SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ +#ifdef SPINE_JSON_DEBUG /* unnecessary, only callsite (parse_value) verifies this */ if (*value != '{') { ep = value; return 0; diff --git a/spine-cpp/spine-cpp/src/spine/LinkedMesh.cpp b/spine-cpp/spine-cpp/src/spine/LinkedMesh.cpp index f4c0f193c..ee07057e5 100644 --- a/spine-cpp/spine-cpp/src/spine/LinkedMesh.cpp +++ b/spine-cpp/spine-cpp/src/spine/LinkedMesh.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; LinkedMesh::LinkedMesh(MeshAttachment *mesh, const String &skin, size_t slotIndex, const String &parent) : _mesh(mesh), diff --git a/spine-cpp/spine-cpp/src/spine/MathUtil.cpp b/spine-cpp/spine-cpp/src/spine/MathUtil.cpp index 9536b8939..4304f9d17 100644 --- a/spine-cpp/spine-cpp/src/spine/MathUtil.cpp +++ b/spine-cpp/spine-cpp/src/spine/MathUtil.cpp @@ -28,10 +28,26 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include +#include +#include -using namespace Spine; +// Required for division by 0 in _isNaN on MSVC +#ifdef _MSC_VER +#pragma warning(disable:4723) +#endif + +using namespace spine; + +const float MathUtil::Pi = 3.1415926535897932385f; +const float MathUtil::Pi_2 = 3.1415926535897932385f * 2; +const float MathUtil::Deg_Rad = (3.1415926535897932385f / 180.0f); +const float MathUtil::Rad_Deg = (180.0f / 3.1415926535897932385f); float MathUtil::abs(float v) { return ((v) < 0 ? -(v) : (v)); @@ -75,12 +91,12 @@ float MathUtil::acos(float v) { /// Returns the sine in radians from a lookup table. float MathUtil::sinDeg(float degrees) { - return (float)::sin(degrees * DEG_RAD); + return (float)::sin(degrees * MathUtil::Deg_Rad); } /// Returns the cosine in radians from a lookup table. float MathUtil::cosDeg(float degrees) { - return (float)::cos(degrees * DEG_RAD); + return (float)::cos(degrees * MathUtil::Deg_Rad); } /* Need to pass 0 as an argument, so VC++ doesn't error with C2124 */ diff --git a/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp b/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp index 30428eaed..74ff78c07 100644 --- a/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/MeshAttachment.cpp @@ -28,13 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif -using namespace Spine; +#include +#include + +using namespace spine; RTTI_IMPL(MeshAttachment, VertexAttachment) -MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), +MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), HasRendererObject(), _regionOffsetX(0), _regionOffsetY(0), _regionWidth(0), @@ -42,7 +47,6 @@ MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), _regionOriginalWidth(0), _regionOriginalHeight(0), _parentMesh(NULL), - _rendererObject(NULL), _path(), _regionU(0), _regionV(0), @@ -56,6 +60,8 @@ MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), _regionRotate(false) { } +MeshAttachment::~MeshAttachment() {} + void MeshAttachment::updateUVs() { float u = _regionU, v = _regionV, width = _regionU2 - _regionU, height = _regionV2 - _regionV; if (_uvs.size() != _regionUVs.size()) { @@ -107,14 +113,6 @@ void MeshAttachment::setPath(const String &inValue) { _path = inValue; } -void *MeshAttachment::getRendererObject() { - return _rendererObject; -} - -void MeshAttachment::setRendererObject(void *inValue) { - _rendererObject = inValue; -} - float MeshAttachment::getRegionU() { return _regionU; } @@ -250,6 +248,6 @@ void MeshAttachment::setHeight(float inValue) { _height = inValue; } -Spine::Color &MeshAttachment::getColor() { +spine::Color &MeshAttachment::getColor() { return _color; } diff --git a/spine-cpp/spine-cpp/src/spine/PathAttachment.cpp b/spine-cpp/spine-cpp/src/spine/PathAttachment.cpp index 7560537c9..bcf54c6e3 100644 --- a/spine-cpp/spine-cpp/src/spine/PathAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathAttachment.cpp @@ -28,9 +28,13 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include -using namespace Spine; +using namespace spine; RTTI_IMPL(PathAttachment, VertexAttachment) diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp index 0726997a1..692bc32ff 100644 --- a/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathConstraint.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -39,7 +43,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(PathConstraint, Constraint) @@ -144,7 +148,7 @@ void PathConstraint::update() { } else { tip = false; Bone &p = _target->getBone(); - offsetRotation *= p.getA() * p.getD() - p.getB() * p.getC() > 0 ? DEG_RAD : -DEG_RAD; + offsetRotation *= p.getA() * p.getD() - p.getB() * p.getC() > 0 ? MathUtil::Deg_Rad : -MathUtil::Deg_Rad; } for (size_t i = 0, p = 3; i < boneCount; i++, p += 3) { @@ -190,10 +194,10 @@ void PathConstraint::update() { r += offsetRotation; } - if (r > PI) { - r -= PI_2; - } else if (r < -PI) { - r += PI_2; + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; } r *= rotateMix; diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp index 810e795b1..381030dc2 100644 --- a/spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathConstraintData.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -35,7 +39,7 @@ #include -using namespace Spine; +using namespace spine; PathConstraintData::PathConstraintData(const String &name) : _name(name), diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraintMixTimeline.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraintMixTimeline.cpp index 244b8110e..a879bdbf8 100644 --- a/spine-cpp/spine-cpp/src/spine/PathConstraintMixTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathConstraintMixTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -40,7 +44,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(PathConstraintMixTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraintPositionTimeline.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraintPositionTimeline.cpp index 316355430..55a8f7600 100644 --- a/spine-cpp/spine-cpp/src/spine/PathConstraintPositionTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathConstraintPositionTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -40,7 +44,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(PathConstraintPositionTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/PathConstraintSpacingTimeline.cpp b/spine-cpp/spine-cpp/src/spine/PathConstraintSpacingTimeline.cpp index 5be88722d..c46c73bbf 100644 --- a/spine-cpp/spine-cpp/src/spine/PathConstraintSpacingTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/PathConstraintSpacingTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -40,7 +44,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(PathConstraintSpacingTimeline, PathConstraintPositionTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/PointAttachment.cpp b/spine-cpp/spine-cpp/src/spine/PointAttachment.cpp index 150b85f1d..39c76236d 100644 --- a/spine-cpp/spine-cpp/src/spine/PointAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/PointAttachment.cpp @@ -28,13 +28,17 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(PointAttachment, Attachment) @@ -51,7 +55,7 @@ float PointAttachment::computeWorldRotation(Bone &bone) { float ix = cos * bone._a + sin * bone._b; float iy = cos * bone._c + sin * bone._d; - return MathUtil::atan2(iy, ix) * RAD_DEG; + return MathUtil::atan2(iy, ix) * MathUtil::Rad_Deg; } float PointAttachment::getX() { diff --git a/spine-cpp/spine-cpp/src/spine/RTTI.cpp b/spine-cpp/spine-cpp/src/spine/RTTI.cpp index 8d1b1e145..e7fec06bb 100644 --- a/spine-cpp/spine-cpp/src/spine/RTTI.cpp +++ b/spine-cpp/spine-cpp/src/spine/RTTI.cpp @@ -28,10 +28,14 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif -using namespace Spine; +#include +#include + +using namespace spine; RTTI::RTTI(const std::string &className) : _className(className), _pBaseRTTI(NULL) { } @@ -44,14 +48,14 @@ const std::string &RTTI::getClassName() const { } bool RTTI::isExactly(const RTTI &rtti) const { - return (this == &rtti); + return (this->_className == rtti._className); } bool RTTI::instanceOf(const RTTI &rtti) const { const RTTI *pCompare = this; while (pCompare) { - if (pCompare == &rtti) { + if (pCompare->_className == rtti._className) { return true; } @@ -59,4 +63,4 @@ bool RTTI::instanceOf(const RTTI &rtti) const { } return false; -} +} \ No newline at end of file diff --git a/spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp b/spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp index f5224410d..cdd05e0cb 100644 --- a/spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/RegionAttachment.cpp @@ -28,13 +28,17 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(RegionAttachment, Attachment) @@ -47,7 +51,7 @@ const int RegionAttachment::URY = 5; const int RegionAttachment::BRX = 6; const int RegionAttachment::BRY = 7; -RegionAttachment::RegionAttachment(const String &name) : Attachment(name), +RegionAttachment::RegionAttachment(const String &name) : Attachment(name), HasRendererObject(), _x(0), _y(0), _rotation(0), @@ -61,7 +65,6 @@ RegionAttachment::RegionAttachment(const String &name) : Attachment(name), _regionHeight(0), _regionOriginalWidth(0), _regionOriginalHeight(0), - _rendererObject(NULL), _path(), _regionU(0), _regionV(0), @@ -124,7 +127,10 @@ void RegionAttachment::setUVs(float u, float v, float u2, float v2, bool rotate) void RegionAttachment::computeWorldVertices(Bone &bone, Vector &worldVertices, size_t offset, size_t stride) { assert(worldVertices.size() >= (offset + 8)); + computeWorldVertices(bone, worldVertices.buffer(), offset, stride); +} +void RegionAttachment::computeWorldVertices(Bone &bone, float* worldVertices, size_t offset, size_t stride) { float x = bone.getWorldX(), y = bone.getWorldY(); float a = bone.getA(), b = bone.getB(), c = bone.getC(), d = bone.getD(); float offsetX, offsetY; @@ -217,14 +223,6 @@ void RegionAttachment::setPath(const String &inValue) { _path = inValue; } -void *RegionAttachment::getRendererObject() { - return _rendererObject; -} - -void RegionAttachment::setRendererObject(void *inValue) { - _rendererObject = inValue; -} - float RegionAttachment::getRegionOffsetX() { return _regionOffsetX; } @@ -281,6 +279,6 @@ Vector &RegionAttachment::getUVs() { return _uvs; } -Spine::Color &RegionAttachment::getColor() { +spine::Color &RegionAttachment::getColor() { return _color; } diff --git a/spine-cpp/spine-cpp/src/spine/RotateTimeline.cpp b/spine-cpp/spine-cpp/src/spine/RotateTimeline.cpp index d333b8706..4f4e1b86a 100644 --- a/spine-cpp/spine-cpp/src/spine/RotateTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/RotateTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(RotateTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/ScaleTimeline.cpp b/spine-cpp/spine-cpp/src/spine/ScaleTimeline.cpp index b3a2c53ff..f2a8d6600 100644 --- a/spine-cpp/spine-cpp/src/spine/ScaleTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/ScaleTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(ScaleTimeline, TranslateTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/ShearTimeline.cpp b/spine-cpp/spine-cpp/src/spine/ShearTimeline.cpp index 27aa07713..cf4f01519 100644 --- a/spine-cpp/spine-cpp/src/spine/ShearTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/ShearTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(ShearTimeline, TranslateTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/Skeleton.cpp b/spine-cpp/spine-cpp/src/spine/Skeleton.cpp index 807919c07..9040e3ce1 100644 --- a/spine-cpp/spine-cpp/src/spine/Skeleton.cpp +++ b/spine-cpp/spine-cpp/src/spine/Skeleton.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -50,7 +54,7 @@ #include -using namespace Spine; +using namespace spine; Skeleton::Skeleton(SkeletonData *skeletonData) : _data(skeletonData), @@ -446,7 +450,7 @@ Bone *Skeleton::getRootBone() { return _bones.size() == 0 ? NULL : _bones[0]; } -const SkeletonData *Skeleton::getData() { +SkeletonData *Skeleton::getData() { return _data; } diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp index b74cb67d9..5ceb029bc 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonBinary.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -71,7 +75,7 @@ #include #include -using namespace Spine; +using namespace spine; const int SkeletonBinary::BONE_ROTATE = 0; const int SkeletonBinary::BONE_TRANSLATE = 1; @@ -297,6 +301,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons } linkedMesh->_mesh->setParentMesh(static_cast(parent)); linkedMesh->_mesh->updateUVs(); + _attachmentLoader->configureAttachment(linkedMesh->_mesh); } ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes); _linkedMeshes.clear(); @@ -476,6 +481,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo region->_height = readFloat(input) * _scale; readColor(input, region->getColor()); region->updateOffset(); + _attachmentLoader->configureAttachment(region); return region; } case AttachmentType_Boundingbox: { @@ -486,6 +492,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo /* Skip color. */ readInt(input); } + _attachmentLoader->configureAttachment(box); return box; } case AttachmentType_Mesh: { @@ -511,6 +518,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo mesh->_width = 0; mesh->_height = 0; } + _attachmentLoader->configureAttachment(mesh); return mesh; } case AttachmentType_Linkedmesh: { @@ -548,6 +556,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo /* Skip color. */ readInt(input); } + _attachmentLoader->configureAttachment(path); return path; } case AttachmentType_Point: { @@ -560,7 +569,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo /* Skip color. */ readInt(input); } - + _attachmentLoader->configureAttachment(point); return point; } case AttachmentType_Clipping: { @@ -573,6 +582,7 @@ Attachment *SkeletonBinary::readAttachment(DataInput *input, Skin *skin, int slo /* Skip color. */ readInt(input); } + _attachmentLoader->configureAttachment(clip); return clip; } } diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp index 7247e8444..5ba3ce130 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonBounds.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -35,7 +39,7 @@ #include -using namespace Spine; +using namespace spine; SkeletonBounds::SkeletonBounds() : _minX(0), _minY(0), _maxX(0), _maxY(0) { } @@ -195,7 +199,7 @@ bool SkeletonBounds::intersectsSegment(Polygon *polygon, float x1, float y1, flo return false; } -Spine::Polygon *SkeletonBounds::getPolygon(BoundingBoxAttachment *attachment) { +spine::Polygon *SkeletonBounds::getPolygon(BoundingBoxAttachment *attachment) { int index = _boundingBoxes.indexOf(attachment); return index == -1 ? NULL : _polygons[index]; diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp index 29586a5bb..67e6f117e 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonClipping.cpp @@ -28,12 +28,16 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include #include -using namespace Spine; +using namespace spine; SkeletonClipping::SkeletonClipping() : _clipAttachment(NULL) { _clipOutput.ensureCapacity(128); @@ -85,10 +89,12 @@ void SkeletonClipping::clipEnd() { _clippingPolygon.clear(); } -void SkeletonClipping::clipTriangles(Vector &vertices, size_t verticesLength, Vector &triangles, - size_t trianglesLength, Vector &uvs) { - SP_UNUSED(verticesLength); +void SkeletonClipping::clipTriangles(Vector &vertices, Vector &triangles, Vector &uvs, size_t stride) { + clipTriangles(vertices.buffer(), triangles.buffer(), triangles.size(), uvs.buffer(), stride); +} +void SkeletonClipping::clipTriangles(float *vertices, unsigned short *triangles, + size_t trianglesLength, float *uvs, size_t stride) { Vector &clipOutput = _clipOutput; Vector &clippedVertices = _clippedVertices; Vector &clippedTriangles = _clippedTriangles; @@ -103,15 +109,15 @@ void SkeletonClipping::clipTriangles(Vector &vertices, size_t verticesLen size_t i = 0; continue_outer: for (; i < trianglesLength; i += 3) { - int vertexOffset = triangles[i] << 1; + int vertexOffset = triangles[i] * stride; float x1 = vertices[vertexOffset], y1 = vertices[vertexOffset + 1]; float u1 = uvs[vertexOffset], v1 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 1] << 1; + vertexOffset = triangles[i + 1] * stride; float x2 = vertices[vertexOffset], y2 = vertices[vertexOffset + 1]; float u2 = uvs[vertexOffset], v2 = uvs[vertexOffset + 1]; - vertexOffset = triangles[i + 2] << 1; + vertexOffset = triangles[i + 2] * stride; float x3 = vertices[vertexOffset], y3 = vertices[vertexOffset + 1]; float u3 = uvs[vertexOffset], v3 = uvs[vertexOffset + 1]; diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonData.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonData.cpp index 19e70caef..3f8624473 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonData.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonData.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -41,7 +45,7 @@ #include -using namespace Spine; +using namespace spine; SkeletonData::SkeletonData() : _name(), @@ -88,7 +92,7 @@ Skin *SkeletonData::findSkin(const String &skinName) { return ContainerUtil::findWithName(_skins, skinName); } -EventData *SkeletonData::findEvent(const String &eventDataName) { +spine::EventData *SkeletonData::findEvent(const String &eventDataName) { return ContainerUtil::findWithName(_events, eventDataName); } @@ -140,7 +144,7 @@ void SkeletonData::setDefaultSkin(Skin *inValue) { _defaultSkin = inValue; } -Vector &SkeletonData::getEvents() { +Vector &SkeletonData::getEvents() { return _events; } diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp index 7049b70f1..9dfd527d3 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -75,7 +79,7 @@ #define strdup _strdup #endif -using namespace Spine; +using namespace spine; SkeletonJson::SkeletonJson(Atlas *atlas) : _attachmentLoader(new(__FILE__, __LINE__) AtlasAttachmentLoader(atlas)), _scale(1), _ownsLoader(true) { @@ -442,7 +446,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { Json *attachmentMap; for (attachmentMap = attachmentsMap->_child; attachmentMap; attachmentMap = attachmentMap->_next) { - Attachment *attachment; + Attachment *attachment = NULL; const char *skinAttachmentName = attachmentMap->_name; const char *attachmentName = Json::getString(attachmentMap, "name", skinAttachmentName); const char *attachmentPath = Json::getString(attachmentMap, "path", attachmentName); @@ -500,13 +504,19 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { } region->updateOffset(); - + _attachmentLoader->configureAttachment(region); break; } case AttachmentType_Mesh: case AttachmentType_Linkedmesh: { attachment = _attachmentLoader->newMeshAttachment(*skin, attachmentName, attachmentPath); + if (!attachment) { + delete skeletonData; + setError(root, "Error reading attachment: ", skinAttachmentName); + return NULL; + } + MeshAttachment *mesh = static_cast(attachment); mesh->_path = attachmentPath; @@ -553,6 +563,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { mesh->_edges[ii] = entry->_valueInt; } } + _attachmentLoader->configureAttachment(mesh); } else { mesh->_inheritDeform = Json::getInt(attachmentMap, "deform", 1) ? true : false; LinkedMesh *linkedMesh = new(__FILE__, __LINE__) LinkedMesh(mesh, @@ -572,6 +583,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { int vertexCount = Json::getInt(attachmentMap, "vertexCount", 0) << 1; readVertices(attachmentMap, box, vertexCount); + _attachmentLoader->configureAttachment(attachment); break; } case AttachmentType_Path: { @@ -592,6 +604,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { for (curves = curves->_child, ii = 0; curves; curves = curves->_next, ++ii) { pathAttatchment->_lengths[ii] = curves->_valueFloat * _scale; } + _attachmentLoader->configureAttachment(attachment); break; } case AttachmentType_Point: { @@ -602,6 +615,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { point->_x = Json::getFloat(attachmentMap, "x", 0) * _scale; point->_y = Json::getFloat(attachmentMap, "y", 0) * _scale; point->_rotation = Json::getFloat(attachmentMap, "rotation", 0); + _attachmentLoader->configureAttachment(attachment); break; } case AttachmentType_Clipping: { @@ -617,6 +631,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { } vertexCount = Json::getInt(attachmentMap, "vertexCount", 0) << 1; readVertices(attachmentMap, clip, vertexCount); + _attachmentLoader->configureAttachment(attachment); break; } } @@ -645,6 +660,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { } linkedMesh->_mesh->setParentMesh(static_cast(parent)); linkedMesh->_mesh->updateUVs(); + _attachmentLoader->configureAttachment(linkedMesh->_mesh); } ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes); _linkedMeshes.clear(); diff --git a/spine-cpp/spine-cpp/src/spine/Skin.cpp b/spine-cpp/spine-cpp/src/spine/Skin.cpp index 4e7524339..a1be7d8b8 100644 --- a/spine-cpp/spine-cpp/src/spine/Skin.cpp +++ b/spine-cpp/spine-cpp/src/spine/Skin.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -37,7 +41,7 @@ #include -using namespace Spine; +using namespace spine; Skin::AttachmentMap::AttachmentMap() { } @@ -134,8 +138,8 @@ void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) { Slot *slot = slots[slotIndex]; if (slot->getAttachment() == entry._attachment) { - Attachment *attachment = NULL; - if ((attachment = getAttachment(slotIndex, entry._name))) { + Attachment *attachment = getAttachment(slotIndex, entry._name); + if (attachment) { slot->setAttachment(attachment); } } diff --git a/spine-cpp/spine-cpp/src/spine/Slot.cpp b/spine-cpp/spine-cpp/src/spine/Slot.cpp index bc80fb06e..35051b59a 100644 --- a/spine-cpp/spine-cpp/src/spine/Slot.cpp +++ b/spine-cpp/spine-cpp/src/spine/Slot.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -35,7 +39,7 @@ #include #include -using namespace Spine; +using namespace spine; Slot::Slot(SlotData &data, Bone &bone) : _data(data), @@ -43,7 +47,7 @@ Slot::Slot(SlotData &data, Bone &bone) : _skeleton(bone.getSkeleton()), _color(1, 1, 1, 1), _darkColor(0, 0, 0, 0), - _hasDarkColor(false), + _hasDarkColor(data.hasDarkColor()), _attachment(NULL), _attachmentTime(0) { setToSetupPose(); @@ -85,10 +89,6 @@ bool Slot::hasDarkColor() { return _hasDarkColor; } -void Slot::setHasDarkColor(bool inValue) { - _hasDarkColor = inValue; -} - Attachment *Slot::getAttachment() { return _attachment; } diff --git a/spine-cpp/spine-cpp/src/spine/SlotData.cpp b/spine-cpp/spine-cpp/src/spine/SlotData.cpp index 6c770e970..f5b7bb51d 100644 --- a/spine-cpp/spine-cpp/src/spine/SlotData.cpp +++ b/spine-cpp/spine-cpp/src/spine/SlotData.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; SlotData::SlotData(int index, const String &name, BoneData &boneData) : _index(index), diff --git a/spine-cpp/spine-cpp/src/spine/SpineObject.cpp b/spine-cpp/spine-cpp/src/spine/SpineObject.cpp index 409ab3e01..55e1616f1 100644 --- a/spine-cpp/spine-cpp/src/spine/SpineObject.cpp +++ b/spine-cpp/spine-cpp/src/spine/SpineObject.cpp @@ -28,10 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; + +void *SpineObject::operator new(size_t sz) { + return SpineExtension::calloc(sz, __FILE__, __LINE__); +} void *SpineObject::operator new(size_t sz, const char *file, int line) { return SpineExtension::calloc(sz, file, line); diff --git a/spine-cpp/spine-cpp/src/spine/TextureLoader.cpp b/spine-cpp/spine-cpp/src/spine/TextureLoader.cpp index 6154c14d7..a00d793b3 100644 --- a/spine-cpp/spine-cpp/src/spine/TextureLoader.cpp +++ b/spine-cpp/spine-cpp/src/spine/TextureLoader.cpp @@ -28,9 +28,13 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include -namespace Spine { +namespace spine { TextureLoader::TextureLoader() { } diff --git a/spine-cpp/spine-cpp/src/spine/Timeline.cpp b/spine-cpp/spine-cpp/src/spine/Timeline.cpp index f8db7a65f..4b48a6a7f 100644 --- a/spine-cpp/spine-cpp/src/spine/Timeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/Timeline.cpp @@ -28,12 +28,16 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include #include -namespace Spine { +namespace spine { RTTI_IMPL_NOPARENT(Timeline) Timeline::Timeline() { diff --git a/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp b/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp index 2d4f52ea6..28bb5fc26 100644 --- a/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/TransformConstraint.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -36,7 +40,7 @@ #include -using namespace Spine; +using namespace spine; RTTI_IMPL(TransformConstraint, Constraint) @@ -136,7 +140,7 @@ void TransformConstraint::applyAbsoluteWorld() { float rotateMix = _rotateMix, translateMix = _translateMix, scaleMix = _scaleMix, shearMix = _shearMix; Bone &target = *_target; float ta = target._a, tb = target._b, tc = target._c, td = target._d; - float degRadReflect = ta * td - tb * tc > 0 ? DEG_RAD : -DEG_RAD; + float degRadReflect = ta * td - tb * tc > 0 ? MathUtil::Deg_Rad : -MathUtil::Deg_Rad; float offsetRotation = _data._offsetRotation * degRadReflect, offsetShearY = _data._offsetShearY * degRadReflect; for (size_t i = 0; i < _bones.size(); ++i) { @@ -148,10 +152,10 @@ void TransformConstraint::applyAbsoluteWorld() { if (rotateMix != 0) { float a = bone._a, b = bone._b, c = bone._c, d = bone._d; float r = MathUtil::atan2(tc, ta) - MathUtil::atan2(c, a) + offsetRotation; - if (r > PI) { - r -= PI_2; - } else if (r < -PI) { - r += PI_2; + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; } r *= rotateMix; @@ -193,10 +197,10 @@ void TransformConstraint::applyAbsoluteWorld() { float b = bone._b, d = bone._d; float by = MathUtil::atan2(d, b); float r = MathUtil::atan2(td, tb) - MathUtil::atan2(tc, ta) - (by - MathUtil::atan2(bone._c, bone._a)); - if (r > PI) { - r -= PI_2; - } else if (r < -PI) { - r += PI_2; + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; } r = by + (r + offsetShearY) * shearMix; @@ -216,7 +220,7 @@ void TransformConstraint::applyRelativeWorld() { float rotateMix = _rotateMix, translateMix = _translateMix, scaleMix = _scaleMix, shearMix = _shearMix; Bone &target = *_target; float ta = target._a, tb = target._b, tc = target._c, td = target._d; - float degRadReflect = ta * td - tb * tc > 0 ? DEG_RAD : -DEG_RAD; + float degRadReflect = ta * td - tb * tc > 0 ? MathUtil::Deg_Rad : -MathUtil::Deg_Rad; float offsetRotation = _data._offsetRotation * degRadReflect, offsetShearY = _data._offsetShearY * degRadReflect; for (size_t i = 0; i < _bones.size(); ++i) { Bone *item = _bones[i]; @@ -227,10 +231,10 @@ void TransformConstraint::applyRelativeWorld() { if (rotateMix != 0) { float a = bone._a, b = bone._b, c = bone._c, d = bone._d; float r = MathUtil::atan2(tc, ta) + offsetRotation; - if (r > PI) { - r -= PI_2; - } else if (r < -PI) { - r += PI_2; + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; } r *= rotateMix; @@ -262,14 +266,14 @@ void TransformConstraint::applyRelativeWorld() { if (shearMix > 0) { float r = MathUtil::atan2(td, tb) - MathUtil::atan2(tc, ta); - if (r > PI) { - r -= PI_2; - } else if (r < -PI) { - r += PI_2; + if (r > MathUtil::Pi) { + r -= MathUtil::Pi_2; + } else if (r < -MathUtil::Pi) { + r += MathUtil::Pi_2; } float b = bone._b, d = bone._d; - r = MathUtil::atan2(d, b) + (r - PI / 2 + offsetShearY) * shearMix; + r = MathUtil::atan2(d, b) + (r - MathUtil::Pi / 2 + offsetShearY) * shearMix; float s = MathUtil::sqrt(b * b + d * d); bone._b = MathUtil::cos(r) * s; bone._d = MathUtil::sin(r) * s; diff --git a/spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp b/spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp index 4c94f2177..ccb3e4211 100644 --- a/spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp +++ b/spine-cpp/spine-cpp/src/spine/TransformConstraintData.cpp @@ -28,13 +28,17 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include #include -using namespace Spine; +using namespace spine; TransformConstraintData::TransformConstraintData(const String &name) : _name(name), _order(0), diff --git a/spine-cpp/spine-cpp/src/spine/TransformConstraintTimeline.cpp b/spine-cpp/spine-cpp/src/spine/TransformConstraintTimeline.cpp index 208596b97..c273b3722 100644 --- a/spine-cpp/spine-cpp/src/spine/TransformConstraintTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/TransformConstraintTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -40,7 +44,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(TransformConstraintTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/TranslateTimeline.cpp b/spine-cpp/spine-cpp/src/spine/TranslateTimeline.cpp index e9f295803..5f1894f69 100644 --- a/spine-cpp/spine-cpp/src/spine/TranslateTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/TranslateTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(TranslateTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/Triangulator.cpp b/spine-cpp/spine-cpp/src/spine/Triangulator.cpp index 3b1db44d7..57daf3ca4 100644 --- a/spine-cpp/spine-cpp/src/spine/Triangulator.cpp +++ b/spine-cpp/spine-cpp/src/spine/Triangulator.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include -using namespace Spine; +using namespace spine; Triangulator::~Triangulator() { ContainerUtil::cleanUpVectorOfPointers(_convexPolygons); diff --git a/spine-cpp/spine-cpp/src/spine/TwoColorTimeline.cpp b/spine-cpp/spine-cpp/src/spine/TwoColorTimeline.cpp index cff5e49ac..3577f7eac 100644 --- a/spine-cpp/spine-cpp/src/spine/TwoColorTimeline.cpp +++ b/spine-cpp/spine-cpp/src/spine/TwoColorTimeline.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -38,7 +42,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(TwoColorTimeline, CurveTimeline) diff --git a/spine-cpp/spine-cpp/src/spine/Updatable.cpp b/spine-cpp/spine-cpp/src/spine/Updatable.cpp index bf172805f..7c52d1749 100644 --- a/spine-cpp/spine-cpp/src/spine/Updatable.cpp +++ b/spine-cpp/spine-cpp/src/spine/Updatable.cpp @@ -28,9 +28,13 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include -using namespace Spine; +using namespace spine; RTTI_IMPL_NOPARENT(Updatable) diff --git a/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp b/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp index 1b31e2eb8..a5d0cea02 100644 --- a/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp +++ b/spine-cpp/spine-cpp/src/spine/VertexAttachment.cpp @@ -28,6 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include @@ -35,7 +39,7 @@ #include #include -using namespace Spine; +using namespace spine; RTTI_IMPL(VertexAttachment, Attachment) @@ -49,7 +53,16 @@ void VertexAttachment::computeWorldVertices(Slot &slot, Vector &worldVert computeWorldVertices(slot, 0, _worldVerticesLength, worldVertices, 0); } +void VertexAttachment::computeWorldVertices(Slot &slot, float *worldVertices) { + computeWorldVertices(slot, 0, _worldVerticesLength, worldVertices, 0); +} + void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t count, Vector &worldVertices, size_t offset, + size_t stride) { + computeWorldVertices(slot, start, count, worldVertices.buffer(), offset, stride); +} + +void VertexAttachment::computeWorldVertices(Slot &slot, size_t start, size_t count, float *worldVertices, size_t offset, size_t stride) { count = offset + (count >> 1) * stride; Skeleton &skeleton = slot._bone._skeleton; diff --git a/spine-cpp/spine-cpp/src/spine/VertexEffect.cpp b/spine-cpp/spine-cpp/src/spine/VertexEffect.cpp index c0c8b693b..18bf150ab 100644 --- a/spine-cpp/spine-cpp/src/spine/VertexEffect.cpp +++ b/spine-cpp/spine-cpp/src/spine/VertexEffect.cpp @@ -28,11 +28,15 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#ifdef SPINE_UE4 +#include "SpinePluginPrivatePCH.h" +#endif + #include #include #include -using namespace Spine; +using namespace spine; JitterVertexEffect::JitterVertexEffect(float jitterX, float jitterY): _jitterX(jitterX), _jitterY(jitterY) { } @@ -132,7 +136,7 @@ float SwirlVertexEffect::getRadius() { } void SwirlVertexEffect::setAngle(float angle) { - _angle = angle * Spine::DEG_RAD; + _angle = angle * MathUtil::Deg_Rad; } float SwirlVertexEffect::getAngle() { diff --git a/spine-sfml/cpp/example/main.cpp b/spine-sfml/cpp/example/main.cpp index e87e5d4d2..f57efc0ab 100644 --- a/spine-sfml/cpp/example/main.cpp +++ b/spine-sfml/cpp/example/main.cpp @@ -34,76 +34,74 @@ #include using namespace std; -using namespace Spine; -#include -#include +using namespace spine; +#include + +template +unique_ptr make_unique(Args&&... args) { + return unique_ptr(new T(forward(args)...)); +} void callback (AnimationState* state, EventType type, TrackEntry* entry, Event* event) { const String& animationName = (entry && entry->getAnimation()) ? entry->getAnimation()->getName() : String(""); switch (type) { - case EventType_Start: - printf("%d start: %s\n", entry->getTrackIndex(), animationName.buffer()); - break; - case EventType_Interrupt: - printf("%d interrupt: %s\n", entry->getTrackIndex(), animationName.buffer()); - break; - case EventType_End: - printf("%d end: %s\n", entry->getTrackIndex(), animationName.buffer()); - break; - case EventType_Complete: - printf("%d complete: %s\n", entry->getTrackIndex(), animationName.buffer()); - break; - case EventType_Dispose: - printf("%d dispose: %s\n", entry->getTrackIndex(), animationName.buffer()); - break; - case EventType_Event: - printf("%d event: %s, %s: %d, %f, %s %f %f\n", entry->getTrackIndex(), animationName.buffer(), event->getData().getName().buffer(), event->getIntValue(), event->getFloatValue(), - event->getStringValue().buffer(), event->getVolume(), event->getBalance()); - break; + case EventType_Start: + printf("%d start: %s\n", entry->getTrackIndex(), animationName.buffer()); + break; + case EventType_Interrupt: + printf("%d interrupt: %s\n", entry->getTrackIndex(), animationName.buffer()); + break; + case EventType_End: + printf("%d end: %s\n", entry->getTrackIndex(), animationName.buffer()); + break; + case EventType_Complete: + printf("%d complete: %s\n", entry->getTrackIndex(), animationName.buffer()); + break; + case EventType_Dispose: + printf("%d dispose: %s\n", entry->getTrackIndex(), animationName.buffer()); + break; + case EventType_Event: + printf("%d event: %s, %s: %d, %f, %s %f %f\n", entry->getTrackIndex(), animationName.buffer(), event->getData().getName().buffer(), event->getIntValue(), event->getFloatValue(), + event->getStringValue().buffer(), event->getVolume(), event->getBalance()); + break; } fflush(stdout); } -SkeletonData* readSkeletonJsonData (const String& filename, Atlas* atlas, float scale) { - SkeletonJson* json = new (__FILE__, __LINE__) SkeletonJson(atlas); - json->setScale(scale); - SkeletonData* skeletonData = json->readSkeletonDataFile(filename); +shared_ptr readSkeletonJsonData (const String& filename, Atlas* atlas, float scale) { + SkeletonJson json(atlas); + json.setScale(scale); + auto skeletonData = json.readSkeletonDataFile(filename); if (!skeletonData) { - printf("%s\n", json->getError().buffer()); + printf("%s\n", json.getError().buffer()); exit(0); } - delete json; - return skeletonData; + return shared_ptr(skeletonData); } -SkeletonData* readSkeletonBinaryData (const char* filename, Atlas* atlas, float scale) { - SkeletonBinary* binary = new (__FILE__, __LINE__) SkeletonBinary(atlas); - binary->setScale(scale); - SkeletonData *skeletonData = binary->readSkeletonDataFile(filename); +shared_ptr readSkeletonBinaryData (const char* filename, Atlas* atlas, float scale) { + SkeletonBinary binary(atlas); + binary.setScale(scale); + auto skeletonData = binary.readSkeletonDataFile(filename); if (!skeletonData) { - printf("%s\n", binary->getError().buffer()); + printf("%s\n", binary.getError().buffer()); exit(0); } - delete binary; - return skeletonData; + return shared_ptr(skeletonData); } void testcase (void func(SkeletonData* skeletonData, Atlas* atlas), - const char* jsonName, const char* binaryName, const char* atlasName, - float scale) { + const char* jsonName, const char* binaryName, const char* atlasName, + float scale) { SFMLTextureLoader textureLoader; - Atlas* atlas = new (__FILE__, __LINE__) Atlas(atlasName, &textureLoader); + auto atlas = make_unique(atlasName, &textureLoader); - SkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas, scale); - func(skeletonData, atlas); - delete skeletonData; + auto skeletonData = readSkeletonJsonData(jsonName, atlas.get(), scale); + func(skeletonData.get(), atlas.get()); - skeletonData = readSkeletonBinaryData(binaryName, atlas, scale); - func(skeletonData, atlas); - delete skeletonData; - - delete atlas; + skeletonData = readSkeletonBinaryData(binaryName, atlas.get(), scale); + func(skeletonData.get(), atlas.get()); } void spineboy (SkeletonData* skeletonData, Atlas* atlas) { @@ -114,10 +112,10 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) { stateData.setMix("walk", "jump", 0.2f); stateData.setMix("jump", "run", 0.2f); - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData, &stateData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData, &stateData); + drawable.timeScale = 1; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setToSetupPose(); skeleton->setPosition(320, 590); @@ -125,10 +123,10 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) { Slot* headSlot = skeleton->findSlot("head"); - drawable->state->setOnAnimationEventFunc(callback); - drawable->state->addAnimation(0, "walk", true, 0); - drawable->state->addAnimation(0, "jump", false, 3); - drawable->state->addAnimation(0, "run", true, 0); + drawable.state->setListener(callback); + drawable.state->addAnimation(0, "walk", true, 0); + drawable.state->addAnimation(0, "jump", false, 3); + drawable.state->addAnimation(0, "run", true, 0); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - spineboy"); window.setFramerateLimit(60); @@ -151,28 +149,26 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) { headSlot->getColor().b = 1; } - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } void goblins (SkeletonData* skeletonData, Atlas* atlas) { - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData); + drawable.timeScale = 1; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setSkin("goblin"); skeleton->setSlotsToSetupPose(); skeleton->setPosition(320, 590); skeleton->updateWorldTransform(); - drawable->state->setAnimation(0, "walk", true); + drawable.state->setAnimation(0, "walk", true); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - goblins"); window.setFramerateLimit(60); @@ -185,32 +181,30 @@ void goblins (SkeletonData* skeletonData, Atlas* atlas) { float delta = deltaClock.getElapsedTime().asSeconds(); deltaClock.restart(); - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } void raptor (SkeletonData* skeletonData, Atlas* atlas) { - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData); + drawable.timeScale = 1; PowInterpolation pow2(2); PowOutInterpolation powOut2(2); SwirlVertexEffect effect(400, powOut2); effect.setCenterY(-200); - drawable->vertexEffect = &effect; + drawable.vertexEffect = &effect; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setPosition(320, 590); skeleton->updateWorldTransform(); - drawable->state->setAnimation(0, "walk", true); - drawable->state->addAnimation(1, "gun-grab", false, 2); + drawable.state->setAnimation(0, "walk", true); + drawable.state->addAnimation(1, "gun-grab", false, 2); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - raptor"); window.setFramerateLimit(60); @@ -229,25 +223,23 @@ void raptor (SkeletonData* skeletonData, Atlas* atlas) { if (percent > 1) percent = 1 - (percent - 1); effect.setAngle(pow2.interpolate(-60.0f, 60.0f, percent)); - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } void tank (SkeletonData* skeletonData, Atlas* atlas) { - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData); + drawable.timeScale = 1; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setPosition(500, 590); skeleton->updateWorldTransform(); - drawable->state->setAnimation(0, "drive", true); + drawable.state->setAnimation(0, "drive", true); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - tank"); window.setFramerateLimit(60); @@ -260,24 +252,22 @@ void tank (SkeletonData* skeletonData, Atlas* atlas) { float delta = deltaClock.getElapsedTime().asSeconds(); deltaClock.restart(); - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } void vine (SkeletonData* skeletonData, Atlas* atlas) { - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData); + drawable.timeScale = 1; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setPosition(320, 590); skeleton->updateWorldTransform(); - drawable->state->setAnimation(0, "grow", true); + drawable.state->setAnimation(0, "grow", true); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - vine"); window.setFramerateLimit(60); @@ -290,26 +280,24 @@ void vine (SkeletonData* skeletonData, Atlas* atlas) { float delta = deltaClock.getElapsedTime().asSeconds(); deltaClock.restart(); - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } void stretchyman (SkeletonData* skeletonData, Atlas* atlas) { - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData); + drawable.timeScale = 1; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setPosition(100, 590); skeleton->updateWorldTransform(); - drawable->state->setAnimation(0, "sneak", true); + drawable.state->setAnimation(0, "sneak", true); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - Streatchyman"); window.setFramerateLimit(60); @@ -322,14 +310,12 @@ void stretchyman (SkeletonData* skeletonData, Atlas* atlas) { float delta = deltaClock.getElapsedTime().asSeconds(); deltaClock.restart(); - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } void stretchymanStrechyIk (SkeletonData* skeletonData, Atlas* atlas) { @@ -365,15 +351,15 @@ void stretchymanStrechyIk (SkeletonData* skeletonData, Atlas* atlas) { } void coin (SkeletonData* skeletonData, Atlas* atlas) { - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData); + drawable.timeScale = 1; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setPosition(320, 590); skeleton->updateWorldTransform(); - drawable->state->setAnimation(0, "rotate", true); - drawable->update(1); + drawable.state->setAnimation(0, "rotate", true); + drawable.update(1); sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - coin"); window.setFramerateLimit(60); @@ -390,30 +376,28 @@ void coin (SkeletonData* skeletonData, Atlas* atlas) { // float delta = deltaClock.getElapsedTime().asSeconds(); // deltaClock.restart(); - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } void owl (SkeletonData* skeletonData, Atlas* atlas) { - SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData); - drawable->timeScale = 1; + SkeletonDrawable drawable(skeletonData); + drawable.timeScale = 1; - Skeleton* skeleton = drawable->skeleton; + Skeleton* skeleton = drawable.skeleton; skeleton->setPosition(320, 400); skeleton->updateWorldTransform(); - drawable->state->setAnimation(0, "idle", true); - drawable->state->setAnimation(1, "blink", true); - TrackEntry* left = drawable->state->setAnimation(2, "left", true); - TrackEntry* right = drawable->state->setAnimation(3, "right", true); - TrackEntry* up = drawable->state->setAnimation(4, "up", true); - TrackEntry* down = drawable->state->setAnimation(5, "down", true); + drawable.state->setAnimation(0, "idle", true); + drawable.state->setAnimation(1, "blink", true); + TrackEntry* left = drawable.state->setAnimation(2, "left", true); + TrackEntry* right = drawable.state->setAnimation(3, "right", true); + TrackEntry* up = drawable.state->setAnimation(4, "up", true); + TrackEntry* down = drawable.state->setAnimation(5, "down", true); left->setAlpha(0); left->setMixBlend(MixBlend_Add); @@ -445,48 +429,43 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) { float delta = deltaClock.getElapsedTime().asSeconds(); deltaClock.restart(); - drawable->update(delta); + drawable.update(delta); window.clear(); - window.draw(*drawable); + window.draw(drawable); window.display(); } - - delete drawable; } /** * Used for debugging purposes during runtime development */ void test (SkeletonData* skeletonData, Atlas* atlas) { - Skeleton* skeleton = new (__FILE__, __LINE__) Skeleton(skeletonData); - AnimationStateData* animData = new (__FILE__, __LINE__) AnimationStateData(skeletonData); - AnimationState* animState = new (__FILE__, __LINE__) AnimationState(animData); - animState->setAnimation(0, "drive", true); + Skeleton skeleton(skeletonData); + AnimationStateData animationStateData(skeletonData); + AnimationState animationState(&animationStateData); + animationState.setAnimation(0, "drive", true); float d = 3; for (int i = 0; i < 1; i++) { - animState->update(d); - animState->apply(*skeleton); - skeleton->updateWorldTransform(); + animationState.update(d); + animationState.apply(skeleton); + skeleton.updateWorldTransform(); d += 0.1f; } - - delete skeleton; - delete animData; - delete animState; } int main () { - DebugExtension dbgExtension; + DebugExtension dbgExtension(SpineExtension::getInstance()); SpineExtension::setInstance(&dbgExtension); testcase(spineboy, "data/spineboy-pro.json", "data/spineboy-pro.skel", "data/spineboy.atlas", 0.6f); testcase(stretchymanStrechyIk, "data/stretchyman-stretchy-ik.json", "data/stretchyman-stretchy-ik.skel", "data/stretchyman.atlas", 0.6f); + testcase(spineboy, "data/spineboy-ess.json", "data/spineboy-ess.skel", "data/spineboy.atlas", 0.6f); testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor.atlas", 0.5f); + testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f); testcase(test, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 1.0f); testcase(owl, "data/owl-pro.json", "data/owl-pro.skel", "data/owl.atlas", 0.5f); - testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f); testcase(vine, "data/vine-pro.json", "data/vine-pro.skel", "data/vine.atlas", 0.5f); testcase(tank, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 0.2f); testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor.atlas", 0.5f); @@ -495,4 +474,4 @@ int main () { dbgExtension.reportLeaks(); return 0; -} +} \ No newline at end of file diff --git a/spine-sfml/cpp/src/spine/spine-sfml.cpp b/spine-sfml/cpp/src/spine/spine-sfml.cpp index 4359c64d7..32ad83b33 100644 --- a/spine-sfml/cpp/src/spine/spine-sfml.cpp +++ b/spine-sfml/cpp/src/spine/spine-sfml.cpp @@ -48,7 +48,7 @@ sf::BlendMode additivePma = sf::BlendMode(sf::BlendMode::One, sf::BlendMode::One sf::BlendMode multiplyPma = sf::BlendMode(sf::BlendMode::DstColor, sf::BlendMode::OneMinusSrcAlpha); sf::BlendMode screenPma = sf::BlendMode(sf::BlendMode::One, sf::BlendMode::OneMinusSrcColor); -namespace Spine { +namespace spine { SkeletonDrawable::SkeletonDrawable(SkeletonData *skeletonData, AnimationStateData *stateData) : timeScale(1), @@ -91,7 +91,7 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const { vertexArray->clear(); states.texture = NULL; - // Early out if the skeleton alpha is 0 + // Early out if skeleton is invisible if (skeleton->getColor().a == 0) return; if (vertexEffect != NULL) vertexEffect->begin(*skeleton); @@ -120,7 +120,7 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const { RegionAttachment *regionAttachment = (RegionAttachment *) attachment; attachmentColor = ®ionAttachment->getColor(); - // Early out if the attachment color is 0 + // Early out if the slot color is 0 if (attachmentColor->a == 0) { clipper.clipEnd(slot); continue; @@ -132,25 +132,26 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const { uvs = ®ionAttachment->getUVs(); indices = &quadIndices; indicesCount = 6; - texture = (Texture *) ((AtlasRegion *) regionAttachment->getRendererObject())->page->rendererObject; + texture = (Texture *) ((AtlasRegion *) regionAttachment->getRendererObject())->page->getRendererObject(); } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { MeshAttachment *mesh = (MeshAttachment *) attachment; attachmentColor = &mesh->getColor(); - // Early out if the attachment color is 0 + // Early out if the slot color is 0 if (attachmentColor->a == 0) { clipper.clipEnd(slot); continue; } worldVertices.setSize(mesh->getWorldVerticesLength(), 0); - texture = (Texture *) ((AtlasRegion *) mesh->getRendererObject())->page->rendererObject; + texture = (Texture *) ((AtlasRegion *) mesh->getRendererObject())->page->getRendererObject(); mesh->computeWorldVertices(slot, 0, mesh->getWorldVerticesLength(), worldVertices, 0, 2); verticesCount = mesh->getWorldVerticesLength() >> 1; uvs = &mesh->getUVs(); indices = &mesh->getTriangles(); indicesCount = mesh->getTriangles().size(); + } else if (attachment->getRTTI().isExactly(ClippingAttachment::rtti)) { ClippingAttachment *clip = (ClippingAttachment *) slot.getAttachment(); clipper.clipStart(slot, clip); @@ -219,7 +220,7 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const { } if (clipper.isClipping()) { - clipper.clipTriangles(worldVertices, verticesCount << 1, *indices, indicesCount, *uvs); + clipper.clipTriangles(worldVertices, *indices, *uvs, 2); vertices = &clipper.getClippedVertices(); verticesCount = clipper.getClippedVertices().size() >> 1; uvs = &clipper.getClippedUVs(); @@ -287,7 +288,7 @@ void SFMLTextureLoader::load(AtlasPage &page, const String &path) { if (page.magFilter == TextureFilter_Linear) texture->setSmooth(true); if (page.uWrap == TextureWrap_Repeat && page.vWrap == TextureWrap_Repeat) texture->setRepeated(true); - page.rendererObject = texture; + page.setRendererObject(texture); Vector2u size = texture->getSize(); page.width = size.x; page.height = size.y; @@ -297,8 +298,7 @@ void SFMLTextureLoader::unload(void *texture) { delete (Texture *) texture; } -String SFMLTextureLoader::toString() const { - return String("SFMLTextureLoader"); -} - +SpineExtension *getDefaultExtension() { + return new DefaultSpineExtension(); } +} \ No newline at end of file diff --git a/spine-sfml/cpp/src/spine/spine-sfml.h b/spine-sfml/cpp/src/spine/spine-sfml.h index de9c8784c..6d057f103 100644 --- a/spine-sfml/cpp/src/spine/spine-sfml.h +++ b/spine-sfml/cpp/src/spine/spine-sfml.h @@ -39,7 +39,7 @@ #include -namespace Spine { +namespace spine { class SkeletonDrawable : public sf::Drawable { public: @@ -80,4 +80,4 @@ public: }; } /* namespace spine */ -#endif /* SPINE_SFML_H_ */ +#endif /* SPINE_SFML_H_ */ \ No newline at end of file