home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Homebrewer's Handbook / vr.iso / vr386 / segment.h < prev    next >
C/C++ Source or Header  |  1996-03-19  |  5KB  |  104 lines

  1. // Dave Stampe, 9/1/94
  2. // old SEGMENT f'ns, not part of API
  3.  
  4. /*
  5.  This code is part of the VR-386 project, created by Dave Stampe.
  6.  VR-386 is a desendent of REND386, created by Dave Stampe and
  7.  Bernie Roehl.  Almost all the code has been rewritten by Dave
  8.  Stampre for VR-386.
  9.  
  10.  Copyright (c) 1994 by Dave Stampe:
  11.  May be freely used to write software for release into the public domain
  12.  or for educational use; all commercial endeavours MUST contact Dave Stampe
  13.  (dstampe@psych.toronto.edu) for permission to incorporate any part of
  14.  this software or source code into their products!  Usually there is no
  15.  charge for under 50-100 items for low-cost or shareware products, and terms
  16.  are reasonable.  Any royalties are used for development, so equipment is
  17.  often acceptable payment.
  18.  
  19.  ATTRIBUTION:  If you use any part of this source code or the libraries
  20.  in your projects, you must give attribution to VR-386 and Dave Stampe,
  21.  and any other authors in your documentation, source code, and at startup
  22.  of your program.  Let's keep the freeware ball rolling!
  23.  
  24.  DEVELOPMENT: VR-386 is a effort to develop the process started by
  25.  REND386, improving programmer access by rewriting the code and supplying
  26.  a standard API.  If you write improvements, add new functions rather
  27.  than rewriting current functions.  This will make it possible to
  28.  include you improved code in the next API release.  YOU can help advance
  29.  VR-386.  Comments on the API are welcome.
  30.  
  31.  CONTACT: dstampe@psych.toronto.edu
  32. */
  33.  
  34.  
  35.  
  36. extern SEGMENT *new_seg(SEGMENT *parent);
  37. extern void seg_set_object(SEGMENT *s, VISOBJ *obj);
  38. extern void seg_reset_object(SEGMENT *s, VISOBJ *obj);
  39. extern void *seg_get_object(SEGMENT *s);
  40. extern char *seg_getname(SEGMENT *s);
  41. extern void seg_setname(SEGMENT *s, char *name);
  42. extern void seg_getposang(SEGMENT *s, long *rx, long *ry, long *rz);
  43. extern void seg_getjointang(SEGMENT *s, long *rx, long *ry, long *rz);
  44. extern void seg_getposxyz(SEGMENT *s, long *x, long *y, long *z);
  45. extern void seg_getjointxyz(SEGMENT *s, long *x, long *y, long *z);
  46. extern void abs_move_segment(SEGMENT *s, long tx, long ty, long tz);
  47. extern void rel_move_segment(SEGMENT *s, long tx, long ty, long tz);
  48. extern void abs_mat_segment(SEGMENT *s, MATRIX m);
  49. extern void rel_mat_segment(SEGMENT *s, MATRIX m);
  50. extern void abs_rotmat_segment(SEGMENT *s, MATRIX m);
  51. extern void rel_rotmat_segment(SEGMENT *s, MATRIX m);
  52. extern void abs_rot_segment(SEGMENT *s, long rx, long ry, long rz, int order);
  53. extern void rel_rot_segment(SEGMENT *s, long rx, long ry, long rz, int order);
  54. extern void move_rep(OBJECT *obj); /* move current rep of object  */
  55. extern void set_move_handler(void (*move_handler_ptr)());
  56. extern void full_update_segment(SEGMENT *seg);
  57. extern void update_segment(SEGMENT *seg); /* scan till update needed */
  58. extern SEGMENT *find_root_segment(SEGMENT *s);
  59. extern SEGMENT *parent_segment(SEGMENT *s);
  60. extern SEGMENT *child_segment(SEGMENT *s);
  61. extern SEGMENT *sibling_segment(SEGMENT *s);
  62. extern MATRIX *get_seg_jmatrix(SEGMENT *s);
  63. extern MATRIX *get_seg_pmatrix(SEGMENT *s);
  64. extern void detach_segment(SEGMENT *s, BOOL preserve);    /* assumes segment is updated! */
  65. extern void attach_segment(SEGMENT *s, SEGMENT *to, BOOL preserve); /* assumes parent is updated! */
  66. extern SEGMENT *copy_segment(SEGMENT *s, long dx, long dy, long dz, void *(*copy_fn)());
  67.  
  68. extern SEGMENT *get_root_segment(SEGMENT *s);
  69. extern void seg_getrxyz(SEGMENT *s, long *rx, long *ry, long *rz);
  70. extern int seg_get_flags(SEGMENT *s);
  71. extern void seg_set_flags(SEGMENT *s, int f);
  72.  
  73. //// EXTENSIONS TO SEGMENTS FOR POSE
  74.  
  75. extern void seg_reset_object(SEGMENT *s, VISOBJ *obj);
  76.     // gets cached joint pos/angle
  77. void seg_getpose(SEGMENT *s, POSE *p);
  78.     // get joint pose, computes angle from matrix
  79. void seg_getmatpose(SEGMENT *s, POSE *p);
  80.     // get position in world after transforms
  81. void seg_getworldpose(SEGMENT *s, POSE *p);
  82.     // set the joint position from the pose
  83. void seg_setpose(SEGMENT *s, POSE *p);
  84.     // attach segments, preserve world position if desired
  85. void attach_segment(SEGMENT *s, SEGMENT *to, BOOL preserve);
  86.     // detach segment, preserve world position if desired
  87. void detach_segment(SEGMENT *s, BOOL preserve);
  88.     // deletes segment, preserves children
  89. void destroy_segment (SEGMENT *s);
  90.     // marks segment as protected from recursive deletes
  91. void register_system_segment(SEGMENT *s);
  92.     // finds, refreshes root field
  93. SEGMENT *find_root_segment(SEGMENT *s);    // try to do without
  94.     // returns root field
  95. SEGMENT *get_root_segment(SEGMENT *s);
  96.  
  97. OBJECT *find_segment_by_name(OBJECT *obj, char *name);
  98.  
  99. void mark_object_invisible(OBJECT *obj);
  100. void mark_object_visible(OBJECT *obj);
  101.  
  102. void remove_from_segment_update_list(SEGMENT *seg);
  103.  
  104.