Make RecastMesh independent from the order of RecastMeshBuilder calls

To make sure RecastMesh objects are equal if built with the same data but in
different order. Will be used later when there will be more than one place
building RecasMesh objects.
This commit is contained in:
elsid 2021-07-11 21:43:19 +02:00
parent 07c70dfb73
commit af7059373c
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
14 changed files with 335 additions and 316 deletions

View file

@ -39,10 +39,11 @@ namespace SceneUtil
{
const osg::ref_ptr<osg::Group> group(new osg::Group);
DebugDraw debugDraw(*group, osg::Vec3f(0, 0, 0), 1.0f / settings.mRecastScaleFactor);
const auto normals = calculateNormals(recastMesh.getVertices(), recastMesh.getIndices());
const DetourNavigator::Mesh& mesh = recastMesh.getMesh();
const auto normals = calculateNormals(mesh.getVertices(), mesh.getIndices());
const auto texScale = 1.0f / (settings.mCellSize * 10.0f);
duDebugDrawTriMesh(&debugDraw, recastMesh.getVertices().data(), recastMesh.getVerticesCount(),
recastMesh.getIndices().data(), normals.data(), recastMesh.getTrianglesCount(), nullptr, texScale);
duDebugDrawTriMesh(&debugDraw, mesh.getVertices().data(), mesh.getVerticesCount(),
mesh.getIndices().data(), normals.data(), mesh.getTrianglesCount(), nullptr, texScale);
return group;
}
}