mirror of
https://github.com/minetest/minetest.git
synced 2024-12-22 14:12:24 +01:00
Restore .x
models to working state (#15550)
* Add "lava flan" (.x model) smoke test * Fix double finalize in `.x` mesh loader * Use reserve instead of resize again The weights are added indirectly via `AnimatedMesh->addWeight`
This commit is contained in:
parent
f99a1a7c7c
commit
a37bdbf8b7
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5,3 +5,4 @@
|
||||
*.h diff=cpp
|
||||
|
||||
*.gltf binary
|
||||
*.x binary
|
||||
|
@ -1,3 +1,5 @@
|
||||
"Minetest Sam":
|
||||
|
||||
Original model by MirceaKitsune (CC BY-SA 3.0).
|
||||
Various alterations and fixes by kilbith, sofar, xunto, Rogier-5, TeTpaAka, Desour,
|
||||
stujones11, An0n3m0us (CC BY-SA 3.0):
|
||||
@ -5,3 +7,9 @@ stujones11, An0n3m0us (CC BY-SA 3.0):
|
||||
|
||||
Jordach (CC BY-SA 3.0):
|
||||
testentities_sam.png
|
||||
|
||||
"Lava Flan":
|
||||
|
||||
Zeg9 (CC BY-SA 3.0):
|
||||
testentities_lava_flan.x
|
||||
testentities_lava_flan.png
|
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
3506
games/devtest/mods/testentities/models/testentities_lava_flan.x
Normal file
3506
games/devtest/mods/testentities/models/testentities_lava_flan.x
Normal file
File diff suppressed because it is too large
Load Diff
@ -79,6 +79,20 @@ core.register_entity("testentities:sam", {
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_entity("testentities:lava_flan", {
|
||||
initial_properties = {
|
||||
infotext = "Lava Flan (smoke test .x)",
|
||||
visual = "mesh",
|
||||
mesh = "testentities_lava_flan.x",
|
||||
textures = {
|
||||
"testentities_lava_flan.png"
|
||||
},
|
||||
},
|
||||
on_activate = function(self)
|
||||
self.object:set_animation({x = 0, y = 28}, 15, 0, true)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Advanced visual tests
|
||||
|
||||
-- An entity for testing animated and yaw-modulated sprites
|
||||
|
@ -56,8 +56,9 @@ IAnimatedMesh *CXMeshFileLoader::createMesh(io::IReadFile *file)
|
||||
|
||||
AnimatedMesh = new SkinnedMeshBuilder();
|
||||
|
||||
SkinnedMesh *res = nullptr;
|
||||
if (load(file)) {
|
||||
AnimatedMesh->finalize();
|
||||
res = AnimatedMesh->finalize();
|
||||
} else {
|
||||
AnimatedMesh->drop();
|
||||
AnimatedMesh = 0;
|
||||
@ -89,7 +90,7 @@ IAnimatedMesh *CXMeshFileLoader::createMesh(io::IReadFile *file)
|
||||
delete Meshes[i];
|
||||
Meshes.clear();
|
||||
|
||||
return AnimatedMesh->finalize();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CXMeshFileLoader::load(io::IReadFile *file)
|
||||
@ -962,15 +963,16 @@ bool CXMeshFileLoader::parseDataObjectSkinWeights(SXMesh &mesh)
|
||||
u32 i;
|
||||
|
||||
const u32 jointStart = joint->Weights.size();
|
||||
joint->Weights.resize(jointStart + nWeights);
|
||||
joint->Weights.reserve(jointStart + nWeights);
|
||||
|
||||
mesh.WeightJoint.reallocate(mesh.WeightJoint.size() + nWeights);
|
||||
mesh.WeightNum.reallocate(mesh.WeightNum.size() + nWeights);
|
||||
|
||||
for (i = 0; i < nWeights; ++i) {
|
||||
mesh.WeightJoint.push_back(*n);
|
||||
mesh.WeightNum.push_back(joint->Weights.size());
|
||||
mesh.WeightNum.push_back(joint->Weights.size()); // id of weight
|
||||
|
||||
// Note: This adds a weight to joint->Weights
|
||||
SkinnedMesh::SWeight *weight = AnimatedMesh->addWeight(joint);
|
||||
|
||||
weight->buffer_id = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user