mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-17 22:08:27 +02:00
boxify static meshes with too many vertices
This commit is contained in:
parent
e538625fe0
commit
74781c0786
1 changed files with 8 additions and 0 deletions
|
@ -696,6 +696,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
|
|||
QVector<glm::mat4> localTransforms;
|
||||
const FBXGeometry& geometry = _model->getFBXGeometry();
|
||||
int numberOfMeshes = geometry.meshes.size();
|
||||
int totalNumVertices = 0;
|
||||
for (int i = 0; i < numberOfMeshes; i++) {
|
||||
const FBXMesh& mesh = geometry.meshes.at(i);
|
||||
if (mesh.clusters.size() > 0) {
|
||||
|
@ -706,6 +707,13 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
|
|||
glm::mat4 identity;
|
||||
localTransforms.push_back(identity);
|
||||
}
|
||||
totalNumVertices += mesh.vertices.size();
|
||||
}
|
||||
const int MAX_VERTICES_PER_STATIC_MESH = 1e6;
|
||||
if (totalNumVertices > MAX_VERTICES_PER_STATIC_MESH) {
|
||||
qWarning() << "model" << getModelURL() << "has too many vertices" << totalNumVertices << "and will collide as a box.";
|
||||
info.setParams(SHAPE_TYPE_BOX, 0.5f * dimensions);
|
||||
return;
|
||||
}
|
||||
|
||||
updateModelBounds();
|
||||
|
|
Loading…
Reference in a new issue