mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
Merge branch '4.1' into 4.2-beta
# Conflicts: # spine-cocos2dx/spine-cocos2dx/src/spine/SkeletonRenderer.cpp
This commit is contained in:
commit
329f5b404f
4
.gitignore
vendored
4
.gitignore
vendored
@ -188,3 +188,7 @@ spine-godot/.clang-format
|
||||
spine-ts/spine-phaser/dist
|
||||
spine-godot/.cache
|
||||
spine-godot/build/compile_commands.json
|
||||
|
||||
spine-flutter/ios/Classes/spine-cpp
|
||||
spine-flutter/macos/Classes/spine-cpp
|
||||
spine-flutter/src/spine-cpp
|
||||
@ -89,6 +89,7 @@
|
||||
* Added CMake parameter `SPINE_SANITIZE` which will enable sanitizers on macOS and Linux.
|
||||
* Added `SPINE_MAJOR_VERSION`, `SPINE_MINOR_VERSION`, and `SPINE_VERSION_STRING`. Parsing skeleton .JSON and .skel files will report an error if the skeleton version does not match the runtime version.
|
||||
* **Breaking changes**
|
||||
* `RegionAttachment` and `MeshAttachment` no longer implement `HasRendererObject`.
|
||||
* `RegionAttachment` and `MeshAttachment` now contain a `TextureRegion*` instead of encoding region fields directly.
|
||||
* `AttachmentLoader::newRegionAttachment()` and `AttachmentLoader::newMeshAttachment()` now take an additional `Sequence*` parameter.
|
||||
* `MeshAttachment::updateUVs()` was renamed to `MeshAttachment::updateRegion()`.
|
||||
@ -97,7 +98,7 @@
|
||||
* `VertexAttachment::getDeformAttachment()` was renamed to `VertexAttachment::getTimelineAttachment()`.
|
||||
* `Skeleton::update()` has been removed.
|
||||
* `Skeleton::getTime()` has been removed.
|
||||
* `VertexEffect` has been removed.
|
||||
* `VertexEffect` has been removed.
|
||||
|
||||
### Cocos2d-x
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@ namespace spine {
|
||||
Color darkColor;
|
||||
const float darkPremultipliedAlpha = _premultipliedAlpha ? 1.f : 0;
|
||||
TwoColorTrianglesCommand *lastTwoColorTrianglesCommand = nullptr;
|
||||
for (int i = 0, n = _skeleton->getSlots().size(); i < n; ++i) {
|
||||
for (int i = 0, n = (int)_skeleton->getSlots().size(); i < n; ++i) {
|
||||
Slot *slot = _skeleton->getDrawOrder()[i];
|
||||
|
||||
if (nothingToDraw(*slot, _startSlotIndex, _endSlotIndex)) {
|
||||
@ -284,7 +284,7 @@ namespace spine {
|
||||
|
||||
if (slot->getAttachment()->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||
RegionAttachment *attachment = static_cast<RegionAttachment *>(slot->getAttachment());
|
||||
texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->texture;
|
||||
texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->texture;
|
||||
|
||||
float *dstTriangleVertices = nullptr;
|
||||
int dstStride = 0;// in floats
|
||||
@ -322,7 +322,7 @@ namespace spine {
|
||||
color = attachment->getColor();
|
||||
} else if (slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) {
|
||||
MeshAttachment *attachment = (MeshAttachment *) slot->getAttachment();
|
||||
texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->texture;
|
||||
texture = (Texture2D*)((AtlasRegion*)attachment->getRegion())->page->texture;
|
||||
|
||||
float *dstTriangleVertices = nullptr;
|
||||
int dstStride = 0;// in floats
|
||||
@ -330,8 +330,8 @@ namespace spine {
|
||||
if (hasSingleTint) {
|
||||
triangles.indices = attachment->getTriangles().buffer();
|
||||
triangles.indexCount = (unsigned short)attachment->getTriangles().size();
|
||||
triangles.verts = batch->allocateVertices(attachment->getWorldVerticesLength() / 2);
|
||||
triangles.vertCount = attachment->getWorldVerticesLength() / 2;
|
||||
triangles.verts = batch->allocateVertices((int)attachment->getWorldVerticesLength() / 2);
|
||||
triangles.vertCount = (int)attachment->getWorldVerticesLength() / 2;
|
||||
for (int v = 0, i = 0; v < triangles.vertCount; v++, i += 2) {
|
||||
auto &texCoords = triangles.verts[v].texCoords;
|
||||
texCoords.u = attachment->getUVs()[i];
|
||||
@ -343,8 +343,8 @@ namespace spine {
|
||||
} else {
|
||||
trianglesTwoColor.indices = attachment->getTriangles().buffer();
|
||||
trianglesTwoColor.indexCount = (unsigned short)attachment->getTriangles().size();
|
||||
trianglesTwoColor.verts = twoColorBatch->allocateVertices(attachment->getWorldVerticesLength() / 2);
|
||||
trianglesTwoColor.vertCount = attachment->getWorldVerticesLength() / 2;
|
||||
trianglesTwoColor.verts = twoColorBatch->allocateVertices((int)attachment->getWorldVerticesLength() / 2);
|
||||
trianglesTwoColor.vertCount = (int)attachment->getWorldVerticesLength() / 2;
|
||||
for (int v = 0, i = 0; v < trianglesTwoColor.vertCount; v++, i += 2) {
|
||||
auto &texCoords = trianglesTwoColor.verts[v].texCoords;
|
||||
texCoords.u = attachment->getUVs()[i];
|
||||
@ -408,9 +408,9 @@ namespace spine {
|
||||
continue;
|
||||
}
|
||||
|
||||
triangles.vertCount = _clipper->getClippedVertices().size() / 2;
|
||||
triangles.vertCount = (int)_clipper->getClippedVertices().size() / 2;
|
||||
triangles.verts = batch->allocateVertices(triangles.vertCount);
|
||||
triangles.indexCount = _clipper->getClippedTriangles().size();
|
||||
triangles.indexCount = (int)_clipper->getClippedTriangles().size();
|
||||
triangles.indices = batch->allocateIndices(triangles.indexCount);
|
||||
memcpy(triangles.indices, _clipper->getClippedTriangles().buffer(), sizeof(unsigned short) * _clipper->getClippedTriangles().size());
|
||||
|
||||
@ -454,9 +454,9 @@ namespace spine {
|
||||
continue;
|
||||
}
|
||||
|
||||
trianglesTwoColor.vertCount = _clipper->getClippedVertices().size() / 2;
|
||||
trianglesTwoColor.vertCount = (int)_clipper->getClippedVertices().size() / 2;
|
||||
trianglesTwoColor.verts = twoColorBatch->allocateVertices(trianglesTwoColor.vertCount);
|
||||
trianglesTwoColor.indexCount = _clipper->getClippedTriangles().size();
|
||||
trianglesTwoColor.indexCount = (int)_clipper->getClippedTriangles().size();
|
||||
trianglesTwoColor.indices = twoColorBatch->allocateIndices(trianglesTwoColor.indexCount);
|
||||
memcpy(trianglesTwoColor.indices, _clipper->getClippedTriangles().buffer(), sizeof(unsigned short) * _clipper->getClippedTriangles().size());
|
||||
|
||||
@ -576,7 +576,7 @@ namespace spine {
|
||||
drawNode->setLineWidth(2.0f);
|
||||
#endif
|
||||
V3F_C4B_T2F_Quad quad;
|
||||
for (int i = 0, n = _skeleton->getSlots().size(); i < n; i++) {
|
||||
for (int i = 0, n = (int)_skeleton->getSlots().size(); i < n; i++) {
|
||||
Slot *slot = _skeleton->getDrawOrder()[i];
|
||||
|
||||
if (!slot->getBone().isActive()) continue;
|
||||
@ -606,7 +606,7 @@ namespace spine {
|
||||
#else
|
||||
drawNode->setLineWidth(2.0f);
|
||||
#endif
|
||||
for (int i = 0, n = _skeleton->getBones().size(); i < n; i++) {
|
||||
for (int i = 0, n = (int)_skeleton->getBones().size(); i < n; i++) {
|
||||
Bone *bone = _skeleton->getBones()[i];
|
||||
if (!bone->isActive()) continue;
|
||||
float x = bone->getData().getLength() * bone->getA() + bone->getWorldX();
|
||||
@ -615,7 +615,7 @@ namespace spine {
|
||||
}
|
||||
// Bone origins.
|
||||
auto color = Color4F::BLUE;// Root bone is blue.
|
||||
for (int i = 0, n = _skeleton->getBones().size(); i < n; i++) {
|
||||
for (int i = 0, n = (int)_skeleton->getBones().size(); i < n; i++) {
|
||||
Bone *bone = _skeleton->getBones()[i];
|
||||
if (!bone->isActive()) continue;
|
||||
drawNode->drawPoint(Vec2(bone->getWorldX(), bone->getWorldY()), 4, color);
|
||||
@ -630,7 +630,7 @@ namespace spine {
|
||||
#else
|
||||
drawNode->setLineWidth(2.0f);
|
||||
#endif
|
||||
for (int i = 0, n = _skeleton->getSlots().size(); i < n; ++i) {
|
||||
for (int i = 0, n = (int)_skeleton->getSlots().size(); i < n; ++i) {
|
||||
Slot *slot = _skeleton->getDrawOrder()[i];
|
||||
if (!slot->getBone().isActive()) continue;
|
||||
if (!slot->getAttachment() || !slot->getAttachment()->getRTTI().isExactly(MeshAttachment::rtti)) continue;
|
||||
|
||||
@ -132,7 +132,7 @@ namespace spine {
|
||||
unsigned short *SkeletonBatch::allocateIndices(uint32_t numIndices) {
|
||||
if (_indices.getCapacity() - _indices.size() < numIndices) {
|
||||
unsigned short *oldData = _indices.buffer();
|
||||
int oldSize = _indices.size();
|
||||
int oldSize = (int)_indices.size();
|
||||
_indices.ensureCapacity(_indices.size() + numIndices);
|
||||
unsigned short *newData = _indices.buffer();
|
||||
for (uint32_t i = 0; i < this->_nextFreeCommand; i++) {
|
||||
@ -187,8 +187,8 @@ namespace spine {
|
||||
|
||||
cocos2d::TrianglesCommand *SkeletonBatch::nextFreeCommand() {
|
||||
if (_commandsPool.size() <= _nextFreeCommand) {
|
||||
unsigned int newSize = _commandsPool.size() * 2 + 1;
|
||||
for (int i = _commandsPool.size(); i < newSize; i++) {
|
||||
unsigned int newSize = (int)_commandsPool.size() * 2 + 1;
|
||||
for (int i = (int)_commandsPool.size(); i < newSize; i++) {
|
||||
_commandsPool.push_back(createNewTrianglesCommand());
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ namespace spine {
|
||||
unsigned short *SkeletonTwoColorBatch::allocateIndices(uint32_t numIndices) {
|
||||
if (_indices.getCapacity() - _indices.size() < numIndices) {
|
||||
unsigned short *oldData = _indices.buffer();
|
||||
int oldSize = _indices.size();
|
||||
int oldSize = (int)_indices.size();
|
||||
_indices.ensureCapacity(_indices.size() + numIndices);
|
||||
unsigned short *newData = _indices.buffer();
|
||||
for (uint32_t i = 0; i < this->_nextFreeCommand; i++) {
|
||||
@ -406,8 +406,8 @@ namespace spine {
|
||||
|
||||
TwoColorTrianglesCommand *SkeletonTwoColorBatch::nextFreeCommand() {
|
||||
if (_commandsPool.size() <= _nextFreeCommand) {
|
||||
unsigned int newSize = _commandsPool.size() * 2 + 1;
|
||||
for (int i = _commandsPool.size(); i < newSize; i++) {
|
||||
unsigned int newSize = (int)_commandsPool.size() * 2 + 1;
|
||||
for (int i = (int)_commandsPool.size(); i < newSize; i++) {
|
||||
_commandsPool.push_back(new TwoColorTrianglesCommand());
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
namespace spine {
|
||||
/// Attachment that displays a texture region using a mesh.
|
||||
class SP_API MeshAttachment : public VertexAttachment, public HasRendererObject {
|
||||
class SP_API MeshAttachment : public VertexAttachment {
|
||||
friend class SkeletonBinary;
|
||||
|
||||
friend class SkeletonJson;
|
||||
|
||||
@ -44,7 +44,7 @@ namespace spine {
|
||||
class Bone;
|
||||
|
||||
/// Attachment that displays a texture region.
|
||||
class SP_API RegionAttachment : public Attachment, public HasRendererObject {
|
||||
class SP_API RegionAttachment : public Attachment {
|
||||
friend class SkeletonBinary;
|
||||
|
||||
friend class SkeletonJson;
|
||||
|
||||
@ -34,7 +34,7 @@ using namespace spine;
|
||||
|
||||
RTTI_IMPL(MeshAttachment, VertexAttachment)
|
||||
|
||||
MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name), HasRendererObject(),
|
||||
MeshAttachment::MeshAttachment(const String &name) : VertexAttachment(name),
|
||||
_parentMesh(NULL),
|
||||
_path(),
|
||||
_color(1, 1, 1, 1),
|
||||
|
||||
@ -47,7 +47,7 @@ const int RegionAttachment::URY = 5;
|
||||
const int RegionAttachment::BRX = 6;
|
||||
const int RegionAttachment::BRY = 7;
|
||||
|
||||
RegionAttachment::RegionAttachment(const String &name) : Attachment(name), HasRendererObject(),
|
||||
RegionAttachment::RegionAttachment(const String &name) : Attachment(name),
|
||||
_x(0),
|
||||
_y(0),
|
||||
_rotation(0),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user