Fixed navmesh

This commit is contained in:
2026-04-26 00:50:55 +03:00
parent abd2dc22d3
commit e0e8e316d4

View File

@@ -164,6 +164,11 @@ static void extractEntityMesh(Ogre::Entity *ent, std::vector<float> &verts,
size_t currentOffset = 0;
size_t nextOffset = 0;
// Global offset of this entity's vertices in the output arrays.
// Indices read from the mesh are relative to submesh/shared vertex
// data; we must shift them so they point into the unified buffers.
size_t baseVertex = verts.size() / 3;
for (unsigned short i = 0; i < mesh->getNumSubMeshes(); ++i) {
Ogre::SubMesh *sub = mesh->getSubMesh(i);
Ogre::VertexData *vd = sub->useSharedVertices ?
@@ -220,8 +225,9 @@ static void extractEntityMesh(Ogre::Entity *ent, std::vector<float> &verts,
Ogre::HardwareIndexBuffer::IT_32BIT);
void *idata = ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY);
size_t offset = sub->useSharedVertices ? sharedOffset :
currentOffset;
size_t offset = baseVertex +
(sub->useSharedVertices ? sharedOffset :
currentOffset);
if (use32) {
unsigned int *p = static_cast<unsigned int *>(idata);