Skip to content

Commit 572789a

Browse files
authored
Dev (#12)
* pre render stage to uptate cube corner * [skip travis] Update cmake * Skybox implementation * Add sample 8k skybox * conditionnal brew depend on the branch push * not update to reduce built time (bugged so revert) * cache brew (Not seen the effect for now) * no update but cache * reactivate update of brew
1 parent 18fdd9a commit 572789a

28 files changed

+204
-81
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
addons:
33
homebrew:
44
packages:
5-
- doxygen
6-
- graphviz
75
- sdl2
86
- sdl2_image
7+
- doxygen
8+
- graphviz
99
update: true
1010
branches:
1111
except:
@@ -33,3 +33,8 @@ script:
3333
- make test
3434
- if [ $TRAVIS_BRANCH == "master" ]; then doxygen Doxyfile; fi
3535
sudo: required
36+
before_cache:
37+
- brew cleanup
38+
cache:
39+
directories:
40+
- $HOME/Library/Caches/Homebrew

CMakeLists.txt

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ target_link_libraries(RT rt)
3131
target_link_libraries(RT cimgui)
3232
target_link_libraries(RT imgui_impl)
3333

34-
target_include_directories(RT PRIVATE lib/cimgui)
35-
3634
find_package(OpenGL REQUIRED)
3735

3836
target_link_libraries(RT ${OPENGL_gl_LIBRARY})
@@ -45,29 +43,43 @@ set_target_properties(RT
4543
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
4644

4745
target_sources(RT PRIVATE
48-
srcs/interface/fullscreen.c
46+
srcs/interface/anim_reset.c
47+
srcs/interface/anim_set.c
48+
srcs/interface/anim_toolbox.c
49+
srcs/interface/delete_obj.c
4950
srcs/interface/interface.c
50-
srcs/interface/interface_lists.c
51-
srcs/interface/interface_menu.c
52-
srcs/interface/interface_objects.c
53-
srcs/interface/interface_scene.c
54-
srcs/interface/interface_tools.c
5551
srcs/interface/new_object.c
56-
srcs/interface/delete_obj.c
5752
srcs/interface/new_object_tools.c
5853
srcs/interface/object_tools.c
54+
srcs/interface/screen_manager.c
55+
srcs/interface/ui_anim.c
56+
srcs/interface/ui_anim_selector.c
57+
srcs/interface/ui_anim_toolbox.c
58+
srcs/interface/ui_cam_win.c
59+
srcs/interface/ui_camera_tab.c
60+
srcs/interface/ui_csg.c
5961
srcs/interface/ui_edit_win.c
6062
srcs/interface/ui_file_win.c
63+
srcs/interface/ui_lists.c
64+
srcs/interface/ui_menu.c
65+
srcs/interface/ui_objects.c
6166
srcs/interface/ui_render.c
62-
srcs/interface/ui_cam_win.c
67+
srcs/interface/ui_render_settings.c
68+
srcs/interface/ui_scene_editor.c
6369
srcs/interface/ui_selector.c
70+
srcs/interface/ui_tools.c
6471
srcs/parser/export.c
72+
srcs/parser/export_anim.c
73+
srcs/parser/export_anim_tools.c
6574
srcs/parser/export_csg.c
6675
srcs/parser/export_shape.c
6776
srcs/parser/export_toolbox.c
6877
srcs/parser/obj_data.c
6978
srcs/parser/obj_name.c
79+
srcs/parser/parse_anim.c
80+
srcs/parser/parse_anim_tools.c
7081
srcs/parser/parse_csg.c
82+
srcs/parser/parse_shape.c
7183
srcs/parser/parse_toolbox.c
7284
srcs/parser/parse_txt.c
7385
srcs/parser/parse_utils.c
@@ -78,12 +90,15 @@ target_sources(RT PRIVATE
7890
srcs/render/cast.c
7991
srcs/render/filters.c
8092
srcs/render/light.c
93+
srcs/render/normal_mapping.c
8194
srcs/render/perturbation.c
8295
srcs/render/post_process.c
8396
srcs/render/render.c
8497
srcs/render/texture_loader.c
8598
srcs/render/texture_toolbox.c
86-
srcs/render/normal_mapping.c
99+
srcs/render/skybox.c
100+
srcs/render/perlin.c
101+
srcs/render/perlin_texture.c
87102
srcs/render_utils
88103
srcs/render_utils/error_sdl.c
89104
srcs/render_utils/exit_sdl.c
@@ -95,13 +110,16 @@ target_sources(RT PRIVATE
95110
srcs/render_utils/render_sdl.c
96111
srcs/render_utils/render_time.c
97112
srcs/render_utils/save_screenshot.c
98-
srcs/tools/free_scene.c
113+
srcs/tools/animate.c
99114
srcs/tools/free.c
115+
srcs/tools/free2.c
116+
srcs/tools/free_scene.c
117+
srcs/tools/get_scenes.c
118+
srcs/tools/hook.c
119+
srcs/tools/list_toolbox.c
120+
srcs/tools/load_tools.c
100121
srcs/tools/reload.c
101122
srcs/tools/update.c
102123
srcs/tools/utils.c
103-
srcs/tools/free.c
104-
srcs/tools/get_scenes.c
105-
srcs/csg.c
106124
srcs/key_mapping.c
107125
srcs/main.c)

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# By: nihuynh <[email protected]> +#+ +:+ +#+ #
77
# +#+#+#+#+#+ +#+ #
88
# Created: 2018/09/27 19:33:22 by nihuynh #+# #+# #
9-
# Updated: 2019/06/26 04:00:32 by nihuynh ### ########.fr #
9+
# Updated: 2019/06/28 20:33:31 by nihuynh ### ########.fr #
1010
# #
1111
# **************************************************************************** #
1212

@@ -29,7 +29,8 @@ PARSER := export_csg.c export_shape.c export_toolbox.c export.c \
2929
parse_anim.c
3030
RENDER := camera.c cast.c filters.c light.c normal_mapping.c \
3131
perturbation.c post_process.c render.c texture_loader.c \
32-
texture_toolbox.c perlin.c perlin_texture.c
32+
texture_toolbox.c perlin.c perlin_texture.c skybox.c \
33+
pre_render.c
3334
RENDER_U := init_sdl.c error_sdl.c exit_sdl.c render_sdl.c loop_sdl.c \
3435
init_mthr_sdl.c render_mthr_sdl.c save_screenshot.c \
3536
render_pool.c render_time.c

includes/libui.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: nihuynh <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2018/11/28 03:32:43 by nihuynh #+# #+# */
9-
/* Updated: 2019/06/25 22:40:50 by nihuynh ### ########.fr */
9+
/* Updated: 2019/06/26 18:02:12 by nihuynh ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -60,6 +60,7 @@ struct s_sdl
6060
void (*click_map)(SDL_Event *, void *);
6161
void (*update)(void *arg);
6262
void (*render_gui)(void *arg);
63+
void (*prep_render)(t_sdl *sdl);
6364
bool sepia;
6465
bool grayscale;
6566
bool cartoon;
@@ -107,7 +108,7 @@ void render_sdl(t_sdl *sdl, int (*f) (int, int, void*), void *d);
107108
void loop_sdl(t_sdl *sdl, void *arg);
108109
void save_screenshot(t_sdl *sdl, char *arg);
109110
void init_mthr_sdl(t_sdl *sdl, int (*do_pxl)(int, int, void*),
110-
void *data);
111+
void *data, void (*prep_render)(t_sdl*));
111112
void render_mthr_sdl(t_sdl *sdl);
112113
void apply_simple_filter(t_sdl *sdl, uint32_t (*fun) (uint32_t));
113114

includes/parse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ float parse_fval(char *key, t_parse_txt *scene_file);
116116
t_vec3 parse_vector(char *key, t_parse_txt *scene_file);
117117
t_vec2 parse_vec2(char *key, t_parse_txt *scene_file);
118118
char *parse_str(t_parse_txt *scene_file, char *key);
119+
t_texture *parse_texture(char *key_name, t_parse_txt *scene_file);
119120
int parse_int(char *key, t_parse_txt *scene_file);
120121

121122
/*
@@ -158,7 +159,6 @@ void cylinder_set(t_obj *obj, void *cylinder, t_parse_txt *scene_fi);
158159
void plane_set(t_obj *obj, void *plane, t_parse_txt *scene_file);
159160
void sphere_set(t_obj *obj, void *sphere, t_parse_txt *scene_file);
160161
void csg_set(t_obj *obj, void *root, t_parse_txt *scene_file);
161-
void set_min_max_corner(t_cube *cube);
162162
void cube_set(t_obj *obj, void *root, t_parse_txt *scene_file);
163163
void tore_set(t_obj *obj, void *root, t_parse_txt *scene_file);
164164

includes/render.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void set_direction(t_cam *cam, t_vec3 direction);
3535
void cam_ray(t_data *app, t_ray *res, float x, float y);
3636
t_color cast_light_primary(t_list *obj_list, t_inter *inter);
3737
t_vec3 compute_shading_normal(t_material mat, t_vec3 uv, t_vec3 geo_n);
38+
t_color get_sky_color(t_scene scene, t_settings settings, t_ray ray);
3839

3940
void update_camera(t_cam *cam, bool *needs_render);
4041

includes/t_data.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: nihuynh <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2019/06/03 00:06:56 by nihuynh #+# #+# */
9-
/* Updated: 2019/06/26 01:20:56 by nihuynh ### ########.fr */
9+
/* Updated: 2019/06/26 17:46:31 by nihuynh ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -40,6 +40,7 @@ typedef struct s_data
4040
*/
4141

4242
int process_pixel(int x, int y, void *arg);
43+
void prep_render(t_sdl *sdl);
4344
t_obj *find_obj_at_pixel(t_data *app, int x, int y);
4445
void interface(t_data *app);
4546
t_data *get_app(t_data *app);

includes/t_scene.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ typedef struct s_scene
2323
t_list *lst_anim_light;
2424
int nb_objs[7];
2525
int nb_light;
26+
t_texture *skybox;
2627
} t_scene;
2728

2829
typedef struct s_scene_name

includes/t_settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ typedef struct s_settings
3030
bool anti_a;
3131
bool debug_normal;
3232
bool normal_mapping;
33+
bool skybox;
3334
int depth_max;
3435
float fov;
3536
} t_settings;

lib/cimgui

0 commit comments

Comments
 (0)