VOXEDIT: set default ambient color value to white

master
Martin Gerhardy 2022-05-22 20:36:03 +02:00
parent a8d842715f
commit 5465676fd2
2 changed files with 11 additions and 9 deletions

View File

@ -5,6 +5,8 @@
#include "RawVolumeRenderer.h"
#include "core/Common.h"
#include "core/Trace.h"
#include <glm/ext/scalar_constants.hpp>
#include <glm/gtc/epsilon.hpp>
#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();

View File

@ -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;