X-Git-Url: https://skaterift.com/git/?a=blobdiff_plain;f=cxr%2Fcxr.h;h=644c8ed83e39381e88ceb5c3beeb4772e29f3be3;hb=HEAD;hp=e1c1679f405ff2fda3080bcc67ea304acc20b0b7;hpb=8e1b6889db7ce10f8d594539ef74dc4390e8e891;p=convexer.git diff --git a/cxr/cxr.h b/cxr/cxr.h index e1c1679..644c8ed 100644 --- a/cxr/cxr.h +++ b/cxr/cxr.h @@ -48,7 +48,6 @@ LICENSE: GPLv3.0, please see COPYING and LICENSE for more information IMPLEMENTATION */ -#define CXR_API #define CXR_EPSILON 0.001 #define CXR_PLANE_SIMILARITY_MAX 0.998 #define CXR_BIG_NUMBER 1e300 @@ -60,31 +59,17 @@ LICENSE: GPLv3.0, please see COPYING and LICENSE for more information #include #include -#include -#include #include #include -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; -typedef int8_t i8; -typedef int16_t i16; -typedef int32_t i32; -typedef int64_t i64; - -typedef unsigned int uint; - -typedef double v2f[2]; -typedef double v3f[3]; -typedef double v4f[4]; -typedef v3f m3x3f[3]; -typedef v3f m4x3f[4]; -typedef v3f boxf[2]; - +#include "cxr_types.h" #include "cxr_math.h" #include "cxr_mem.h" +#include "cxr_log.h" + +#ifdef CXR_VALVE_BIN + #include "cxr_valve_bin.h" +#endif typedef struct cxr_world cxr_world; typedef struct cxr_solid cxr_solid; @@ -232,8 +217,11 @@ struct cxr_mesh /* Simple mesh type mainly for debugging */ struct cxr_tri_mesh { - v3f *vertices; + v3f *vertices, + *normals; + v2f *uvs; v4f *colours; + i32 *indices, indices_count, vertex_count; @@ -314,9 +302,6 @@ enum cxr_soliderr #endif #endif -static void (*cxr_log_func)(const char *str); -static void (*cxr_line_func)( v3f p0, v3f p1, v4f colour ); - static int cxr_range(int x, int bound) { if( x < 0 ) @@ -391,21 +376,6 @@ static void colour_random_brush(int n, v4f colour) #ifdef CXR_DEBUG -static void cxr_log( const char *fmt, ... ) -{ - char buf[512]; - - va_list args; - va_start( args, fmt ); - vsnprintf( buf, sizeof(buf)-1, fmt, args ); - va_end(args); - - if( cxr_log_func ) - cxr_log_func( buf ); - - fputs(buf,stdout); -} - static void cxr_debug_line( v3f p0, v3f p1, v4f colour ) { if( cxr_line_func ) @@ -2218,6 +2188,8 @@ CXR_API cxr_tri_mesh *cxr_world_preview( cxr_world *world ) out->colours = malloc( sizeof(v4f)*out->vertex_count ); out->vertices = malloc( sizeof(v3f)*out->vertex_count ); out->indices = malloc( sizeof(i32)*out->indices_count ); + out->uvs = NULL; + out->normals = NULL; v3f *overts = out->vertices; v4f *colours = out->colours; @@ -2299,6 +2271,8 @@ CXR_API void cxr_free_tri_mesh( cxr_tri_mesh *mesh ) free( mesh->colours ); free( mesh->indices ); free( mesh->vertices ); + free( mesh->normals ); + free( mesh->uvs ); free( mesh ); } @@ -3535,5 +3509,6 @@ CXR_API int cxr_lightpatch_bsp( const char *path ) return 1; } + #endif /* CXR_VALVE_MAP_FILE */ #endif /* CXR_IMPLEMENTATION */