mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
wip
This commit is contained in:
parent
b78c3680cd
commit
d67ac7120c
101
spine-cpp/spine-cpp/include/spine/BoneData.h
Normal file
101
spine-cpp/spine-cpp/include/spine/BoneData.h
Normal file
@ -0,0 +1,101 @@
|
||||
/******************************************************************************
|
||||
* 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_BoneData_h
|
||||
#define Spine_BoneData_h
|
||||
|
||||
#include <spine/TransformMode.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class BoneData
|
||||
{
|
||||
public:
|
||||
BoneData(int index, std::string name, BoneData* parent);
|
||||
|
||||
/// The index of the bone in Skeleton.Bones
|
||||
const int getIndex();
|
||||
|
||||
/// The name of the bone, which is unique within the skeleton.
|
||||
const std::string& getName();
|
||||
|
||||
/// May be null.
|
||||
const BoneData* getParent();
|
||||
|
||||
float getLength();
|
||||
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.
|
||||
TransformMode getTransformMode();
|
||||
void setTransformMode(TransformMode inValue);
|
||||
|
||||
private:
|
||||
const int _index;
|
||||
const std::string _name;
|
||||
const BoneData* _parent;
|
||||
float _length;
|
||||
float _x, _y, _rotation, _scaleX, _scaleY, _shearX, _shearY;
|
||||
TransformMode _transformMode;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream& os, const BoneData& ref);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_BoneData_h */
|
||||
78
spine-cpp/spine-cpp/include/spine/IkConstraintData.h
Normal file
78
spine-cpp/spine-cpp/include/spine/IkConstraintData.h
Normal file
@ -0,0 +1,78 @@
|
||||
/******************************************************************************
|
||||
* 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_IkConstraintData_h
|
||||
#define Spine_IkConstraintData_h
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
class BoneData;
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
class IkConstraintData
|
||||
{
|
||||
public:
|
||||
IkConstraintData(std::string name);
|
||||
|
||||
/// The IK constraint's name, which is unique within the skeleton.
|
||||
const std::string& getName();
|
||||
|
||||
int getOrder();
|
||||
void setOrder(int inValue);
|
||||
|
||||
/// The bones that are constrained by this IK Constraint.
|
||||
std::list<BoneData*>& getBones();
|
||||
|
||||
/// The bone that is the IK target.
|
||||
BoneData* getTarget();
|
||||
void setTarget(BoneData* inValue);
|
||||
|
||||
/// Controls the bend direction of the IK bones, either 1 or -1.
|
||||
int getBendDirection();
|
||||
void setBendDirection(int inValue);
|
||||
|
||||
float getMix();
|
||||
void setMix(float inValue);
|
||||
|
||||
private:
|
||||
const std::string _name;
|
||||
int _order;
|
||||
std::list<BoneData*> _bones;
|
||||
BoneData* _target;
|
||||
int _bendDirection;
|
||||
float _mix;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream& os, const IkConstraintData& ref);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_IkConstraintData_h */
|
||||
48
spine-cpp/spine-cpp/include/spine/TransformMode.h
Normal file
48
spine-cpp/spine-cpp/include/spine/TransformMode.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_TransformMode_h
|
||||
#define Spine_TransformMode_h
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
enum TransformMode
|
||||
{
|
||||
//0000 0 Flip Scale Rotation
|
||||
Normal = 0, // 0000
|
||||
OnlyTranslation = 7, // 0111
|
||||
NoRotationOrReflection = 1, // 0001
|
||||
NoScale = 2, // 0010
|
||||
NoScaleOrReflection = 6, // 0110
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* Spine_TransformMode_h */
|
||||
|
||||
165
spine-cpp/spine-cpp/src/spine/BoneData.cpp
Normal file
165
spine-cpp/spine-cpp/src/spine/BoneData.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/******************************************************************************
|
||||
* 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/BoneData.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
BoneData::BoneData(int index, std::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),
|
||||
_transformMode(TransformMode::Normal)
|
||||
{
|
||||
assert(index < 0);
|
||||
}
|
||||
|
||||
const int BoneData::getIndex()
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
const std::string& BoneData::getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
const BoneData* BoneData::getParent()
|
||||
{
|
||||
return _parent;
|
||||
}
|
||||
|
||||
float BoneData::getLength()
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
TransformMode BoneData::getTransformMode()
|
||||
{
|
||||
return _transformMode;
|
||||
}
|
||||
|
||||
void BoneData::setTransformMode(TransformMode inValue)
|
||||
{
|
||||
_transformMode = inValue;
|
||||
}
|
||||
|
||||
std::ostream& operator <<(std::ostream& os, const BoneData& ref)
|
||||
{
|
||||
os << ref._name;
|
||||
|
||||
return os;
|
||||
}
|
||||
}
|
||||
101
spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp
Normal file
101
spine-cpp/spine-cpp/src/spine/IkConstraintData.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
/******************************************************************************
|
||||
* 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/IkConstraintData.h>
|
||||
|
||||
namespace Spine
|
||||
{
|
||||
IkConstraintData::IkConstraintData(std::string name) :
|
||||
_name(name),
|
||||
_order(0),
|
||||
_target(nullptr),
|
||||
_bendDirection(1),
|
||||
_mix(1)
|
||||
{
|
||||
// Empty
|
||||
}
|
||||
|
||||
const std::string& IkConstraintData::getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
int IkConstraintData::getOrder()
|
||||
{
|
||||
return _order;
|
||||
}
|
||||
|
||||
void IkConstraintData::setOrder(int inValue)
|
||||
{
|
||||
_order = inValue;
|
||||
}
|
||||
|
||||
std::list<BoneData*>& IkConstraintData::getBones()
|
||||
{
|
||||
return _bones;
|
||||
}
|
||||
|
||||
BoneData* IkConstraintData::getTarget()
|
||||
{
|
||||
return _target;
|
||||
}
|
||||
|
||||
void IkConstraintData::setTarget(BoneData* inValue)
|
||||
{
|
||||
_target = inValue;
|
||||
}
|
||||
|
||||
int IkConstraintData::getBendDirection()
|
||||
{
|
||||
return _bendDirection;
|
||||
}
|
||||
|
||||
void IkConstraintData::setBendDirection(int inValue)
|
||||
{
|
||||
_bendDirection = inValue;
|
||||
}
|
||||
|
||||
float IkConstraintData::getMix()
|
||||
{
|
||||
return _mix;
|
||||
}
|
||||
|
||||
void IkConstraintData::setMix(float inValue)
|
||||
{
|
||||
_mix = inValue;
|
||||
}
|
||||
|
||||
std::ostream& operator <<(std::ostream& os, const IkConstraintData& ref)
|
||||
{
|
||||
os << ref._name;
|
||||
|
||||
return os;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user