Skip to content

Commit

Permalink
remove unneeded code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Canvasfull committed Oct 11, 2023
1 parent 7f217c2 commit 4832457
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 125 deletions.
7 changes: 3 additions & 4 deletions cocos/spine/skeleton-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,9 @@ class SkeletonCache {
public getSkeletonCache (uuid: string, skeletonData: spine.SkeletonData): SkeletonCacheItemInfo {
let skeletonInfo = this._skeletonCache[uuid];
if (!skeletonInfo) {
const skeleton = null; //new spine.Skeleton(skeletonData);
const clipper = null; //new spine.SkeletonClipping();
//const stateData = null; //new spine.AnimationStateData(skeleton.data);
const state = null; //new spine.AnimationState(stateData);
const skeleton = null;
const clipper = null;
const state = null;
const listener = new TrackEntryListeners();

this._skeletonCache[uuid] = skeletonInfo = {
Expand Down
2 changes: 0 additions & 2 deletions cocos/spine/skeleton-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ export class SkeletonSystem extends System {
}
}

index = 0;
postUpdate (dt: number): void {
if (!this._skeletons) {
return;
}
this.index++;
if (!EDITOR_NOT_IN_PREVIEW) spine.SkeletonSystem.updateAnimation(dt);
this._skeletons.forEach((skeleton) => {
skeleton.updateAnimation(dt);
Expand Down
43 changes: 0 additions & 43 deletions native/cocos/editor-support/spine-wasm/spine-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,6 @@ SpineModel::~SpineModel() {
SpineModel::data = nullptr;
}

/*
void SpineModel::addSlotMesh(SlotMesh& mesh, bool needMerge) {
bool canMerge = false;
auto count = meshArray.size();
if (needMerge && count >= 1) {
auto* lastMesh = &meshArray[count - 1];
if (lastMesh->blendMode == mesh.blendMode && lastMesh->textureID == mesh.textureID) {
canMerge = true;
lastMesh->vCount += mesh.vCount;
lastMesh->iCount += mesh.iCount;
}
}
if (!canMerge) {
auto mergeMesh = SlotMesh(mesh.vBuf, mesh.iBuf, mesh.vCount, mesh.iCount);
mergeMesh.blendMode = mesh.blendMode;
mergeMesh.textureID = mesh.textureID;
meshArray.push_back(mergeMesh);
}
auto indexCount = mesh.iCount;
uint16_t* iiPtr = mesh.iBuf;
for (uint16_t i = 0; i < indexCount; i++) {
iiPtr[i] += vCount;
}
auto vertexCount = mesh.vCount;
float* floatPtr = (float*)mesh.vBuf;
int floatStride = this->byteStride / 4;
for (int i = 0; i < vertexCount; i++) {
floatPtr[floatStride * i + 2] = 0;
}
vCount += vertexCount;
iCount += indexCount;
}
*/

void SpineModel::addSlotMesh(SlotMesh& mesh, bool needMerge) {
bool canMerge = false;
auto count = data->size();
Expand Down Expand Up @@ -81,10 +46,6 @@ void SpineModel::addSlotMesh(SlotMesh& mesh, bool needMerge) {
}

void SpineModel::clearMeshes() {
//for (auto it = meshArray.begin(); it != meshArray.end(); ++it) {
// delete &(*it);
//}
//meshArray.clear();
data->resize(0);
vCount = 0;
iCount = 0;
Expand All @@ -94,10 +55,6 @@ std::vector<uint32_t>* SpineModel::getData() {
return data;
}

//std::vector<SlotMesh>* SpineModel::getMeshes() {
// return &meshArray;
//}

void SpineModel::setBufferPtr(uint8_t* vp, uint16_t* ip) {
vPtr = (uint32_t)vp;
iPtr = (uint32_t)ip;
Expand Down
3 changes: 0 additions & 3 deletions native/cocos/editor-support/spine-wasm/spine-model.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@ class SpineModel {
void setBufferPtr(uint8_t* vp, uint16_t* ip);
std::vector<uint32_t>* data;
std::vector<uint32_t>* getData();
//std::vector<SlotMesh>* getMeshes();

public:
uint32_t vCount;
uint32_t iCount;
uint32_t vPtr;
uint32_t iPtr;
uint32_t byteStride;
//std::vector<SlotMesh> meshArray{};

};

#endif
73 changes: 0 additions & 73 deletions native/cocos/editor-support/spine-wasm/spine-type-export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,6 @@ const spine::String STRING_STD2SP(const std::string &str) {
return spString;
}

/*
template <typename T>
std::vector<T> VECTOR_SP2STD(Vector<T> &container) {
int count = container.size();
std::vector<T> stdVector(count);
for (int i = 0; i < count; i++) {
stdVector[i] = container[i];
}
return stdVector;
}
std::vector<float> VECTOR_SP2STD_SIZE_T(Vector<size_t> &container) {
int count = container.size();
std::vector<float> stdVector(count);
for (int i = 0; i < count; i++) {
stdVector[i] = container[i];
}
return stdVector;
}
*/

const std::vector<std::string> VECTOR_SP2STD_STRING(Vector<String> &container) {
int count = container.size();
std::vector<std::string> stdVector(count);
Expand All @@ -52,29 +31,6 @@ const std::vector<std::string> VECTOR_SP2STD_STRING(Vector<String> &container) {
return stdVector;
}

/*
template <typename T>
std::vector<std::vector<T>> VECTOR_2_SP2STD(Vector<Vector<T>> &container) {
int count = container.size();
std::vector<std::vector<T>> stdVector(count);
for (int i = 0; i < count; i++) {
stdVector[i] = VECTOR_SP2STD(container[i]);
}
return stdVector;
}
template <typename T>
std::vector<T> VECTOR_SP2STD2(Vector<T> container) {
int count = container.size();
std::vector<T> stdVector(count);
for (int i = 0; i < count; i++) {
stdVector[i] = container[i];
}
return stdVector;
}
*/

template <typename T>
Vector<T> VECTOR_STD2SP(std::vector<T> &container) {
int count = container.size();
Expand Down Expand Up @@ -126,9 +82,6 @@ using SPVectorTimelinePtr = Vector<Timeline*>;
using SPVectorTrackEntryPtr = Vector<TrackEntry*>;
using SPVectorUpdatablePtr = Vector<Updatable*>;

//using SPVectorEntry = Vector<Skin::AttachmentMap::Entry>;
//using SPVectorVectorEntry = Vector<Vector<Skin::AttachmentMap::Entry>>;

} // namespace

EMSCRIPTEN_BINDINGS(spine) {
Expand Down Expand Up @@ -348,31 +301,7 @@ EMSCRIPTEN_BINDINGS(spine) {
.function("set", &Vector2::set)
.function("length", &Vector2::length)
.function("normalize", &Vector2::normalize);
/*
class_<SPVectorEntry>("SPVectorEntry")
.function("size", &SPVectorEntry::size)
.function("get", &SPVectorEntry::operator[], allow_raw_pointers());
class_<SPVectorVectorEntry>("SPVectorVectorEntry")
.function("size", &SPVectorVectorEntry::size)
.function("get", &SPVectorVectorEntry::operator[], allow_raw_pointers());
class_<Skin::AttachmentMap>("AttachmentMap")
.function("get", &Skin::AttachmentMap::get, allow_raw_pointers());
class_<Skin::AttachmentMap::Entries>("Entries")
.function("hasNext", &Skin::AttachmentMap::Entries::hasNext)
.function("next", &Skin::AttachmentMap::Entries::next);

value_object<Skin::AttachmentMap::Entry>("Entry")
//.constructor<>()
//.constructor<size_t, String, Attachment*>()
.field("_slotIndex",&Skin::AttachmentMap::Entry::_slotIndex)
.field("_name",&Skin::AttachmentMap::Entry::_name);
///.field("_attachment", &Skin::AttachmentMap::Entry::_attachment, allow_raw_pointer<spine::Attachment>());
*/
class_<String>("String")
.function("length", &String::length)
.function("isEmpty", &String::isEmpty)
Expand Down Expand Up @@ -1645,9 +1574,7 @@ EMSCRIPTEN_BINDINGS(spine) {
.property("iCount", &SpineModel::iCount)
.property("vPtr", &SpineModel::vPtr)
.property("iPtr", &SpineModel::iPtr)
//.property("data", &SpineModel::data, allow_raw_pointer<std::vector<uint32_t>>());
.function("getData", &SpineModel::getData, allow_raw_pointer<std::vector<unsigned int>>());
//.function("getMeshes", &SpineModel::getMeshes, allow_raw_pointer<std::vector<SlotMesh>>());

class_<SpineDebugShape>("SpineDebugShape")
.property("type", &SpineDebugShape::type)
Expand Down

0 comments on commit 4832457

Please sign in to comment.