mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 12:04:18 +02:00
Add locking around the code that reads polyline entity data and builds GPU structures for them
This commit is contained in:
parent
c3db2704ed
commit
5bade2ef9a
2 changed files with 10 additions and 4 deletions
|
@ -161,8 +161,14 @@ void RenderablePolyLineEntityItem::update(const quint64& now) {
|
|||
uniforms.color = toGlm(getXColor());
|
||||
memcpy(&_uniformBuffer.edit<PolyLineUniforms>(), &uniforms, sizeof(PolyLineUniforms));
|
||||
if (_pointsChanged || _strokeWidthsChanged || _normalsChanged) {
|
||||
updateVertices();
|
||||
updateGeometry();
|
||||
QWriteLocker lock(&_quadReadWriteLock);
|
||||
if (_points.size() < 2 || _normals.size() < 2 || _strokeWidths.size() < 2) {
|
||||
_empty = true;
|
||||
}
|
||||
if (!_empty) {
|
||||
updateVertices();
|
||||
updateGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -170,8 +176,7 @@ void RenderablePolyLineEntityItem::update(const quint64& now) {
|
|||
void RenderablePolyLineEntityItem::render(RenderArgs* args) {
|
||||
checkFading();
|
||||
|
||||
QWriteLocker lock(&_quadReadWriteLock);
|
||||
if (_points.size() < 2 || _normals.size () < 2 || _strokeWidths.size() < 2) {
|
||||
if (_empty) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ protected:
|
|||
gpu::BufferPointer _verticesBuffer;
|
||||
gpu::BufferView _uniformBuffer;
|
||||
unsigned int _numVertices;
|
||||
bool _empty { true };
|
||||
QVector<glm::vec3> _vertices;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue