diff --git a/src/modules/voxelrender/RawVolumeRenderer.cpp b/src/modules/voxelrender/RawVolumeRenderer.cpp index 3d4d52242..8d4fac8e5 100644 --- a/src/modules/voxelrender/RawVolumeRenderer.cpp +++ b/src/modules/voxelrender/RawVolumeRenderer.cpp @@ -5,6 +5,8 @@ #include "RawVolumeRenderer.h" #include "core/Common.h" #include "core/Trace.h" +#include +#include #include "video/FrameBufferConfig.h" #include "video/ScopedFrameBuffer.h" #include "video/Texture.h" @@ -290,12 +292,18 @@ bool RawVolumeRenderer::updateBufferForVolume(int idx, const voxel::VertexArray& } void RawVolumeRenderer::setAmbientColor(const glm::vec3& color) { + if (glm::all(glm::epsilonEqual(_ambientColor, color, 0.001f))) { + return; + } _ambientColor = color; // force updating the cached uniform values _voxelShader.markDirty(); } void RawVolumeRenderer::setDiffuseColor(const glm::vec3& color) { + if (glm::all(glm::epsilonEqual(_diffuseColor, color, 0.001f))) { + return; + } _diffuseColor = color; // force updating the cached uniform values _voxelShader.markDirty(); diff --git a/src/tools/voxedit/modules/voxedit-util/SceneManager.cpp b/src/tools/voxedit/modules/voxedit-util/SceneManager.cpp index 4f89b7039..4ef8459a3 100644 --- a/src/tools/voxedit/modules/voxedit-util/SceneManager.cpp +++ b/src/tools/voxedit/modules/voxedit-util/SceneManager.cpp @@ -1792,7 +1792,7 @@ bool SceneManager::init() { } _autoSaveSecondsDelay = core::Var::get(cfg::VoxEditAutoSaveSeconds, "180"); - _ambientColor = core::Var::get(cfg::VoxEditAmbientColor, "0.2 0.2 0.2"); + _ambientColor = core::Var::get(cfg::VoxEditAmbientColor, "1.0 1.0 1.0"); _diffuseColor = core::Var::get(cfg::VoxEditDiffuseColor, "1.0 1.0 1.0"); _cameraZoomSpeed = core::Var::get(cfg::VoxEditCameraZoomSpeed, "10.0"); const core::TimeProviderPtr& timeProvider = app::App::getInstance()->timeProvider(); @@ -1899,14 +1899,8 @@ bool SceneManager::update(double nowSeconds) { }); } - if (_ambientColor->isDirty()) { - _volumeRenderer.setAmbientColor(_ambientColor->vec3Val()); - _ambientColor->markClean(); - } - if (_diffuseColor->isDirty()) { - _volumeRenderer.setDiffuseColor(_diffuseColor->vec3Val()); - _diffuseColor->markClean(); - } + _volumeRenderer.setAmbientColor(_ambientColor->vec3Val()); + _volumeRenderer.setDiffuseColor(_diffuseColor->vec3Val()); animate(nowSeconds); autosave(); return loadedNewScene;