mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 16:48:43 +08:00
[cpp] 4.3 porting WIP
This commit is contained in:
parent
cf27cb438c
commit
61126de9f3
@ -31,6 +31,7 @@
|
||||
#define SPINE_TOPROPERTY_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
@ -38,10 +39,12 @@ namespace spine {
|
||||
|
||||
/// Constrained property for a TransformConstraint.
|
||||
class SP_API ToProperty {
|
||||
RTTI_DECL
|
||||
public:
|
||||
ToProperty();
|
||||
virtual ~ToProperty();
|
||||
|
||||
protected:
|
||||
/// The value of this property that corresponds to FromProperty::offset.
|
||||
float offset;
|
||||
|
||||
@ -51,6 +54,7 @@ namespace spine {
|
||||
/// The scale of the FromProperty value in relation to this property.
|
||||
float scale;
|
||||
|
||||
public:
|
||||
/// Reads the mix for this property from the specified pose.
|
||||
virtual float mix(TransformConstraintPose& pose) = 0;
|
||||
|
||||
|
||||
56
spine-cpp/spine-cpp/include/spine/ToRotate.h
Normal file
56
spine-cpp/spine-cpp/include/spine/ToRotate.h
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TOROTATE_H_
|
||||
#define SPINE_TOROTATE_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
class BonePose;
|
||||
|
||||
class SP_API ToRotate : public ToProperty {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ToRotate();
|
||||
virtual ~ToRotate();
|
||||
|
||||
/// Returns the mix rotation value from the pose.
|
||||
virtual float mix(TransformConstraintPose& pose) override;
|
||||
|
||||
/// Applies the rotation value to the bone.
|
||||
virtual void apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SPINE_TOROTATE_H_ */
|
||||
52
spine-cpp/spine-cpp/include/spine/ToScaleX.h
Normal file
52
spine-cpp/spine-cpp/include/spine/ToScaleX.h
Normal file
@ -0,0 +1,52 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TOSCALEX_H_
|
||||
#define SPINE_TOSCALEX_H_
|
||||
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
class BonePose;
|
||||
|
||||
class SP_API ToScaleX : public ToProperty {
|
||||
RTTI_DECL
|
||||
public:
|
||||
ToScaleX();
|
||||
virtual ~ToScaleX();
|
||||
|
||||
virtual float mix(TransformConstraintPose& pose) override;
|
||||
|
||||
virtual void apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SPINE_TOSCALEX_H_ */
|
||||
56
spine-cpp/spine-cpp/include/spine/ToScaleY.h
Normal file
56
spine-cpp/spine-cpp/include/spine/ToScaleY.h
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TOSCALEY_H_
|
||||
#define SPINE_TOSCALEY_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
class BonePose;
|
||||
|
||||
class SP_API ToScaleY : public ToProperty {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ToScaleY();
|
||||
virtual ~ToScaleY();
|
||||
|
||||
/// Returns the mix scale Y value from the pose.
|
||||
virtual float mix(TransformConstraintPose& pose) override;
|
||||
|
||||
/// Applies the scale Y value to the bone.
|
||||
virtual void apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SPINE_TOSCALEY_H_ */
|
||||
56
spine-cpp/spine-cpp/include/spine/ToShearY.h
Normal file
56
spine-cpp/spine-cpp/include/spine/ToShearY.h
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TOSHEARY_H_
|
||||
#define SPINE_TOSHEARY_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
class BonePose;
|
||||
|
||||
class SP_API ToShearY : public ToProperty {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ToShearY();
|
||||
virtual ~ToShearY();
|
||||
|
||||
/// Returns the mix shear Y value from the pose.
|
||||
virtual float mix(TransformConstraintPose& pose) override;
|
||||
|
||||
/// Applies the shear Y value to the bone.
|
||||
virtual void apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SPINE_TOSHEARY_H_ */
|
||||
56
spine-cpp/spine-cpp/include/spine/ToX.h
Normal file
56
spine-cpp/spine-cpp/include/spine/ToX.h
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TOX_H_
|
||||
#define SPINE_TOX_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
class BonePose;
|
||||
|
||||
class SP_API ToX : public ToProperty {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ToX();
|
||||
virtual ~ToX();
|
||||
|
||||
/// Returns the mix X value from the pose.
|
||||
virtual float mix(TransformConstraintPose& pose) override;
|
||||
|
||||
/// Applies the X value to the bone.
|
||||
virtual void apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SPINE_TOX_H_ */
|
||||
56
spine-cpp/spine-cpp/include/spine/ToY.h
Normal file
56
spine-cpp/spine-cpp/include/spine/ToY.h
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TOY_H_
|
||||
#define SPINE_TOY_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
class BonePose;
|
||||
|
||||
class SP_API ToY : public ToProperty {
|
||||
RTTI_DECL
|
||||
|
||||
public:
|
||||
ToY();
|
||||
virtual ~ToY();
|
||||
|
||||
/// Returns the mix Y value from the pose.
|
||||
virtual float mix(TransformConstraintPose& pose) override;
|
||||
|
||||
/// Applies the Y value to the bone.
|
||||
virtual void apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SPINE_TOY_H_ */
|
||||
@ -126,6 +126,12 @@
|
||||
#include <spine/TextureLoader.h>
|
||||
#include <spine/Timeline.h>
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/ToRotate.h>
|
||||
#include <spine/ToScaleX.h>
|
||||
#include <spine/ToScaleY.h>
|
||||
#include <spine/ToShearY.h>
|
||||
#include <spine/ToX.h>
|
||||
#include <spine/ToY.h>
|
||||
#include <spine/TransformConstraint.h>
|
||||
#include <spine/TransformConstraintData.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL_NOPARENT(ToProperty)
|
||||
|
||||
ToProperty::ToProperty() : offset(0), max(0), scale(1) {
|
||||
}
|
||||
|
||||
|
||||
68
spine-cpp/spine-cpp/src/spine/ToRotate.cpp
Normal file
68
spine-cpp/spine-cpp/src/spine/ToRotate.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ToRotate.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
#include <spine/BonePose.h>
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(ToRotate, ToProperty)
|
||||
|
||||
ToRotate::ToRotate() {
|
||||
}
|
||||
|
||||
ToRotate::~ToRotate() {
|
||||
}
|
||||
|
||||
float ToRotate::mix(TransformConstraintPose& pose) {
|
||||
return pose.getMixRotate();
|
||||
}
|
||||
|
||||
void ToRotate::apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) {
|
||||
if (local) {
|
||||
if (!additive) value -= bone.getRotation();
|
||||
bone.setRotation(bone.getRotation() + value * pose.getMixRotate());
|
||||
} else {
|
||||
float a = bone._a, b = bone._b, c = bone._c, d = bone._d;
|
||||
value *= MathUtil::Deg_Rad;
|
||||
if (!additive) value -= MathUtil::atan2(c, a);
|
||||
if (value > MathUtil::Pi)
|
||||
value -= MathUtil::Pi * 2;
|
||||
else if (value < -MathUtil::Pi)
|
||||
value += MathUtil::Pi * 2;
|
||||
value *= pose.getMixRotate();
|
||||
float cosVal = MathUtil::cos(value), sinVal = MathUtil::sin(value);
|
||||
bone._a = cosVal * a - sinVal * c;
|
||||
bone._b = cosVal * b - sinVal * d;
|
||||
bone._c = sinVal * a + cosVal * c;
|
||||
bone._d = sinVal * b + cosVal * d;
|
||||
}
|
||||
}
|
||||
66
spine-cpp/spine-cpp/src/spine/ToScaleX.cpp
Normal file
66
spine-cpp/spine-cpp/src/spine/ToScaleX.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ToScaleX.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
#include <spine/BonePose.h>
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(ToScaleX, ToProperty)
|
||||
|
||||
ToScaleX::ToScaleX() {
|
||||
}
|
||||
|
||||
ToScaleX::~ToScaleX() {
|
||||
}
|
||||
|
||||
float ToScaleX::mix(TransformConstraintPose& pose) {
|
||||
return pose.getMixScaleX();
|
||||
}
|
||||
|
||||
void ToScaleX::apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) {
|
||||
if (local) {
|
||||
if (additive)
|
||||
bone.setScaleX(bone.getScaleX() * (1 + ((value - 1) * pose.getMixScaleX())));
|
||||
else if (bone.getScaleX() != 0)
|
||||
bone.setScaleX(1 + (value / bone.getScaleX() - 1) * pose.getMixScaleX());
|
||||
} else {
|
||||
float s;
|
||||
if (additive)
|
||||
s = 1 + (value - 1) * pose.getMixScaleX();
|
||||
else {
|
||||
s = MathUtil::sqrt(bone._a * bone._a + bone._c * bone._c);
|
||||
if (s != 0) s = 1 + (value / s - 1) * pose.getMixScaleX();
|
||||
}
|
||||
bone._a *= s;
|
||||
bone._c *= s;
|
||||
}
|
||||
}
|
||||
66
spine-cpp/spine-cpp/src/spine/ToScaleY.cpp
Normal file
66
spine-cpp/spine-cpp/src/spine/ToScaleY.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ToScaleY.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
#include <spine/BonePose.h>
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(ToScaleY, ToProperty)
|
||||
|
||||
ToScaleY::ToScaleY() {
|
||||
}
|
||||
|
||||
ToScaleY::~ToScaleY() {
|
||||
}
|
||||
|
||||
float ToScaleY::mix(TransformConstraintPose& pose) {
|
||||
return pose.getMixScaleY();
|
||||
}
|
||||
|
||||
void ToScaleY::apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) {
|
||||
if (local) {
|
||||
if (additive)
|
||||
bone.setScaleY(bone.getScaleY() * (1 + ((value - 1) * pose.getMixScaleY())));
|
||||
else if (bone.getScaleY() != 0)
|
||||
bone.setScaleY(1 + (value / bone.getScaleY() - 1) * pose.getMixScaleY());
|
||||
} else {
|
||||
float s;
|
||||
if (additive)
|
||||
s = 1 + (value - 1) * pose.getMixScaleY();
|
||||
else {
|
||||
s = MathUtil::sqrt(bone._b * bone._b + bone._d * bone._d);
|
||||
if (s != 0) s = 1 + (value / s - 1) * pose.getMixScaleY();
|
||||
}
|
||||
bone._b *= s;
|
||||
bone._d *= s;
|
||||
}
|
||||
}
|
||||
70
spine-cpp/spine-cpp/src/spine/ToShearY.cpp
Normal file
70
spine-cpp/spine-cpp/src/spine/ToShearY.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ToShearY.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
#include <spine/BonePose.h>
|
||||
#include <spine/MathUtil.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(ToShearY, ToProperty)
|
||||
|
||||
ToShearY::ToShearY() {
|
||||
}
|
||||
|
||||
ToShearY::~ToShearY() {
|
||||
}
|
||||
|
||||
float ToShearY::mix(TransformConstraintPose& pose) {
|
||||
return pose.getMixShearY();
|
||||
}
|
||||
|
||||
void ToShearY::apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) {
|
||||
if (local) {
|
||||
if (!additive) value -= bone.getShearY();
|
||||
bone.setShearY(bone.getShearY() + value * pose.getMixShearY());
|
||||
} else {
|
||||
float b = bone._b, d = bone._d, by = MathUtil::atan2(d, b);
|
||||
value = (value + 90) * MathUtil::Deg_Rad;
|
||||
if (additive)
|
||||
value -= MathUtil::Pi / 2;
|
||||
else {
|
||||
value -= by - MathUtil::atan2(bone._c, bone._a);
|
||||
if (value > MathUtil::Pi)
|
||||
value -= MathUtil::Pi * 2;
|
||||
else if (value < -MathUtil::Pi)
|
||||
value += MathUtil::Pi * 2;
|
||||
}
|
||||
value = by + value * pose.getMixShearY();
|
||||
float s = MathUtil::sqrt(b * b + d * d);
|
||||
bone._b = MathUtil::cos(value) * s;
|
||||
bone._d = MathUtil::sin(value) * s;
|
||||
}
|
||||
}
|
||||
56
spine-cpp/spine-cpp/src/spine/ToX.cpp
Normal file
56
spine-cpp/spine-cpp/src/spine/ToX.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ToX.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
#include <spine/BonePose.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(ToX, ToProperty)
|
||||
|
||||
ToX::ToX() {
|
||||
}
|
||||
|
||||
ToX::~ToX() {
|
||||
}
|
||||
|
||||
float ToX::mix(TransformConstraintPose& pose) {
|
||||
return pose.getMixX();
|
||||
}
|
||||
|
||||
void ToX::apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) {
|
||||
if (local) {
|
||||
if (!additive) value -= bone.getX();
|
||||
bone.setX(bone.getX() + value * pose.getMixX());
|
||||
} else {
|
||||
if (!additive) value -= bone.getWorldX();
|
||||
bone.setWorldX(bone.getWorldX() + value * pose.getMixX());
|
||||
}
|
||||
}
|
||||
56
spine-cpp/spine-cpp/src/spine/ToY.cpp
Normal file
56
spine-cpp/spine-cpp/src/spine/ToY.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "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 LLC 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
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <spine/ToY.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
#include <spine/BonePose.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
RTTI_IMPL(ToY, ToProperty)
|
||||
|
||||
ToY::ToY() {
|
||||
}
|
||||
|
||||
ToY::~ToY() {
|
||||
}
|
||||
|
||||
float ToY::mix(TransformConstraintPose& pose) {
|
||||
return pose.getMixY();
|
||||
}
|
||||
|
||||
void ToY::apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) {
|
||||
if (local) {
|
||||
if (!additive) value -= bone.getY();
|
||||
bone.setY(bone.getY() + value * pose.getMixY());
|
||||
} else {
|
||||
if (!additive) value -= bone.getWorldY();
|
||||
bone.setWorldY(bone.getWorldY() + value * pose.getMixY());
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user