-
Notifications
You must be signed in to change notification settings - Fork 33
/
nightmode.html
117 lines (101 loc) · 5.28 KB
/
nightmode.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html>
<head>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="./dist/aframe-street-component.js"></script>
<script src="//cdn.8thwall.com/web/aframe/aframe-extras-6.1.1.min.js"></script>
<!-- user controls -->
<script src="https://raw.githack.com/fernandojsg/aframe-teleport-controls/master/dist/aframe-teleport-controls.min.js"></script>
<script src="src/lib/aframe-orbit-controls.min.js"></script>
<!-- ocean, ground, sky -->
<script src="src/components/ocean-plane.js"></script>
<script src="src/lib/aframe-cubemap-component.js"></script>
<title>3DStreet</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="ui_assets/favicon.ico">
<link rel="stylesheet" href="src/style.css">
</head>
<body>
<header class="header">
<div class="header-wrapper">
<div class="logo-wrapper">
<a class="logo-link" href="https://www.3dstreet.org/" id="3dstreet-logo-length">
<img class="logo-img" alt="3DStreet Viewer" src="ui_assets/logo-viewer.svg">
</a>
</div>
</header>
<div class="right-fixed">
<ul class="right-menu">
<li onclick="screenshot()"> <a class="camera" href="#"> <span> Capture image as PNG </span> <img src="ui_assets/camera-icon.svg"> </a></li>
<li> <a id="custom-enter-vr-button" class="vr" href="#"> <span class="vr">Enter VR mode</span> <img src="ui_assets/vr-icon.svg"> </a></li>
</ul>
</div>
<script>
function screenshot() {
AFRAME.scenes[0].setAttribute('screenshot','width',AFRAME.scenes[0].canvas.width)
AFRAME.scenes[0].setAttribute('screenshot','height',AFRAME.scenes[0].canvas.height)
document.querySelector('a-scene').components.screenshot.capture('perspective');
}
</script>
<div class="content">
<a-scene vr-mode-ui="enterVRButton: #custom-enter-vr-button;" renderer="colorManagement: true; highRefreshRate: true; foveationLevel: 3; physicallyCorrectLights: true; logarithmicDepthBuffer: false;" fogoff="type: linear; color: #D5C69B; far: 200" gltf-model="dracoDecoderPath: https://www.gstatic.com/draco/versioned/decoders/1.4.3/">
<a-assets>
<!-- <streetmix-assets url="assets/"></streetmix-assets> -->
</a-assets>
<a-entity id="cameraRig">
<a-entity id="camera" camera="far: 1000" wasd-controls="enabled: false" orbit-controls="autoRotate: true;autoRotateSpeed:0.01;target: 0 0 0;initialPosition:0 4 15;minDistance:3;maxDistance:100;enableKeys:false"></a-entity>
<a-entity id="leftHand" hand-controls="hand: left; handModelStyle: lowPoly; color: #ccffcc" teleport-controls="cameraRig: #cameraRig; button: trigger"></a-entity>
<a-entity id="rightHand" hand-controls="hand: right; handModelStyle: lowPoly; color: #ccffcc" teleport-controls="cameraRig: #cameraRig; button: trigger"></a-entity>
</a-entity>
<a-entity street-environment="preset: night;"></a-entity>
<a-entity id="street-parent" street streetmix-loader set-loader-from-hash="defaultURL: https://streetmix.net/kfarr/3"></a-entity>
</a-scene>
</div>
<div class="location" >
<p id="location"><img src="ui_assets/location.svg"> </p>
</div>
<script>
var locationString = (location.href.split("#")[1] != undefined) ? location.href.split("#")[1] : "https://streetmix.net/kfarr/3";
document.getElementById("location").innerHTML += locationString;
</script>
</body>
<script>
AFRAME.registerComponent('set-loader-from-hash', {
dependencies: ['streetmix-loader'],
schema: {
defaultURL: { type: 'string' }
},
init: function () {
// get hash from window
const streetURL = window.location.hash.substring(1);
if (streetURL !== undefined && streetURL.length > 0) {
console.log('[set-loader-from-hash]','Using URL from hash', streetURL)
this.el.setAttribute('streetmix-loader', 'streetmixStreetURL', streetURL);
} else {
console.log('[set-loader-from-hash]','Using default URL', this.data.defaultURL)
this.el.setAttribute('streetmix-loader', 'streetmixStreetURL', this.data.defaultURL);
}
}
});
window.onload = function () {
if (window.location.hash.substring(1).length === 0) window.location.hash = '#https://streetmix.net/kfarr/3';
document.querySelector('#inputUrl').value = window.location.hash.substring(1);
}
function startAudio() {
// set sounds enabled in global state
state.sounds.enabled = true;
// iterate through all entities with .playme class and start them playing
var entities = document.querySelectorAll('.playme'), i;
for (i = 0; i < entities.length; ++i) {
entities[i].components.sound.playSound();
}
// set 2D DOM toolbar volume icon to green to indicate state
document.getElementById("audio-icon").setAttribute("class","fa fa-volume-up");
document.getElementById("audio-icon").setAttribute("style","color: lightgreen");
}
document.querySelector('a-scene').addEventListener('enter-vr', function () {
console.log("ENTERED VR");
// startAudio();
});
</script>
</html>