Merge branch '4.0' into 4.1

This commit is contained in:
Mario Zechner 2022-07-18 14:10:10 +02:00
commit 4bba3f1822
3 changed files with 51 additions and 48 deletions

View File

@ -1258,6 +1258,8 @@ spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char
data->spacingMode = SP_SPACING_MODE_FIXED;
else if (strcmp(item, "percent") == 0)
data->spacingMode = SP_SPACING_MODE_PERCENT;
else
data->spacingMode = SP_SPACING_MODE_PROPORTIONAL;
item = Json_getString(constraintMap, "rotateMode", "tangent");
if (strcmp(item, "tangent") == 0) data->rotateMode = SP_ROTATE_MODE_TANGENT;

View File

@ -40,6 +40,7 @@ using std::max;
#include "renderer/backend/Device.h"
#include "renderer/ccShaders.h"
#include "renderer/backend/Types.h"
namespace spine {
@ -89,17 +90,17 @@ namespace spine {
void SkeletonBatch::updateProgramStateLayout(cocos2d::backend::ProgramState *programState) {
auto vertexLayout = programState->getVertexLayout();
auto locPosition = programState->getAttributeLocation("a_position");
auto locTexcoord = programState->getAttributeLocation("a_texCoord");
auto locColor = programState->getAttributeLocation("a_color");
vertexLayout->setAttribute("a_position", locPosition, backend::VertexFormat::FLOAT3, offsetof(V3F_C4B_T2F, vertices), false);
vertexLayout->setAttribute("a_color", locColor, backend::VertexFormat::UBYTE4, offsetof(V3F_C4B_T2F, colors), true);
vertexLayout->setAttribute("a_texCoord", locTexcoord, backend::VertexFormat::FLOAT2, offsetof(V3F_C4B_T2F, texCoords), false);
auto locPosition = programState->getAttributeLocation(backend::ATTRIBUTE_NAME_POSITION);
auto locTexcoord = programState->getAttributeLocation(backend::ATTRIBUTE_NAME_TEXCOORD);
auto locColor = programState->getAttributeLocation(backend::ATTRIBUTE_NAME_COLOR);
vertexLayout->setAttribute(backend::ATTRIBUTE_NAME_POSITION, locPosition, backend::VertexFormat::FLOAT3, offsetof(V3F_C4B_T2F, vertices), false);
vertexLayout->setAttribute(backend::ATTRIBUTE_NAME_COLOR, locColor, backend::VertexFormat::UBYTE4, offsetof(V3F_C4B_T2F, colors), true);
vertexLayout->setAttribute(backend::ATTRIBUTE_NAME_TEXCOORD, locTexcoord, backend::VertexFormat::FLOAT2, offsetof(V3F_C4B_T2F, texCoords), false);
vertexLayout->setLayout(sizeof(_vertices[0]));
_locMVP = programState->getUniformLocation("u_MVPMatrix");
_locTexture = programState->getUniformLocation("u_texture");
_locMVP = programState->getUniformLocation(backend::UNIFORM_NAME_MVP_MATRIX);
_locTexture = programState->getUniformLocation(backend::UNIFORM_NAME_TEXTURE);
}
void SkeletonBatch::update(float delta) {

View File

@ -512,9 +512,9 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
skeletonData->_defaultSkin = skin;
}
for (attachmentsMap = Json::getItem(skinMap,
"attachments")
->_child;
Json *attachments = Json::getItem(skinMap, "attachments");
if (attachments)
for (attachmentsMap = attachments->_child;
attachmentsMap; attachmentsMap = attachmentsMap->_next) {
SlotData *slot = skeletonData->findSlot(attachmentsMap->_name);
Json *attachmentMap;