From: hgn Date: Sun, 10 Apr 2022 04:59:19 +0000 (+0100) Subject: fix makefile + gitignore X-Git-Url: https://skaterift.com/git/?p=convexer.git;a=commitdiff_plain;h=2d8415532d13da0132b762dcff2d043b77441d33 fix makefile + gitignore --- diff --git a/.gitignore b/.gitignore index 00b2e1f..1a9d358 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ !*.h !*.py -Makefile +!Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4bafbd0 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +all: libcxr.so libnbvtf.so + +libcxr.so: src/convexer.c src/cxr_math.h src/cxr_mem.h + gcc -ggdb -O1 -Wall -fPIC -shared src/convexer.c -o libcxr.so -lm -Wno-unused-variable -Wno-unused-function -DDEBUG_WRITE_MESH -std=c99 -pedantic + +tovtf: src/obj/librgbcx.o src/obj/tovtf.o + g++ -O3 src/obj/tovtf.o src/obj/librgbcx.o -o tovtf + +src/obj/librgbcx.o: src/nbvtf/librgbcx.cc src/nbvtf/rgbcx.h + g++ -O3 -c src/nbvtf/librgbcx.cc -o src/obj/librgbcx.o + +src/obj/tovtf.o: src/nbvtf/vtf_cmd.c src/nbvtf/nbvtf.h + gcc -O3 -DUSE_LIBRGBCX -c -I./src/nbvtf/ src/nbvtf/vtf_cmd.c -o src/obj/tovtf.o + +src/obj/libnbvtf.o: src/nbvtf/nbvtf.h + gcc -O3 -fPIC -x c -c -DNBVTF_AS_SO src/nbvtf/nbvtf.h -o src/obj/libnbvtf.o + +libnbvtf.so: src/obj/librgbcx.o src/obj/libnbvtf.o + g++ -O3 -shared src/obj/librgbcx.o src/obj/libnbvtf.o -o libnbvtf.so + +test: src/convexer.c src/test.c src/cxr_math.h src/solid.h + gcc -ggdb -O1 -Wall src/test.c -o test -lm -Wno-unused-variable -Wno-unused-function -fsanitize=address -Werror=vla diff --git a/src/convexer.c b/src/convexer.c index 47ba128..fd750d6 100644 --- a/src/convexer.c +++ b/src/convexer.c @@ -11,6 +11,7 @@ - Freely form displacements without limits - Build your entire map in Blender - Compile models and model groups easily + - It runs at an ok speed! - Light patch BSP files; remove unwanted realtime effects - Fastest VTF compressor (thanks to Richgel999 and stb) @@ -260,6 +261,42 @@ static void cxr_log( const char *fmt, ... ) fputs(buf,stdout); } +/* + * Public API + */ + +/* + * Main function + * Breaks up geometry into solid pieces + * Turns marked mesh segments into displacements + */ +CXR_API i32 cxr_convert_mesh_to_vmf(cxr_input_mesh *src, cxr_vdf *output); + +/* Context management */ +CXR_API void cxr_context_reset(void); +CXR_API void cxr_set_offset(double offset); +CXR_API void cxr_set_scale_factor(double scale); +CXR_API void cxr_settings_update( struct cxr_settings *settings ); + +/* VDF interface */ +CXR_API cxr_vdf *cxr_vdf_open(const char *path); +CXR_API void cxr_vdf_close(cxr_vdf *vdf); +CXR_API void cxr_vdf_put(cxr_vdf *vdf, const char *str); +CXR_API void cxr_vdf_node(cxr_vdf *vdf, const char *str); +CXR_API void cxr_vdf_edon( cxr_vdf *vdf ); +CXR_API void cxr_vdf_kv( cxr_vdf *vdf, const char *strk, const char *strv ); + +/* Debugging */ +CXR_API void cxr_set_log_function( void (*func)(const char *str) ); +CXR_API void cxr_set_line_function( void (*func)(v3f p0, v3f p1, v4f colour) ); +CXR_API cxr_input_mesh *cxr_write_test_data( cxr_input_mesh *src ); + +/* Other tools */ +CXR_API int cxr_lightpatch_bsp( const char *path ); + +/* + * Implementation + */ CXR_API void cxr_context_reset(void) {