|
@@ -135,7 +135,7 @@ typedef struct _spine_render_command {
|
|
float *positions;
|
|
float *positions;
|
|
float *uvs;
|
|
float *uvs;
|
|
int32_t *colors;
|
|
int32_t *colors;
|
|
- int32_t *darkColors;
|
|
|
|
|
|
+ int32_t *darkColors;
|
|
int32_t numVertices;
|
|
int32_t numVertices;
|
|
uint16_t *indices;
|
|
uint16_t *indices;
|
|
int32_t numIndices;
|
|
int32_t numIndices;
|
|
@@ -654,7 +654,7 @@ static _spine_render_command *spine_render_command_create(BlockAllocator &alloca
|
|
cmd->positions = allocator.allocate<float>(numVertices << 1);
|
|
cmd->positions = allocator.allocate<float>(numVertices << 1);
|
|
cmd->uvs = allocator.allocate<float>(numVertices << 1);
|
|
cmd->uvs = allocator.allocate<float>(numVertices << 1);
|
|
cmd->colors = allocator.allocate<int32_t>(numVertices);
|
|
cmd->colors = allocator.allocate<int32_t>(numVertices);
|
|
- cmd->darkColors = allocator.allocate<int32_t>(numVertices);
|
|
|
|
|
|
+ cmd->darkColors = allocator.allocate<int32_t>(numVertices);
|
|
cmd->numVertices = numVertices;
|
|
cmd->numVertices = numVertices;
|
|
cmd->indices = allocator.allocate<uint16_t>(numIndices);
|
|
cmd->indices = allocator.allocate<uint16_t>(numIndices);
|
|
cmd->numIndices = numIndices;
|
|
cmd->numIndices = numIndices;
|
|
@@ -699,7 +699,7 @@ static _spine_render_command *batch_sub_commands(BlockAllocator &allocator, Vect
|
|
float *positions = batched->positions;
|
|
float *positions = batched->positions;
|
|
float *uvs = batched->uvs;
|
|
float *uvs = batched->uvs;
|
|
int32_t *colors = batched->colors;
|
|
int32_t *colors = batched->colors;
|
|
- int32_t *darkColors = batched->darkColors;
|
|
|
|
|
|
+ int32_t *darkColors = batched->darkColors;
|
|
uint16_t *indices = batched->indices;
|
|
uint16_t *indices = batched->indices;
|
|
int indicesOffset = 0;
|
|
int indicesOffset = 0;
|
|
for (int i = first; i <= last; i++) {
|
|
for (int i = first; i <= last; i++) {
|
|
@@ -707,14 +707,14 @@ static _spine_render_command *batch_sub_commands(BlockAllocator &allocator, Vect
|
|
memcpy(positions, cmd->positions, sizeof(float) * 2 * cmd->numVertices);
|
|
memcpy(positions, cmd->positions, sizeof(float) * 2 * cmd->numVertices);
|
|
memcpy(uvs, cmd->uvs, sizeof(float) * 2 * cmd->numVertices);
|
|
memcpy(uvs, cmd->uvs, sizeof(float) * 2 * cmd->numVertices);
|
|
memcpy(colors, cmd->colors, sizeof(int32_t) * cmd->numVertices);
|
|
memcpy(colors, cmd->colors, sizeof(int32_t) * cmd->numVertices);
|
|
- memcpy(darkColors, cmd->darkColors, sizeof(int32_t) * cmd->numVertices);
|
|
|
|
|
|
+ memcpy(darkColors, cmd->darkColors, sizeof(int32_t) * cmd->numVertices);
|
|
for (int ii = 0; ii < cmd->numIndices; ii++)
|
|
for (int ii = 0; ii < cmd->numIndices; ii++)
|
|
indices[ii] = cmd->indices[ii] + indicesOffset;
|
|
indices[ii] = cmd->indices[ii] + indicesOffset;
|
|
indicesOffset += cmd->numVertices;
|
|
indicesOffset += cmd->numVertices;
|
|
positions += 2 * cmd->numVertices;
|
|
positions += 2 * cmd->numVertices;
|
|
uvs += 2 * cmd->numVertices;
|
|
uvs += 2 * cmd->numVertices;
|
|
colors += cmd->numVertices;
|
|
colors += cmd->numVertices;
|
|
- darkColors += cmd->numVertices;
|
|
|
|
|
|
+ darkColors += cmd->numVertices;
|
|
indices += cmd->numIndices;
|
|
indices += cmd->numIndices;
|
|
}
|
|
}
|
|
return batched;
|
|
return batched;
|
|
@@ -734,15 +734,15 @@ static _spine_render_command *batch_commands(BlockAllocator &allocator, Vector<_
|
|
while (i <= (int) commands.size()) {
|
|
while (i <= (int) commands.size()) {
|
|
_spine_render_command *cmd = i < (int) commands.size() ? commands[i] : nullptr;
|
|
_spine_render_command *cmd = i < (int) commands.size() ? commands[i] : nullptr;
|
|
|
|
|
|
- if (cmd && cmd->numVertices == 0 && cmd->numIndices == 0) {
|
|
|
|
- i++;
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ if (cmd && cmd->numVertices == 0 && cmd->numIndices == 0) {
|
|
|
|
+ i++;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
if (cmd != nullptr && cmd->atlasPage == first->atlasPage &&
|
|
if (cmd != nullptr && cmd->atlasPage == first->atlasPage &&
|
|
cmd->blendMode == first->blendMode &&
|
|
cmd->blendMode == first->blendMode &&
|
|
cmd->colors[0] == first->colors[0] &&
|
|
cmd->colors[0] == first->colors[0] &&
|
|
- cmd->darkColors[0] == first->darkColors[0] &&
|
|
|
|
|
|
+ cmd->darkColors[0] == first->darkColors[0] &&
|
|
numIndices + cmd->numIndices < 0xffff) {
|
|
numIndices + cmd->numIndices < 0xffff) {
|
|
numVertices += cmd->numVertices;
|
|
numVertices += cmd->numVertices;
|
|
numIndices += cmd->numIndices;
|
|
numIndices += cmd->numIndices;
|
|
@@ -848,11 +848,11 @@ spine_render_command spine_skeleton_drawable_render(spine_skeleton_drawable draw
|
|
uint8_t b = static_cast<uint8_t>(skeleton->getColor().b * slot.getColor().b * attachmentColor->b * 255);
|
|
uint8_t b = static_cast<uint8_t>(skeleton->getColor().b * slot.getColor().b * attachmentColor->b * 255);
|
|
uint8_t a = static_cast<uint8_t>(skeleton->getColor().a * slot.getColor().a * attachmentColor->a * 255);
|
|
uint8_t a = static_cast<uint8_t>(skeleton->getColor().a * slot.getColor().a * attachmentColor->a * 255);
|
|
uint32_t color = (a << 24) | (r << 16) | (g << 8) | b;
|
|
uint32_t color = (a << 24) | (r << 16) | (g << 8) | b;
|
|
- uint32_t darkColor = 0xff000000;
|
|
|
|
- if (slot.hasDarkColor()) {
|
|
|
|
- Color &slotDarkColor = slot.getDarkColor();
|
|
|
|
- darkColor = 0xff000000 | (static_cast<uint8_t>(slotDarkColor.r * 255) << 16)| (static_cast<uint8_t>(slotDarkColor.g * 255) << 8)| static_cast<uint8_t>(slotDarkColor.b * 255);
|
|
|
|
- }
|
|
|
|
|
|
+ uint32_t darkColor = 0xff000000;
|
|
|
|
+ if (slot.hasDarkColor()) {
|
|
|
|
+ Color &slotDarkColor = slot.getDarkColor();
|
|
|
|
+ darkColor = 0xff000000 | (static_cast<uint8_t>(slotDarkColor.r * 255) << 16) | (static_cast<uint8_t>(slotDarkColor.g * 255) << 8) | static_cast<uint8_t>(slotDarkColor.b * 255);
|
|
|
|
+ }
|
|
|
|
|
|
if (clipper.isClipping()) {
|
|
if (clipper.isClipping()) {
|
|
clipper.clipTriangles(*worldVertices, *indices, *uvs, 2);
|
|
clipper.clipTriangles(*worldVertices, *indices, *uvs, 2);
|
|
@@ -868,9 +868,9 @@ spine_render_command spine_skeleton_drawable_render(spine_skeleton_drawable draw
|
|
memcpy(cmd->positions, vertices->buffer(), (verticesCount << 1) * sizeof(float));
|
|
memcpy(cmd->positions, vertices->buffer(), (verticesCount << 1) * sizeof(float));
|
|
memcpy(cmd->uvs, uvs->buffer(), (verticesCount << 1) * sizeof(float));
|
|
memcpy(cmd->uvs, uvs->buffer(), (verticesCount << 1) * sizeof(float));
|
|
for (int ii = 0; ii < verticesCount; ii++) {
|
|
for (int ii = 0; ii < verticesCount; ii++) {
|
|
- cmd->colors[ii] = color;
|
|
|
|
- cmd->darkColors[ii] = darkColor;
|
|
|
|
- }
|
|
|
|
|
|
+ cmd->colors[ii] = color;
|
|
|
|
+ cmd->darkColors[ii] = darkColor;
|
|
|
|
+ }
|
|
memcpy(cmd->indices, indices->buffer(), indices->size() * sizeof(uint16_t));
|
|
memcpy(cmd->indices, indices->buffer(), indices->size() * sizeof(uint16_t));
|
|
clipper.clipEnd(slot);
|
|
clipper.clipEnd(slot);
|
|
}
|
|
}
|
|
@@ -916,8 +916,8 @@ int32_t *spine_render_command_get_colors(spine_render_command command) {
|
|
}
|
|
}
|
|
|
|
|
|
int32_t *spine_render_command_get_dark_colors(spine_render_command command) {
|
|
int32_t *spine_render_command_get_dark_colors(spine_render_command command) {
|
|
- if (!command) return nullptr;
|
|
|
|
- return ((_spine_render_command *) command)->darkColors;
|
|
|
|
|
|
+ if (!command) return nullptr;
|
|
|
|
+ return ((_spine_render_command *) command)->darkColors;
|
|
}
|
|
}
|
|
|
|
|
|
int32_t spine_render_command_get_num_vertices(spine_render_command command) {
|
|
int32_t spine_render_command_get_num_vertices(spine_render_command command) {
|
|
@@ -1448,15 +1448,15 @@ float spine_track_entry_get_track_complete(spine_track_entry entry) {
|
|
}
|
|
}
|
|
|
|
|
|
spine_bool spine_track_entry_was_applied(spine_track_entry entry) {
|
|
spine_bool spine_track_entry_was_applied(spine_track_entry entry) {
|
|
- if (entry == nullptr) return false;
|
|
|
|
- TrackEntry *_entry = (TrackEntry *) entry;
|
|
|
|
- return _entry->wasApplied();
|
|
|
|
|
|
+ if (entry == nullptr) return false;
|
|
|
|
+ TrackEntry *_entry = (TrackEntry *) entry;
|
|
|
|
+ return _entry->wasApplied();
|
|
}
|
|
}
|
|
|
|
|
|
spine_bool spine_track_entry_is_next_ready(spine_track_entry entry) {
|
|
spine_bool spine_track_entry_is_next_ready(spine_track_entry entry) {
|
|
- if (entry == nullptr) return false;
|
|
|
|
- TrackEntry *_entry = (TrackEntry *) entry;
|
|
|
|
- return _entry->isNextReady();
|
|
|
|
|
|
+ if (entry == nullptr) return false;
|
|
|
|
+ TrackEntry *_entry = (TrackEntry *) entry;
|
|
|
|
+ return _entry->isNextReady();
|
|
}
|
|
}
|
|
|
|
|
|
// Skeleton
|
|
// Skeleton
|
|
@@ -1723,10 +1723,10 @@ void spine_skeleton_set_y(spine_skeleton skeleton, float y) {
|
|
}
|
|
}
|
|
|
|
|
|
void spine_skeleton_set_scale(spine_skeleton skeleton, float scaleX, float scaleY) {
|
|
void spine_skeleton_set_scale(spine_skeleton skeleton, float scaleX, float scaleY) {
|
|
- if (skeleton == nullptr) return;
|
|
|
|
- Skeleton *_skeleton = (Skeleton *) skeleton;
|
|
|
|
- _skeleton->setScaleX(scaleX);
|
|
|
|
- _skeleton->setScaleY(scaleY);
|
|
|
|
|
|
+ if (skeleton == nullptr) return;
|
|
|
|
+ Skeleton *_skeleton = (Skeleton *) skeleton;
|
|
|
|
+ _skeleton->setScaleX(scaleX);
|
|
|
|
+ _skeleton->setScaleY(scaleY);
|
|
}
|
|
}
|
|
|
|
|
|
float spine_skeleton_get_scale_x(spine_skeleton skeleton) {
|
|
float spine_skeleton_get_scale_x(spine_skeleton skeleton) {
|