mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +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,17 +161,22 @@ void RenderablePolyLineEntityItem::update(const quint64& now) {
|
||||||
uniforms.color = toGlm(getXColor());
|
uniforms.color = toGlm(getXColor());
|
||||||
memcpy(&_uniformBuffer.edit<PolyLineUniforms>(), &uniforms, sizeof(PolyLineUniforms));
|
memcpy(&_uniformBuffer.edit<PolyLineUniforms>(), &uniforms, sizeof(PolyLineUniforms));
|
||||||
if (_pointsChanged || _strokeWidthsChanged || _normalsChanged) {
|
if (_pointsChanged || _strokeWidthsChanged || _normalsChanged) {
|
||||||
|
QWriteLocker lock(&_quadReadWriteLock);
|
||||||
|
if (_points.size() < 2 || _normals.size() < 2 || _strokeWidths.size() < 2) {
|
||||||
|
_empty = true;
|
||||||
|
}
|
||||||
|
if (!_empty) {
|
||||||
updateVertices();
|
updateVertices();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderablePolyLineEntityItem::render(RenderArgs* args) {
|
void RenderablePolyLineEntityItem::render(RenderArgs* args) {
|
||||||
checkFading();
|
checkFading();
|
||||||
|
|
||||||
QWriteLocker lock(&_quadReadWriteLock);
|
if (_empty) {
|
||||||
if (_points.size() < 2 || _normals.size () < 2 || _strokeWidths.size() < 2) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ protected:
|
||||||
gpu::BufferPointer _verticesBuffer;
|
gpu::BufferPointer _verticesBuffer;
|
||||||
gpu::BufferView _uniformBuffer;
|
gpu::BufferView _uniformBuffer;
|
||||||
unsigned int _numVertices;
|
unsigned int _numVertices;
|
||||||
|
bool _empty { true };
|
||||||
QVector<glm::vec3> _vertices;
|
QVector<glm::vec3> _vertices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue