home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / vecmat / vecmat.h < prev    next >
Text File  |  1998-06-08  |  21KB  |  528 lines

  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/vecmat/rcs/vecmat.h $
  15.  * $Revision: 1.37 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/22 13:23:22 $
  18.  *
  19.  * Header file for vector/matrix library
  20.  *
  21.  * $Log: vecmat.h $
  22.  * Revision 1.37  1995/02/22  13:23:22  john
  23.  * Added the vms_vector_array structure, to access a vms_vector
  24.  * with an array.
  25.  * 
  26.  * Revision 1.36  1995/02/22  12:34:33  john
  27.  * Took out anonymous unions.
  28.  * 
  29.  * Revision 1.35  1994/12/13  14:44:20  matt
  30.  * Added vm_vector_2_matrix_norm()
  31.  * 
  32.  * Revision 1.34  1994/09/11  19:22:55  matt
  33.  * Added vm_vec_normalized_dir_quick()
  34.  * 
  35.  * Revision 1.33  1994/08/04  19:45:38  matt
  36.  * Added option to make a bunch of functions (add, sub, dotprod) inline
  37.  * 
  38.  * Revision 1.32  1994/07/19  18:52:36  matt
  39.  * Added vm_vec_normalize_quick() and vm_vec_copy_normalize_quick()
  40.  * 
  41.  * Revision 1.31  1994/06/16  18:24:30  matt
  42.  * Added vm_vec_mag_quick()
  43.  * 
  44.  * Revision 1.30  1994/06/10  23:19:00  matt
  45.  * New register usage for vm_vec_ang_2_matrix()
  46.  * 
  47.  * Revision 1.29  1994/06/01  17:32:06  matt
  48.  * Fixed modify list for vm_vec_normalized_dir()
  49.  * 
  50.  * Revision 1.28  1994/05/19  12:07:20  matt
  51.  * Fixed globals and macros and added a constant
  52.  * 
  53.  * Revision 1.27  1994/05/19  09:19:15  matt
  54.  * Made vm_vec_normalized_dir() return mag of vector
  55.  * 
  56.  * Revision 1.26  1994/05/18  22:28:57  matt
  57.  * Added function vm_vec_normalized_dir()
  58.  * Added C macros IS_ZERO_VEC(), vm_vec_zero(), and vm_set_identity()
  59.  * Added C global static vars vmd_zero_vector & vmd_identity_matrix
  60.  * 
  61.  * Revision 1.25  1994/05/18  21:45:06  matt
  62.  * Added functions:
  63.  *   vm_extract_angles_vector()
  64.  *   vm_extract_angles_vector_normalized()
  65.  *   vm_vec_copy_normalize()
  66.  * 
  67.  * Revision 1.24  1994/05/13  12:42:16  matt
  68.  * Added new function, vm_vec_dist_quick(), which does an approximation.
  69.  * 
  70.  * Revision 1.23  1994/03/30  13:37:34  matt
  71.  * Added prototype for vm_vec_scale_add(), and fixed typos
  72.  * 
  73.  * Revision 1.22  1994/03/30  13:29:42  matt
  74.  * Header for vm_vec_scale_add2()
  75.  * 
  76.  * Revision 1.21  1994/01/31  19:45:13  matt
  77.  * Added function vm_extract_angles_matrix()
  78.  * 
  79.  * Revision 1.20  1993/12/21  19:46:14  matt
  80.  * Added function vm_dist_to_plane()
  81.  * 
  82.  * Revision 1.19  1993/12/13  17:26:41  matt
  83.  * Added vm_vec_dist()
  84.  * 
  85.  * Revision 1.18  1993/12/02  12:45:11  matt
  86.  * New functions: vm_vec_copy_scale(), vm_vec_scale2()
  87.  * Aliases: vm_transpose(), vm_vec_dot(), vm_vec_cross(), vm_copy_transpose()
  88.  * 
  89.  * Revision 1.17  1993/10/29  22:38:36  matt
  90.  * Changed matrix order, making direction vectors the rows
  91.  * 
  92.  * Revision 1.16  1993/10/25  11:49:57  matt
  93.  * Made vm_vec_delta_ang() take optional forward vector to return signed delta
  94.  * 
  95.  * Revision 1.15  1993/10/20  01:10:05  matt
  96.  * Added vm_vec_delta_ang(), vm_vec_delta_ang_norm(), and vm_vec_ang_2_matrix()
  97.  * 
  98.  * Revision 1.14  1993/10/17  17:02:52  matt
  99.  * vm_vector_2_matrix() now takes optional right vector
  100.  * 
  101.  * Revision 1.13  1993/10/12  19:31:39  matt
  102.  * Added IDENTITY_MATRIX constant
  103.  * 
  104.  * Revision 1.12  1993/10/08  18:10:16  matt
  105.  * Changed vm_vec_make() and vm_angvec_make() to be inline assembly 
  106.  * functions, to get rid of compiler warnings.  Did not change vm_mat_make(),
  107.  * which could still get warnings if the return value is unused.
  108.  * 
  109.  * Revision 1.11  1993/09/29  12:10:07  matt
  110.  * Changed modified regs in pragmas to include return register
  111.  * 
  112.  * Revision 1.10  1993/09/28  12:15:41  matt
  113.  * Added func vm_vector_2_matrix()
  114.  * 
  115.  * Revision 1.9  1993/09/24  21:18:38  matt
  116.  * Added vm_vec_avg(), vm_vec_avg4(), and vm_angvec_make().
  117.  * Documented which functions could have dest==source
  118.  * 
  119.  * Revision 1.8  1993/09/20  14:56:11  matt
  120.  * Added new function, vm_vec_perp()
  121.  * 
  122.  * Revision 1.7  1993/09/20  14:27:42  mike
  123.  * unfix last fix which introduced a bug
  124.  * 
  125.  * Revision 1.6  1993/09/20  10:11:53  mike
  126.  * no changes
  127.  * 
  128.  * Revision 1.5  1993/09/20  09:58:58  mike
  129.  * Re-fix vm_vec_make
  130.  * 
  131.  * Revision 1.4  1993/09/20  09:41:21  mike
  132.  * Correct vm_vec_make and vm_mat_make macros to return the destination
  133.  * as the value of the macro.
  134.  * 
  135.  * Revision 1.3  1993/09/17  11:23:47  matt
  136.  * Added row access (via xrow,yrow,zrow) to vms_matrix
  137.  * Added macro vm_mat_make(), like vm_vec_make()
  138.  * 
  139.  * Revision 1.2  1993/09/17  11:10:32  matt
  140.  * Added vm_vec_add2() and vm_vec_sub2(), which take 2 args (dest==src0)
  141.  * 
  142.  * Revision 1.1  1993/09/16  20:10:01  matt
  143.  * Initial revision
  144.  * 
  145.  *
  146.  */
  147.  
  148. #ifndef _VECMAT_H
  149. #define _VECMAT_H
  150.  
  151. #include "fix.h"
  152.  
  153. //#define INLINE 1        //are some of these functions inline?
  154.  
  155. //The basic fixed-point vector.  Access elements by name or position
  156. typedef struct vms_vector {
  157.     fix x,y,z;
  158. } vms_vector;
  159.  
  160. typedef struct vms_vector_array {
  161.     fix xyz[3];
  162. } vms_vector_array;
  163.  
  164. //Short vector, used for pre-rotation points. 
  165. //Access elements by name or position
  166. typedef struct vms_svec {
  167.     short sv_x,sv_y,sv_z;
  168. } vms_svec;
  169.  
  170. //Angle vector.  Used to store orientations
  171. typedef struct vms_angvec {
  172.     fixang p,b,h;
  173. } vms_angvec;
  174.  
  175. //A 3x3 rotation matrix.  Sorry about the numbering starting with one.
  176. //Ordering is across then down, so <m1,m2,m3> is the first row
  177. typedef struct vms_matrix {
  178.     vms_vector rvec,uvec,fvec;
  179. } vms_matrix;
  180.  
  181. //Macros/functions to fill in fields of structures
  182.  
  183. //macro to check if vector is zero
  184. #define IS_VEC_NULL(v) (v->x == 0 && v->y == 0 && v->z == 0)
  185.  
  186. //macro to set a vector to zero.  we could do this with an in-line assembly 
  187. //macro, but it's probably better to let the compiler optimize it.
  188. //Note: NO RETURN VALUE
  189. #define vm_vec_zero(v) (v)->x=(v)->y=(v)->z=0
  190.  
  191. //macro set set a matrix to the identity. Note: NO RETURN VALUE
  192. #define vm_set_identity(m) do {m->rvec.x = m->uvec.y = m->fvec.z = f1_0;    \
  193.                                         m->rvec.y = m->rvec.z = \
  194.                                         m->uvec.x = m->uvec.z = \
  195.                                         m->fvec.x = m->fvec.y = 0;} while (0)
  196.  
  197. vms_vector *vm_vec_make(vms_vector *v,fix x,fix y,fix z);
  198.  
  199. #pragma aux vm_vec_make "*_" parm [eax] [edx] [ebx] [ecx] value [eax] modify exact [] = \
  200.     "mov 0[eax],edx"    \
  201.     "mov 4[eax],ebx"    \
  202.     "mov 8[eax],ecx";
  203.  
  204. vms_angvec *vm_angvec_make(vms_angvec *v,fixang p,fixang b,fixang h);
  205.  
  206. #pragma aux vm_angvec_make "*_" parm [eax] [dx] [bx] [cx] value [eax] modify exact [] = \
  207.     "mov 0[eax],dx"    \
  208.     "mov 2[eax],bx"    \
  209.     "mov 4[eax],cx";
  210.  
  211. //Global constants
  212.  
  213. extern vms_vector vmd_zero_vector;
  214. extern vms_matrix vmd_identity_matrix;
  215.  
  216. //Here's a handy constant
  217.  
  218. #define ZERO_VECTOR {0,0,0}
  219. #define IDENTITY_MATRIX {f1_0,0,0,0,f1_0,0,0,0,f1_0}
  220.  
  221. //#define vm_vec_make(v,_x,_y,_z) (((v)->x=(_x), (v)->y=(_y), (v)->z=(_z)), (v))
  222.  
  223. //#pragma off (unreferenced)
  224. ////make this local, so compiler can in-line it
  225. //static vms_vector *vm_vec_make(vms_vector *v,fix x,fix y,fix z)
  226. //{
  227. //    v->x = x;
  228. //    v->y = y;
  229. //    v->z = z;
  230. //
  231. //    return v;
  232. //}
  233. //#pragma on (unreferenced)
  234.  
  235.  
  236. ////macro to fill in elements of a matrix, also for Mike
  237. //#define vm_mat_make(m,_m1,_m2,_m3,_m4,_m5,_m6,_m7,_m8,_m9) \
  238. //     do {    (m)->m1=(_m1); (m)->m2=(_m2); (m)->m3=(_m3); \
  239. //            (m)->m4=(_m4); (m)->m5=(_m5); (m)->m6=(_m6); \
  240. //            (m)->m7=(_m7); (m)->m8=(_m8); (m)->m9=(_m9);} while (0)
  241.  
  242. #if 0    //kill this, since bogus with new matrix ordering
  243.  
  244. //macro to fill in elements of a matrix, also for Mike
  245. #define vm_mat_make(m,_m1,_m2,_m3,_m4,_m5,_m6,_m7,_m8,_m9) \
  246.          ( ((m)->m1=(_m1), (m)->m2=(_m2), (m)->m3=(_m3), \
  247.             (m)->m4=(_m4), (m)->m5=(_m5), (m)->m6=(_m6), \
  248.             (m)->m7=(_m7), (m)->m8=(_m8), (m)->m9=(_m9)), (m))
  249.  
  250. #endif
  251.  
  252. ////fills in fields of an angle vector
  253. //#define vm_angvec_make(v,_p,_b,_h) (((v)->p=(_p), (v)->b=(_b), (v)->h=(_h)), (v))
  254.  
  255. //negate a vector
  256. #define vm_vec_negate(v) do {(v)->x = - (v)->x; (v)->y = - (v)->y; (v)->z = - (v)->z;} while (0);
  257.  
  258. //Functions in library
  259.  
  260. #ifndef INLINE
  261.  
  262. //adds two vectors, fills in dest, returns ptr to dest
  263. //ok for dest to equal either source, but should use vm_vec_add2() if so
  264. vms_vector *vm_vec_add(vms_vector *dest,vms_vector *src0,vms_vector *src1);
  265.  
  266. //subs two vectors, fills in dest, returns ptr to dest
  267. //ok for dest to equal either source, but should use vm_vec_sub2() if so
  268. vms_vector *vm_vec_sub(vms_vector *dest,vms_vector *src0,vms_vector *src1);
  269.  
  270. //adds one vector to another. returns ptr to dest
  271. //dest can equal source
  272. vms_vector *vm_vec_add2(vms_vector *dest,vms_vector *src);
  273.  
  274. //subs one vector from another, returns ptr to dest
  275. //dest can equal source
  276. vms_vector *vm_vec_sub2(vms_vector *dest,vms_vector *src);
  277.  
  278. #else
  279.  
  280. #define vm_vec_add(dest,src0,src1) do {    \
  281.     (dest)->x = (src0)->x + (src1)->x;        \
  282.     (dest)->y = (src0)->y + (src1)->y;        \
  283.     (dest)->z = (src0)->z + (src1)->z;        \
  284. } while (0);
  285.  
  286. #define vm_vec_sub(dest,src0,src1) do {    \
  287.     (dest)->x = (src0)->x - (src1)->x;        \
  288.     (dest)->y = (src0)->y - (src1)->y;        \
  289.     (dest)->z = (src0)->z - (src1)->z;        \
  290. } while (0);
  291.  
  292. #define vm_vec_add2(dest,src) do {        \
  293.     (dest)->x += (src)->x;                    \
  294.     (dest)->y += (src)->y;                    \
  295.     (dest)->z += (src)->z;                    \
  296. } while (0);
  297.  
  298. #define vm_vec_sub2(dest,src) do {        \
  299.     (dest)->x -= (src)->x;                    \
  300.     (dest)->y -= (src)->y;                    \
  301.     (dest)->z -= (src)->z;                    \
  302. } while (0);
  303.  
  304. #endif
  305.  
  306. //averages two vectors. returns ptr to dest
  307. //dest can equal either source
  308. vms_vector *vm_vec_avg(vms_vector *dest,vms_vector *src0,vms_vector *src1);
  309.  
  310. //averages four vectors. returns ptr to dest
  311. //dest can equal any source
  312. vms_vector *vm_vec_avg4(vms_vector *dest,vms_vector *src0,vms_vector *src1,vms_vector *src2,vms_vector *src3);
  313.  
  314. //scales a vector in place.  returns ptr to vector
  315. vms_vector *vm_vec_scale(vms_vector *dest,fix s);
  316.  
  317. //scales and copies a vector.  returns ptr to dest
  318. vms_vector *vm_vec_copy_scale(vms_vector *dest,vms_vector *src,fix s);
  319.  
  320. //scales a vector, adds it to another, and stores in a 3rd vector
  321. //dest = src1 + k * src2
  322. vms_vector *vm_vec_scale_add(vms_vector *dest,vms_vector *src1,vms_vector *src2,fix k);
  323.  
  324. //scales a vector and adds it to another
  325. //dest += k * src
  326. vms_vector *vm_vec_scale_add2(vms_vector *dest,vms_vector *src,fix k);
  327.  
  328. //scales a vector in place, taking n/d for scale.  returns ptr to vector
  329. //dest *= n/d
  330. vms_vector *vm_vec_scale2(vms_vector *dest,fix n,fix d);
  331.  
  332. //returns magnitude of a vector
  333. fix vm_vec_mag(vms_vector *v);
  334.  
  335. //computes the distance between two points. (does sub and mag)
  336. fix vm_vec_dist(vms_vector *v0,vms_vector *v1);
  337.  
  338. //computes an approximation of the magnitude of the vector
  339. //uses dist = largest + next_largest*3/8 + smallest*3/16
  340. fix vm_vec_mag_quick(vms_vector *v);
  341.  
  342. //computes an approximation of the distance between two points.
  343. //uses dist = largest + next_largest*3/8 + smallest*3/16
  344. fix vm_vec_dist_quick(vms_vector *v0,vms_vector *v1);
  345.  
  346. //normalize a vector in place.  returns mag of source vec
  347. fix vm_vec_normalize(vms_vector *v);
  348.  
  349. //normalize a vector in place.  returns mag of source vec. used approx mag.
  350. fix vm_vec_normalize_quick(vms_vector *v);
  351.  
  352. //normalize a vector. returns mag of source vec
  353. fix vm_vec_copy_normalize(vms_vector *dest,vms_vector *src);
  354.  
  355. //normalize a vector. returns mag of source vec. uses approx mag
  356. fix vm_vec_copy_normalize_quick(vms_vector *dest,vms_vector *src);
  357.  
  358. //return the normalized direction vector between two points
  359. //dest = normalized(end - start).  Returns mag of direction vector
  360. //NOTE: the order of the parameters matches the vector subtraction
  361. fix vm_vec_normalized_dir(vms_vector *dest,vms_vector *end,vms_vector *start);
  362. fix vm_vec_normalized_dir_quick(vms_vector *dest,vms_vector *end,vms_vector *start);
  363.  
  364. #ifndef INLINE
  365.  
  366. ////returns dot product of two vectors
  367. fix vm_vec_dotprod(vms_vector *v0,vms_vector *v1);
  368. fix vm_vec_dot(vms_vector *v0,vms_vector *v1);
  369.  
  370. #else
  371.  
  372. #define vm_vec_dotprod(v0,v1) vm_vec_dot((v0),(v1))
  373.  
  374. fix vm_vec_dotprod(vms_vector *v0,vms_vector *v1);
  375. #pragma aux vm_vec_dotprod parm [esi] [edi] value [eax] modify exact [eax ebx ecx edx] = \
  376.     "mov    eax,[esi]"                \
  377.     "imul    dword ptr [edi]"        \
  378.     "mov    ebx,eax"                    \
  379.     "mov    ecx,edx"                    \
  380.                                         \
  381.     "mov    eax,4[esi]"                \
  382.     "imul    dword ptr 4[edi]"        \
  383.     "add    ebx,eax"                    \
  384.     "adc    ecx,edx"                    \
  385.                                         \
  386.     "mov    eax,8[esi]"                \
  387.     "imul    dword ptr 8[edi]"        \
  388.     "add    eax,ebx"                    \
  389.     "adc    edx,ecx"                    \
  390.                                         \
  391.     "shrd    eax,edx,16";
  392.  
  393. #endif
  394.  
  395. //computes cross product of two vectors. returns ptr to dest
  396. //dest CANNOT equal either source
  397. vms_vector *vm_vec_crossprod(vms_vector *dest,vms_vector *src0,vms_vector *scr1);
  398. vms_vector *vm_vec_cross(vms_vector *dest,vms_vector *src0,vms_vector *scr1);
  399.  
  400. //computes surface normal from three points. result is normalized
  401. //returns ptr to dest
  402. //dest CANNOT equal either source
  403. vms_vector *vm_vec_normal(vms_vector *dest,vms_vector *p0,vms_vector *p1,vms_vector *p2);
  404.  
  405. //computes non-normalized surface normal from three points. 
  406. //returns ptr to dest
  407. //dest CANNOT equal either source
  408. vms_vector *vm_vec_perp(vms_vector *dest,vms_vector *p0,vms_vector *p1,vms_vector *p2);
  409.  
  410. //computes the delta angle between two vectors. 
  411. //vectors need not be normalized. if they are, call vm_vec_delta_ang_norm()
  412. //the forward vector (third parameter) can be NULL, in which case the absolute
  413. //value of the angle in returned.  Otherwise the angle around that vector is
  414. //returned.
  415. fixang vm_vec_delta_ang(vms_vector *v0,vms_vector *v1,vms_vector *fvec);
  416.  
  417. //computes the delta angle between two normalized vectors. 
  418. fixang vm_vec_delta_ang_norm(vms_vector *v0,vms_vector *v1,vms_vector *fvec);
  419.  
  420. //computes a matrix from a set of three angles.  returns ptr to matrix
  421. vms_matrix *vm_angles_2_matrix(vms_matrix *m,vms_angvec *a);
  422.  
  423. //computes a matrix from a forward vector and an angle
  424. vms_matrix *vm_vec_ang_2_matrix(vms_matrix *m,vms_vector *v,fixang a);
  425.  
  426. //computes a matrix from one or more vectors. The forward vector is required,
  427. //with the other two being optional.  If both up & right vectors are passed,
  428. //the up vector is used.  If only the forward vector is passed, a bank of
  429. //zero is assumed
  430. //returns ptr to matrix
  431. vms_matrix *vm_vector_2_matrix(vms_matrix *m,vms_vector *fvec,vms_vector *uvec,vms_vector *rvec);
  432.  
  433. //this version of vector_2_matrix requires that the vectors be more-or-less
  434. //normalized and close to perpendicular
  435. vms_matrix *vm_vector_2_matrix_norm(vms_matrix *m,vms_vector *fvec,vms_vector *uvec,vms_vector *rvec);
  436.  
  437. //rotates a vector through a matrix. returns ptr to dest vector
  438. //dest CANNOT equal either source
  439. vms_vector *vm_vec_rotate(vms_vector *dest,vms_vector *src,vms_matrix *m);
  440.  
  441. //transpose a matrix in place. returns ptr to matrix
  442. vms_matrix *vm_transpose_matrix(vms_matrix *m);
  443. vms_matrix *vm_transpose(vms_matrix *m);    //same as vm_transpose_matrix()
  444.  
  445. //copy and transpose a matrix. returns ptr to matrix
  446. //dest CANNOT equal source. use vm_transpose_matrix() if this is the case
  447. vms_matrix *vm_copy_transpose_matrix(vms_matrix *dest,vms_matrix *src);
  448. vms_matrix *vm_copy_transpose(vms_matrix *dest,vms_matrix *src);
  449.  
  450. //mulitply 2 matrices, fill in dest.  returns ptr to dest
  451. //dest CANNOT equal either source
  452. vms_matrix *vm_matrix_x_matrix(vms_matrix *dest,vms_matrix *src0,vms_matrix *src1);
  453.  
  454. //extract angles from a matrix 
  455. vms_angvec *vm_extract_angles_matrix(vms_angvec *a,vms_matrix *m);
  456.  
  457. //extract heading and pitch from a vector, assuming bank==0
  458. vms_angvec *vm_extract_angles_vector(vms_angvec *a,vms_vector *v);
  459.  
  460. //compute the distance from a point to a plane.  takes the normalized normal
  461. //of the plane (ebx), a point on the plane (edi), and the point to check (esi).
  462. //returns distance in eax
  463. //distance is signed, so negative dist is on the back of the plane
  464. fix vm_dist_to_plane(vms_vector *checkp,vms_vector *norm,vms_vector *planep);
  465.  
  466. //Pragmas for functions
  467.  
  468. #ifndef INLINE
  469. #pragma aux vm_vec_add "*" parm [eax] [esi] [edi] value [eax] modify exact [];
  470. #pragma aux vm_vec_sub "*" parm [eax] [esi] [edi] value [eax] modify exact [];
  471. #pragma aux vm_vec_add2 "*" parm [edi] [esi] value [edi] modify exact [];
  472. #pragma aux vm_vec_sub2 "*" parm [edi] [esi] value [edi] modify exact [];
  473. #endif
  474. #pragma aux vm_vec_avg "*" parm [eax] [esi] [edi] value [eax] modify exact [];
  475. #pragma aux vm_vec_avg4 "*" parm [eax] [esi] [edi] [ecx] [edx] value [eax] modify exact [];
  476. #pragma aux vm_vec_scale "*" parm [ebx] [ecx] value [ebx] modify exact [];
  477. #pragma aux vm_vec_copy_scale "*" parm [edi] [ebx] [ecx] value [edi] modify exact [];
  478. #pragma aux vm_vec_scale2 "*" parm [edi] [ebx] [ecx] value [edi] modify exact [];
  479. #pragma aux vm_vec_mag "*" parm [esi] value [eax] modify exact [eax];
  480. #pragma aux vm_vec_dist "*" parm [esi] [edi] value [eax] modify exact [eax];
  481. #pragma aux vm_vec_mag_quick "*" parm [esi] value [eax] modify exact [eax];
  482. #pragma aux vm_vec_dist_quick "*" parm [esi] [edi] value [eax] modify exact [eax];
  483. #pragma aux vm_vec_normalize "*" parm [esi] value [ecx] modify exact [ecx];
  484. #pragma aux vm_vec_normalize_quick "*" parm [esi] value [ecx] modify exact [ecx];
  485. #pragma aux vm_vec_copy_normalize "*" parm [edi] [esi] value [ecx] modify exact [ecx];
  486. #pragma aux vm_vec_copy_normalize_quick "*" parm [edi] [esi] value [ecx] modify exact [ecx];
  487. #ifndef INLINE
  488. #pragma aux vm_vec_dotprod "*" parm [esi] [edi] value [eax] modify exact [eax];
  489. #pragma aux vm_vec_dot "vm_vec_dotprod" parm [esi] [edi] value [eax] modify exact [eax];
  490. #endif
  491. #pragma aux vm_vec_crossprod "*" parm [eax esi edi] value [eax] modify exact [];
  492. #pragma aux vm_vec_cross "vm_vec_crossprod" parm [eax esi edi] value [eax] modify exact [];
  493. #pragma aux vm_vec_normal "*" parm [ebx] [eax] [esi] [edi] value [eax] modify exact [eax];
  494. #pragma aux vm_vec_perp "*" parm [ebx] [eax] [esi] [edi] value [eax] modify exact [eax];
  495. #pragma aux vm_angles_2_matrix "*" parm [edi] [esi] value [edi] modify exact [];
  496. #pragma aux vm_vector_2_matrix "*" parm [edi] [esi] [eax] [ebx] value [edi] modify exact [eax ebx esi];
  497. #pragma aux vm_vector_2_matrix_norm "*" parm [edi] [esi] [eax] [ebx] value [edi] modify exact [eax ebx esi];
  498. #pragma aux vm_vec_rotate "*" parm [eax] [esi] [edi] value [eax] modify exact [];
  499. #pragma aux vm_transpose_matrix "*" parm [edi] value [edi] modify exact [];
  500. #pragma aux vm_transpose "vm_transpose_matrix" parm [edi] value [edi] modify exact [];
  501. #pragma aux vm_copy_transpose_matrix "*" parm [edi] [esi] value [edi] modify exact [];
  502. #pragma aux vm_copy_transpose "vm_copy_transpose_matrix" parm [edi] [esi] value [edi] modify exact [];
  503. #pragma aux vm_matrix_x_matrix "*" parm [eax] [esi] [edi] value [eax] modify exact [];
  504. #pragma aux vm_vec_delta_ang "*" parm [esi] [edi] [eax] value [ax] modify exact [eax];
  505. #pragma aux vm_vec_delta_ang_norm "*" parm [esi] [edi] [eax] value [ax] modify exact [eax];
  506. #pragma aux vm_vec_ang_2_matrix "*" parm [edi] [esi] [eax] value [edi] modify exact [];
  507. #pragma aux vm_dist_to_plane "*" parm [esi] [ebx] [edi] value [eax] modify exact [eax];
  508. #pragma aux vm_extract_angles_matrix "*" parm [edi] [esi] value [edi] modify exact [];
  509. #pragma aux vm_vec_scale_add "*" parm [edi] [ebx] [esi] [ecx] value [edi] modify exact [];
  510. #pragma aux vm_vec_scale_add2 "*" parm [edi] [esi] [ecx] value [edi] modify exact [];
  511.  
  512. #pragma aux vm_vec_normalized_dir "*" parm [edi] [esi] [ebx] value [ecx] modify exact [ecx];
  513. #pragma aux vm_vec_normalized_dir_quick "*" parm [edi] [esi] [ebx] value [ecx] modify exact [ecx];
  514.  
  515. #pragma aux vm_extract_angles_vector "*" parm [edi] [esi] value [edi] modify exact [esi];
  516. #pragma aux vm_extract_angles_vector_normalized "*" parm [edi] [esi] value [edi] modify exact [];
  517.  
  518. /*
  519.     Questions:
  520.  
  521.     should simple functions like vec_add() and vec_sub() be macros?
  522.  
  523. */
  524.  
  525. #endif
  526.  
  527. 
  528.