-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebgl_plot_drawable.ml
57 lines (50 loc) · 1.38 KB
/
webgl_plot_drawable.ml
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
(* This file is released under the terms of an MIT-like license. *)
(* See the attached LICENSE file. *)
(* Copyright 2016 by LexiFi. *)
open Webgl_plot_math
class identified =
let next_id = ref 0 in
object
val id = !next_id
method id = id
initializer
incr next_id
end
class type object3d =
object
method id : int
method name : string
method draw : int -> int -> unit
method opaque : bool
method magnetize: float * float * float -> float * float * float
method ray: three Vector.vector -> three Vector.vector -> three Vector.vector option
method hash_state : string
method bounds: Webgl_plot_geometry.box
end
class with_alpha ?alpha () =
let alpha, opaque =
match alpha with
| Some alpha -> alpha, false
| None -> 1.0, true
in
object
val mutable alpha = alpha
val mutable opaque = opaque
method opaque = opaque
method set_alpha = function
| None ->
begin
alpha <- 1.0;
opaque <- true;
end
| Some a ->
begin
alpha <- a;
opaque <- false
end
end
class not_intersectable =
object
method ray (_ : three Vector.vector) (_ : three Vector.vector) = (None : three Vector.vector option)
method magnetize (x : float * float * float) = x
end