Skip to content

Commit

Permalink
patch for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
platonvin committed Aug 31, 2024
1 parent 7c72795 commit 467b97b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
compile_flags.txt
*.tga
*.exe
*.o
*.o
test
fractal
37 changes: 28 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
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
4 changes: 2 additions & 2 deletions tests/fractal.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#include <stdio.h>

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;
Expand Down
5 changes: 2 additions & 3 deletions tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <stdio.h>
#include <stdlib.h>

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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 467b97b

Please sign in to comment.