Fix handling of light direction (hopefully)
This commit is contained in:
@@ -42,6 +42,7 @@ function init () {
|
||||
AppState.camera = ATON.Nav._camera;
|
||||
AppState.renderer = ATON._renderer;
|
||||
AppState.shadows = config.scene.shadows;
|
||||
AppState.lightDirection = ATON.getMainLightDirection();
|
||||
|
||||
ATON.Nav.setUserControl(true);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ let AppState = {
|
||||
// {id: String, active: Boolean}
|
||||
nodes: [],
|
||||
/**
|
||||
* @property {NormalizedSceneNode[]} normalizedNodes
|
||||
* @type {NormalizedSceneNode[]} normalizedNodes
|
||||
*/
|
||||
normalizedNodes: [],
|
||||
mainNodeId: null,
|
||||
@@ -28,6 +28,7 @@ let AppState = {
|
||||
sceneHasAudio: false,
|
||||
layersMenuBuilt: false,
|
||||
initialRotation: null,
|
||||
lightDirection: [],
|
||||
camera: null,
|
||||
renderer: null,
|
||||
ambientOcclusion : true,
|
||||
|
||||
@@ -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