pt2game/compiled_structures.h

28 lines
859 B
C

#ifndef COMPILED_STRUCTURES_H_
#define COMPILED_STRUCTURES_H_
struct navmesh_point {
int x, y;
};
struct navmesh_tri_edge {
float a,b,c; // line equation a*x + b*y + c > 0 if point is in triangle, and value gives distance from line.
int other_tri; // -1 if this edge is a border of navmesh, else triangle it connects to
struct navmesh_point center; // intermediate point for use in routing. could be improved later.
};
struct navmesh_tri {
struct navmesh_tri_edge edges[3];
struct navmesh_point points[3];
// edges[0]: points[0]-points[1]
// edges[1]: points[1]-points[2]
// edges[2]: points[2]-points[0]
};
struct navmesh {
int num_tris;
const struct navmesh_tri *tris;
const unsigned char *pathfindgrid; // [dest*num_tris + source] gives index of next tri. Placeholder value is used when dest==source.
};
#endif /* COMPILED_STRUCTURES_H_ */