[cpp] 4.3 porting WIP

This commit is contained in:
Mario Zechner 2025-07-07 21:37:55 +02:00
parent e7c4a3eef0
commit 972a1bc8fc
14 changed files with 519 additions and 571 deletions

View File

@ -38,9 +38,6 @@ Cocos2dAtlasAttachmentLoader::Cocos2dAtlasAttachmentLoader(Atlas *atlas) : Atlas
Cocos2dAtlasAttachmentLoader::~Cocos2dAtlasAttachmentLoader() {}
void Cocos2dAtlasAttachmentLoader::configureAttachment(Attachment *attachment) {
}
#if COCOS2D_VERSION >= 0x0040000
backend::SamplerAddressMode wrap(TextureWrap wrap) {

View File

@ -60,8 +60,6 @@ namespace spine {
virtual ClippingAttachment *newClippingAttachment(Skin &skin, const String &name);
virtual void configureAttachment(Attachment *attachment);
AtlasRegion *findRegion(const String &name);
private:

View File

@ -74,8 +74,6 @@ namespace spine {
virtual PointAttachment *newPointAttachment(Skin &skin, const String &name) = 0;
virtual ClippingAttachment *newClippingAttachment(Skin &skin, const String &name) = 0;
virtual void configureAttachment(Attachment *attachment) = 0;
};
}

View File

@ -66,11 +66,15 @@ namespace spine {
Vector<float> &getRegionUVs();
void setRegionUVs(Vector<float> &inValue);
/// The UV pair for each vertex, normalized within the entire texture. See also MeshAttachment::updateRegion
Vector<float> &getUVs();
Vector<unsigned short> &getTriangles();
void setTriangles(Vector<unsigned short> &inValue);
Color &getColor();
const String &getPath();
@ -92,6 +96,8 @@ namespace spine {
// Nonessential.
Vector<unsigned short> &getEdges();
void setEdges(Vector<unsigned short> &inValue);
float getWidth();
void setWidth(float inValue);

View File

@ -47,6 +47,8 @@ namespace spine {
/// The length in the setup pose from the start of the path to the end of each curve.
Vector<float> &getLengths();
void setLengths(Vector<float> &inValue);
bool isClosed();
void setClosed(bool inValue);

View File

@ -140,11 +140,11 @@ namespace spine {
}
inline signed char readByte() {
return (signed char)*cursor++;
return (signed char) *cursor++;
}
inline unsigned char readUnsignedByte() {
return (unsigned char)*cursor++;
return (unsigned char) *cursor++;
}
inline bool readBoolean() {
@ -163,9 +163,9 @@ namespace spine {
}
inline long long readLong() {
long long result = (unsigned long long)readInt();
long long result = (unsigned long long) readInt();
result <<= 32;
result |= (unsigned long long)readInt();
result |= (unsigned long long) readInt();
return result;
}
@ -230,28 +230,28 @@ namespace spine {
void setError(const char *value1, const char *value2);
Skin *readSkin(DataInput &input, SkeletonData *skeletonData, bool defaultSkin, bool nonessential);
Skin *readSkin(DataInput &input, SkeletonData &skeletonData, bool defaultSkin, bool nonessential);
Attachment *readAttachment(DataInput &input, Skin &skin, int slotIndex, const String &attachmentName,
SkeletonData &skeletonData, bool nonessential);
Sequence *readSequence(DataInput &input);
Attachment *readAttachment(DataInput &input, Skin *skin, int slotIndex, const String &attachmentName,
SkeletonData *skeletonData, bool nonessential);
int readVertices(DataInput &input, Vector<float> &vertices, Vector<int> &bones, bool weighted);
void readFloatArray(DataInput &input, int n, float scale, Vector<float> &array);
void readShortArray(DataInput &input, Vector<unsigned short> &array, int n);
Animation *readAnimation(DataInput &input, const String &name, SkeletonData *skeletonData);
Animation *readAnimation(DataInput &input, const String &name, SkeletonData &skeletonData);
void readTimeline(DataInput &input, Vector<Timeline *> &timelines, CurveTimeline1 &timeline, float scale);
void readTimeline(DataInput &input, Vector<Timeline *> &timelines, BoneTimeline2 &timeline, float scale);
void
setBezier(DataInput &input, CurveTimeline *timeline, int bezier, int frame, int value, float time1, float time2,
setBezier(DataInput &input, CurveTimeline &timeline, int bezier, int frame, int value, float time1, float time2,
float value1, float value2, float scale);
void readTimeline(DataInput &input, Vector<Timeline *> &timelines, CurveTimeline1 *timeline, float scale);
void readTimeline2(DataInput &input, Vector<Timeline *> &timelines, CurveTimeline2 *timeline, float scale);
};
}// namespace spine

View File

@ -76,8 +76,12 @@ namespace spine {
Vector<int> &getBones();
void setBones(Vector<int> &bones);
Vector<float> &getVertices();
void setVertices(Vector<float> &vertices);
size_t getWorldVerticesLength();
void setWorldVerticesLength(size_t inValue);

View File

@ -100,10 +100,6 @@ ClippingAttachment *AtlasAttachmentLoader::newClippingAttachment(Skin &skin, con
return new (__FILE__, __LINE__) ClippingAttachment(name);
}
void AtlasAttachmentLoader::configureAttachment(Attachment *attachment) {
SP_UNUSED(attachment);
}
AtlasRegion *AtlasAttachmentLoader::findRegion(const String &name) {
return _atlas->findRegion(name);
}

View File

@ -127,6 +127,10 @@ Vector<float> &MeshAttachment::getRegionUVs() {
return _regionUVs;
}
void MeshAttachment::setRegionUVs(Vector<float> &inValue) {
_regionUVs.clearAndAddAll(inValue);
}
Vector<float> &MeshAttachment::getUVs() {
return _uvs;
}
@ -135,6 +139,10 @@ Vector<unsigned short> &MeshAttachment::getTriangles() {
return _triangles;
}
void MeshAttachment::setTriangles(Vector<unsigned short> &inValue) {
_triangles.clearAndAddAll(inValue);
}
const String &MeshAttachment::getPath() {
return _path;
}
@ -182,6 +190,10 @@ Vector<unsigned short> &MeshAttachment::getEdges() {
return _edges;
}
void MeshAttachment::setEdges(Vector<unsigned short> &inValue) {
_edges.clearAndAddAll(inValue);
}
float MeshAttachment::getWidth() {
return _width;
}

View File

@ -41,6 +41,10 @@ Vector<float> &PathAttachment::getLengths() {
return _lengths;
}
void PathAttachment::setLengths(Vector<float> &inValue) {
_lengths.clearAndAddAll(inValue);
}
bool PathAttachment::isClosed() {
return _closed;
}

File diff suppressed because it is too large Load Diff

View File

@ -554,7 +554,6 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) {
: linkedMesh->_mesh;
linkedMesh->_mesh->setParentMesh(static_cast<MeshAttachment *>(parent));
if (linkedMesh->_mesh->_region != NULL) linkedMesh->_mesh->updateRegion();
_attachmentLoader->configureAttachment(linkedMesh->_mesh);
}
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
_linkedMeshes.clear();

View File

@ -126,10 +126,18 @@ Vector<int> &VertexAttachment::getBones() {
return _bones;
}
void VertexAttachment::setBones(Vector<int> &bones) {
_bones.clearAndAddAll(bones);
}
Vector<float> &VertexAttachment::getVertices() {
return _vertices;
}
void VertexAttachment::setVertices(Vector<float> &vertices) {
_vertices.clearAndAddAll(vertices);
}
size_t VertexAttachment::getWorldVerticesLength() {
return _worldVerticesLength;
}

View File

@ -0,0 +1,13 @@
arguments=--init-script /var/folders/49/l4171l3n219_xwq30fmyzr8w0000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle --init-script /var/folders/49/l4171l3n219_xwq30fmyzr8w0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true