fix makefile + gitignore
authorhgn <hgodden00@gmail.com>
Sun, 10 Apr 2022 04:59:19 +0000 (05:59 +0100)
committerhgn <hgodden00@gmail.com>
Sun, 10 Apr 2022 04:59:19 +0000 (05:59 +0100)
.gitignore
Makefile [new file with mode: 0644]
src/convexer.c

index 00b2e1f05ddd03d56ab97095811da1d7fa8bba40..1a9d3587b5e5818884f1f200e9f301792b722d7c 100644 (file)
@@ -6,4 +6,4 @@
 !*.h
 !*.py
 
-Makefile
+!Makefile
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
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
index 47ba1282f5992467a164e87726c44e01afa60ad0..fd750d6ad1c0963cbd08a4e7b995a89021bb2cad 100644 (file)
@@ -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)
 {