










(**************************************************************************)
(* $Id: vrml_objects_pre.ml,v 1.8 1997/05/01 13:58:20 doub Exp $          *)
(* Creation and manipulation of VRML objects                              *)
(**************************************************************************)

open Compatibility;;
open Types;;
open Default;;
open Exceptions;;
open Basic_types;;
open Font;;
open Fonts;;
open Colors;;




(**************************************************************************)
(* Creation of VRML objects                                               *)
(**************************************************************************)

(* New empty referential **************************************************)

(* new_referential: vrml_object *)
let new_referential = default_vrml_object ;;


(* New VRML obj ********************************************************)

(* new_vrml_object :
 vrml_positionable list -> vrml_object list -> vect3D -> rotation
-> vect3D -> frame -> bool -> anchor -> billboard -> collision
-> vrml_object *)
let new_vrml_object objects children position rotation scale
                    frame unique anchor billboard collision =
    { objects   = objects ;
      children  = children ;
      position  = position ;
      rotation  = rotation ;
      scale     = scale ;
      frame     = frame ;
      unique    = unique ;
      anchor    = anchor ;
      billboard = billboard ;
      collision = collision }
;;


(**************************************************************************)
(* Setting fields                                                         *)
(**************************************************************************)

(* set_objects : vrml_object -> vrml_positionable list -> vrml_object *)
let setf_objects obj objects =
    new_vrml_object objects obj.children obj.position
                    obj.rotation obj.scale obj.frame
                    obj.unique obj.anchor obj.billboard
                    obj.collision
;;

let set_objects = setf_objects ;;

(* set_children : vrml_object -> vrml_object list -> vrml_object *)
let setf_children obj children =
    new_vrml_object obj.objects children obj.position
                    obj.rotation obj.scale obj.frame
                    obj.unique obj.anchor obj.billboard
                    obj.collision
;;

let set_children = setf_children ;;

(* setf_position : vrml_object -> float -> float -> float -> vrml_object *)
let setf_position obj position =
    new_vrml_object obj.objects obj.children position
                    obj.rotation obj.scale obj.frame
                    obj.unique obj.anchor obj.billboard
                    obj.collision
;;

(* setf_rotation :
   vrml_object -> float -> float -> float -> float -> vrml_object *)
let setf_rotation obj rotation =
    new_vrml_object obj.objects obj.children obj.position
                    rotation obj.scale obj.frame
                    obj.unique obj.anchor obj.billboard
                    obj.collision
;;

(* setf_scale : vrml_object -> float -> float -> float -> vrml_object *)
let setf_scale obj scale =
    new_vrml_object obj.objects obj.children obj.position
                    obj.rotation scale obj.frame
                    obj.unique obj.anchor obj.billboard
                    obj.collision
;;

(* setf_frame : vrml_object -> frame -> vrml_object *)
let setf_frame obj frame =
    new_vrml_object obj.objects obj.children obj.position
                    obj.rotation obj.scale frame
                    obj.unique obj.anchor obj.billboard
                    obj.collision
;;

let set_frame = setf_frame ;;

(* setf_unique : vrml_object -> bool -> vrml_object *)
let setf_unique obj unique =
    new_vrml_object obj.objects obj.children obj.position
                    obj.rotation obj.scale obj.frame
                    unique obj.anchor obj.billboard
                    obj.collision
;;

let set_unique = setf_unique ;;

(* setf_anchor : vrml_object -> anchor -> vrml_object *)
let setf_anchor obj anchor =
    new_vrml_object obj.objects obj.children obj.position
                    obj.rotation obj.scale obj.frame
                    obj.unique anchor obj.billboard
                    obj.collision
;;

(* setf_billboard : vrml_object -> billboard -> vrml_object *)
let setf_billboard obj billboard =
    new_vrml_object obj.objects obj.children obj.position
                    obj.rotation obj.scale obj.frame
                    obj.unique obj.anchor billboard
                    obj.collision
;;

(* setf_collision : vrml_object -> collision -> vrml_object *)
let setf_collision obj collision =
    new_vrml_object obj.objects obj.children obj.position
                    obj.rotation obj.scale obj.frame
                    obj.unique obj.anchor obj.billboard
                    collision
;;

