(* ************ *)
(* Mip textures *)
(* ************ *)

type mipheader_t = {
  numtex : long_t ;        (* Number of textures in mip texture list *)
  moffset : long_t array   (* Offset to each individual texture from ... *)
                           (* ... the beginning of mipheader_t *)
  } ;;

type miptex_t = {
  name : string ;        (* Name of the texture *)
  width : long_t ;       (* Width of the picture, must be a multiple of 8 *)
  height : long_t ;      (* Height of the picture, must be a multiple of 8 *)
  offset1 : long_t ;     (* Offset to u_char Pix[width * height] *)
  offset2 : long_t ;     (* Offset to u_char Pix[width/2 * height/2] *)
  offset4 : long_t ;     (* Offset to u_char Pix[width/4 * height/4] *)
  offset8 : long_t       (* Offset to u_char Pix[width/8 * height/8] *)
  } ;;


let sizeof_texinfo_t = 40 ;;


(* ******** *)
(* Surfaces *)
(* ******** *)

type surface_t = {
  vectorS : vec3_t ;       (* S vector, horizontal in texture space *)
  distS : scalar_t ;       (* Horizontal offset in texture space *)
  vectorT : vec3_t ;       (* T vector, vertical in texture space *)
  distT : scalar_t ;       (* Vertical offset in texture space *)
  texture_id : ulong_t ;   (* Index of mip texture. [0, numtex[ *)
  animated : ulong_t       (* 0 for ordinary textures, 1 for water *)
  } ;;

