mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
Add a read lock where we think it s needed and banging my head on the problem
This commit is contained in:
parent
3ec812d5c3
commit
18226e64f8
4 changed files with 7 additions and 13 deletions
|
@ -108,15 +108,6 @@ protected:
|
||||||
virtual void setIsVisibleInSecondaryCamera(bool value) { _isVisibleInSecondaryCamera = value; }
|
virtual void setIsVisibleInSecondaryCamera(bool value) { _isVisibleInSecondaryCamera = value; }
|
||||||
virtual void setRenderLayer(RenderLayer value) { _renderLayer = value; }
|
virtual void setRenderLayer(RenderLayer value) { _renderLayer = value; }
|
||||||
virtual void setPrimitiveMode(PrimitiveMode value) { _primitiveMode = value; }
|
virtual void setPrimitiveMode(PrimitiveMode value) { _primitiveMode = value; }
|
||||||
|
|
||||||
template <typename F, typename T>
|
|
||||||
T withReadLockResult(const std::function<T()>& f) {
|
|
||||||
T result;
|
|
||||||
withReadLock([&] {
|
|
||||||
result = f();
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestRenderUpdate();
|
void requestRenderUpdate();
|
||||||
|
|
|
@ -1431,12 +1431,13 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_texturesLoaded && model->getGeometry() && model->getGeometry()->areTexturesLoaded()) {
|
bool currentTexturesLoaded = resultWithReadLock<bool>([&] { return _texturesLoaded; });
|
||||||
|
if (!currentTexturesLoaded && model->getGeometry() && model->getGeometry()->areTexturesLoaded()) {
|
||||||
withWriteLock([&] {
|
withWriteLock([&] {
|
||||||
_texturesLoaded = true;
|
_texturesLoaded = true;
|
||||||
});
|
});
|
||||||
model->updateRenderItems();
|
model->updateRenderItems();
|
||||||
} else if (!_texturesLoaded) {
|
} else if (!currentTexturesLoaded) {
|
||||||
emit requestRenderUpdate();
|
emit requestRenderUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ public:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
AlphaMapMode getAlphaMapMode() const { return (_flags[OPACITY_MASK_MAP_BIT] ? ALPHA_MAP_MASK : (_flags[OPACITY_TRANSLUCENT_MAP_BIT] ? ALPHA_MAP_BLEND : ALPHA_MAP_OPAQUE)); }
|
AlphaMapMode getAlphaMapMode() const { return (isOpacityMaskMap() ? ALPHA_MAP_MASK : (isTranslucentMap() ? ALPHA_MAP_BLEND : ALPHA_MAP_OPAQUE)); }
|
||||||
|
|
||||||
bool isTranslucent() const { return isTranslucentFactor() || isTranslucentMap(); }
|
bool isTranslucent() const { return isTranslucentFactor() || isTranslucentMap(); }
|
||||||
bool isOpaque() const { return !isTranslucent(); }
|
bool isOpaque() const { return !isTranslucent(); }
|
||||||
|
|
|
@ -176,14 +176,16 @@ void RenderThread::renderFrame(gpu::FramePointer& frame) {
|
||||||
|
|
||||||
#ifdef USE_GL
|
#ifdef USE_GL
|
||||||
static gpu::BatchPointer batch = nullptr;
|
static gpu::BatchPointer batch = nullptr;
|
||||||
|
float scale = 1.0;
|
||||||
if (!batch) {
|
if (!batch) {
|
||||||
batch = std::make_shared<gpu::Batch>();
|
batch = std::make_shared<gpu::Batch>();
|
||||||
batch->setPipeline(_presentPipeline);
|
batch->setPipeline(_presentPipeline);
|
||||||
batch->setFramebuffer(nullptr);
|
batch->setFramebuffer(nullptr);
|
||||||
batch->setResourceTexture(0, frame->framebuffer->getRenderBuffer(0));
|
batch->setResourceTexture(0, frame->framebuffer->getRenderBuffer(0));
|
||||||
batch->setViewportTransform(ivec4(uvec2(0), ivec2(0.5 * fboSize.x, 0.5*fboSize.y)));
|
batch->setViewportTransform(ivec4(uvec2(0), ivec2(scale * fboSize.x, scale * fboSize.y)));
|
||||||
batch->draw(gpu::TRIANGLE_STRIP, 4);
|
batch->draw(gpu::TRIANGLE_STRIP, 4);
|
||||||
}
|
}
|
||||||
|
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
_gpuContext->executeBatch(*batch);
|
_gpuContext->executeBatch(*batch);
|
||||||
|
|
||||||
//glDisable(GL_FRAMEBUFFER_SRGB);
|
//glDisable(GL_FRAMEBUFFER_SRGB);
|
||||||
|
|
Loading…
Reference in a new issue