Fix handling of light direction (hopefully)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
// Global ATON and THREE
|
||||
|
||||
import AppState from "../state.js";
|
||||
|
||||
/**
|
||||
* @module Environment
|
||||
*/
|
||||
@@ -28,16 +30,21 @@ export function toggleAmbientOcclusion(isEnabled) {
|
||||
* @param {Number} step - The slider's step
|
||||
*/
|
||||
export function createLightSlider(direction, label, range, step) {
|
||||
const currentVal = ATON.getMainLightDirection()[direction];
|
||||
const currentVal = AppState.lightDirection[direction];
|
||||
|
||||
console.debug(currentVal);
|
||||
|
||||
const lightSlider = ATON.UI.createSlider({
|
||||
range,
|
||||
label,
|
||||
value: Number.parseFloat(currentVal).toPrecision(1),
|
||||
value: Number.parseFloat(currentVal).toPrecision(2),
|
||||
oninput: val => {
|
||||
const lightDir = ATON.getMainLightDirection();
|
||||
const lightDir = AppState.lightDirection;
|
||||
|
||||
// Keep existing direction values for the other axes
|
||||
lightDir[direction] = Number.parseFloat(val);
|
||||
changeLightDirection(lightDir);
|
||||
AppState.lightDirection = lightDir;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user