2 * $Source: x:/prj/tech/libsrc/newskel/RCS/newskel.h $
5 * $Date: 1996/10/23 09:21:46 $
7 * Skeleton libary includes
17 // Data types for a cylindrical bitmap object
18 // eventually we'll want one for a full 3d one
21 int nviews
; // number of views
22 fix ppu
; // pixels per unit
23 fix len
; // length from anchor to anchor
24 bool bisym
; // bilateral symmetry or not (means its a mirror)
25 int off
[1]; // offsets, in reality there should be off[nview] of them
26 } CylBMObj
; // cylindrical 3d bitmap object
30 signed char u1
,v1
; // anchor point 1
31 signed char u2
,v2
; // anchor point 2
32 fix vper1
; // v1 / (v2-v1)
33 fix vper2
; // (h-v2) / (v2-v1)
34 fix uper
; // (w - u) / u
35 } CylBMFrame
; // one frame of the cylindrical bm object. Always put the bits after this.
37 typedef void (*CylBMDecalFunc
)(void *data
, grs_vertex
*v
, uchar frame
);
39 // Segment flag, mirror image
41 // Are joints 1 and 2 exposed to light or not
44 #define SKF_DONTRENDER 16 // take a big guess
60 // Structure for each segment
62 ubyte p1
; // offsets of points 1 and 2
64 ubyte
or; // offset of orientation vector
65 ubyte flag
; // flags, for instance, is it mirrored,exposed?,locked?
67 struct { // for cylinder dude
73 ulong handle
; // for locking
75 struct { // for bitmap dude
78 CylBMDecalFunc decfunc
; // decal rendering function
79 void *decdata
; // data for decal rendering func
81 struct { // for 3d model dude
90 typedef struct sks_skel
;
92 // The skeleton structure, followed by seginfo
93 // then orientation vectors, then joints
95 ske_segtype type
; // type of skeleton
96 ubyte segn
; // number of segments
97 ubyte pointn
; // number of points
98 ubyte orn
; // number of orientation vectors
99 void (*qsort
) (struct _sks
*s
,ubyte
*rl
,g3s_phandle
*tmp
); // pointer to sorter
100 sks_seginfo
*sg
; // pointer to start of seg info
101 g3s_vector
*pn
; // pointer to start of list of vectors
102 g3s_vector
*or; // first in array of local orientation vectors
107 // Allocate space for a skeleton
109 sks_skel
*sk_alloc_skel(ubyte segn
,ubyte pointn
,ubyte orn
);
111 // initialize a skeleton given the model
112 sks_skel
*sk_init_skel(sks_skel
*sk
,ubyte segn
,ubyte pointn
,ubyte orn
);
114 // returns target size of the skeleton, given the model
115 int sk_size_skel(ubyte segn
,ubyte pointn
,ubyte orn
);
117 // Free a skeleton, does not unlock it
118 void sk_free_skel(sks_skel
*s
);
120 // Set this skeleton to use the given color lookup table when rendering
121 // in bitmap limb mode. NULL (default) means no clut
122 void sk_set_bmap_clut(sks_skel
*s
, ubyte
*clut
);
124 // Set the quick sorter for this model
125 void sk_set_skel_sort(sks_skel
*sk
,void (*qsort
)(sks_skel
*s
,ubyte
*rl
,g3s_phandle
*tmp
));
127 // Lock down the cylinder bmap objects for a bmap object, ignore otherwise
128 void sk_res_lock(sks_skel
*sk
,Id resid
);
129 void sk_res_unlock(sks_skel
*sk
,Id resid
);
131 // lock down bmap objects, assuming handle IS refid
132 void sk_lock(sks_skel
*sk
);
133 void sk_unlock(sks_skel
*sk
);
135 // Render a skeleton given
136 // skeleton and model
137 // assuming all other things have been set,
138 // points transformed, etc.
139 void sk_render_skel(sks_skel
*s
,ske_sorttype
);
141 // phandle of transformed point, pointer to g3s_vector
142 typedef void (*skt_vcall_func
)(g3s_phandle p
,g3s_vector
*v
);
144 // Do a callback at the joint in question, passes in
145 // g3s_phandle of point.
146 void sk_set_joint_call(int seg_id
,skt_vcall_func v_func
,int j
);
147 void sk_set_seg_call(int set_id
,skt_vcall_func v_func
,fix xoff
,fix yoff
,fix zoff
);
149 // Do a vhot set that puts the world coords into sk_vhot_vecs[vhot_num];
150 void sk_set_joint_vhot(int seg_id
,int vhot_num
,int j
);
151 void sk_set_seg_vhot(int set_id
,int vhot_num
,fix xoff
,fix yoff
,fix zoff
);
152 void sk_vhot_skel(sks_skel
*s
);
153 extern g3s_vector skd_vhot_vecs
[];
154 extern uchar skd_light_detail
;
158 #define sk_set_light_detail(x) (skd_light_detail = (x))
159 #define sk_vhot_vec(x) (&skd_vhot_vecs[x])
161 // Provide it the segment info and the endpoints, orientation vector, transformed endpoints, and clut or not
162 void sk_render_bmap_piece(sks_seginfo
*cseg
,g3s_vector
*j1
,g3s_vector
*j2
,g3s_vector
*or,g3s_phandle p1
,g3s_phandle p2
);
163 void sk_render_poly_piece(sks_seginfo
*cseg
,g3s_vector
*j1
,g3s_vector
*j2
,g3s_vector
*or);
167 #endif /* __SKEL_H */