[3d] fix inevitable crashes when terrain bounding boxes were shown

The list of vertices just kept growing and growing (and we didn't even need another copy!)
This commit is contained in:
Martin Dobias 2018-11-07 15:04:18 +01:00
parent 222f0a0355
commit 528c8a63bf
2 changed files with 3 additions and 3 deletions

View File

@ -48,9 +48,9 @@ void LineMeshGeometry::setVertices( const QList<QVector3D> &vertices )
rawVertexArray[idx++] = v.x();
rawVertexArray[idx++] = v.y();
rawVertexArray[idx++] = v.z();
mVertices.append( v );
}
mVertexCount = vertices.count();
mVertexBuffer->setData( vertexBufferData );
}

View File

@ -67,7 +67,7 @@ class LineMeshGeometry : public Qt3DRender::QGeometry
int vertexCount()
{
return mVertices.size();
return mVertexCount;
}
void setVertices( const QList<QVector3D> &vertices );
@ -75,7 +75,7 @@ class LineMeshGeometry : public Qt3DRender::QGeometry
private:
Qt3DRender::QAttribute *mPositionAttribute = nullptr;
Qt3DRender::QBuffer *mVertexBuffer = nullptr;
QList<QVector3D> mVertices;
int mVertexCount = 0;
};