00001
00002 #ifndef COLL_H
00003 #define COLL_H
00004
00005
00006
00007 #define PlaneDist(plane, point) \
00008 (((plane)->v[A] * (point)->v[X] + (plane)->v[B] * (point)->v[Y] + (plane)->v[C] * (point)->v[Z] + (plane)->v[D]))
00009
00010 typedef struct {
00011 short CollNum;
00012 } COLL_HEADER;
00013
00014 typedef struct {
00015 long Flag;
00016 PLANE Plane;
00017 float MinX, MaxX, MinY, MaxY, MinZ, MaxZ;
00018 VECTOR v0;
00019 VECTOR v1;
00020 VECTOR v2;
00021 VECTOR v3;
00022 } COLL_POLY;
00023
00024
00025
00026 #ifdef _N64
00027 extern void COL_LoadCollision(FIL_ID Fil);
00028 extern void COL_FreeCollision(void);
00029 #else
00030 extern bool LoadCollision(char *file);
00031 extern void FreeCollision(void);
00032 #endif
00033 extern char PointInsidePlane(VECTOR *point, COLL_POLY *p);
00034 extern float PointToPolyEdge(VECTOR *point, COLL_POLY *p, VECTOR *out);
00035 extern float FindNearestPointOnLine(VECTOR *lp1, VECTOR *lp2, VECTOR *point, VECTOR *out);
00036 extern void FindIntersection(VECTOR *point1, float dist1, VECTOR *point2, float dist2, VECTOR *out);
00037 extern short SpheresToPlane(VECTOR *o, VECTOR *n, VECTOR *out, float rad, COLL_POLY *p);
00038 extern short SpheresToPlaneNorm(VECTOR *o, VECTOR *n, VECTOR *out, float rad, COLL_POLY *p);
00039 extern char SphereCollTest(VECTOR *from, VECTOR *to, float radius, VECTOR *result, float *friction, VECTOR *norm);
00040 extern char SphereCollTestNorm(VECTOR *from, VECTOR *to, float radius, VECTOR *result, float *friction, VECTOR *norm);
00041
00042
00043
00044
00045 extern COLL_POLY *CollPtr;
00046 #ifdef _N64
00047 extern long CollNum;
00048 #else
00049 extern short CollNum;
00050 #endif
00051 #endif