mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-11 09:38:44 +08:00
wip
This commit is contained in:
parent
a48f650f03
commit
d80a00ead6
@ -46,6 +46,8 @@ namespace Spine
|
||||
class Animation
|
||||
{
|
||||
friend class RotateTimeline;
|
||||
friend class TranslateTimeline;
|
||||
friend class AnimationStateData;
|
||||
|
||||
public:
|
||||
Animation(std::string name, Vector<Timeline*>& timelines, float duration);
|
||||
|
||||
93
spine-cpp/spine-cpp/include/spine/AnimationStateData.h
Normal file
93
spine-cpp/spine-cpp/include/spine/AnimationStateData.h
Normal file
@ -0,0 +1,93 @@
|
||||
/******************************************************************************
|
||||
* 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_AnimationStateData_h
|
||||
#define Spine_AnimationStateData_h
|
||||
|
||||
#include <spine/HashMap.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class SkeletonData;
|
||||
class Animation;
|
||||
|
||||
/// Stores mix (crossfade) durations to be applied when AnimationState animations are changed.
|
||||
class AnimationStateData
|
||||
{
|
||||
public:
|
||||
/// 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);
|
||||
|
||||
AnimationStateData(SkeletonData& skeletonData);
|
||||
|
||||
/// Sets a mix duration by animation names.
|
||||
void setMix(std::string fromName, std::string toName, float duration);
|
||||
|
||||
/// Sets a mix duration when changing from the specified animation to the other.
|
||||
/// See TrackEntry.MixDuration.
|
||||
void setMix(Animation& from, Animation& to, float duration);
|
||||
|
||||
///
|
||||
/// The mix duration to use when changing from the specified animation to the other,
|
||||
/// or the DefaultMix if no mix duration has been set.
|
||||
///
|
||||
float getMix(Animation& from, Animation& to);
|
||||
|
||||
private:
|
||||
class AnimationPair
|
||||
{
|
||||
public:
|
||||
Animation& _a1;
|
||||
Animation& _a2;
|
||||
|
||||
AnimationPair(Animation& a1, Animation& a2);
|
||||
|
||||
bool operator==(const AnimationPair &other) const;
|
||||
};
|
||||
|
||||
struct HashAnimationPair
|
||||
{
|
||||
std::size_t operator()(const Spine::AnimationStateData::AnimationPair& val) const;
|
||||
};
|
||||
|
||||
SkeletonData& _skeletonData;
|
||||
float _defaultMix;
|
||||
HashMap<AnimationPair, float, HashAnimationPair> _animationToMixTime;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_AnimationStateData_h */
|
||||
132
spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h
Normal file
132
spine-cpp/spine-cpp/include/spine/AtlasAttachmentLoader.h
Normal file
@ -0,0 +1,132 @@
|
||||
/******************************************************************************
|
||||
* 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_AtlasAttachmentLoader_h
|
||||
#define Spine_AtlasAttachmentLoader_h
|
||||
|
||||
#include <spine/AttachmentLoader.h>
|
||||
|
||||
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;
|
||||
|
||||
public:
|
||||
private:
|
||||
Vector<Atlas> atlasArray;
|
||||
|
||||
public AtlasAttachmentLoader (params Atlas[] atlasArray)
|
||||
{
|
||||
if (atlasArray == NULL) throw new ArgumentNullException("atlas array cannot be NULL.");
|
||||
_atlasArray = atlasArray;
|
||||
}
|
||||
|
||||
public RegionAttachment newRegionAttachment(Skin skin, std::string name, std::string path)
|
||||
{
|
||||
AtlasRegion* region = findRegion(path);
|
||||
if (region == NULL) throw new ArgumentException(std::string.Format("Region not found in atlas: {0} (region attachment: {1})", path, name));
|
||||
RegionAttachment attachment = new RegionAttachment(name);
|
||||
attachment.RendererObject = region;
|
||||
attachment.SetUVs(region.u, region.v, region.u2, region.v2, region.rotate);
|
||||
attachment.regionOffsetX = region.offsetX;
|
||||
attachment.regionOffsetY = region.offsetY;
|
||||
attachment.regionWidth = region.width;
|
||||
attachment.regionHeight = region.height;
|
||||
attachment.regionOriginalWidth = region.originalWidth;
|
||||
attachment.regionOriginalHeight = region.originalHeight;
|
||||
return attachment;
|
||||
}
|
||||
|
||||
public MeshAttachment newMeshAttachment(Skin skin, std::string name, std::string path)
|
||||
{
|
||||
AtlasRegion region = findRegion(path);
|
||||
if (region == NULL) throw new ArgumentException(std::string.Format("Region not found in atlas: {0} (region attachment: {1})", path, name));
|
||||
|
||||
MeshAttachment attachment = new MeshAttachment(name);
|
||||
attachment.RendererObject = region;
|
||||
attachment.RegionU = region.u;
|
||||
attachment.RegionV = region.v;
|
||||
attachment.RegionU2 = region.u2;
|
||||
attachment.RegionV2 = region.v2;
|
||||
attachment.RegionRotate = region.rotate;
|
||||
attachment.regionOffsetX = region.offsetX;
|
||||
attachment.regionOffsetY = region.offsetY;
|
||||
attachment.regionWidth = region.width;
|
||||
attachment.regionHeight = region.height;
|
||||
attachment.regionOriginalWidth = region.originalWidth;
|
||||
attachment.regionOriginalHeight = region.originalHeight;
|
||||
|
||||
return attachment;
|
||||
}
|
||||
|
||||
public BoundingBoxAttachment NewBoundingBoxAttachment (Skin skin, std::string name)
|
||||
{
|
||||
return new BoundingBoxAttachment(name);
|
||||
}
|
||||
|
||||
public PathAttachment newPathAttachment(Skin skin, std::string name)
|
||||
{
|
||||
return new PathAttachment(name);
|
||||
}
|
||||
|
||||
public PointAttachment newPointAttachment(Skin skin, std::string name)
|
||||
{
|
||||
return new PointAttachment(name);
|
||||
}
|
||||
|
||||
public ClippingAttachment newClippingAttachment(Skin skin, std::string name)
|
||||
{
|
||||
return new ClippingAttachment(name);
|
||||
}
|
||||
|
||||
public AtlasRegion findRegion (std::string name)
|
||||
{
|
||||
AtlasRegion region;
|
||||
|
||||
for (int i = 0; i < atlasArray.Length; i++)
|
||||
{
|
||||
region = atlasArray[i].findRegion(name);
|
||||
if (region != NULL)
|
||||
{
|
||||
return region;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_AtlasAttachmentLoader_h */
|
||||
70
spine-cpp/spine-cpp/include/spine/AttachmentLoader.h
Normal file
70
spine-cpp/spine-cpp/include/spine/AttachmentLoader.h
Normal file
@ -0,0 +1,70 @@
|
||||
/******************************************************************************
|
||||
* 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_AttachmentLoader_h
|
||||
#define Spine_AttachmentLoader_h
|
||||
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class RegionAttachment;
|
||||
class MeshAttachment;
|
||||
class BoundingBoxAttachment;
|
||||
class PathAttachment;
|
||||
class PointAttachment;
|
||||
class ClippingAttachment;
|
||||
class Skin;
|
||||
|
||||
class AttachmentLoader
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual RegionAttachment* newRegionAttachment(Skin& skin, std::string name, std::string path) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual MeshAttachment* newMeshAttachment(Skin& skin, std::string name, std::string path) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment.
|
||||
virtual BoundingBoxAttachment* NewBoundingBoxAttachment(Skin& skin, std::string name) = 0;
|
||||
|
||||
/// @return May be NULL to not load any attachment
|
||||
virtual PathAttachment* newPathAttachment(Skin& skin, std::string name) = 0;
|
||||
|
||||
virtual PointAttachment* newPointAttachment(Skin& skin, std::string name) = 0;
|
||||
|
||||
virtual ClippingAttachment* newClippingAttachment(Skin& skin, std::string name) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_AttachmentLoader_h */
|
||||
122
spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h
Normal file
122
spine-cpp/spine-cpp/include/spine/AttachmentTimeline.h
Normal file
@ -0,0 +1,122 @@
|
||||
/******************************************************************************
|
||||
* 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_AttachmentTimeline_h
|
||||
#define Spine_AttachmentTimeline_h
|
||||
|
||||
#include <spine/Timeline.h>
|
||||
|
||||
#include <spine/Vector.h>
|
||||
#include <spine/MixPose.h>
|
||||
#include <spine/MixDirection.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class Skeleton;
|
||||
class Event;
|
||||
|
||||
class AttachmentTimeline : public Timeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public:
|
||||
AttachmentTimeline(int frameCount)
|
||||
{
|
||||
_frames.reserve(frameCount);
|
||||
_attachmentNames.reserve(frameCount);
|
||||
}
|
||||
|
||||
virtual int getPropertyId()
|
||||
{
|
||||
return ((int)TimelineType_Attachment << 24) + slotIndex;
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
void setFrame(int frameIndex, float time, std::string attachmentName)
|
||||
{
|
||||
frames[frameIndex] = time;
|
||||
attachmentNames[frameIndex] = attachmentName;
|
||||
}
|
||||
|
||||
void apply(Skeleton& skeleton, float lastTime, float time, Vector<Event*> firedEvents, float alpha, MixPose pose, MixDirection direction)
|
||||
{
|
||||
std::string attachmentName;
|
||||
Slot slot = skeleton.slots.Items[slotIndex];
|
||||
if (direction == MixDirection_Out && pose == MixPose_Setup)
|
||||
{
|
||||
attachmentName = slot.data.attachmentName;
|
||||
slot.Attachment = attachmentName == NULL ? NULL : skeleton.getAttachment(slotIndex, attachmentName);
|
||||
return;
|
||||
}
|
||||
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0])
|
||||
{
|
||||
// Time is before first frame.
|
||||
if (pose == MixPose_Setup)
|
||||
{
|
||||
attachmentName = slot.data.attachmentName;
|
||||
slot.Attachment = attachmentName == NULL ? NULL : skeleton.getAttachment(slotIndex, attachmentName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int frameIndex;
|
||||
if (time >= frames[frames.Length - 1]) // Time is after last frame.
|
||||
{
|
||||
frameIndex = frames.Length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
frameIndex = Animation::binarySearch(frames, time, 1) - 1;
|
||||
}
|
||||
|
||||
attachmentName = attachmentNames[frameIndex];
|
||||
slot.Attachment = attachmentName == NULL ? NULL : skeleton.getAttachment(slotIndex, attachmentName);
|
||||
}
|
||||
|
||||
int getSlotIndex() { return _slotIndex; }
|
||||
void setSlotIndex(int inValue) { _slotIndex = inValue; }
|
||||
Vector<float>& getFrames() { return _frames; }
|
||||
void setFrames(Vector<float>& inValue) { _frames = inValue; } // time, ...
|
||||
Vector<std::string> getAttachmentNames() { return _attachmentNames; }
|
||||
set { attachmentNames = inValue; }
|
||||
int getFrameCount() { return frames.Length; }
|
||||
|
||||
private:
|
||||
int _slotIndex;
|
||||
Vector<float> _frames;
|
||||
Vector<std::string> _attachmentNames;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_AttachmentTimeline_h */
|
||||
48
spine-cpp/spine-cpp/include/spine/AttachmentType.h
Normal file
48
spine-cpp/spine-cpp/include/spine/AttachmentType.h
Normal file
@ -0,0 +1,48 @@
|
||||
/******************************************************************************
|
||||
* 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_AttachmentType_h
|
||||
#define Spine_AttachmentType_h
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
enum AttachmentType
|
||||
{
|
||||
AttachmentType_Region,
|
||||
AttachmentType_Boundingbox,
|
||||
AttachmentType_Mesh,
|
||||
AttachmentType_Linkedmesh,
|
||||
AttachmentType_Path,
|
||||
AttachmentType_Point,
|
||||
AttachmentType_Clipping
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_AttachmentType_h */
|
||||
@ -56,6 +56,7 @@ namespace Spine
|
||||
friend class PathConstraint;
|
||||
friend class Skeleton;
|
||||
friend class RegionAttachment;
|
||||
friend class PointAttachment;
|
||||
|
||||
public:
|
||||
static void setYDown(bool inValue);
|
||||
|
||||
47
spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h
Normal file
47
spine-cpp/spine-cpp/include/spine/BoundingBoxAttachment.h
Normal file
@ -0,0 +1,47 @@
|
||||
/******************************************************************************
|
||||
* 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_BoundingBoxAttachment_h
|
||||
#define Spine_BoundingBoxAttachment_h
|
||||
|
||||
#include <spine/VertexAttachment.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
/// Attachment that has a polygon for bounds checking.
|
||||
class BoundingBoxAttachment : public VertexAttachment
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
BoundingBoxAttachment(std::string name);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_BoundingBoxAttachment_h */
|
||||
55
spine-cpp/spine-cpp/include/spine/ClippingAttachment.h
Normal file
55
spine-cpp/spine-cpp/include/spine/ClippingAttachment.h
Normal file
@ -0,0 +1,55 @@
|
||||
/******************************************************************************
|
||||
* 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_ClippingAttachment_h
|
||||
#define Spine_ClippingAttachment_h
|
||||
|
||||
#include <spine/VertexAttachment.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class SlotData;
|
||||
|
||||
class ClippingAttachment : public VertexAttachment
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public:
|
||||
ClippingAttachment(std::string name);
|
||||
|
||||
SlotData* getEndSlot();
|
||||
void setEndSlot(SlotData* inValue);
|
||||
|
||||
private:
|
||||
SlotData* _endSlot;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_ClippingAttachment_h */
|
||||
143
spine-cpp/spine-cpp/include/spine/ColorTimeline.h
Normal file
143
spine-cpp/spine-cpp/include/spine/ColorTimeline.h
Normal file
@ -0,0 +1,143 @@
|
||||
/******************************************************************************
|
||||
* 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_ColorTimeline_h
|
||||
#define Spine_ColorTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class ColorTimeline : public CurveTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public const int ENTRIES = 5;
|
||||
protected const int PREV_TIME = -5, PREV_R = -4, PREV_G = -3, PREV_B = -2, PREV_A = -1;
|
||||
protected const int R = 1, G = 2, B = 3, A = 4;
|
||||
|
||||
internal int slotIndex;
|
||||
internal float[] frames;
|
||||
|
||||
public int SlotIndex { return slotIndex; } set { slotIndex = inValue; }
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, r, g, b, a, ...
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.Color << 24) + slotIndex; }
|
||||
}
|
||||
|
||||
public ColorTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
frames = new float[frameCount * ENTRIES];
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
public void SetFrame (int frameIndex, float time, float r, float g, float b, float a) {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + R] = r;
|
||||
frames[frameIndex + G] = g;
|
||||
frames[frameIndex + B] = b;
|
||||
frames[frameIndex + A] = a;
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
Slot slot = skeleton.slots.Items[slotIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
var slotData = slot.data;
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
slot.r = slotData.r;
|
||||
slot.g = slotData.g;
|
||||
slot.b = slotData.b;
|
||||
slot.a = slotData.a;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
slot.r += (slot.r - slotData.r) * alpha;
|
||||
slot.g += (slot.g - slotData.g) * alpha;
|
||||
slot.b += (slot.b - slotData.b) * alpha;
|
||||
slot.a += (slot.a - slotData.a) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float r, g, b, a;
|
||||
if (time >= frames[frames.Length - ENTRIES]) { // Time is after last frame.
|
||||
int i = frames.Length;
|
||||
r = frames[i + PREV_R];
|
||||
g = frames[i + PREV_G];
|
||||
b = frames[i + PREV_B];
|
||||
a = frames[i + PREV_A];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
r = frames[frame + PREV_R];
|
||||
g = frames[frame + PREV_G];
|
||||
b = frames[frame + PREV_B];
|
||||
a = frames[frame + PREV_A];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
r += (frames[frame + R] - r) * percent;
|
||||
g += (frames[frame + G] - g) * percent;
|
||||
b += (frames[frame + B] - b) * percent;
|
||||
a += (frames[frame + A] - a) * percent;
|
||||
}
|
||||
if (alpha == 1) {
|
||||
slot.r = r;
|
||||
slot.g = g;
|
||||
slot.b = b;
|
||||
slot.a = a;
|
||||
} else {
|
||||
float br, bg, bb, ba;
|
||||
if (pose == MixPose_Setup) {
|
||||
br = slot.data.r;
|
||||
bg = slot.data.g;
|
||||
bb = slot.data.b;
|
||||
ba = slot.data.a;
|
||||
} else {
|
||||
br = slot.r;
|
||||
bg = slot.g;
|
||||
bb = slot.b;
|
||||
ba = slot.a;
|
||||
}
|
||||
slot.r = br + ((r - br) * alpha);
|
||||
slot.g = bg + ((g - bg) * alpha);
|
||||
slot.b = bb + ((b - bb) * alpha);
|
||||
slot.a = ba + ((a - ba) * alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_ColorTimeline_h */
|
||||
186
spine-cpp/spine-cpp/include/spine/DeformTimeline.h
Normal file
186
spine-cpp/spine-cpp/include/spine/DeformTimeline.h
Normal file
@ -0,0 +1,186 @@
|
||||
/******************************************************************************
|
||||
* 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_DeformTimeline_h
|
||||
#define Spine_DeformTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class DeformTimeline : CurveTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
internal int slotIndex;
|
||||
internal float[] frames;
|
||||
internal float[][] frameVertices;
|
||||
internal VertexAttachment attachment;
|
||||
|
||||
public int SlotIndex { return slotIndex; } set { slotIndex = inValue; }
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, ...
|
||||
public float[][] Vertices { return frameVertices; } set { frameVertices = inValue; }
|
||||
public VertexAttachment Attachment { return attachment; } set { attachment = inValue; }
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.Deform << 24) + attachment.id + slotIndex; }
|
||||
}
|
||||
|
||||
public DeformTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
frames = new float[frameCount];
|
||||
frameVertices = new float[frameCount][];
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
public void SetFrame (int frameIndex, float time, float[] vertices) {
|
||||
frames[frameIndex] = time;
|
||||
frameVertices[frameIndex] = vertices;
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
Slot slot = skeleton.slots.Items[slotIndex];
|
||||
VertexAttachment vertexAttachment = slot.attachment as VertexAttachment;
|
||||
if (vertexAttachment == NULL || !vertexAttachment.ApplyDeform(attachment)) return;
|
||||
|
||||
var verticesArray = slot.attachmentVertices;
|
||||
if (verticesArray.Count == 0) alpha = 1;
|
||||
|
||||
float[][] frameVertices = _frameVertices;
|
||||
int vertexCount = frameVertices[0].Length;
|
||||
float[] frames = _frames;
|
||||
float[] vertices;
|
||||
|
||||
if (time < frames[0]) {
|
||||
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
verticesArray.Clear();
|
||||
return;
|
||||
case MixPose_Current:
|
||||
if (alpha == 1) {
|
||||
verticesArray.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
// verticesArray.SetSize(vertexCount) // Ensure size and preemptively set count.
|
||||
if (verticesArray.Capacity < vertexCount) verticesArray.Capacity = vertexCount;
|
||||
verticesArray.Count = vertexCount;
|
||||
vertices = verticesArray.Items;
|
||||
|
||||
if (vertexAttachment.bones == NULL) {
|
||||
// Unweighted vertex positions.
|
||||
float[] setupVertices = vertexAttachment.vertices;
|
||||
for (int i = 0; i < vertexCount; i++)
|
||||
vertices[i] += (setupVertices[i] - vertices[i]) * alpha;
|
||||
} else {
|
||||
// Weighted deform offsets.
|
||||
alpha = 1 - alpha;
|
||||
for (int i = 0; i < vertexCount; i++)
|
||||
vertices[i] *= alpha;
|
||||
}
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// verticesArray.SetSize(vertexCount) // Ensure size and preemptively set count.
|
||||
if (verticesArray.Capacity < vertexCount) verticesArray.Capacity = vertexCount;
|
||||
verticesArray.Count = vertexCount;
|
||||
vertices = verticesArray.Items;
|
||||
|
||||
if (time >= frames[frames.Length - 1]) { // Time is after last frame.
|
||||
float[] lastVertices = frameVertices[frames.Length - 1];
|
||||
if (alpha == 1) {
|
||||
// Vertex positions or deform offsets, no alpha.
|
||||
Array.Copy(lastVertices, 0, vertices, 0, vertexCount);
|
||||
} else if (pose == MixPose_Setup) {
|
||||
if (vertexAttachment.bones == NULL) {
|
||||
// Unweighted vertex positions, with alpha.
|
||||
float[] setupVertices = vertexAttachment.vertices;
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float setup = setupVertices[i];
|
||||
vertices[i] = setup + (lastVertices[i] - setup) * alpha;
|
||||
}
|
||||
} else {
|
||||
// Weighted deform offsets, with alpha.
|
||||
for (int i = 0; i < vertexCount; i++)
|
||||
vertices[i] = lastVertices[i] * alpha;
|
||||
}
|
||||
} else {
|
||||
// Vertex positions or deform offsets, with alpha.
|
||||
for (int i = 0; i < vertexCount; i++)
|
||||
vertices[i] += (lastVertices[i] - vertices[i]) * alpha;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time);
|
||||
float[] prevVertices = frameVertices[frame - 1];
|
||||
float[] nextVertices = frameVertices[frame];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame - 1, 1 - (time - frameTime) / (frames[frame - 1] - frameTime));
|
||||
|
||||
if (alpha == 1) {
|
||||
// Vertex positions or deform offsets, no alpha.
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float prev = prevVertices[i];
|
||||
vertices[i] = prev + (nextVertices[i] - prev) * percent;
|
||||
}
|
||||
} else if (pose == MixPose_Setup) {
|
||||
if (vertexAttachment.bones == NULL) {
|
||||
// Unweighted vertex positions, with alpha.
|
||||
var setupVertices = vertexAttachment.vertices;
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float prev = prevVertices[i], setup = setupVertices[i];
|
||||
vertices[i] = setup + (prev + (nextVertices[i] - prev) * percent - setup) * alpha;
|
||||
}
|
||||
} else {
|
||||
// Weighted deform offsets, with alpha.
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float prev = prevVertices[i];
|
||||
vertices[i] = (prev + (nextVertices[i] - prev) * percent) * alpha;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Vertex positions or deform offsets, with alpha.
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
float prev = prevVertices[i];
|
||||
vertices[i] += (prev + (nextVertices[i] - prev) * percent - vertices[i]) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_DeformTimeline_h */
|
||||
100
spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h
Normal file
100
spine-cpp/spine-cpp/include/spine/DrawOrderTimeline.h
Normal file
@ -0,0 +1,100 @@
|
||||
/******************************************************************************
|
||||
* 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_DrawOrderTimeline_h
|
||||
#define Spine_DrawOrderTimeline_h
|
||||
|
||||
#include <spine/Timeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class DrawOrderTimeline : public Timeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
internal float[] frames;
|
||||
private int[][] drawOrders;
|
||||
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, ...
|
||||
public int[][] DrawOrders { return drawOrders; } set { drawOrders = inValue; }
|
||||
public int FrameCount { return frames.Length; }
|
||||
|
||||
public int PropertyId {
|
||||
get { return ((int)TimelineType.DrawOrder << 24); }
|
||||
}
|
||||
|
||||
public DrawOrderTimeline (int frameCount) {
|
||||
frames = new float[frameCount];
|
||||
drawOrders = new int[frameCount][];
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
/// <param name="drawOrder">May be NULL to use bind pose draw order.</param>
|
||||
public void SetFrame (int frameIndex, float time, int[] drawOrder) {
|
||||
frames[frameIndex] = time;
|
||||
drawOrders[frameIndex] = drawOrder;
|
||||
}
|
||||
|
||||
public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
Vector<Slot> drawOrder = skeleton.drawOrder;
|
||||
Vector<Slot> slots = skeleton.slots;
|
||||
if (direction == MixDirection_Out && pose == MixPose_Setup) {
|
||||
Array.Copy(slots.Items, 0, drawOrder.Items, 0, slots.Count);
|
||||
return;
|
||||
}
|
||||
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
if (pose == MixPose_Setup) Array.Copy(slots.Items, 0, drawOrder.Items, 0, slots.Count);
|
||||
return;
|
||||
}
|
||||
|
||||
int frame;
|
||||
if (time >= frames[frames.Length - 1]) // Time is after last frame.
|
||||
frame = frames.Length - 1;
|
||||
else
|
||||
frame = Animation.BinarySearch(frames, time) - 1;
|
||||
|
||||
int[] drawOrderToSetupIndex = drawOrders[frame];
|
||||
if (drawOrderToSetupIndex == NULL) {
|
||||
drawOrder.Clear();
|
||||
for (int i = 0, n = slots.Count; i < n; i++)
|
||||
drawOrder.Add(slots.Items[i]);
|
||||
} else {
|
||||
var drawOrderItems = drawOrder.Items;
|
||||
var slotsItems = slots.Items;
|
||||
for (int i = 0, n = drawOrderToSetupIndex.Length; i < n; i++)
|
||||
drawOrderItems[i] = slotsItems[drawOrderToSetupIndex[i]];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_DrawOrderTimeline_h */
|
||||
94
spine-cpp/spine-cpp/include/spine/EventTimeline.h
Normal file
94
spine-cpp/spine-cpp/include/spine/EventTimeline.h
Normal file
@ -0,0 +1,94 @@
|
||||
/******************************************************************************
|
||||
* 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_EventTimeline_h
|
||||
#define Spine_EventTimeline_h
|
||||
|
||||
#include <spine/Timeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class EventTimeline : public Timeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
internal float[] frames;
|
||||
private Event[] events;
|
||||
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, ...
|
||||
public Event[] Events { return events; } set { events = inValue; }
|
||||
public int FrameCount { return frames.Length; }
|
||||
|
||||
public int PropertyId {
|
||||
get { return ((int)TimelineType.Event << 24); }
|
||||
}
|
||||
|
||||
public EventTimeline (int frameCount) {
|
||||
frames = new float[frameCount];
|
||||
events = new Event[frameCount];
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
public void SetFrame (int frameIndex, Event e) {
|
||||
frames[frameIndex] = e.Time;
|
||||
events[frameIndex] = e;
|
||||
}
|
||||
|
||||
/// Fires events for frames > lastTime and <= time.
|
||||
public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
if (firedEvents == NULL) return;
|
||||
float[] frames = _frames;
|
||||
int frameCount = frames.Length;
|
||||
|
||||
if (lastTime > time) { // Fire events after last time for looped animations.
|
||||
Apply(skeleton, lastTime, int.MaxValue, firedEvents, alpha, pose, direction);
|
||||
lastTime = -1f;
|
||||
} else if (lastTime >= frames[frameCount - 1]) // Last time is after last frame.
|
||||
return;
|
||||
if (time < frames[0]) return; // Time is before first frame.
|
||||
|
||||
int frame;
|
||||
if (lastTime < frames[0])
|
||||
frame = 0;
|
||||
else {
|
||||
frame = Animation.BinarySearch(frames, lastTime);
|
||||
float frameTime = frames[frame];
|
||||
while (frame > 0) { // Fire multiple events with the same frame.
|
||||
if (frames[frame - 1] != frameTime) break;
|
||||
frame--;
|
||||
}
|
||||
}
|
||||
for (; frame < frameCount && time >= frames[frame]; frame++)
|
||||
firedEvents.Add(events[frame]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_EventTimeline_h */
|
||||
@ -153,7 +153,7 @@ namespace Spine
|
||||
|
||||
Entry* entry = new Entry();
|
||||
entry->_key = key;
|
||||
entry->_value = value;
|
||||
entry->_value = inValue;
|
||||
|
||||
_hashSize++;
|
||||
|
||||
|
||||
115
spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h
Normal file
115
spine-cpp/spine-cpp/include/spine/IkConstraintTimeline.h
Normal file
@ -0,0 +1,115 @@
|
||||
/******************************************************************************
|
||||
* 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_IkConstraintTimeline_h
|
||||
#define Spine_IkConstraintTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class IkConstraintTimeline : public CurveTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public const int ENTRIES = 3;
|
||||
private const int PREV_TIME = -3, PREV_MIX = -2, PREV_BEND_DIRECTION = -1;
|
||||
private const int MIX = 1, BEND_DIRECTION = 2;
|
||||
|
||||
internal int ikConstraintIndex;
|
||||
internal float[] frames;
|
||||
|
||||
public int IkConstraintIndex { return ikConstraintIndex; } set { ikConstraintIndex = inValue; }
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, mix, bendDirection, ...
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.IkConstraint << 24) + ikConstraintIndex; }
|
||||
}
|
||||
|
||||
public IkConstraintTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
frames = new float[frameCount * ENTRIES];
|
||||
}
|
||||
|
||||
/// Sets the time, mix and bend direction of the specified keyframe.
|
||||
public void SetFrame (int frameIndex, float time, float mix, int bendDirection) {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + MIX] = mix;
|
||||
frames[frameIndex + BEND_DIRECTION] = bendDirection;
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
IkConstraint constraint = skeleton.ikConstraints.Items[ikConstraintIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
constraint.mix = constraint.data.mix;
|
||||
constraint.bendDirection = constraint.data.bendDirection;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
constraint.mix += (constraint.data.mix - constraint.mix) * alpha;
|
||||
constraint.bendDirection = constraint.data.bendDirection;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (time >= frames[frames.Length - ENTRIES]) { // Time is after last frame.
|
||||
if (pose == MixPose_Setup) {
|
||||
constraint.mix = constraint.data.mix + (frames[frames.Length + PREV_MIX] - constraint.data.mix) * alpha;
|
||||
constraint.bendDirection = direction == MixDirection_Out ? constraint.data.bendDirection
|
||||
: (int)frames[frames.Length + PREV_BEND_DIRECTION];
|
||||
} else {
|
||||
constraint.mix += (frames[frames.Length + PREV_MIX] - constraint.mix) * alpha;
|
||||
if (direction == MixDirection_In) constraint.bendDirection = (int)frames[frames.Length + PREV_BEND_DIRECTION];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
float mix = frames[frame + PREV_MIX];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
if (pose == MixPose_Setup) {
|
||||
constraint.mix = constraint.data.mix + (mix + (frames[frame + MIX] - mix) * percent - constraint.data.mix) * alpha;
|
||||
constraint.bendDirection = direction == MixDirection_Out ? constraint.data.bendDirection : (int)frames[frame + PREV_BEND_DIRECTION];
|
||||
} else {
|
||||
constraint.mix += (mix + (frames[frame + MIX] - mix) * percent - constraint.mix) * alpha;
|
||||
if (direction == MixDirection_In) constraint.bendDirection = (int)frames[frame + PREV_BEND_DIRECTION];
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_IkConstraintTimeline_h */
|
||||
114
spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h
Normal file
114
spine-cpp/spine-cpp/include/spine/PathConstraintMixTimeline.h
Normal file
@ -0,0 +1,114 @@
|
||||
/******************************************************************************
|
||||
* 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_PathConstraintMixTimeline_h
|
||||
#define Spine_PathConstraintMixTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class PathConstraintMixTimeline : public CurveTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public const int ENTRIES = 3;
|
||||
private const int PREV_TIME = -3, PREV_ROTATE = -2, PREV_TRANSLATE = -1;
|
||||
private const int ROTATE = 1, TRANSLATE = 2;
|
||||
|
||||
internal int pathConstraintIndex;
|
||||
internal float[] frames;
|
||||
|
||||
public int PathConstraintIndex { return pathConstraintIndex; } set { pathConstraintIndex = inValue; }
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, rotate mix, translate mix, ...
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.PathConstraintMix << 24) + pathConstraintIndex; }
|
||||
}
|
||||
|
||||
public PathConstraintMixTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
frames = new float[frameCount * ENTRIES];
|
||||
}
|
||||
|
||||
/// Sets the time and mixes of the specified keyframe.
|
||||
public void SetFrame (int frameIndex, float time, float rotateMix, float translateMix) {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + ROTATE] = rotateMix;
|
||||
frames[frameIndex + TRANSLATE] = translateMix;
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
PathConstraint constraint = skeleton.pathConstraints.Items[pathConstraintIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
constraint.rotateMix = constraint.data.rotateMix;
|
||||
constraint.translateMix = constraint.data.translateMix;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
constraint.rotateMix += (constraint.data.rotateMix - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (constraint.data.translateMix - constraint.translateMix) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float rotate, translate;
|
||||
if (time >= frames[frames.Length - ENTRIES]) { // Time is after last frame.
|
||||
rotate = frames[frames.Length + PREV_ROTATE];
|
||||
translate = frames[frames.Length + PREV_TRANSLATE];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
rotate = frames[frame + PREV_ROTATE];
|
||||
translate = frames[frame + PREV_TRANSLATE];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
rotate += (frames[frame + ROTATE] - rotate) * percent;
|
||||
translate += (frames[frame + TRANSLATE] - translate) * percent;
|
||||
}
|
||||
|
||||
if (pose == MixPose_Setup) {
|
||||
constraint.rotateMix = constraint.data.rotateMix + (rotate - constraint.data.rotateMix) * alpha;
|
||||
constraint.translateMix = constraint.data.translateMix + (translate - constraint.data.translateMix) * alpha;
|
||||
} else {
|
||||
constraint.rotateMix += (rotate - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (translate - constraint.translateMix) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_PathConstraintMixTimeline_h */
|
||||
@ -0,0 +1,102 @@
|
||||
/******************************************************************************
|
||||
* 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_PathConstraintPositionTimeline_h
|
||||
#define Spine_PathConstraintPositionTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class PathConstraintPositionTimeline : public CurveTimeline
|
||||
{
|
||||
public const int ENTRIES = 2;
|
||||
protected const int PREV_TIME = -2, PREV_VALUE = -1;
|
||||
protected const int VALUE = 1;
|
||||
|
||||
internal int pathConstraintIndex;
|
||||
internal float[] frames;
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.PathConstraintPosition << 24) + pathConstraintIndex; }
|
||||
}
|
||||
|
||||
public PathConstraintPositionTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
frames = new float[frameCount * ENTRIES];
|
||||
}
|
||||
|
||||
public int PathConstraintIndex { return pathConstraintIndex; } set { pathConstraintIndex = inValue; }
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, position, ...
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
public void SetFrame (int frameIndex, float time, float value) {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + VALUE] = inValue;
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
PathConstraint constraint = skeleton.pathConstraints.Items[pathConstraintIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
constraint.position = constraint.data.position;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
constraint.position += (constraint.data.position - constraint.position) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float position;
|
||||
if (time >= frames[frames.Length - ENTRIES]) // Time is after last frame.
|
||||
position = frames[frames.Length + PREV_VALUE];
|
||||
else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
position = frames[frame + PREV_VALUE];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
position += (frames[frame + VALUE] - position) * percent;
|
||||
}
|
||||
if (pose == MixPose_Setup)
|
||||
constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
|
||||
else
|
||||
constraint.position += (position - constraint.position) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_PathConstraintPositionTimeline_h */
|
||||
@ -0,0 +1,87 @@
|
||||
/******************************************************************************
|
||||
* 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_PathConstraintSpacingTimeline_h
|
||||
#define Spine_PathConstraintSpacingTimeline_h
|
||||
|
||||
#include <spine/PathConstraintPositionTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class PathConstraintSpacingTimeline : public PathConstraintPositionTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.PathConstraintSpacing << 24) + pathConstraintIndex; }
|
||||
}
|
||||
|
||||
public PathConstraintSpacingTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
PathConstraint constraint = skeleton.pathConstraints.Items[pathConstraintIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
constraint.spacing = constraint.data.spacing;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float spacing;
|
||||
if (time >= frames[frames.Length - ENTRIES]) // Time is after last frame.
|
||||
spacing = frames[frames.Length + PREV_VALUE];
|
||||
else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
spacing = frames[frame + PREV_VALUE];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
spacing += (frames[frame + VALUE] - spacing) * percent;
|
||||
}
|
||||
|
||||
if (pose == MixPose_Setup)
|
||||
constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
|
||||
else
|
||||
constraint.spacing += (spacing - constraint.spacing) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_PathConstraintSpacingTimeline_h */
|
||||
71
spine-cpp/spine-cpp/include/spine/PointAttachment.h
Normal file
71
spine-cpp/spine-cpp/include/spine/PointAttachment.h
Normal file
@ -0,0 +1,71 @@
|
||||
/******************************************************************************
|
||||
* 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_PointAttachment_h
|
||||
#define Spine_PointAttachment_h
|
||||
|
||||
#include <spine/Attachment.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class Bone;
|
||||
|
||||
///
|
||||
/// An attachment which is a single point and a rotation. This can be used to spawn projectiles, particles, etc. A bone can be
|
||||
/// used in similar ways, but a PointAttachment is slightly less expensive to compute and can be hidden, shown, and placed in a
|
||||
/// skin.
|
||||
///
|
||||
/// See http://esotericsoftware.com/spine-point-attachments for Point Attachments in the Spine User Guide.
|
||||
///
|
||||
class PointAttachment : public Attachment
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
PointAttachment(std::string name);
|
||||
|
||||
void computeWorldPosition(Bone& bone, float& ox, float& oy);
|
||||
|
||||
float computeWorldRotation(Bone& bone);
|
||||
|
||||
float getX();
|
||||
void setX(float inValue);
|
||||
|
||||
float getY();
|
||||
void setY(float inValue);
|
||||
|
||||
float getRotation();
|
||||
void setRotation(float inValue);
|
||||
|
||||
private:
|
||||
float _x, _y, _rotation;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_PointAttachment_h */
|
||||
111
spine-cpp/spine-cpp/include/spine/ScaleTimeline.h
Normal file
111
spine-cpp/spine-cpp/include/spine/ScaleTimeline.h
Normal file
@ -0,0 +1,111 @@
|
||||
/******************************************************************************
|
||||
* 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_ScaleTimeline_h
|
||||
#define Spine_ScaleTimeline_h
|
||||
|
||||
#include <spine/TranslateTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class ScaleTimeline : public TranslateTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.Scale << 24) + boneIndex; }
|
||||
}
|
||||
|
||||
public ScaleTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
Bone bone = skeleton.bones.Items[boneIndex];
|
||||
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
bone.scaleX = bone.data.scaleX;
|
||||
bone.scaleY = bone.data.scaleY;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
|
||||
bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y;
|
||||
if (time >= frames[frames.Length - ENTRIES]) { // Time is after last frame.
|
||||
x = frames[frames.Length + PREV_X] * bone.data.scaleX;
|
||||
y = frames[frames.Length + PREV_Y] * bone.data.scaleY;
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
x = frames[frame + PREV_X];
|
||||
y = frames[frame + PREV_Y];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
x = (x + (frames[frame + X] - x) * percent) * bone.data.scaleX;
|
||||
y = (y + (frames[frame + Y] - y) * percent) * bone.data.scaleY;
|
||||
}
|
||||
if (alpha == 1) {
|
||||
bone.scaleX = x;
|
||||
bone.scaleY = y;
|
||||
} else {
|
||||
float bx, by;
|
||||
if (pose == MixPose_Setup) {
|
||||
bx = bone.data.scaleX;
|
||||
by = bone.data.scaleY;
|
||||
} else {
|
||||
bx = bone.scaleX;
|
||||
by = bone.scaleY;
|
||||
}
|
||||
// Mixing out uses sign of setup or current pose, else use sign of key.
|
||||
if (direction == MixDirection_Out) {
|
||||
x = (x >= 0 ? x : -x) * (bx >= 0 ? 1 : -1);
|
||||
y = (y >= 0 ? y : -y) * (by >= 0 ? 1 : -1);
|
||||
} else {
|
||||
bx = (bx >= 0 ? bx : -bx) * (x >= 0 ? 1 : -1);
|
||||
by = (by >= 0 ? by : -by) * (y >= 0 ? 1 : -1);
|
||||
}
|
||||
bone.scaleX = bx + (x - bx) * alpha;
|
||||
bone.scaleY = by + (y - by) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_ScaleTimeline_h */
|
||||
94
spine-cpp/spine-cpp/include/spine/ShearTimeline.h
Normal file
94
spine-cpp/spine-cpp/include/spine/ShearTimeline.h
Normal file
@ -0,0 +1,94 @@
|
||||
/******************************************************************************
|
||||
* 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_ShearTimeline_h
|
||||
#define Spine_ShearTimeline_h
|
||||
|
||||
#include <spine/TranslateTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class ShearTimeline : public TranslateTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.Shear << 24) + boneIndex; }
|
||||
}
|
||||
|
||||
public ShearTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
Bone bone = skeleton.bones.Items[boneIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
bone.shearX = bone.data.shearX;
|
||||
bone.shearY = bone.data.shearY;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
|
||||
bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y;
|
||||
if (time >= frames[frames.Length - ENTRIES]) { // Time is after last frame.
|
||||
x = frames[frames.Length + PREV_X];
|
||||
y = frames[frames.Length + PREV_Y];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
x = frames[frame + PREV_X];
|
||||
y = frames[frame + PREV_Y];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
x = x + (frames[frame + X] - x) * percent;
|
||||
y = y + (frames[frame + Y] - y) * percent;
|
||||
}
|
||||
if (pose == MixPose_Setup) {
|
||||
bone.shearX = bone.data.shearX + x * alpha;
|
||||
bone.shearY = bone.data.shearY + y * alpha;
|
||||
} else {
|
||||
bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
|
||||
bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_ShearTimeline_h */
|
||||
@ -61,19 +61,7 @@ namespace Spine
|
||||
|
||||
struct HashAttachmentKey
|
||||
{
|
||||
std::size_t operator()(const Spine::Skin::AttachmentKey& val) const
|
||||
{
|
||||
std::size_t h1 = val._slotIndex;
|
||||
|
||||
std::size_t h2 = 7;
|
||||
size_t strlen = val._name.length();
|
||||
for (int i = 0; i < strlen; ++i)
|
||||
{
|
||||
h2 = h2 * 31 + val._name.at(i);
|
||||
}
|
||||
|
||||
return h1 ^ (h2 << 1);
|
||||
}
|
||||
std::size_t operator()(const Spine::Skin::AttachmentKey& val) const;
|
||||
};
|
||||
|
||||
Skin(std::string name);
|
||||
|
||||
131
spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h
Normal file
131
spine-cpp/spine-cpp/include/spine/TransformConstraintTimeline.h
Normal file
@ -0,0 +1,131 @@
|
||||
/******************************************************************************
|
||||
* 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_TransformConstraintTimeline_h
|
||||
#define Spine_TransformConstraintTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class TransformConstraintTimeline : public CurveTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public const int ENTRIES = 5;
|
||||
private const int PREV_TIME = -5, PREV_ROTATE = -4, PREV_TRANSLATE = -3, PREV_SCALE = -2, PREV_SHEAR = -1;
|
||||
private const int ROTATE = 1, TRANSLATE = 2, SCALE = 3, SHEAR = 4;
|
||||
|
||||
internal int transformConstraintIndex;
|
||||
internal float[] frames;
|
||||
|
||||
public int TransformConstraintIndex { return transformConstraintIndex; } set { transformConstraintIndex = inValue; }
|
||||
public float[] Frames { return frames; } set { frames = inValue; } // time, rotate mix, translate mix, scale mix, shear mix, ...
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.TransformConstraint << 24) + transformConstraintIndex; }
|
||||
}
|
||||
|
||||
public TransformConstraintTimeline (int frameCount)
|
||||
: base(frameCount) {
|
||||
frames = new float[frameCount * ENTRIES];
|
||||
}
|
||||
|
||||
public void SetFrame (int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix) {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + ROTATE] = rotateMix;
|
||||
frames[frameIndex + TRANSLATE] = translateMix;
|
||||
frames[frameIndex + SCALE] = scaleMix;
|
||||
frames[frameIndex + SHEAR] = shearMix;
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
TransformConstraint constraint = skeleton.transformConstraints.Items[transformConstraintIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) {
|
||||
var data = constraint.data;
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
constraint.rotateMix = data.rotateMix;
|
||||
constraint.translateMix = data.translateMix;
|
||||
constraint.scaleMix = data.scaleMix;
|
||||
constraint.shearMix = data.shearMix;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
constraint.rotateMix += (data.rotateMix - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (data.translateMix - constraint.translateMix) * alpha;
|
||||
constraint.scaleMix += (data.scaleMix - constraint.scaleMix) * alpha;
|
||||
constraint.shearMix += (data.shearMix - constraint.shearMix) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float rotate, translate, scale, shear;
|
||||
if (time >= frames[frames.Length - ENTRIES]) { // Time is after last frame.
|
||||
int i = frames.Length;
|
||||
rotate = frames[i + PREV_ROTATE];
|
||||
translate = frames[i + PREV_TRANSLATE];
|
||||
scale = frames[i + PREV_SCALE];
|
||||
shear = frames[i + PREV_SHEAR];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
rotate = frames[frame + PREV_ROTATE];
|
||||
translate = frames[frame + PREV_TRANSLATE];
|
||||
scale = frames[frame + PREV_SCALE];
|
||||
shear = frames[frame + PREV_SHEAR];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
rotate += (frames[frame + ROTATE] - rotate) * percent;
|
||||
translate += (frames[frame + TRANSLATE] - translate) * percent;
|
||||
scale += (frames[frame + SCALE] - scale) * percent;
|
||||
shear += (frames[frame + SHEAR] - shear) * percent;
|
||||
}
|
||||
if (pose == MixPose_Setup) {
|
||||
TransformConstraintData data = constraint.data;
|
||||
constraint.rotateMix = data.rotateMix + (rotate - data.rotateMix) * alpha;
|
||||
constraint.translateMix = data.translateMix + (translate - data.translateMix) * alpha;
|
||||
constraint.scaleMix = data.scaleMix + (scale - data.scaleMix) * alpha;
|
||||
constraint.shearMix = data.shearMix + (shear - data.shearMix) * alpha;
|
||||
} else {
|
||||
constraint.rotateMix += (rotate - constraint.rotateMix) * alpha;
|
||||
constraint.translateMix += (translate - constraint.translateMix) * alpha;
|
||||
constraint.scaleMix += (scale - constraint.scaleMix) * alpha;
|
||||
constraint.shearMix += (shear - constraint.shearMix) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_TransformConstraintTimeline_h */
|
||||
129
spine-cpp/spine-cpp/include/spine/TranslateTimeline.h
Normal file
129
spine-cpp/spine-cpp/include/spine/TranslateTimeline.h
Normal file
@ -0,0 +1,129 @@
|
||||
/******************************************************************************
|
||||
* 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_TranslateTimeline_h
|
||||
#define Spine_TranslateTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
#include <spine/Animation.h>
|
||||
#include <spine/TimelineType.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class TranslateTimeline : public CurveTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public const int ENTRIES = 3;
|
||||
protected const int PREV_TIME = -3, PREV_X = -2, PREV_Y = -1;
|
||||
protected const int X = 1, Y = 2;
|
||||
|
||||
internal int boneIndex;
|
||||
internal float[] frames;
|
||||
|
||||
public int getBoneIndex { return boneIndex; } set { boneIndex = inValue; }
|
||||
public Vector<float> getFrames { return frames; } set { frames = inValue; } // time, value, value, ...
|
||||
|
||||
virtual int getPropertyId()
|
||||
{
|
||||
return ((int)TimelineType_Translate << 24) + boneIndex;
|
||||
}
|
||||
|
||||
public TranslateTimeline(int frameCount) : CurveTimeline(frameCount)
|
||||
{
|
||||
frames = new float[frameCount * ENTRIES];
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
public void setFrame(int frameIndex, float time, float x, float y)
|
||||
{
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + X] = x;
|
||||
frames[frameIndex + Y] = y;
|
||||
}
|
||||
|
||||
override public void apply(Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction)
|
||||
{
|
||||
Bone bone = skeleton.bones.Items[boneIndex];
|
||||
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0])
|
||||
{
|
||||
switch (pose)
|
||||
{
|
||||
case MixPose_Setup:
|
||||
bone.x = bone.data.x;
|
||||
bone.y = bone.data.y;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
bone.x += (bone.data.x - bone.x) * alpha;
|
||||
bone.y += (bone.data.y - bone.y) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y;
|
||||
if (time >= frames[frames.Length - ENTRIES])
|
||||
{
|
||||
// Time is after last frame.
|
||||
x = frames[frames.Length + PREV_X];
|
||||
y = frames[frames.Length + PREV_Y];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation::binarySearch(frames, time, ENTRIES);
|
||||
x = frames[frame + PREV_X];
|
||||
y = frames[frame + PREV_Y];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1, 1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
x += (frames[frame + X] - x) * percent;
|
||||
y += (frames[frame + Y] - y) * percent;
|
||||
}
|
||||
|
||||
if (pose == MixPose_Setup)
|
||||
{
|
||||
bone.x = bone.data.x + x * alpha;
|
||||
bone.y = bone.data.y + y * alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
bone.x += (bone.data.x + x - bone.x) * alpha;
|
||||
bone.y += (bone.data.y + y - bone.y) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_TranslateTimeline_h */
|
||||
342
spine-cpp/spine-cpp/include/spine/Triangulator.h
Normal file
342
spine-cpp/spine-cpp/include/spine/Triangulator.h
Normal file
@ -0,0 +1,342 @@
|
||||
/******************************************************************************
|
||||
* 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_Triangulator_h
|
||||
#define Spine_Triangulator_h
|
||||
|
||||
#include <spine/Vector.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class Triangulator
|
||||
{
|
||||
public:
|
||||
public Vector<int> triangulate(Vector<float>& verticesArray)
|
||||
{
|
||||
var vertices = verticesArray.Items;
|
||||
int vertexCount = verticesArray.Count >> 1;
|
||||
|
||||
var indicesArray = _indicesArray;
|
||||
indicesArray.Clear();
|
||||
int[] indices = indicesArray.Resize(vertexCount).Items;
|
||||
for (int i = 0; i < vertexCount; i++)
|
||||
{
|
||||
indices[i] = i;
|
||||
}
|
||||
|
||||
var isConcaveArray = _isConcaveArray;
|
||||
bool[] isConcave = isConcaveArray.Resize(vertexCount).Items;
|
||||
for (int i = 0, n = vertexCount; i < n; ++i)
|
||||
{
|
||||
isConcave[i] = isConcave(i, vertexCount, vertices, indices);
|
||||
}
|
||||
|
||||
var triangles = _triangles;
|
||||
triangles.Clear();
|
||||
triangles.EnsureCapacity(Math.Max(0, vertexCount - 2) << 2);
|
||||
|
||||
while (vertexCount > 3)
|
||||
{
|
||||
// Find ear tip.
|
||||
int previous = vertexCount - 1, i = 0, next = 1;
|
||||
|
||||
// outer:
|
||||
while (true)
|
||||
{
|
||||
if (!isConcave[i])
|
||||
{
|
||||
int p1 = indices[previous] << 1, p2 = indices[i] << 1, p3 = indices[next] << 1;
|
||||
float p1x = vertices[p1], p1y = vertices[p1 + 1];
|
||||
float p2x = vertices[p2], p2y = vertices[p2 + 1];
|
||||
float p3x = vertices[p3], p3y = vertices[p3 + 1];
|
||||
for (int ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount)
|
||||
{
|
||||
if (!isConcave[ii]) continue;
|
||||
int v = indices[ii] << 1;
|
||||
float vx = vertices[v], vy = vertices[v + 1];
|
||||
if (positiveArea(p3x, p3y, p1x, p1y, vx, vy))
|
||||
{
|
||||
if (positiveArea(p1x, p1y, p2x, p2y, vx, vy))
|
||||
{
|
||||
if (positiveArea(p2x, p2y, p3x, p3y, vx, vy))
|
||||
{
|
||||
goto break_outer; // break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break_outer:
|
||||
|
||||
if (next == 0)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!isConcave[i])
|
||||
{
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
} while (i > 0);
|
||||
break;
|
||||
}
|
||||
|
||||
previous = i;
|
||||
i = next;
|
||||
next = (next + 1) % vertexCount;
|
||||
}
|
||||
|
||||
// Cut ear tip.
|
||||
triangles.Add(indices[(vertexCount + i - 1) % vertexCount]);
|
||||
triangles.Add(indices[i]);
|
||||
triangles.Add(indices[(i + 1) % vertexCount]);
|
||||
indicesArray.RemoveAt(i);
|
||||
isConcaveArray.RemoveAt(i);
|
||||
vertexCount--;
|
||||
|
||||
int previousIndex = (vertexCount + i - 1) % vertexCount;
|
||||
int nextIndex = i == vertexCount ? 0 : i;
|
||||
isConcave[previousIndex] = isConcave(previousIndex, vertexCount, vertices, indices);
|
||||
isConcave[nextIndex] = isConcave(nextIndex, vertexCount, vertices, indices);
|
||||
}
|
||||
|
||||
if (vertexCount == 3)
|
||||
{
|
||||
triangles.Add(indices[2]);
|
||||
triangles.Add(indices[0]);
|
||||
triangles.Add(indices[1]);
|
||||
}
|
||||
|
||||
return triangles;
|
||||
}
|
||||
|
||||
public Vector<Vector<float>> decompose(Vector<float>& verticesArray, Vector<int>& triangles)
|
||||
{
|
||||
var vertices = verticesArray.Items;
|
||||
var convexPolygons = _convexPolygons;
|
||||
for (int i = 0, n = convexPolygons.Count; i < n; i++)
|
||||
{
|
||||
polygonPool.Free(convexPolygons.Items[i]);
|
||||
}
|
||||
convexPolygons.Clear();
|
||||
|
||||
var convexPolygonsIndices = _convexPolygonsIndices;
|
||||
for (int i = 0, n = convexPolygonsIndices.Count; i < n; i++)
|
||||
{
|
||||
polygonIndicesPool.Free(convexPolygonsIndices.Items[i]);
|
||||
}
|
||||
convexPolygonsIndices.Clear();
|
||||
|
||||
var polygonIndices = polygonIndicesPool.Obtain();
|
||||
polygonIndices.Clear();
|
||||
|
||||
var polygon = polygonPool.Obtain();
|
||||
polygon.Clear();
|
||||
|
||||
// Merge subsequent triangles if they form a triangle fan.
|
||||
int fanBaseIndex = -1, lastwinding = 0;
|
||||
int[] trianglesItems = triangles.Items;
|
||||
for (int i = 0, n = triangles.Count; i < n; i += 3)
|
||||
{
|
||||
int t1 = trianglesItems[i] << 1, t2 = trianglesItems[i + 1] << 1, t3 = trianglesItems[i + 2] << 1;
|
||||
float x1 = vertices[t1], y1 = vertices[t1 + 1];
|
||||
float x2 = vertices[t2], y2 = vertices[t2 + 1];
|
||||
float x3 = vertices[t3], y3 = vertices[t3 + 1];
|
||||
|
||||
// If the base of the last triangle is the same as this triangle, check if they form a convex polygon (triangle fan).
|
||||
var merged = false;
|
||||
if (fanBaseIndex == t1)
|
||||
{
|
||||
int o = polygon.Count - 4;
|
||||
float[] p = polygon.Items;
|
||||
int winding1 = winding(p[o], p[o + 1], p[o + 2], p[o + 3], x3, y3);
|
||||
int winding2 = winding(x3, y3, p[0], p[1], p[2], p[3]);
|
||||
if (winding1 == lastwinding && winding2 == lastwinding)
|
||||
{
|
||||
polygon.Add(x3);
|
||||
polygon.Add(y3);
|
||||
polygonIndices.Add(t3);
|
||||
merged = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise make this triangle the new base.
|
||||
if (!merged)
|
||||
{
|
||||
if (polygon.Count > 0)
|
||||
{
|
||||
convexPolygons.Add(polygon);
|
||||
convexPolygonsIndices.Add(polygonIndices);
|
||||
}
|
||||
else
|
||||
{
|
||||
polygonPool.Free(polygon);
|
||||
polygonIndicesPool.Free(polygonIndices);
|
||||
}
|
||||
|
||||
polygon = polygonPool.Obtain();
|
||||
polygon.Clear();
|
||||
polygon.Add(x1);
|
||||
polygon.Add(y1);
|
||||
polygon.Add(x2);
|
||||
polygon.Add(y2);
|
||||
polygon.Add(x3);
|
||||
polygon.Add(y3);
|
||||
polygonIndices = polygonIndicesPool.Obtain();
|
||||
polygonIndices.Clear();
|
||||
polygonIndices.Add(t1);
|
||||
polygonIndices.Add(t2);
|
||||
polygonIndices.Add(t3);
|
||||
lastwinding = winding(x1, y1, x2, y2, x3, y3);
|
||||
fanBaseIndex = t1;
|
||||
}
|
||||
}
|
||||
|
||||
if (polygon.Count > 0)
|
||||
{
|
||||
convexPolygons.Add(polygon);
|
||||
convexPolygonsIndices.Add(polygonIndices);
|
||||
}
|
||||
|
||||
// Go through the list of polygons and try to merge the remaining triangles with the found triangle fans.
|
||||
for (int i = 0, n = convexPolygons.Count; i < n; ++i)
|
||||
{
|
||||
polygonIndices = convexPolygonsIndices.Items[i];
|
||||
if (polygonIndices.Count == 0) continue;
|
||||
int firstIndex = polygonIndices.Items[0];
|
||||
int lastIndex = polygonIndices.Items[polygonIndices.Count - 1];
|
||||
|
||||
polygon = convexPolygons.Items[i];
|
||||
int o = polygon.Count - 4;
|
||||
float[] p = polygon.Items;
|
||||
float prevPrevX = p[o], prevPrevY = p[o + 1];
|
||||
float prevX = p[o + 2], prevY = p[o + 3];
|
||||
float firstX = p[0], firstY = p[1];
|
||||
float secondX = p[2], secondY = p[3];
|
||||
int winding = winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
|
||||
|
||||
for (int ii = 0; ii < n; ii++)
|
||||
{
|
||||
if (ii == i)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var otherIndices = convexPolygonsIndices.Items[ii];
|
||||
|
||||
if (otherIndices.Count != 3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int otherFirstIndex = otherIndices.Items[0];
|
||||
int otherSecondIndex = otherIndices.Items[1];
|
||||
int otherLastIndex = otherIndices.Items[2];
|
||||
|
||||
var otherPoly = convexPolygons.Items[ii];
|
||||
float x3 = otherPoly.Items[otherPoly.Count - 2], y3 = otherPoly.Items[otherPoly.Count - 1];
|
||||
|
||||
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int winding1 = winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
|
||||
int winding2 = winding(x3, y3, firstX, firstY, secondX, secondY);
|
||||
if (winding1 == winding && winding2 == winding)
|
||||
{
|
||||
otherPoly.Clear();
|
||||
otherIndices.Clear();
|
||||
polygon.Add(x3);
|
||||
polygon.Add(y3);
|
||||
polygonIndices.Add(otherLastIndex);
|
||||
prevPrevX = prevX;
|
||||
prevPrevY = prevY;
|
||||
prevX = x3;
|
||||
prevY = y3;
|
||||
ii = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove empty polygons that resulted from the merge step above.
|
||||
for (int i = convexPolygons.Count - 1; i >= 0; --i)
|
||||
{
|
||||
polygon = convexPolygons.Items[i];
|
||||
if (polygon.Count == 0)
|
||||
{
|
||||
convexPolygons.RemoveAt(i);
|
||||
polygonPool.Free(polygon);
|
||||
polygonIndices = convexPolygonsIndices.Items[i];
|
||||
convexPolygonsIndices.RemoveAt(i);
|
||||
polygonIndicesPool.Free(polygonIndices);
|
||||
}
|
||||
}
|
||||
|
||||
return convexPolygons;
|
||||
}
|
||||
|
||||
private:
|
||||
Vector<Vector<float>> convexPolygons;
|
||||
Vector<Vector<int>> convexPolygonsIndices;
|
||||
|
||||
Vector<int> indicesArray;
|
||||
Vector<bool> isConcaveArray;
|
||||
Vector<int> triangles;
|
||||
|
||||
Pool<Vector<float>> polygonPool;
|
||||
Pool<Vector<int>> polygonIndicesPool;
|
||||
|
||||
static bool isConcave(int index, int vertexCount, Vector<float> vertices, Vector<int> indices)
|
||||
{
|
||||
int previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
|
||||
int current = indices[index] << 1;
|
||||
int next = indices[(index + 1) % vertexCount] << 1;
|
||||
|
||||
return !positiveArea(vertices[previous], vertices[previous + 1], vertices[current], vertices[current + 1], vertices[next],
|
||||
vertices[next + 1]);
|
||||
}
|
||||
|
||||
static bool positiveArea(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y)
|
||||
{
|
||||
return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
|
||||
}
|
||||
|
||||
static int winding(float p1x, float p1y, float p2x, float p2y, float p3x, float p3y)
|
||||
{
|
||||
float px = p2x - p1x, py = p2y - p1y;
|
||||
|
||||
return p3x * py - p3y * px + px * p1y - p1x * py >= 0 ? 1 : -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_Triangulator_h */
|
||||
183
spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h
Normal file
183
spine-cpp/spine-cpp/include/spine/TwoColorTimeline.h
Normal file
@ -0,0 +1,183 @@
|
||||
/******************************************************************************
|
||||
* 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_TwoColorTimeline_h
|
||||
#define Spine_TwoColorTimeline_h
|
||||
|
||||
#include <spine/CurveTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class TwoColorTimeline : public CurveTimeline
|
||||
{
|
||||
RTTI_DECL;
|
||||
|
||||
public const int ENTRIES = 8;
|
||||
protected const int PREV_TIME = -8, PREV_R = -7, PREV_G = -6, PREV_B = -5, PREV_A = -4;
|
||||
protected const int PREV_R2 = -3, PREV_G2 = -2, PREV_B2 = -1;
|
||||
protected const int R = 1, G = 2, B = 3, A = 4, R2 = 5, G2 = 6, B2 = 7;
|
||||
|
||||
internal float[] frames; // time, r, g, b, a, r2, g2, b2, ...
|
||||
public float[] Frames { return frames; }
|
||||
|
||||
internal int slotIndex;
|
||||
public int SlotIndex {
|
||||
get { return slotIndex; }
|
||||
set {
|
||||
if (value < 0) throw new ArgumentOutOfRangeException("index must be >= 0.");
|
||||
slotIndex = inValue;
|
||||
}
|
||||
}
|
||||
|
||||
override public int PropertyId {
|
||||
get { return ((int)TimelineType.TwoColor << 24) + slotIndex; }
|
||||
}
|
||||
|
||||
public TwoColorTimeline (int frameCount) :
|
||||
base(frameCount) {
|
||||
frames = new float[frameCount * ENTRIES];
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
public void SetFrame (int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2) {
|
||||
frameIndex *= ENTRIES;
|
||||
frames[frameIndex] = time;
|
||||
frames[frameIndex + R] = r;
|
||||
frames[frameIndex + G] = g;
|
||||
frames[frameIndex + B] = b;
|
||||
frames[frameIndex + A] = a;
|
||||
frames[frameIndex + R2] = r2;
|
||||
frames[frameIndex + G2] = g2;
|
||||
frames[frameIndex + B2] = b2;
|
||||
}
|
||||
|
||||
override public void Apply (Skeleton skeleton, float lastTime, float time, Vector<Event> firedEvents, float alpha, MixPose pose, MixDirection direction) {
|
||||
Slot slot = skeleton.slots.Items[slotIndex];
|
||||
float[] frames = _frames;
|
||||
if (time < frames[0]) { // Time is before first frame.
|
||||
var slotData = slot.data;
|
||||
switch (pose) {
|
||||
case MixPose_Setup:
|
||||
// slot.color.set(slot.data.color);
|
||||
// slot.darkColor.set(slot.data.darkColor);
|
||||
slot.r = slotData.r;
|
||||
slot.g = slotData.g;
|
||||
slot.b = slotData.b;
|
||||
slot.a = slotData.a;
|
||||
slot.r2 = slotData.r2;
|
||||
slot.g2 = slotData.g2;
|
||||
slot.b2 = slotData.b2;
|
||||
return;
|
||||
case MixPose_Current:
|
||||
slot.r += (slot.r - slotData.r) * alpha;
|
||||
slot.g += (slot.g - slotData.g) * alpha;
|
||||
slot.b += (slot.b - slotData.b) * alpha;
|
||||
slot.a += (slot.a - slotData.a) * alpha;
|
||||
slot.r2 += (slot.r2 - slotData.r2) * alpha;
|
||||
slot.g2 += (slot.g2 - slotData.g2) * alpha;
|
||||
slot.b2 += (slot.b2 - slotData.b2) * alpha;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
float r, g, b, a, r2, g2, b2;
|
||||
if (time >= frames[frames.Length - ENTRIES]) { // Time is after last frame.
|
||||
int i = frames.Length;
|
||||
r = frames[i + PREV_R];
|
||||
g = frames[i + PREV_G];
|
||||
b = frames[i + PREV_B];
|
||||
a = frames[i + PREV_A];
|
||||
r2 = frames[i + PREV_R2];
|
||||
g2 = frames[i + PREV_G2];
|
||||
b2 = frames[i + PREV_B2];
|
||||
} else {
|
||||
// Interpolate between the previous frame and the current frame.
|
||||
int frame = Animation.BinarySearch(frames, time, ENTRIES);
|
||||
r = frames[frame + PREV_R];
|
||||
g = frames[frame + PREV_G];
|
||||
b = frames[frame + PREV_B];
|
||||
a = frames[frame + PREV_A];
|
||||
r2 = frames[frame + PREV_R2];
|
||||
g2 = frames[frame + PREV_G2];
|
||||
b2 = frames[frame + PREV_B2];
|
||||
float frameTime = frames[frame];
|
||||
float percent = GetCurvePercent(frame / ENTRIES - 1,
|
||||
1 - (time - frameTime) / (frames[frame + PREV_TIME] - frameTime));
|
||||
|
||||
r += (frames[frame + R] - r) * percent;
|
||||
g += (frames[frame + G] - g) * percent;
|
||||
b += (frames[frame + B] - b) * percent;
|
||||
a += (frames[frame + A] - a) * percent;
|
||||
r2 += (frames[frame + R2] - r2) * percent;
|
||||
g2 += (frames[frame + G2] - g2) * percent;
|
||||
b2 += (frames[frame + B2] - b2) * percent;
|
||||
}
|
||||
if (alpha == 1) {
|
||||
slot.r = r;
|
||||
slot.g = g;
|
||||
slot.b = b;
|
||||
slot.a = a;
|
||||
slot.r2 = r2;
|
||||
slot.g2 = g2;
|
||||
slot.b2 = b2;
|
||||
} else {
|
||||
float br, bg, bb, ba, br2, bg2, bb2;
|
||||
if (pose == MixPose_Setup) {
|
||||
br = slot.data.r;
|
||||
bg = slot.data.g;
|
||||
bb = slot.data.b;
|
||||
ba = slot.data.a;
|
||||
br2 = slot.data.r2;
|
||||
bg2 = slot.data.g2;
|
||||
bb2 = slot.data.b2;
|
||||
} else {
|
||||
br = slot.r;
|
||||
bg = slot.g;
|
||||
bb = slot.b;
|
||||
ba = slot.a;
|
||||
br2 = slot.r2;
|
||||
bg2 = slot.g2;
|
||||
bb2 = slot.b2;
|
||||
}
|
||||
slot.r = br + ((r - br) * alpha);
|
||||
slot.g = bg + ((g - bg) * alpha);
|
||||
slot.b = bb + ((b - bb) * alpha);
|
||||
slot.a = ba + ((a - ba) * alpha);
|
||||
slot.r2 = br2 + ((r2 - br2) * alpha);
|
||||
slot.g2 = bg2 + ((g2 - bg2) * alpha);
|
||||
slot.b2 = bb2 + ((b2 - bb2) * alpha);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* Spine_TwoColorTimeline_h */
|
||||
119
spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp
Normal file
119
spine-cpp/spine-cpp/src/spine/AnimationStateData.cpp
Normal file
@ -0,0 +1,119 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/AnimationStateData.h>
|
||||
|
||||
#include <spine/SkeletonData.h>
|
||||
#include <spine/Animation.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
AnimationStateData::AnimationStateData(SkeletonData& skeletonData) : _skeletonData(skeletonData)
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
void AnimationStateData::setMix(std::string fromName, std::string toName, float duration)
|
||||
{
|
||||
Animation* from = _skeletonData.findAnimation(fromName);
|
||||
assert(from != NULL);
|
||||
|
||||
Animation* to = _skeletonData.findAnimation(toName);
|
||||
assert(to != NULL);
|
||||
|
||||
setMix(*from, *to, duration);
|
||||
}
|
||||
|
||||
void AnimationStateData::setMix(Animation& from, Animation& to, float duration)
|
||||
{
|
||||
AnimationPair key(from, to);
|
||||
HashMap<AnimationPair, float, HashAnimationPair>::Iterator i = _animationToMixTime.find(key);
|
||||
_animationToMixTime.erase(i);
|
||||
_animationToMixTime.insert(key, duration);
|
||||
}
|
||||
|
||||
float AnimationStateData::getMix(Animation& from, Animation& to)
|
||||
{
|
||||
AnimationPair key(from, to);
|
||||
|
||||
HashMap<AnimationPair, float, HashAnimationPair>::Iterator i = _animationToMixTime.find(key);
|
||||
|
||||
if (i != _animationToMixTime.end())
|
||||
{
|
||||
return i.second();
|
||||
}
|
||||
|
||||
return _defaultMix;
|
||||
}
|
||||
|
||||
SkeletonData& AnimationStateData::getSkeletonData()
|
||||
{
|
||||
return _skeletonData;
|
||||
}
|
||||
|
||||
float AnimationStateData::getDefaultMix()
|
||||
{
|
||||
return _defaultMix;
|
||||
}
|
||||
|
||||
void AnimationStateData::setDefaultMix(float inValue)
|
||||
{
|
||||
_defaultMix = inValue;
|
||||
}
|
||||
|
||||
AnimationStateData::AnimationPair::AnimationPair(Animation& a1, Animation& a2) : _a1(a1), _a2(a2)
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
bool AnimationStateData::AnimationPair::operator==(const AnimationPair &other) const
|
||||
{
|
||||
return _a1._name == other._a1._name && _a2._name == other._a2._name;
|
||||
}
|
||||
|
||||
std::size_t AnimationStateData::HashAnimationPair::operator()(const Spine::AnimationStateData::AnimationPair& val) const
|
||||
{
|
||||
std::size_t h1 = 7;
|
||||
size_t strlen = val._a1._name.length();
|
||||
for (int i = 0; i < strlen; ++i)
|
||||
{
|
||||
h1 = h1 * 31 + val._a1._name.at(i);
|
||||
}
|
||||
|
||||
std::size_t h2 = 7;
|
||||
strlen = val._a2._name.length();
|
||||
for (int i = 0; i < strlen; ++i)
|
||||
{
|
||||
h2 = h2 * 31 + val._a2._name.at(i);
|
||||
}
|
||||
|
||||
return (((h1 << 5) + h1) ^ h2);
|
||||
}
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/AtlasAttachmentLoader.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/AtlasAttachmentLoader.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(AtlasAttachmentLoader, AttachmentLoader);
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/AttachmentLoader.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/AttachmentLoader.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/AttachmentLoader.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL_NOPARENT(AttachmentLoader);
|
||||
}
|
||||
42
spine-cpp/spine-cpp/src/spine/AttachmentTimeline.cpp
Normal file
42
spine-cpp/spine-cpp/src/spine/AttachmentTimeline.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/AttachmentTimeline.h>
|
||||
|
||||
#include <spine/Skeleton.h>
|
||||
#include <spine/Event.h>
|
||||
|
||||
#include <spine/Animation.h>
|
||||
#include <spine/TimelineType.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(AttachmentTimeline, Timeline);
|
||||
}
|
||||
41
spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp
Normal file
41
spine-cpp/spine-cpp/src/spine/BoundingBoxAttachment.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/BoundingBoxAttachment.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(BoundingBoxAttachment, VertexAttachment);
|
||||
|
||||
BoundingBoxAttachment::BoundingBoxAttachment(std::string name) : VertexAttachment(name)
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
}
|
||||
53
spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp
Normal file
53
spine-cpp/spine-cpp/src/spine/ClippingAttachment.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ClippingAttachment.h>
|
||||
|
||||
#include <spine/SlotData.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(ClippingAttachment, VertexAttachment);
|
||||
|
||||
ClippingAttachment::ClippingAttachment(std::string name) : VertexAttachment(name)
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
SlotData* ClippingAttachment::getEndSlot()
|
||||
{
|
||||
return _endSlot;
|
||||
}
|
||||
|
||||
void ClippingAttachment::setEndSlot(SlotData* inValue)
|
||||
{
|
||||
_endSlot = inValue;
|
||||
}
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/ColorTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/ColorTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ColorTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(ColorTimeline, CurveTimeline);
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/DeformTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/DeformTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(DeformTimeline, CurveTimeline);
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/DrawOrderTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/DrawOrderTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/DrawOrderTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(DrawOrderTimeline, Timeline);
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/EventTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/EventTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/EventTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(EventTimeline, Timeline);
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/IkConstraintTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/IkConstraintTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/IkConstraintTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(IkConstraintTimeline, CurveTimeline);
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/PathConstraintMixTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/PathConstraintMixTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/PathConstraintMixTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(PathConstraintMixTimeline, CurveTimeline);
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/PathConstraintPositionTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(PathConstraintPositionTimeline, CurveTimeline);
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/PathConstraintSpacingTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(PathConstraintSpacingTimeline, PathConstraintPositionTimeline);
|
||||
}
|
||||
90
spine-cpp/spine-cpp/src/spine/PointAttachment.cpp
Normal file
90
spine-cpp/spine-cpp/src/spine/PointAttachment.cpp
Normal file
@ -0,0 +1,90 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/PointAttachment.h>
|
||||
|
||||
#include <spine/Bone.h>
|
||||
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(PointAttachment, Attachment);
|
||||
|
||||
PointAttachment::PointAttachment(std::string name) : Attachment(name)
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
void PointAttachment::computeWorldPosition(Bone& bone, float& ox, float& oy)
|
||||
{
|
||||
bone.localToWorld(_x, _y, ox, oy);
|
||||
}
|
||||
|
||||
float PointAttachment::computeWorldRotation(Bone& bone)
|
||||
{
|
||||
float cos = MathUtil::cosDeg(_rotation);
|
||||
float sin = MathUtil::sinDeg(_rotation);
|
||||
float ix = cos * bone._a + sin * bone._b;
|
||||
float iy = cos * bone._c + sin * bone._d;
|
||||
|
||||
return MathUtil::atan2(iy, ix) * RadDeg;
|
||||
}
|
||||
|
||||
float PointAttachment::getX()
|
||||
{
|
||||
return _x;
|
||||
}
|
||||
|
||||
void PointAttachment::setX(float inValue)
|
||||
{
|
||||
_x = inValue;
|
||||
}
|
||||
|
||||
float PointAttachment::getY()
|
||||
{
|
||||
return _y;
|
||||
}
|
||||
|
||||
void PointAttachment::setY(float inValue)
|
||||
{
|
||||
_y = inValue;
|
||||
}
|
||||
|
||||
float PointAttachment::getRotation()
|
||||
{
|
||||
return _rotation;
|
||||
}
|
||||
|
||||
void PointAttachment::setRotation(float inValue)
|
||||
{
|
||||
_rotation = inValue;
|
||||
}
|
||||
}
|
||||
@ -122,7 +122,6 @@ namespace Spine
|
||||
return ((int)TimelineType_Rotate << 24) + _boneIndex;
|
||||
}
|
||||
|
||||
/// Sets the time and value of the specified keyframe.
|
||||
void RotateTimeline::setFrame(int frameIndex, float time, float degrees)
|
||||
{
|
||||
frameIndex <<= 1;
|
||||
|
||||
36
spine-cpp/spine-cpp/src/spine/ScaleTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/ScaleTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ScaleTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(ScaleTimeline, TranslateTimeline);
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/ShearTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/ShearTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ShearTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(ShearTimeline, TranslateTimeline);
|
||||
}
|
||||
@ -51,6 +51,13 @@ namespace Spine
|
||||
return _slotIndex == other._slotIndex && _name == other._name;
|
||||
}
|
||||
|
||||
std::size_t Skin::HashAttachmentKey::operator()(const Spine::Skin::AttachmentKey& val) const
|
||||
{
|
||||
std::size_t h1 = val._slotIndex;
|
||||
|
||||
return h1;
|
||||
}
|
||||
|
||||
Skin::Skin(std::string name) : _name(name)
|
||||
{
|
||||
assert(_name.length() > 0);
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/TransformConstraintTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(TransformConstraintTimeline, CurveTimeline);
|
||||
}
|
||||
|
||||
36
spine-cpp/spine-cpp/src/spine/TranslateTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/TranslateTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/TranslateTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(TranslateTimeline, CurveTimeline);
|
||||
}
|
||||
34
spine-cpp/spine-cpp/src/spine/Triangulator.cpp
Normal file
34
spine-cpp/spine-cpp/src/spine/Triangulator.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
36
spine-cpp/spine-cpp/src/spine/TwoColorTimeline.cpp
Normal file
36
spine-cpp/spine-cpp/src/spine/TwoColorTimeline.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
/******************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/TwoColorTimeline.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
RTTI_IMPL(TwoColorTimeline, CurveTimeline);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user