mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
fix locking around polyvox state flags
This commit is contained in:
parent
d97ab1e2fc
commit
f3ba16ab3e
2 changed files with 14 additions and 6 deletions
|
@ -554,12 +554,20 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
|||
assert(getType() == EntityTypes::PolyVox);
|
||||
Q_ASSERT(args->_batch);
|
||||
|
||||
if (_voxelDataDirty) {
|
||||
_voxelDataDirty = false;
|
||||
bool voxelDataDirty;
|
||||
bool volDataDirty;
|
||||
withWriteLock([&] {
|
||||
voxelDataDirty = _voxelDataDirty;
|
||||
volDataDirty = _volDataDirty;
|
||||
if (_voxelDataDirty) {
|
||||
_voxelDataDirty = false;
|
||||
} else if (_volDataDirty) {
|
||||
_volDataDirty = false;
|
||||
}
|
||||
});
|
||||
if (voxelDataDirty) {
|
||||
decompressVolumeData();
|
||||
}
|
||||
if (_volDataDirty && !_voxelDataDirty) {
|
||||
_volDataDirty = false;
|
||||
} else if (volDataDirty) {
|
||||
getMesh();
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ public:
|
|||
uint8_t getVoxelInternal(int x, int y, int z);
|
||||
bool setVoxelInternal(int x, int y, int z, uint8_t toValue);
|
||||
|
||||
void setVolDataDirty() { _volDataDirty = true; }
|
||||
void setVolDataDirty() { withWriteLock([&] { _volDataDirty = true; }); }
|
||||
|
||||
private:
|
||||
// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
|
||||
|
|
Loading…
Reference in a new issue