mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
[cpp] 4.3 porting WIP
This commit is contained in:
parent
0f5cc0b766
commit
5fe90b456f
@ -30,13 +30,15 @@
|
||||
#ifndef Spine_BoneData_h
|
||||
#define Spine_BoneData_h
|
||||
|
||||
#include <spine/Inherit.h>
|
||||
#include <spine/SpineObject.h>
|
||||
#include <spine/PosedData.h>
|
||||
#include <spine/BoneLocal.h>
|
||||
#include <spine/SpineString.h>
|
||||
#include <spine/Color.h>
|
||||
#include <spine/RTTI.h>
|
||||
|
||||
namespace spine {
|
||||
class SP_API BoneData : public SpineObject {
|
||||
class SP_API BoneData : public PosedData<BoneLocal> {
|
||||
RTTI_DECL
|
||||
friend class SkeletonBinary;
|
||||
|
||||
friend class SkeletonJson;
|
||||
@ -69,9 +71,6 @@ namespace spine {
|
||||
/// The index of the bone in Skeleton.Bones
|
||||
int getIndex();
|
||||
|
||||
/// The name of the bone, which is unique within the skeleton.
|
||||
const String &getName();
|
||||
|
||||
/// May be NULL.
|
||||
BoneData *getParent();
|
||||
|
||||
@ -79,71 +78,23 @@ namespace spine {
|
||||
|
||||
void setLength(float inValue);
|
||||
|
||||
/// Local X translation.
|
||||
float getX();
|
||||
|
||||
void setX(float inValue);
|
||||
|
||||
/// Local Y translation.
|
||||
float getY();
|
||||
|
||||
void setY(float inValue);
|
||||
|
||||
/// Local rotation.
|
||||
float getRotation();
|
||||
|
||||
void setRotation(float inValue);
|
||||
|
||||
/// Local scaleX.
|
||||
float getScaleX();
|
||||
|
||||
void setScaleX(float inValue);
|
||||
|
||||
/// Local scaleY.
|
||||
float getScaleY();
|
||||
|
||||
void setScaleY(float inValue);
|
||||
|
||||
/// Local shearX.
|
||||
float getShearX();
|
||||
|
||||
void setShearX(float inValue);
|
||||
|
||||
/// Local shearY.
|
||||
float getShearY();
|
||||
|
||||
void setShearY(float inValue);
|
||||
|
||||
/// The transform mode for how parent world transforms affect this bone.
|
||||
Inherit getInherit();
|
||||
|
||||
void setInherit(Inherit inValue);
|
||||
|
||||
bool isSkinRequired();
|
||||
|
||||
void setSkinRequired(bool inValue);
|
||||
|
||||
Color &getColor();
|
||||
|
||||
const String &getIcon();
|
||||
const String &getIcon();
|
||||
|
||||
void setIcon(const String &icon);
|
||||
void setIcon(const String &icon);
|
||||
|
||||
bool isVisible();
|
||||
bool isVisible();
|
||||
|
||||
void setVisible(bool inValue);
|
||||
void setVisible(bool inValue);
|
||||
|
||||
private:
|
||||
const int _index;
|
||||
const String _name;
|
||||
BoneData *_parent;
|
||||
float _length;
|
||||
float _x, _y, _rotation, _scaleX, _scaleY, _shearX, _shearY;
|
||||
Inherit _inherit;
|
||||
bool _skinRequired;
|
||||
Color _color;
|
||||
String _icon;
|
||||
bool _visible;
|
||||
String _icon;
|
||||
bool _visible;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -70,6 +70,7 @@ namespace spine {
|
||||
|
||||
template<class P>
|
||||
PosedData<P>::~PosedData() {
|
||||
delete _setup;
|
||||
}
|
||||
|
||||
template<class P>
|
||||
|
||||
62
spine-cpp/spine-cpp/include/spine/ToProperty.h
Normal file
62
spine-cpp/spine-cpp/include/spine/ToProperty.h
Normal file
@ -0,0 +1,62 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated July 28, 2023. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2023, 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_TOPROPERTY_H_
|
||||
#define SPINE_TOPROPERTY_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
|
||||
namespace spine {
|
||||
class TransformConstraintPose;
|
||||
class BonePose;
|
||||
|
||||
/// Constrained property for a TransformConstraint.
|
||||
class SP_API ToProperty {
|
||||
public:
|
||||
ToProperty();
|
||||
virtual ~ToProperty();
|
||||
|
||||
/// The value of this property that corresponds to FromProperty::offset.
|
||||
float offset;
|
||||
|
||||
/// The maximum value of this property when TransformConstraintData::clamp clamped.
|
||||
float max;
|
||||
|
||||
/// The scale of the FromProperty value in relation to this property.
|
||||
float scale;
|
||||
|
||||
/// Reads the mix for this property from the specified pose.
|
||||
virtual float mix(TransformConstraintPose& pose) = 0;
|
||||
|
||||
/// Applies the value to this property.
|
||||
virtual void apply(TransformConstraintPose& pose, BonePose& bone, float value, bool local, bool additive) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* SPINE_TOPROPERTY_H_ */
|
||||
@ -123,6 +123,7 @@
|
||||
#include <spine/SpineString.h>
|
||||
#include <spine/TextureLoader.h>
|
||||
#include <spine/Timeline.h>
|
||||
#include <spine/ToProperty.h>
|
||||
#include <spine/TransformConstraint.h>
|
||||
#include <spine/TransformConstraintData.h>
|
||||
#include <spine/TransformConstraintPose.h>
|
||||
|
||||
@ -33,34 +33,22 @@
|
||||
|
||||
using namespace spine;
|
||||
|
||||
BoneData::BoneData(int index, const String &name, BoneData *parent) : _index(index),
|
||||
_name(name),
|
||||
_parent(parent),
|
||||
_length(0),
|
||||
_x(0),
|
||||
_y(0),
|
||||
_rotation(0),
|
||||
_scaleX(1),
|
||||
_scaleY(1),
|
||||
_shearX(0),
|
||||
_shearY(0),
|
||||
_inherit(Inherit_Normal),
|
||||
_skinRequired(false),
|
||||
_color(),
|
||||
_icon(),
|
||||
_visible(true) {
|
||||
RTTI_IMPL_NOPARENT(BoneData)
|
||||
|
||||
BoneData::BoneData(int index, const String &name, BoneData *parent) : PosedData<BoneLocal>(name, new (__FILE__, __LINE__) BoneLocal()),
|
||||
_index(index),
|
||||
_parent(parent),
|
||||
_length(0),
|
||||
_color(0.61f, 0.61f, 0.61f, 1.0f),
|
||||
_icon(),
|
||||
_visible(true) {
|
||||
assert(index >= 0);
|
||||
assert(_name.length() > 0);
|
||||
}
|
||||
|
||||
int BoneData::getIndex() {
|
||||
return _index;
|
||||
}
|
||||
|
||||
const String &BoneData::getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
BoneData *BoneData::getParent() {
|
||||
return _parent;
|
||||
}
|
||||
@ -73,78 +61,6 @@ void BoneData::setLength(float inValue) {
|
||||
_length = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getX() {
|
||||
return _x;
|
||||
}
|
||||
|
||||
void BoneData::setX(float inValue) {
|
||||
_x = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getY() {
|
||||
return _y;
|
||||
}
|
||||
|
||||
void BoneData::setY(float inValue) {
|
||||
_y = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getRotation() {
|
||||
return _rotation;
|
||||
}
|
||||
|
||||
void BoneData::setRotation(float inValue) {
|
||||
_rotation = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getScaleX() {
|
||||
return _scaleX;
|
||||
}
|
||||
|
||||
void BoneData::setScaleX(float inValue) {
|
||||
_scaleX = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getScaleY() {
|
||||
return _scaleY;
|
||||
}
|
||||
|
||||
void BoneData::setScaleY(float inValue) {
|
||||
_scaleY = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getShearX() {
|
||||
return _shearX;
|
||||
}
|
||||
|
||||
void BoneData::setShearX(float inValue) {
|
||||
_shearX = inValue;
|
||||
}
|
||||
|
||||
float BoneData::getShearY() {
|
||||
return _shearY;
|
||||
}
|
||||
|
||||
void BoneData::setShearY(float inValue) {
|
||||
_shearY = inValue;
|
||||
}
|
||||
|
||||
Inherit BoneData::getInherit() {
|
||||
return _inherit;
|
||||
}
|
||||
|
||||
void BoneData::setInherit(Inherit inValue) {
|
||||
_inherit = inValue;
|
||||
}
|
||||
|
||||
bool BoneData::isSkinRequired() {
|
||||
return _skinRequired;
|
||||
}
|
||||
|
||||
void BoneData::setSkinRequired(bool inValue) {
|
||||
_skinRequired = inValue;
|
||||
}
|
||||
|
||||
Color &BoneData::getColor() {
|
||||
return _color;
|
||||
}
|
||||
@ -163,4 +79,4 @@ bool BoneData::isVisible() {
|
||||
|
||||
void BoneData::setVisible(bool inValue) {
|
||||
this->_visible = inValue;
|
||||
}
|
||||
}
|
||||
38
spine-cpp/spine-cpp/src/spine/ToProperty.cpp
Normal file
38
spine-cpp/spine-cpp/src/spine/ToProperty.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated July 28, 2023. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2023, 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/ToProperty.h>
|
||||
|
||||
using namespace spine;
|
||||
|
||||
ToProperty::ToProperty() : offset(0), max(0), scale(1) {
|
||||
}
|
||||
|
||||
ToProperty::~ToProperty() {
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user