forked from 3DStreet/3dstreet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathintersection.html
141 lines (122 loc) · 6.26 KB
/
intersection.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html>
<head>
<script src="https://aframe.io/releases/1.4.2/aframe.min.js"></script>
<script src="./dist/aframe-street-component.js"></script>
<!-- user controls -->
<!-- ocean, ground, sky -->
<script src="src/components/ocean-plane.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>
<a-cubemap id="skycube">
<streetmix-assets url="assets/"></streetmix-assets>
<img src="assets/images/skybox/posx.jpg">
<img src="assets/images/skybox/negx.jpg">
<img src="assets/images/skybox/posy.jpg">
<img src="assets/images/skybox/negy.jpg">
<img src="assets/images/skybox/posz.jpg">
<img src="assets/images/skybox/negz.jpg">
</a-cubemap>
</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 light="type: ambient; color: #FFF; intensity: 2"></a-entity>
<a-entity light="type: directional; color: #FFF; intensity: 0.6" position="0.5 1 -1"></a-entity>
<a-ocean-plane height="100" width="100" position="0 -1 0" material="envMap: #skycube;"></a-ocean-plane>
<a-entity id="skybox" cubemap="folder: assets/images/skybox/"></a-entity>
<a-entity
position="0 0 -35"
id="left_street"
street="length: 50"
streetmix-loader="streetmixStreetURL: https://streetmix.net/kfarr/72/"
></a-entity>
<a-entity
position="42.4 0 -1"
rotation = "0 90 0"
id="perpendicular_street"
street="length: 55"
streetmix-loader="streetmixStreetURL: https://streetmix.net/srothst1/7/lapara; showBuildings: false;"
></a-entity>
<a-entity position="0 0 -1" intersection="crosswalk: 1 1 1 1; stopsign: 1 0 1 0; dimensions: 29.8704 17.9832;sidewalk: 0 6.096 6.096 0;northeastcurb: 4.8768 4.8768"></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>