mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 00:15:19 +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);
|
assert(getType() == EntityTypes::PolyVox);
|
||||||
Q_ASSERT(args->_batch);
|
Q_ASSERT(args->_batch);
|
||||||
|
|
||||||
if (_voxelDataDirty) {
|
bool voxelDataDirty;
|
||||||
_voxelDataDirty = false;
|
bool volDataDirty;
|
||||||
|
withWriteLock([&] {
|
||||||
|
voxelDataDirty = _voxelDataDirty;
|
||||||
|
volDataDirty = _volDataDirty;
|
||||||
|
if (_voxelDataDirty) {
|
||||||
|
_voxelDataDirty = false;
|
||||||
|
} else if (_volDataDirty) {
|
||||||
|
_volDataDirty = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (voxelDataDirty) {
|
||||||
decompressVolumeData();
|
decompressVolumeData();
|
||||||
}
|
} else if (volDataDirty) {
|
||||||
if (_volDataDirty && !_voxelDataDirty) {
|
|
||||||
_volDataDirty = false;
|
|
||||||
getMesh();
|
getMesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ public:
|
||||||
uint8_t getVoxelInternal(int x, int y, int z);
|
uint8_t getVoxelInternal(int x, int y, int z);
|
||||||
bool setVoxelInternal(int x, int y, int z, uint8_t toValue);
|
bool setVoxelInternal(int x, int y, int z, uint8_t toValue);
|
||||||
|
|
||||||
void setVolDataDirty() { _volDataDirty = true; }
|
void setVolDataDirty() { withWriteLock([&] { _volDataDirty = true; }); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
|
// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
|
||||||
|
|
Loading…
Reference in a new issue