1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

SurfaceTool - efficiency improvements

Changed to use LocalVector rather than linked lists.
This commit is contained in:
lawnjelly
2022-12-07 13:54:59 +00:00
parent 5d5f0a3958
commit ff714fbe02
3 changed files with 263 additions and 213 deletions

View File

@@ -1373,10 +1373,20 @@ Error ArrayMesh::lightmap_unwrap_cached(int *&r_cache_data, unsigned int &r_cach
surfaces_tools[surface]->add_tangent(t);
}
if (lightmap_surfaces[surface].format & ARRAY_FORMAT_BONES) {
surfaces_tools[surface]->add_bones(v.bones);
Vector<int> bones;
bones.resize(v.num_bones);
for (int n = 0; n < v.num_bones; n++) {
bones.set(n, v.bones[n]);
}
surfaces_tools[surface]->add_bones(bones);
}
if (lightmap_surfaces[surface].format & ARRAY_FORMAT_WEIGHTS) {
surfaces_tools[surface]->add_weights(v.weights);
Vector<float> weights;
weights.resize(v.num_bones);
for (int n = 0; n < v.num_bones; n++) {
weights.set(n, v.weights[n]);
}
surfaces_tools[surface]->add_weights(weights);
}
Vector2 uv2(gen_uvs[gen_indices[i + j] * 2 + 0], gen_uvs[gen_indices[i + j] * 2 + 1]);