-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
155 lines (139 loc) · 9.3 KB
/
index.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<html>
<head>
<meta charset="utf-8" />
<title>City Builder Jr</title>
<meta name="description" content="Try with a WebXR headset" />
<script src="https://aframe.io/releases/1.5.0/aframe.min.js"></script>
<script src="./dist/citybuilderjr.js"></script>
</head>
<body>
<a-scene
xr-mode-ui="XRMode: ar"
renderer="colorManagement: true;"
load-catalog="source: #catalog"
background="color: #595959"
>
<a-assets>
<a-asset-item id="catalog" src="./catalog.json"></a-asset-item>
<!-- <img id="groundTexture" src="https://cdn.aframe.io/a-painter/images/floor.jpg" crossorigin="anonymous" /> -->
<!-- <img id="skyTexture" src="https://cdn.aframe.io/a-painter/images/sky.jpg" crossorigin="anonymous" /> -->
<audio id="click-ogg"
src="https://cdn.glitch.com/e8742440-f85d-495a-8f52-6f066f464880%2Fclick_003.ogg?v=1599273869869"
crossorigin="anonymous"></audio>
<audio id="scroll4-ogg"
src="https://cdn.glitch.com/e8742440-f85d-495a-8f52-6f066f464880%2Fscroll_004.ogg?v=1599280533644"
crossorigin="anonymous"></audio>
<audio id="select6-ogg"
src="https://cdn.glitch.com/e8742440-f85d-495a-8f52-6f066f464880%2Fselect_006.ogg?v=1599280906834"
crossorigin="anonymous"></audio>
<audio id="select5-ogg"
src="https://cdn.glitch.com/e8742440-f85d-495a-8f52-6f066f464880%2Fselect_005.ogg?v=1599280906992"
crossorigin="anonymous"></audio>
<audio id="glass2-ogg"
src="https://cdn.glitch.com/e8742440-f85d-495a-8f52-6f066f464880%2Fglass_002.ogg?v=1599281940496"
crossorigin="anonymous"></audio>
<audio id="glass6-ogg"
src="https://cdn.glitch.com/e8742440-f85d-495a-8f52-6f066f464880%2Fglass_006.ogg?v=1599281942342"
crossorigin="anonymous"></audio>
<audio id="ambient"
src="https://cdn.glitch.com/e8742440-f85d-495a-8f52-6f066f464880%2FAMB_Suburbs_Afternoon_Woods_Spring_Small_ST_MKH8050-30shortened_amplified.mp3?v=1599596031022"
crossorigin="anonymous"></audio>
<a-mixin id="voxel" scale="0.5 0.5 0.5" geometry="primitive: box; height: 0.25; width: 0.25; depth: 0.25" material="shader: standard"
set-model-from-state snap="offset: 0.125; snap: 0.25"></a-mixin>
<a-mixin id="hoverEffect"
animation__mouseenter="property: components.material.material.color; type: color; from: #444; to: #FFF; dur: 200; startEvents: mouseenter"
animation__mouseleave="property: components.material.material.color; type: color; from: #FFF; to: #444; dur: 200; startEvents: mouseleave"
sound__hover="src: #glass2-ogg; on: mouseenter;"></a-mixin>
<a-mixin id="slice"
slice9="transparent: true; opacity: 0.9; src: #sliceImg; left: 15; right: 52; top: 15; bottom: 52; padding: 0.055"></a-mixin>
<img id="sliceImg"
src="https://cdn.glitch.com/eed0ef68-30af-43e5-91e2-432e3a9bae97%2F9127db83-3bfa-4331-9320-a41e2935e13f_tooltip.png"
crossorigin />
<img id="logoImg"
src="https://cdn.glitch.com/04a3ab50-8caa-4927-b1c6-d76f07d1d5cc%2Fcity-builder-jr-logo-min.png?v=1599862475818"
crossorigin />
</a-assets>
<a-entity id="cursor" geometry="primitive: box; height: 0.25; width: 0.25; depth: 0.25"
animation="property: components.material.material.opacity; from: 0.7; to: 0.2; loop: true"
material="shader: standard; color: #F00; opacity: 0.5; " bind__material="color: color.hex"
sound="src: #click-ogg; on: cursormoved; poolSize: 10;"
set-rotation-from-anchor></a-entity>
<!-- <a-entity id="world-grid"
gridhelper="size:5;divisions:10;colorGrid:#000000;colorCenterLine:#222222;"></a-entity> -->
<a-entity id="city-container" anchored="persistent: true">
<a-entity id="cityhall" gltf-model="./dist/models/cityhall.glb" scale="0.250 0.250 0.250"></a-entity>
<a-entity id="ground" sound="src: #select6-ogg; on: click; poolSize: 6;" geometry="primitive: box; height: 0.1; width: 5; depth: 5;" class="collidable spawnable" material="visible:false"
grid-cursor="allowFrom: .can-select"
gridhelper="size:5;divisions:20;colorGrid:#660066;colorCenterLine:#FF5555;"
bind-for="for: item; in: grid; key: coord; updateInPlace: true"
>
<template>
<a-entity scale="0.125 0.125 0.125"
geometry="primitive: box; height: 0.25; width: 0.25; depth: 0.25" material="shader: standard"
snap="offset: 0.125; snap: 0.25"
bind-item__grid-rotation="rotation: item.rotation"
bind-item__grid-model="model: item.model"
bind-item__grid-coord="gridCoord: item.coord"
></a-entity>
</template>
</a-entity>
<a-entity id="whiteboard" rotation="0 -70 0" scale="0.8 0.8 0.8" position="-0.5 -0.046 -4">
<a-entity id="whiteboard-model" scale="0.15 0.15 0.2"
gltf-model="src: url(https://cdn.glitch.com/1f272f01-6d82-443d-9bc8-fd11301a5d9e%2Fwhiteboard-gltfpack.glb?v=1599846766103)"></a-entity>
<a-entity id="header" scale="2.2 2.2 2.2" position="0.02 1.98 0" rotation="0 90 0" geometry="primitive: plane;"
material="src: #logoImg; transparent: true; shader: flat"></a-entity>
<a-entity></a-entity>
<a-entity id="whiteboardMenuSlot" position="0.1 1.4 0" rotation="0 90 0" scale="0.5 0.5 0.5">
<a-entity id="menuWhiteboardColor" mixin="slice" slice9="height: 1; width: 3; color: #000000">
<a-triangle proxy-event="event: click; to: a-scene; as: decreaseColorIndex" class="collidable"
mixin="hoverEffect" rotation="0 0 90" scale="0.5 0.5 0.5" position="-1 0 0.01" material="color: #444"
sound="src: #select5-ogg; on: click; poolSize: 6;"></a-triangle>
<a-entity bind__text="value: color.index + '\n' + color.name + '\n' + color.hex"
bind__material="color: color.hex" text="color: #111; width: 3; align: center" geometry="primitive: plane"
material="color: #CCC" position="0 0 0.01" scale="0.9 0.9 0.9"></a-entity>
<a-triangle proxy-event="event: click; to: a-scene; as: increaseColorIndex" class="collidable"
mixin="hoverEffect" rotation="0 0 -90" scale="0.5 0.5 0.5" position="1 0 0.01" material="color: #444"
sound="src: #select5-ogg; on: click; poolSize: 6;"></a-triangle>
</a-entity>
<a-entity id="menuWhiteboardModel" position="0 1.1 0" mixin="slice"
slice9="height: 1; width: 3; color: #000000">
<a-triangle proxy-event="event: click; to: a-scene; as: decreaseModelIndex" class="collidable"
mixin="hoverEffect" rotation="0 0 90" scale="0.5 0.5 0.5" position="-1 0 0.01" material="color: #444"
sound="src: #select5-ogg; on: click; poolSize: 6;"></a-triangle>
<a-entity bind__text="value: '\n\n\n\n\n ' + model.name" bind__material="src: 'url(' + model.img + ')'"
geometry="primitive: plane; buffer: false; skipCache: true" text="color: #111; width: 3; align: center"
material="color: #CCC" position="0 0 0.01" scale="0.9 0.9 0.9"></a-entity>
<a-triangle proxy-event="event: click; to: a-scene; as: increaseModelIndex" class="collidable"
mixin="hoverEffect" rotation="0 0 -90" scale="0.5 0.5 0.5" position="1 0 0.01" material="color: #444"
sound="src: #select5-ogg; on: click; poolSize: 6;"></a-triangle>
</a-entity>
</a-entity>
</a-entity>
</a-entity>
<!-- <a-entity id="skyMenuSlot" position="0 3 -3" scale="1 1 1" look-at="#camera-ray"></a-entity> -->
<!-- Camera and Controls -->
<a-entity id="rig">
<a-camera look-controls="touchEnabled: false">
<a-entity id="camera-ray" class="can-select" raycaster="objects: .collidable" cursor="rayOrigin: mouse"
intersection-spawn="event: click; mixin: voxel; objects: spawnable; gridSize:5; gridDivisions:20;"></a-entity>
</a-camera>
<a-entity id="leftHand" laser-controls="hand: left" raycaster="objects: .collidable"></a-entity>
<a-entity id="rightHand" laser-controls="hand: right" raycaster="objects: .collidable"
intersection-spawn="event: click; mixin: voxel; objects: spawnable; gridSize:5; gridDivisions:20;" class="can-select">
<a-entity id="menuHand" scale="0.1 0.1 0.1" look-at="#camera-ray" position="0 0 -0.2" mixin="slice"
slice9="height: 1; width: 3; color: #777777">
<a-triangle proxy-event="event: click; to: a-scene; as: decreaseModelIndex" class="collidable"
mixin="hoverEffect" rotation="0 0 90" scale="0.5 0.5 0.5" position="-1 0 0.01" material="color: #444"
sound="src: #select5-ogg; on: click; poolSize: 6;"></a-triangle>
<a-entity bind__text="value: '\n\n\n\n\n ' + model.name" bind__material="src: 'url(' + model.img + ')'"
geometry="primitive: plane; buffer: false; skipCache: true" text="color: #111; width: 3; align: center"
material="color: #CCC" position="0 0 0.01" scale="0.9 0.9 0.9"></a-entity>
<a-triangle proxy-event="event: click; to: a-scene; as: increaseModelIndex" class="collidable"
mixin="hoverEffect" rotation="0 0 -90" scale="0.5 0.5 0.5" position="1 0 0.01" material="color: #444"
sound="src: #select5-ogg; on: click; poolSize: 6;"></a-triangle>
</a-entity>
</a-entity>
</a-entity>
</a-scene>
</body>
</html>