-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: some more init and multi threading start.
- Loading branch information
Showing
15 changed files
with
365 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# By: pacovali <[email protected]> +#+ # | ||
# +#+ # | ||
# Created: 2019/11/05 19:50:44 by pacovali #+# #+# # | ||
# Updated: 2019/11/12 18:19:28 by nmartins ######## odam.nl # | ||
# Updated: 2019/11/13 01:03:26 by nmartins ######## odam.nl # | ||
# # | ||
# **************************************************************************** # | ||
|
||
|
@@ -88,6 +88,9 @@ STNAMES= \ | |
algebra/shapes/init \ | ||
algebra/shapes/sphere_init \ | ||
algebra/shapes/plane_init \ | ||
algebra/shapes/square_init \ | ||
algebra/shapes/cube_init \ | ||
algebra/shapes/disk_init \ | ||
algebra/shapes/move \ | ||
algebra/shapes/cone_move \ | ||
algebra/shapes/cube_move \ | ||
|
@@ -193,4 +196,4 @@ re: | |
dev: | ||
@$(MAKE) -j10 -s | ||
@echo "$(TIME) $(CNORM) $(CRED)Running $(CCYAN)$(NAME)$(CDEF)" | ||
@./$(NAME) | ||
@./$(NAME) $(SCENE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"camera": { | ||
"fov": 50, | ||
"origin": [0, 18, -75] | ||
}, | ||
"objects": [ | ||
{ | ||
"type": "square", | ||
"origin": [-15, 40, -20], | ||
"normal": [0, -1, 0], | ||
"side_a": [0, 0, 30], | ||
"side_b": [30, 0, 0], | ||
"emission": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 0, 20], | ||
"normal": [0, 0, -1], | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [20, 0, 0], | ||
"normal": [-1, 0, 0], | ||
"color": [100, 255, 100] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [-20, 0, 0], | ||
"normal": [1, 0, 0], | ||
"color": [255, 100, 100] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 0, 0], | ||
"normal": [0, 1, 0], | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 40, 0], | ||
"normal": [0, -1, 0], | ||
"color": [255, 255, 255] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"camera": { | ||
"fov": 50, | ||
"origin": [0, 18, -50] | ||
}, | ||
"objects": [ | ||
{ | ||
"type": "square", | ||
"origin": [-15, 40, -20], | ||
"normal": [0, -1, 0], | ||
"side_a": [0, 0, 30], | ||
"side_b": [30, 0, 0], | ||
"emission": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "sphere", | ||
"origin": [-10, 10, 10], | ||
"radius": 10, | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "sphere", | ||
"origin": [5, 8, 10], | ||
"radius": 8, | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 0, 20], | ||
"normal": [0, 0, -1], | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [20, 0, 0], | ||
"normal": [-1, 0, 0], | ||
"color": [100, 255, 100] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [-20, 0, 0], | ||
"normal": [1, 0, 0], | ||
"color": [255, 100, 100] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 0, 0], | ||
"normal": [0, 1, 0], | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 40, 0], | ||
"normal": [0, -1, 0], | ||
"color": [255, 255, 255] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"camera": { | ||
"fov": 50, | ||
"origin": [0, 18, -75] | ||
}, | ||
"objects": [ | ||
{ | ||
"type": "disk", | ||
"origin": [0, 40, -20], | ||
"normal": [0, -1, 0], | ||
"outer_radius": 10, | ||
"emission": [5000, 5000, 5000] | ||
}, | ||
{ | ||
"type": "square", | ||
"origin": [-5, 10, -20], | ||
"normal": [0, -1, 0], | ||
"side_a": [0, 0, 10], | ||
"side_b": [10, 0, 0], | ||
"color": [50, 50, 50] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 0, 20], | ||
"normal": [0, 0, -1], | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [20, 0, 0], | ||
"normal": [-1, 0, 0], | ||
"color": [100, 255, 100] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [-20, 0, 0], | ||
"normal": [1, 0, 0], | ||
"color": [255, 100, 100] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 0, 0], | ||
"normal": [0, 1, 0], | ||
"color": [255, 255, 255] | ||
}, | ||
{ | ||
"type": "plane", | ||
"origin": [0, 40, 0], | ||
"normal": [0, -1, 0], | ||
"color": [255, 255, 255] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* :::::::: */ | ||
/* cube_init.c :+: :+: */ | ||
/* +:+ */ | ||
/* By: nmartins <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/11/13 00:05:41 by nmartins #+# #+# */ | ||
/* Updated: 2019/11/13 01:00:56 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "shape.h" | ||
|
||
// typedef struct s_cube | ||
// { | ||
// t_vec origin; | ||
// t_vec size; | ||
// t_vec up_axis; | ||
// t_vec front_axis; | ||
// t_vec right_axis; | ||
// t_square side[6]; | ||
// } t_cube; | ||
|
||
bool cube_init( | ||
t_shape *shape_out, const t_json_value *value) | ||
{ | ||
t_cube *cube; | ||
|
||
(void)value; | ||
shape_out->type = SHAPE_CUBE; | ||
cube = &shape_out->val.as_cube; | ||
/* TODO */ | ||
return (true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* :::::::: */ | ||
/* disk_init.c :+: :+: */ | ||
/* +:+ */ | ||
/* By: nmartins <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/11/13 01:00:23 by nmartins #+# #+# */ | ||
/* Updated: 2019/11/13 01:04:02 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "shape.h" | ||
|
||
bool disk_init( | ||
t_shape *shape_out, const t_json_value *value) | ||
{ | ||
t_disk *disk; | ||
|
||
shape_out->type = SHAPE_DISK; | ||
disk = &shape_out->val.as_disk; | ||
dict_def_vec(value, "origin", (t_vec){0, 0, 0}, &disk->plane.origin); | ||
dict_def_vec(value, "normal", (t_vec){0, 0, 0}, &disk->plane.normal); | ||
disk->inner_radius = dict_def_double(value, "inner_radius", 0.0); | ||
disk->outer_radius = dict_def_double(value, "outer_radius", 0.0); | ||
return (true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: nmartins <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/11/12 18:03:38 by nmartins #+# #+# */ | ||
/* Updated: 2019/11/12 20:09:52 by nmartins ######## odam.nl */ | ||
/* Updated: 2019/11/13 01:02:45 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -20,6 +20,9 @@ | |
const static t_shape_init_kvp g_shape_init_map[] = { | ||
{ "sphere", sphere_init }, | ||
{ "plane", plane_init }, | ||
{ "square", square_init }, | ||
{ "cube", cube_init }, | ||
{ "disk", disk_init }, | ||
}; | ||
|
||
static char *get_type(const t_json_value *value) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: pacovali <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/01/12 18:56:23 by pacovali #+# #+# */ | ||
/* Updated: 2019/11/12 18:05:52 by nmartins ######## odam.nl */ | ||
/* Updated: 2019/11/13 01:10:44 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -133,6 +133,18 @@ bool sphere_init( | |
bool plane_init( | ||
t_shape *shape_out, const t_json_value *value); | ||
|
||
bool square_init( | ||
t_shape *shape_out, const t_json_value *value); | ||
|
||
bool cube_init( | ||
t_shape *shape_out, const t_json_value *value); | ||
|
||
bool disk_init( | ||
t_shape *shape_out, const t_json_value *value); | ||
|
||
bool triangle_init( | ||
t_shape *shape_out, const t_json_value *value); | ||
|
||
/* | ||
** Moving objects | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
/* +:+ */ | ||
/* By: pacovali <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/01/12 18:56:23 by pacovali #+# #+# */ | ||
/* Updated: 2019/01/23 17:53:36 by pacovali ######## odam.nl */ | ||
/* Created: 2019/01/12 18:56:23 by pacovali #+# #+# */ | ||
/* Updated: 2019/11/13 01:12:30 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -44,6 +44,8 @@ typedef struct s_square | |
REAL dot_b; | ||
} t_square; | ||
|
||
// TODO: defo reimplement this using just 3 `t_vec`s | ||
|
||
typedef struct s_triangle | ||
{ | ||
t_plane plane; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* :::::::: */ | ||
/* square_init.c :+: :+: */ | ||
/* +:+ */ | ||
/* By: nmartins <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/11/12 23:16:16 by nmartins #+# #+# */ | ||
/* Updated: 2019/11/12 23:21:13 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "shape.h" | ||
|
||
bool square_init( | ||
t_shape *shape_out, const t_json_value *value) | ||
{ | ||
t_square *square; | ||
|
||
shape_out->type = SHAPE_SQUARE; | ||
square = &shape_out->val.as_square; | ||
dict_def_vec(value, "origin", (t_vec){0, 0, 0}, &square->plane.origin); | ||
dict_def_vec(value, "normal", (t_vec){0, 0, 0}, &square->plane.normal); | ||
dict_def_vec(value, "side_a", (t_vec){0, 0, 0}, &square->side_a); | ||
dict_def_vec(value, "side_b", (t_vec){0, 0, 0}, &square->side_b); | ||
square->dot_a = vec_dot(&square->side_a, &square->side_a); | ||
square->dot_b = vec_dot(&square->side_b, &square->side_b); | ||
return (true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* :::::::: */ | ||
/* triangle_init.c :+: :+: */ | ||
/* +:+ */ | ||
/* By: nmartins <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/11/13 01:10:30 by nmartins #+# #+# */ | ||
/* Updated: 2019/11/13 01:13:12 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "shape.h" | ||
|
||
bool triangle_init( | ||
t_shape *shape_out, const t_json_value *value) | ||
{ | ||
t_triangle *tri; | ||
|
||
shape_out->type = SHAPE_TRIANGLE; | ||
tri = &shape_out->val.as_triangle; | ||
(void)shape_out; | ||
(void)value; | ||
return (true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: nmartins <[email protected]> +#+ */ | ||
/* +#+ */ | ||
/* Created: 2019/10/26 13:20:57 by nmartins #+# #+# */ | ||
/* Updated: 2019/11/12 20:36:35 by nmartins ######## odam.nl */ | ||
/* Updated: 2019/11/13 01:38:24 by nmartins ######## odam.nl */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -23,8 +23,7 @@ | |
** By doing it this way, we are able to | ||
** switch from floats to doubles. | ||
*/ | ||
# define SUPERSAMPLE 256 | ||
# define SQRT_SUPERS 16 | ||
# define SUPERSAMPLE 1 | ||
|
||
# define SUCCESS 0 | ||
# define FAILURE 1 | ||
|
Oops, something went wrong.