Skip to content

Commit

Permalink
Why those bugs?
Browse files Browse the repository at this point in the history
Nothing works. Everything broken.
  • Loading branch information
mosra committed Dec 16, 2021
1 parent 5d94cb5 commit 56f12fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/esp/assets/GenericMeshData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ void GenericMeshData::setMeshData(Magnum::Trade::MeshData&& meshData) {
/* For collision data we need indices as UnsignedInt. If the mesh already has
those, just make the collision data reference them. If not, unpack them
and store them here. */
if (meshData_->indexType() == Mn::MeshIndexType::UnsignedInt)
collisionMeshData_.indices = meshData_->mutableIndices<Mn::UnsignedInt>();
else
collisionMeshData_.indices = indexData_ = meshData_->indicesAsArray();
if(meshData_->isIndexed()) { // TODO how did this even work for non-indexed meshes????
if (meshData_->indexType() == Mn::MeshIndexType::UnsignedInt)
collisionMeshData_.indices = meshData_->mutableIndices<Mn::UnsignedInt>();
else
collisionMeshData_.indices = indexData_ = meshData_->indicesAsArray();
} else {
collisionMeshData_.indices = indexData_ = Cr::Containers::Array<Mn::UnsignedInt>{Mn::NoInit, meshData_->vertexCount()};
for(std::size_t i = 0; i != indexData_.size(); ++i)
indexData_[i] = i;
}
} // setMeshData

void GenericMeshData::importAndSetMeshData(
Expand Down
4 changes: 2 additions & 2 deletions src/esp/assets/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,8 +1377,8 @@ bool ResourceManager::loadRenderAssetGeneral(const AssetInfo& info) {
meshes_.at(meshMetaData.meshIndex.first)) {
// no default scene --- standalone OBJ/PLY files, for example
// take a wild guess and load the first mesh with the first material
// addMeshToDrawables(metaData, *parent, drawables, 0, 0);
loadMeshHierarchy(*fileImporter_, meshMetaData.root, 0);
meshMetaData.root.children.emplace_back();
meshMetaData.root.children.back().meshIDLocal = 0;
} else {
ESP_ERROR() << "No default scene available and no meshes found, exiting";
return false;
Expand Down

0 comments on commit 56f12fa

Please sign in to comment.