mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[flutter] Add formatter pass.
This commit is contained in:
parent
78f603284b
commit
7c73988b42
@ -30,7 +30,9 @@ spotless {
|
|||||||
'spine-ue4/**/*.cpp',
|
'spine-ue4/**/*.cpp',
|
||||||
'spine-ue4/**/*.h',
|
'spine-ue4/**/*.h',
|
||||||
'spine-godot/spine_godot/*.cpp',
|
'spine-godot/spine_godot/*.cpp',
|
||||||
'spine-godot/spine_godot/*.h'
|
'spine-godot/spine_godot/*.h',
|
||||||
|
'spine-flutter/src/spine_flutter.cpp',
|
||||||
|
'spine-flutter/src/spine_flutter.h'
|
||||||
clangFormat("13.0.1").pathToExe("$System.env.CLANGFORMAT").style('file')
|
clangFormat("13.0.1").pathToExe("$System.env.CLANGFORMAT").style('file')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -154,11 +154,13 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY
|
|||||||
}
|
}
|
||||||
x = targetX - pp->_worldX;
|
x = targetX - pp->_worldX;
|
||||||
y = targetY - pp->_worldY;
|
y = targetY - pp->_worldY;
|
||||||
tx = (x * d - y * b) * id - px; ty = (y * a - x * c) * id - py;
|
tx = (x * d - y * b) * id - px;
|
||||||
|
ty = (y * a - x * c) * id - py;
|
||||||
dd = tx * tx + ty * ty;
|
dd = tx * tx + ty * ty;
|
||||||
if (softness != 0) {
|
if (softness != 0) {
|
||||||
softness *= psx * (csx + 1) * 0.5f;
|
softness *= psx * (csx + 1) * 0.5f;
|
||||||
td = MathUtil::sqrt(dd); sd = td - l1 - l2 * psx + softness;
|
td = MathUtil::sqrt(dd);
|
||||||
|
sd = td - l1 - l2 * psx + softness;
|
||||||
if (sd > 0) {
|
if (sd > 0) {
|
||||||
p = MathUtil::min(1.0f, sd / (softness * 2)) - 1;
|
p = MathUtil::min(1.0f, sd / (softness * 2)) - 1;
|
||||||
p = (sd - softness * (1 - p * p)) / td;
|
p = (sd - softness * (1 - p * p)) / td;
|
||||||
@ -188,7 +190,8 @@ void IkConstraint::apply(Bone &parent, Bone &child, float targetX, float targetY
|
|||||||
b = l2 * MathUtil::sin(a2);
|
b = l2 * MathUtil::sin(a2);
|
||||||
a1 = MathUtil::atan2(ty * a - tx * b, tx * a + ty * b);
|
a1 = MathUtil::atan2(ty * a - tx * b, tx * a + ty * b);
|
||||||
} else {
|
} else {
|
||||||
a = psx * l2; b = psy * l2;
|
a = psx * l2;
|
||||||
|
b = psy * l2;
|
||||||
float aa = a * a, bb = b * b, ll = l1 * l1, ta = MathUtil::atan2(ty, tx);
|
float aa = a * a, bb = b * b, ll = l1 * l1, ta = MathUtil::atan2(ty, tx);
|
||||||
float c0 = bb * ll + aa * dd - aa * bb, c1 = -2 * bb * l1, c2 = bb - aa;
|
float c0 = bb * ll + aa * dd - aa * bb, c1 = -2 * bb * l1, c2 = bb - aa;
|
||||||
d = c1 * c1 - 4 * c2 * c0;
|
d = c1 * c1 - 4 * c2 * c0;
|
||||||
|
|||||||
@ -4027,4 +4027,3 @@ void spine_texture_region_set_original_height(spine_texture_region textureRegion
|
|||||||
TextureRegion *_region = (TextureRegion *) textureRegion;
|
TextureRegion *_region = (TextureRegion *) textureRegion;
|
||||||
_region->originalHeight = originalHeight;
|
_region->originalHeight = originalHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SPINE_OPAQUE_TYPE(name) \
|
#define SPINE_OPAQUE_TYPE(name) \
|
||||||
typedef struct name##_wrapper {} name##_wrapper; \
|
typedef struct name##_wrapper { \
|
||||||
|
} name##_wrapper; \
|
||||||
typedef name##_wrapper *name;
|
typedef name##_wrapper *name;
|
||||||
|
|
||||||
SPINE_OPAQUE_TYPE(spine_skeleton)
|
SPINE_OPAQUE_TYPE(spine_skeleton)
|
||||||
@ -456,7 +457,6 @@ SPINE_FLUTTER_EXPORT void spine_slot_set_attachment(spine_slot slot, spine_attac
|
|||||||
SPINE_FLUTTER_EXPORT int32_t spine_slot_get_sequence_index(spine_slot slot);
|
SPINE_FLUTTER_EXPORT int32_t spine_slot_get_sequence_index(spine_slot slot);
|
||||||
SPINE_FLUTTER_EXPORT void spine_slot_set_sequence_index(spine_slot slot, int32_t sequenceIndex);
|
SPINE_FLUTTER_EXPORT void spine_slot_set_sequence_index(spine_slot slot, int32_t sequenceIndex);
|
||||||
|
|
||||||
|
|
||||||
SPINE_FLUTTER_EXPORT int32_t spine_bone_data_get_index(spine_bone_data data);
|
SPINE_FLUTTER_EXPORT int32_t spine_bone_data_get_index(spine_bone_data data);
|
||||||
SPINE_FLUTTER_EXPORT const utf8 *spine_bone_data_get_name(spine_bone_data data);
|
SPINE_FLUTTER_EXPORT const utf8 *spine_bone_data_get_name(spine_bone_data data);
|
||||||
SPINE_FLUTTER_EXPORT spine_bone_data spine_bone_data_get_parent(spine_bone_data data);
|
SPINE_FLUTTER_EXPORT spine_bone_data spine_bone_data_get_parent(spine_bone_data data);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user