From 467b97bf977de4f0321d4f1e683552cdc9ba4f90 Mon Sep 17 00:00:00 2001 From: platonvin Date: Sat, 31 Aug 2024 14:21:03 +0300 Subject: [PATCH] patch for linux --- .gitignore | 4 +++- Makefile | 37 ++++++++++++++++++++++++++++--------- tests/fractal.c | 4 ++-- tests/test.c | 5 ++--- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index c66754e..915f51a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ compile_flags.txt *.tga *.exe -*.o \ No newline at end of file +*.o +test +fractal \ No newline at end of file diff --git a/Makefile b/Makefile index 5d966e7..5d06587 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,30 @@ .ONESHELL: -#example with object file -test: tests/test.c - cc -Ofast -msse4.2 -DRAVE_CUSTOM_VOXEL_TYPE=int src/raytracer.c -c -o raytracer.o - cc -Ofast -msse4.2 tests/test.c raytracer.o dependencies/tgafunc.c -o test - test -#example with just .c inclusion -fractal: tests/fractal.c - cc -Ofast -msse4.2 tests/fractal.c dependencies/tgafunc.c -o fractal - fractal \ No newline at end of file +raytracer.o: + cc -c -o raytracer.o -DRAVE_CUSTOM_VOXEL_TYPE=int src/raytracer.c -Ofast -msse4.2 +test: tests/test.c dependencies/tgafunc.c raytracer.o + cc -o test tests/test.c raytracer.o dependencies/tgafunc.c -Ofast -msse4.2 -lm -pthread +ifeq ($(OS),Windows_NT) + .\test +else + ./test +endif + +fractal: tests/fractal.c dependencies/tgafunc.c raytracer.o + cc -o fractal tests/fractal.c dependencies/tgafunc.c -Ofast -msse4.2 -lm -pthread +ifeq ($(OS),Windows_NT) + .\fractal +else + ./fractal +endif + +clean: +ifeq ($(OS),Windows_NT) + del "*.o" + del "test" + del "fractal" +else + rm -R *.o + rm -R test + rm -R fractal +endif \ No newline at end of file diff --git a/tests/fractal.c b/tests/fractal.c index 34ee700..b9d93dd 100644 --- a/tests/fractal.c +++ b/tests/fractal.c @@ -9,10 +9,10 @@ #include -static int width = 512, height = 512; +static int width = 256, height = 256; uint32_t max_reflections = 7; uint32_t max_steps = 512; -const int sample_count = 50; +const int sample_count = 20; rave_voxel rave_empty_voxel = 0; static rave_vec3 camera_ray_dir; diff --git a/tests/test.c b/tests/test.c index 6950b51..ec394a0 100644 --- a/tests/test.c +++ b/tests/test.c @@ -7,10 +7,10 @@ #include #include -static int width = 512, height = 512; +static int width = 256, height = 256; uint32_t max_reflections = 12; uint32_t max_steps = 256; -const int sample_count = 100; +const int sample_count = 10; rave_voxel rave_empty_voxel = 0; void delete_if_exists(const char *filename) { @@ -214,7 +214,6 @@ int main(int argc, char *argv[]) { error_code = tga_save_from_info(data, info, out_name); assert(error_code == TGA_NO_ERROR); - tga_free_data(data); tga_free_info(info); free(image);