This file is indexed.

/usr/lib/ocaml/lablgl/glMat.ml is in liblablgl-ocaml-dev 1:1.05-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
(* $Id: glMat.ml,v 1.11 2005-10-28 02:49:09 garrigue Exp $ *)

type t = [`double] Raw.t

external frustum :
    x:(float * float) -> y:(float * float) -> z:(float * float) -> unit
    = "ml_glFrustum"

external load_identity : unit -> unit = "ml_glLoadIdentity"
external load : t -> unit = "ml_glLoadMatrixd"
let load m =
  if Raw.length m <> 16 then invalid_arg "Gl.load_matrix";
  load m
external load_transpose : t -> unit = "ml_glLoadTransposeMatrixd"
let load_transpose m =
  if Raw.length m <> 16 then invalid_arg "Gl.load_transpose_matrix";
  load_transpose m


external get_matrix : [`modelview_matrix|`projection_matrix|`texture_matrix] -> t -> unit = "ml_glGetDoublev" 
let get_matrix mode = 
  let model = Raw.create `double ~len:16 in
  get_matrix mode model;
  model

external mode : [`modelview|`projection|`texture] -> unit
    = "ml_glMatrixMode"
external mult : t -> unit = "ml_glMultMatrixd"
let mult m =
  if Raw.length m <> 16 then invalid_arg "Gl.mult_matrix";
  mult m
external mult_transpose : t -> unit = "ml_glMultTransposeMatrixd"
let mult_transpose m =
  if Raw.length m <> 16 then invalid_arg "Gl.mult_matrix";
  mult_transpose m

external ortho :
    x:(float * float) -> y:(float * float) -> z:(float * float) -> unit
    = "ml_glOrtho"

external pop : unit -> unit = "ml_glPopMatrix"
external push : unit -> unit = "ml_glPushMatrix"

external rotate : angle:float -> x:float -> y:float -> z:float -> unit
    = "ml_glRotated"
let rotate3 ~angle (x,y,z) = rotate ~angle ~x ~y ~z
let rotate ~angle ?(x=0.) ?(y=0.) ?(z=0.) () = rotate ~angle ~x ~y ~z

external scale : x:float -> y:float -> z:float -> unit = "ml_glScaled"
let scale3 (x,y,z) = scale ~x ~y ~z
let scale ?(x=0.) ?(y=0.) ?(z=0.) () = scale ~x ~y ~z

external translate : x:float -> y:float -> z:float -> unit = "ml_glTranslated"
let translate3 (x,y,z) = translate ~x ~y ~z
let translate ?(x=0.) ?(y=0.) ?(z=0.) () = translate ~x ~y ~z

let of_raw mat =
  if Raw.length mat <> 16 then invalid_arg "GlMatrix.of_array";
  mat
external to_raw : t -> [`double] Raw.t = "%identity"

let of_array m : t =
  if Array.length m <> 4 then invalid_arg "GlMatrix.of_array";
  let mat = Raw.create `double ~len:16 in
  for i = 0 to 3 do
    let arr = Array.unsafe_get m i in
    if Array.length arr <> 4 then invalid_arg "GlMatrix.of_array";
    Raw.sets_float mat ~pos:(i*4) arr
  done;
  mat

let to_array (mat : t) =
  let m = Array.create 4 [||] in
  for i = 0 to 3 do
    Array.unsafe_set m i (Raw.gets_float mat ~pos:(i*4) ~len:4)
  done;
  m