Sound
This commit is contained in:
parent
c319bb460a
commit
cb53f9b16f
|
@ -2,7 +2,7 @@ version 1 .
|
|||
|
||||
Sprite = <sprite @name string @shape Shape> .
|
||||
|
||||
Shape = Mesh / Light / Scale / Move / Rotate / @many [Shape ...] / Texture / Color / Name / Floor / Nonphysical / Touchable / CSG / Skybox .
|
||||
Shape = Mesh / Light / Scale / Move / Rotate / @many [Shape ...] / Texture / Color / Sound / Name / Floor / Nonphysical / Touchable / CSG / Skybox .
|
||||
|
||||
Mesh = Sphere / Box / Ground / Plane / External .
|
||||
|
||||
|
@ -34,6 +34,8 @@ Color =
|
|||
/ @transparent <color @r double @g double @b double @alpha double @shape Shape>
|
||||
.
|
||||
|
||||
Sound = <sound @url string @shape Shape> .
|
||||
|
||||
Name = <name @base string @shape Shape> .
|
||||
|
||||
Floor = <floor @shape Shape> .
|
||||
|
|
|
@ -76,12 +76,13 @@
|
|||
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
|
||||
<v 1.0 3.0 1.0>
|
||||
<v 0.0 0.0 0.0>]
|
||||
<csg
|
||||
<subtract [
|
||||
<move <v 0.0 0.0 0.5> <scale <v 1.1 3.1 1.1> <mesh <box>>>>
|
||||
<move <v 0.0 0.0 0.5> <scale <v 1.0 3.0 1.0> <mesh <box>>>>
|
||||
]>
|
||||
>
|
||||
<sound "https://streams.95bfm.com/stream95"
|
||||
<csg
|
||||
<subtract [
|
||||
<move <v 0.0 0.0 0.5> <scale <v 1.1 3.1 1.1> <mesh <box>>>>
|
||||
<move <v 0.0 0.0 0.5> <scale <v 1.0 3.0 1.0> <mesh <box>>>>
|
||||
]>
|
||||
>>
|
||||
>>>
|
||||
|
||||
; <Exit "y" "lobby">
|
||||
|
|
|
@ -12,6 +12,7 @@ import {
|
|||
Quaternion,
|
||||
Scene,
|
||||
SceneLoader,
|
||||
Sound,
|
||||
StandardMaterial,
|
||||
Texture,
|
||||
TransformNode,
|
||||
|
@ -252,6 +253,27 @@ export function build(name: string, scene: Scene, shape: Shapes.Shape, customize
|
|||
});
|
||||
}
|
||||
|
||||
case "Sound": {
|
||||
const sound = new Sound(
|
||||
name + ".sound",
|
||||
shape.value.url,
|
||||
scene,
|
||||
null,
|
||||
{
|
||||
distanceModel: "inverse",
|
||||
loop: true,
|
||||
rolloffFactor: 0.25,
|
||||
autoplay: true,
|
||||
streaming: true,
|
||||
skipCodecCheck: true,
|
||||
});
|
||||
console.log(sound);
|
||||
return build(name + ".inner", scene, shape.value.shape, {
|
||||
... customize,
|
||||
sound: async m => sound.attachToMesh(m.rootnode),
|
||||
});
|
||||
}
|
||||
|
||||
case "Name":
|
||||
return build(name + '.' + shape.value.base, scene, shape.value.shape, customize);
|
||||
|
||||
|
|
Loading…
Reference in New Issue