48 lines
1.3 KiB
C
48 lines
1.3 KiB
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 polygon, and value gives distance from line.
|
|
int other_tri; // -1 if this edge is a border of navmesh, else polygon 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.
|
|
};
|
|
|
|
struct level_clickregion_edge {
|
|
float a,b,c; // line equation a*x + b*y + c > 0 if point is in polygon
|
|
};
|
|
struct level_clickregion {
|
|
int id;
|
|
int x, y, width, height;
|
|
int num_edges;
|
|
const struct level_clickregion_edge *edges;
|
|
};
|
|
struct level_predef_point {
|
|
int x, y;
|
|
int id;
|
|
};
|
|
struct level_predef_data {
|
|
const struct level_clickregion *clickregions; // terminated by null entry
|
|
const struct level_predef_point *points; // terminated by x=0 y=0
|
|
};
|
|
|
|
|
|
#endif /* COMPILED_STRUCTURES_H_ */
|