@@ -71,9 +71,9 @@ async function main(embedURL) {
71
71
let textGroup , textMesh , textGeo , textMaterials ;
72
72
let text = `Outside the virtual computer:\n\nLeft-click to rotate\nRight-click to pan\nScroll wheel for zoom` , font = 'helvetiker'
73
73
const textHeight = 0 ,
74
- size = 0.015 ,
75
- hover = 0.51 ,
76
- curveSegments = 4
74
+ size = 0.015 ,
75
+ hover = 0.51 ,
76
+ curveSegments = 4
77
77
78
78
textMaterials = [
79
79
new THREE . MeshPhongMaterial ( { color : 0xffffff , flatShading : true } ) , // front
@@ -144,13 +144,10 @@ async function main(embedURL) {
144
144
animate ( )
145
145
146
146
function tryAudio ( track ) {
147
+ // sound.play() does not need to be called when calling setMediaStreamSource
148
+ // See https://threejs.org/docs/#api/en/audio/Audio.setMediaStreamSource
147
149
sound . setMediaStreamSource ( new MediaStream ( [ track ] ) )
148
150
sound . setRefDistance ( 0.5 )
149
- // The audio context might be waiting on a user gesture
150
- // In that case, we'll call sound.play() in the pointerdown handler
151
- if ( listener . context . state === "running" ) {
152
- sound . play ( )
153
- }
154
151
}
155
152
156
153
function onWindowResized ( ) {
@@ -215,7 +212,6 @@ async function main(embedURL) {
215
212
// resume the audio context now since the user interacted with the page
216
213
if ( listener . context . state === "suspended" ) {
217
214
await listener . context . resume ( )
218
- await sound . play ( )
219
215
}
220
216
}
221
217
@@ -243,7 +239,6 @@ function checkerboardMesh(width, segments) {
243
239
} )
244
240
const positionAttribute = geometry . getAttribute ( "position" )
245
241
const colors = [ ]
246
- console . log ( segments * segments , positionAttribute . count / 6 )
247
242
for ( let i = 0 ; i < positionAttribute . count ; i ++ ) {
248
243
colors . push ( 0 , 0 , 0 , i % 6 === i % 12 ? 1 : 0 )
249
244
}
0 commit comments