From a77a99f056dabef7023603ab064e1de41d3aef06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20P?= Date: Fri, 10 Oct 2025 16:25:05 +0200 Subject: [PATCH] Change map initial center and zoom + lame clipping plane... --- config.js | 4 ++-- index.html | 6 ++++++ js/main.js | 2 ++ js/scene.js | 33 ++++++++++++++++++++++++++++++--- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/config.js b/config.js index aabe1c8..6f57918 100644 --- a/config.js +++ b/config.js @@ -17,8 +17,8 @@ export const config = { } ], map : { - center: [41.9028, 12.4964], - initialZoom : 6, + center: [43.570833, 12.140278], + initialZoom : 7, minZoom : 5, maxZoom : 15 } diff --git a/index.html b/index.html index efee111..4735d92 100644 --- a/index.html +++ b/index.html @@ -75,11 +75,17 @@ + + + + +
Disabilitare le ombre può migliorare le prestazioni
+
diff --git a/js/main.js b/js/main.js index 640b4d4..999d478 100644 --- a/js/main.js +++ b/js/main.js @@ -24,12 +24,14 @@ APP.UI.pauseAudio = function(triggerSelector) { }); } + // APP.setup() is required for web-app initialization // You can place here UI setup (HTML), events handling, etc. APP.setup = ()=>{ Map.init('map'); Scene.toggleScene('back'); APP.UI.pauseAudio('[data-bs-dismiss="modal"'); + //APP.UI.showClipper('#clipper'); }; /* If you plan to use an update routine (executed continuously), you can place its logic here. diff --git a/js/scene.js b/js/scene.js index aec9eab..0ee88af 100644 --- a/js/scene.js +++ b/js/scene.js @@ -10,6 +10,8 @@ const material = { const Scene = {}; +Scene.UI = {}; + /** * @todo Experimental... * @param {THREE.Object3D} object - A THREE Object3D instance @@ -31,10 +33,26 @@ Scene.showEdges = function(object) { /** * - * @param {{x,y,z}} vector - An object with x,y,z coordinates + */ +Scene.activateClipper = function() { + const geometry = new THREE.PlaneGeometry( 24, 24 ); + const material = new THREE.MeshPhongMaterial({ + color: 0xffffee, + opacity: 0.5, + transparent: true, + }); + const plane = new THREE.Mesh( geometry, material ); + const root = ATON.getRootScene(); + console.log(root, plane); + root.add(plane); +} + +/** + * + * @param {THREE.Vector3} vector - An object with x,y,z coordinates */ Scene.changeLightDirection = function(vector) { - ATON.setMainLightDirection(new THREE.Vector3(vector.x, vector.y, vector.z)); + ATON.setMainLightDirection(vector); } /** @@ -111,7 +129,7 @@ Scene.toggleSettingsPanel = function(id) { shadowsSwitch.className = 'form-check form-switch ms-4 mt-2'; shadowsSwitch.innerHTML = ` - + `; shadowsSwitch.querySelector('input[type="checkbox"').checked = AppState.shadows; @@ -137,6 +155,13 @@ Scene.toggleSettingsPanel = function(id) { }); } +Scene.UI.showClipper = function(triggerSelector) { + document.querySelector(triggerSelector).addEventListener( + 'click', + () => Scene.activateClipper() + ); +} + Scene.init = function() { console.log("I'm initializing, baby!") ATON.realize(); @@ -197,6 +222,8 @@ Scene.openScene = function(marker) { ATON.setAutoLP(true); Scene.toggleAmbientOcclusion(true); + + Scene.UI.showClipper('#clipper'); } //const rootUI = ATON.getRootUI(); }