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
|
module SomhairlesDream.Frontend.Bindings
open Fable.Core
[<Erase>]
type ThreeVector =
abstract set: x: float * y: float * z: float -> ThreeVector
abstract x: float with get, set
abstract y: float with get, set
abstract z: float with get, set
[<Erase>]
type ThreeNode =
abstract add: child: ThreeNode -> unit
abstract clear: unit -> unit
abstract lookAt: x: float * y: float * z: float -> unit
abstract position: ThreeVector with get
abstract rotation: ThreeVector with get
abstract background: obj with get, set
[<Erase>]
type ThreeRenderer =
abstract setPixelRatio: ratio: float -> unit
abstract setSize: width: float * height: float * updateStyle: bool -> unit
abstract render: scene: ThreeNode * camera: ThreeNode -> unit
[<Erase>]
type ThreeGeometry =
abstract setAttribute: name: string * attribute: obj -> ThreeGeometry
abstract setIndex: attribute: obj -> ThreeGeometry
abstract computeVertexNormals: unit -> unit
[<Erase>]
type ServerEvent =
abstract data: string with get
[<Erase>]
type GLTFScene =
abstract scene: ThreeNode with get
[<Emit("new GLTFLoader()")>]
let createGLTFLoader () : obj = jsNative
[<Emit("$0.load($1, $2, null, $3)")>]
let loadGLTF (loader: obj) (url: string) (onLoad: GLTFScene -> unit) (onError: obj -> unit) : unit = jsNative
[<Emit("new URLSearchParams(window.location.search).get($0)")>]
let queryParam (name: string) : string = jsNative
[<Erase>]
type EventSource =
abstract onerror: (obj -> unit) with get, set
abstract onmessage: (ServerEvent -> unit) with get, set
abstract close: unit -> unit
[<Erase>]
type FetchResponse =
abstract ok: bool with get
abstract status: int with get
abstract json: unit -> JS.Promise<obj>
[<Erase>]
type HtmlInput =
abstract value: string with get
abstract ``checked``: bool with get
[<Emit("new THREE.Scene()")>]
let createScene () : ThreeNode = jsNative
[<Emit("new THREE.Group()")>]
let createGroup () : ThreeNode = jsNative
[<Emit("new THREE.PerspectiveCamera($0, $1, $2, $3)")>]
let createPerspectiveCamera (fieldOfView: float, aspect: float, nearPlane: float, farPlane: float) : ThreeNode = jsNative
[<Emit("new THREE.WebGLRenderer($0)")>]
let createRenderer (options: obj) : ThreeRenderer = jsNative
[<Emit("new THREE.BufferGeometry()")>]
let createBufferGeometry () : ThreeGeometry = jsNative
[<Emit("new THREE.Float32BufferAttribute($0, $1)")>]
let createFloat32BufferAttribute (values: float array, itemSize: int) : obj = jsNative
[<Emit("new THREE.Uint32BufferAttribute($0, 1)")>]
let createUint32BufferAttribute (values: int array) : obj = jsNative
[<Emit("new THREE.Color($0)")>]
let createColor (value: string) : obj = jsNative
[<Emit("new THREE.BoxGeometry($0, $1, $2)")>]
let createBoxGeometry (width: float, height: float, depth: float) : obj = jsNative
[<Emit("new THREE.MeshStandardMaterial($0)")>]
let createMeshStandardMaterial (options: obj) : obj = jsNative
[<Emit("new THREE.Mesh($0, $1)")>]
let createMesh (geometry: obj, material: obj) : ThreeNode = jsNative
[<Emit("new THREE.AmbientLight($0, $1)")>]
let createAmbientLight (color: string, intensity: float) : ThreeNode = jsNative
[<Emit("new THREE.DirectionalLight($0, $1)")>]
let createDirectionalLight (color: string, intensity: float) : ThreeNode = jsNative
[<Emit("new EventSource($0)")>]
let createEventSource (url: string) : EventSource = jsNative
[<Global("fetch")>]
let fetch (url: string, options: obj) : JS.Promise<FetchResponse> = jsNative
[<Global("encodeURIComponent")>]
let encodeURIComponent (value: string) : string = jsNative
[<Global("setInterval")>]
let setInterval (callback: unit -> unit) (milliseconds: int) : int = jsNative
[<Global("clearInterval")>]
let clearInterval (handle: int) : unit = jsNative
[<Global("requestAnimationFrame")>]
let requestAnimationFrame (callback: float -> unit) : int = jsNative
|