mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Add a new property to control whether the blackout factor should apply to the master (closes #2923)
This commit is contained in:
@@ -92,9 +92,6 @@ public:
|
||||
void renderEndscreen();
|
||||
void postDraw();
|
||||
|
||||
float globalBlackOutFactor() const;
|
||||
void setGlobalBlackOutFactor(float opacity);
|
||||
|
||||
float hdrExposure() const;
|
||||
bool isHdrDisabled() const;
|
||||
|
||||
@@ -168,6 +165,7 @@ private:
|
||||
void renderCameraInformation();
|
||||
void renderShutdownInformation(float timer, float fullTime);
|
||||
void renderDashboard();
|
||||
float combinedBlackoutFactor() const;
|
||||
|
||||
Camera* _camera = nullptr;
|
||||
Scene* _scene = nullptr;
|
||||
@@ -193,6 +191,7 @@ private:
|
||||
properties::BoolProperty _disableMasterRendering;
|
||||
|
||||
properties::FloatProperty _globalBlackOutFactor;
|
||||
properties::BoolProperty _applyBlackoutToMaster;
|
||||
|
||||
properties::BoolProperty _enableFXAA;
|
||||
|
||||
|
||||
@@ -278,6 +278,14 @@ namespace {
|
||||
openspace::properties::Property::Visibility::User
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ApplyBlackoutToMasterInfo = {
|
||||
"ApplyBlackoutToMaster",
|
||||
"Apply Blackout to Master",
|
||||
"If this value is 'true', the blackout factor is applied to the master node. "
|
||||
"Regardless of this value, the clients will always adhere to the factor",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo FXAAInfo = {
|
||||
"FXAA",
|
||||
"Enable FXAA",
|
||||
@@ -317,6 +325,7 @@ RenderEngine::RenderEngine()
|
||||
, _showFrameInformation(ShowFrameNumberInfo, false)
|
||||
, _disableMasterRendering(DisableMasterInfo, false)
|
||||
, _globalBlackOutFactor(GlobalBlackoutFactorInfo, 1.f, 0.f, 1.f)
|
||||
, _applyBlackoutToMaster(ApplyBlackoutToMasterInfo, true)
|
||||
, _enableFXAA(FXAAInfo, true)
|
||||
, _disableHDRPipeline(DisableHDRPipelineInfo, false)
|
||||
, _hdrExposure(HDRExposureInfo, 3.7f, 0.01f, 10.f)
|
||||
@@ -377,6 +386,7 @@ RenderEngine::RenderEngine()
|
||||
addProperty(_value);
|
||||
|
||||
addProperty(_globalBlackOutFactor);
|
||||
addProperty(_applyBlackoutToMaster);
|
||||
addProperty(_screenshotWindowIds);
|
||||
addProperty(_applyWarping);
|
||||
|
||||
@@ -686,8 +696,8 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
|
||||
}
|
||||
|
||||
const bool renderingEnabled = delegate.isMaster() ? !_disableMasterRendering : true;
|
||||
if (renderingEnabled && _globalBlackOutFactor > 0.f) {
|
||||
_renderer.render(_scene, _camera, _globalBlackOutFactor);
|
||||
if (renderingEnabled && combinedBlackoutFactor() > 0.f) {
|
||||
_renderer.render(_scene, _camera, combinedBlackoutFactor());
|
||||
}
|
||||
|
||||
// The CEF webbrowser fix has to be called at least once per frame and we are doing
|
||||
@@ -755,7 +765,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
for (ScreenSpaceRenderable* ssr : ssrs) {
|
||||
ssr->render(_globalBlackOutFactor);
|
||||
ssr->render(combinedBlackoutFactor());
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
@@ -905,6 +915,15 @@ void RenderEngine::renderDashboard() {
|
||||
global::dashboard->render(penPosition);
|
||||
}
|
||||
|
||||
float RenderEngine::combinedBlackoutFactor() const {
|
||||
if (global::windowDelegate->isMaster()) {
|
||||
return _applyBlackoutToMaster ? _globalBlackOutFactor : 1.f;
|
||||
}
|
||||
else {
|
||||
return _globalBlackOutFactor;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderEngine::postDraw() {
|
||||
ZoneScoped;
|
||||
|
||||
@@ -930,14 +949,6 @@ ghoul::opengl::OpenGLStateCache& RenderEngine::openglStateCache() {
|
||||
return *_openglStateCache;
|
||||
}
|
||||
|
||||
float RenderEngine::globalBlackOutFactor() const {
|
||||
return _globalBlackOutFactor;
|
||||
}
|
||||
|
||||
void RenderEngine::setGlobalBlackOutFactor(float opacity) {
|
||||
_globalBlackOutFactor = opacity;
|
||||
}
|
||||
|
||||
float RenderEngine::hdrExposure() const {
|
||||
return _hdrExposure;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user