pt2game/compiled_structures.h

30 lines
903 B
C
Raw Normal View History

#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 {
int num_verts;
const struct navmesh_tri_edge *edges;
const struct navmesh_point *points;
// For a triangle:
// 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_ */