From 7a16e43fb625e315555770cf19ea3fb6e3e8db50 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Mon, 21 Nov 2022 21:16:19 +0100 Subject: [PATCH] updated hotspots and added visual markers --- index.html | 64 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index 08c1592..a6322d4 100644 --- a/index.html +++ b/index.html @@ -42,27 +42,25 @@ var currentGeoPose = null; // https://developer.mozilla.org/en-US/docs/Web/API/G // otherwise have 2 fallbacks via menu var positionsCurated = [ -// [50.8354400, 4.3582900], { position:[50.8365354, 4.3581719], hotspots: []}, - { shortname: "baquets", worldposition:[83.03582, -346.4272], position:[49.3516400, 0.5461600], + { shortname: "baquets", worldposition:[83.03582, -346.4272], position:[49.3516400, 0.5461600], // way heavier! hotspots: [ - // done via the AFrame inspector then pasting here, then regex - [-126.65372, -0.46424], [-126.65372, -0.46424], [-126.29815, -26.94149], [-125.92851, -42.42632], [-122.30186, -52.18768], [-105.27281, -51.22971], [-104.02136, -36.467], [-102.82045, -18.61413], [-102.20349, -3.76295], [-118.85539, 2.56914], - + // done via the AFrame inspector then pasting here, then regex + "43.48623 3 -288.74555", "68.57429 3 -282.87103", "46.02284 3 -305.55214", "49.22355 3 -327.33712", "52.05644 3 -340.62478", "77.24641 3 -340.95731", "78.9282 3 -321.94687", "76.38192 3 -304.13508", "73.59993999999999 3 -290.19813", "56.94803999999999 3 -283.86604", + ], + visualMarkerPositions:[ + {rotation:"0 -90 0" , position:"54.31842 -0.21946 -335.17472"}, + {rotation:"0 -90 0" , position:"46.8447 -0.21946 -291.55328"}, ], - hotspotoffsetPosition: new THREE.Vector3(175.80343,0,-286.43518), - //hotspotoffsetRotation: "0 8.047765190407544 0" }, { shortname: "ruelle", worldposition:[-126, -40], position:[49.3605700, 0.5031000], - hotspots: [ - [-134.62038, -13.29107], [-125.89544, -30.36393], [-119.72245, -49.78609], [-96.91944, -95.00968], [-90.17903, -109.1628], -, [-142.76086, 11.1124] + hotspots: [ "-134.62038 3 -13.29107", "-125.89544 3 -30.36393", "-119.72245 3 -49.78609", "-96.91944 3 -95.00968", "-90.17903 3 -109.1628", "-142.76086 3 11.1124", + visualMarkerPositions:[ + {position:"-124.32254 0.78377 -46.41836"}, + {position:"-130.50386 0.78377 -30.91602"}, + {position:"-137.62082 0.78377 -12.86285"}, ], - hotspotoffsetPosition: new THREE.Vector3(), - //hotspotoffsetPosition: "0 0 0", - //hotspotoffsetRotation: "0 0 0", }, - { position:[50.8440239, 4.3952614], hotspots: []}, // brussels for tests ] var textureOffsetStart = 0 @@ -106,7 +104,8 @@ var forceSelection = AFRAME.utils.getUrlParameter('position'); if ( forceSelection ) selection = forceSelection var position = positionsCurated[selection].position -var hotspots = positionsCurated[selection].hotspots.map( i => [ i[0]+positionsCurated[selection].hotspotoffsetPosition.x ,i[1]+positionsCurated[selection].hotspotoffsetPosition.z ] ) +var hotspots = positionsCurated[selection].hotspots +var visualmarkers = positionsCurated[selection].visualMarkerPositions var precision = 4 var bbox_limit = 10/10**precision @@ -439,19 +438,32 @@ AFRAME.registerComponent('cerema', { } }) +AFRAME.registerComponent('watervisuals', { + init: function () { + var el = this.el + visualmarkers.map( h => { + var pointEl = document.createElement("a-gltf-model") + pointEl.setAttribute("gltf-model", "Visuals/ASSETS_3D/AA_Crue.glb") + pointEl.setAttribute("scale", "60 60 60") + pointEl.setAttribute("rotation", "0 70 0") + pointEl.setAttribute("position", h.position) + if (h.rotation) pointEl.setAttribute("rotation", h.rotation) + el.appendChild( pointEl ) + }) + + } +}) + AFRAME.registerComponent('hotspots', { init: function () { var el = this.el hotspots.map( h => { - //var pointEl = document.createElement("a-sphere") - //pointEl.setAttribute("geometry", "segmentsHeight: 4; segmentsWidth: 8") var pointEl = document.createElement("a-gltf-model") pointEl.setAttribute("gltf-model", "Visuals/ASSETS_3D/AA_Hotspot.glb") - //pointEl.setAttribute("opacity", .3) pointEl.setAttribute("model-opacity", .3) pointEl.setAttribute("scale", "50 50 50") - pointEl.setAttribute("position", h[0] + " 3 " + h[1]) pointEl.setAttribute("teleport-via-cursor", true) + pointEl.setAttribute("position", h) el.appendChild( pointEl ) }) @@ -617,8 +629,9 @@ function playSound(param){ } - + + @@ -642,10 +655,9 @@ function playSound(param){ - - + - - + -