41 lines
979 B
C
41 lines
979 B
C
#ifndef __GMC_MAP_H__
|
|
#define __GMC_MAP_H__
|
|
|
|
#include <HandmadeMath/HandmadeMath.h>
|
|
#include <slibs/slibs.h>
|
|
|
|
#define PLANE_FMT "( %f %f %f ) ( %f %f %f ) ( %f %f %f ) %s %f %f %f %f %f"
|
|
#define SPREAD_VEC2(v) v.X, v.Y
|
|
#define SPREAD_VEC3(v) SPREAD_VEC2(v), v.Z
|
|
#define SPREAD_PLANE(p) SPREAD_VEC3(p.p1), SPREAD_VEC3(p.p2), SPREAD_VEC3(p.p3), \
|
|
p.texture, SPREAD_VEC2(p.tex_offset), p.tex_rotation, SPREAD_VEC2(p.tex_scale)
|
|
|
|
typedef struct map_plane {
|
|
HMM_Vec3 p1, p2, p3;
|
|
char texture[128];
|
|
HMM_Vec2 tex_offset;
|
|
float tex_rotation;
|
|
HMM_Vec2 tex_scale;
|
|
} map_plane;
|
|
|
|
typedef struct map_brush {
|
|
sl_vec(map_plane) planes;
|
|
} map_brush;
|
|
|
|
typedef struct map_property {
|
|
char key[128];
|
|
char value[128];
|
|
} map_property;
|
|
|
|
typedef struct map_entity {
|
|
sl_vec(map_property) properties;
|
|
sl_vec(map_brush) brushes;
|
|
} map_entity;
|
|
|
|
typedef struct map_map {
|
|
sl_vec(map_entity) entities;
|
|
} map_map;
|
|
|
|
map_map map_parse(const char* filename);
|
|
|
|
#endif
|