Skip to content

Commit

Permalink
RT
Browse files Browse the repository at this point in the history
  • Loading branch information
dgaitsgo committed Jul 14, 2017
0 parents commit 057c541
Show file tree
Hide file tree
Showing 247 changed files with 15,371 additions and 0 deletions.
205 changes: 205 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: dgaitsgo <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/09/26 14:32:25 by dgaitsgo #+# #+# #
# Updated: 2017/03/23 18:22:36 by dgaitsgo ### ########.fr #
# #
# **************************************************************************** #

NAME = rt

SRC_DIR = ./src
OBJ_DIR = ./obs
INC_DIR = ./include

SRC_FILES = \
./src/core/affine_group.c \
./src/core/anti_aliasing.c \
./src/core/bound_entire_scene.c \
./src/core/bounding_box.c \
./src/core/calc_perl_color.c \
./src/core/calc_uv.c \
./src/core/camera.c \
./src/core/cannonical.c \
./src/core/cannonical2.c \
./src/core/color.c \
./src/core/color2.c \
./src/core/cone_inter.c \
./src/core/cone_intersection.c \
./src/core/constructors.c \
./src/core/csg.c \
./src/core/csg2.c \
./src/core/csg_lst.c \
./src/core/csg_ops.c \
./src/core/csg_select.c \
./src/core/cube_intersection.c \
./src/core/cylinder_inter.c \
./src/core/cylinder_intersection.c \
./src/core/draw_bounding_box.c \
./src/core/draw_line.c \
./src/core/event.c \
./src/core/generate_primary_ray.c \
./src/core/geometry.c \
./src/core/get_intersection_color.c \
./src/core/graphics_helpers.c \
./src/core/helpers.c \
./src/core/helpers2.c \
./src/core/inter.c \
./src/core/intersect_bbox.c \
./src/core/intersection.c \
./src/core/light.c \
./src/core/line.c \
./src/core/main.c \
./src/core/material.c \
./src/core/math.c \
./src/core/multithreading.c \
./src/core/multithreading_aa.c \
./src/core/node_util.c \
./src/core/obj_data.c \
./src/core/object.c \
./src/core/perl_noise_tools.c \
./src/core/perlin_noise.c \
./src/core/perlin_noise2.c \
./src/core/phong_shading.c \
./src/core/plane_inter.c \
./src/core/plane_intersection.c \
./src/core/quantize_colors.c \
./src/core/random.c \
./src/core/rasterize.c \
./src/core/refraction.c \
./src/core/render.c \
./src/core/scene.c \
./src/core/screen_shot.c \
./src/core/shader.c \
./src/core/soft_shadow.c \
./src/core/sphere_inter.c \
./src/core/sphere_intersection.c \
./src/core/test_intersection.c \
./src/core/tone_mapping.c \
./src/core/transform.c \
./src/core/transform_bbox.c \
./src/core/triangle_intersection.c \
./src/core/window.c \
./src/matrix/copy_matrix.c \
./src/matrix/inverse_rotation_matrix.c \
./src/matrix/inverse_transformations.c \
./src/matrix/matrix.c \
./src/matrix/matrix_getters.c \
./src/matrix/matrix_utility.c \
./src/matrix/object_matrix_build.c \
./src/matrix/perspective_matrix.c \
./src/matrix/rotation_matrix.c \
./src/matrix/screen_space.c \
./src/matrix/transformation_matrix.c \
./src/mesh/mesh_to_trianlges.c \
./src/mesh/new_mesh.c \
./src/parse/character_check.c \
./src/parse/check_flags.c \
./src/parse/count_words_and_length.c \
./src/parse/file_to_string.c \
./src/parse/flags.c \
./src/parse/get_next_line.c \
./src/parse/only_one_word.c \
./src/parse/parse.c \
./src/parse/parse_camera.c \
./src/parse/parse_csg.c \
./src/parse/parse_element.c \
./src/parse/parse_error.c \
./src/parse/parse_light.c \
./src/parse/parse_material.c \
./src/parse/parse_mesh.c \
./src/parse/parse_mesh2.c \
./src/parse/parse_object.c \
./src/parse/parse_stream_controls.c \
./src/parse/parse_string.c \
./src/parse/parse_texture.c \
./src/parse/parse_tools.c \
./src/parse/parse_transform.c \
./src/parse/parse_triangle.c \
./src/parse/parse_vector_and_scalar.c \
./src/parse/parse_window.c \
./src/parse/remove_white_space.c \
./src/parse/tokenize.c \
./src/vector/vector.c \
./src/vector/vector_basic_ops.c \
./src/vector/vector_basic_ops2.c \
./src/vector/vector_basic_ops3.c \
./src/vector/vector_constructors.c \
./src/vector/vector_min_max.c \
./src/vector/vector_scale.c \
./src/vector/vector_transformations.c \

OBJ_FILES = $(SRC_FILES:.c=.o) #$(addprefix $(OBJ_DIR)/,$(notdir $(SRC_FILES:.c=.o)))

INC_FILES = \
./include/affine_group.h \
./include/bounding_box.h \
./include/camera.h \
./include/color.h \
./include/csg.h \
./include/debug.h \
./include/enums.h \
./include/external_headers.h \
./include/film.h \
./include/flags.h \
./include/geometry.h \
./include/get_next_line.h \
./include/graphics_helpers.h \
./include/intersection.h \
./include/libft.h \
./include/light.h \
./include/local_headers.h \
./include/macros.h \
./include/maths.h \
./include/matrix.h \
./include/mesh.h \
./include/noise.h \
./include/obj_data.h \
./include/object.h \
./include/parse.h \
./include/random.h \
./include/rasterize.h \
./include/ray.h \
./include/ray_trace.h \
./include/refraction.h \
./include/rt_open_gl.h \
./include/shader.h \
./include/shapes.h \
./include/stats.h \
./include/texture.h \
./include/threads.h \
./include/tile.h \
./include/tone_map.h \
./include/transform.h \
./include/utility.h \
./include/vector.h \
./include/window.h \

LIB_DIR = ./lib/libft

FLAGS = -Wall -Wextra -Werror

.PHONY: all, clean, fclean, re

all: $(NAME)

$(NAME): $(OBJ_FILES)
make -C ./lib/libft
gcc $(FLAGS) -o $(NAME) $(OBJ_FILES) -L$(LIB_DIR) -lft -F/Library/Frameworks -framework SDL2

%.o:%.c $(INC_FILES)
gcc -c -I$(INC_DIR) $< -o $@

clean:
make -C ./lib/libft/ clean
rm -rf $(OBJ_FILES)

fclean: clean
make -C ./lib/libft/ fclean
rm -rf $(NAME)

re: fclean all
1 change: 1 addition & 0 deletions auteur
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dgaitsgo mdiarra psaint-j trecomps
31 changes: 31 additions & 0 deletions docs/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
RTSDF

Ray Tracing Scene Description File - .rtsdf

- rtv1 only understands files with this extension .rtsdf
- Single line comments are possible and use c++ style '//' and must be placed
at beginning of line to function
- Typing is strong:

- Scene elements and sub Elements beging with a capital letter
- Their fields are balenced with '{}'
- Scalars are contained in <>
- Vectors are contained in <>, their values are comma seperated

Elements:
Camera

Accepted Fields:
Fov <> : Must be a value between 1 and 360
Origin <x, y, z>
Direction <x, y, z>
Sub Elements:
Transformation {} : Only translation and rotation accepted

Light
Plane
Sphere
Cylinder
Cone

TODO
27 changes: 27 additions & 0 deletions include/.kd_trees.hellno
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* kd_trees.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaitsgo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/01 15:08:04 by dgaitsgo #+# #+# */
/* Updated: 2017/03/08 10:58:39 by dgaitsgo ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef kd_trees_h
#define kd_trees_h

# include "bbox.h"
# include "object.h"

typedef struct s_kd_node
{
t_bbox bbox;
struct_s_kd_nod *left;
struct_s_kd_nod *right;
t_object **objects;
} t_kd_node;

#endif
30 changes: 30 additions & 0 deletions include/affine_group.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* affine_group.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaitsgo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 10:42:14 by dgaitsgo #+# #+# */
/* Updated: 2017/03/15 15:31:23 by trecomps ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef __AFFINE_GROUP_H
# define __AFFINE_GROUP_H

# include "matrix.h"
# include "transform.h"

typedef struct s_affine_group
{
t_matrix transformation;
t_matrix inverse;
t_matrix inverse_scale_times_rotation;
t_transform trans_data;
} t_affine_group;

t_affine_group new_affine_group(void);
void build_affine_group(t_affine_group *ag);

#endif
50 changes: 50 additions & 0 deletions include/bounding_box.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bounding_box.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaitsgo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/22 14:40:32 by dgaitsgo #+# #+# */
/* Updated: 2017/03/08 10:46:27 by dgaitsgo ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef __BOUNDING_BOX_H
# define __BOUNDING_BOX_H

# include "vector.h"

typedef struct
{
t_vector min;
t_vector max;
} t_bbox;

typedef struct
{
t_vector xmin;
t_vector ymin;
t_vector zmin;
t_vector xmax;
t_vector ymax;
t_vector zmax;
} t_pointbox;

typedef struct
{
double xmin;
double ymin;
double zmin;
double xmax;
double ymax;
double zmax;
} t_extremebox;

void cannonical_bbox(t_bbox *bbox);
t_bbox *new_bbox(void);
void init_bbox(t_bbox *box, t_vector min, t_vector max);
t_bbox transform_bbox(t_bbox box, t_matrix m);
t_bbox extreme_bbox(void);

#endif
48 changes: 48 additions & 0 deletions include/camera.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* camera.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaitsgo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/08 10:46:45 by dgaitsgo #+# #+# */
/* Updated: 2017/03/08 10:46:52 by dgaitsgo ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef __CAMERA_H
# define __CAMERA_H

# include "vector.h"
# include "transform.h"
# include "window.h"
# include "film.h"
# include "matrix.h"

typedef struct
{
int flags;
int visualize_bboxes;
t_transform transformation;
t_matrix view_matrix;
t_matrix inverse_view_matrix;
t_vector origin;
t_vector direction;
t_vector eye;
t_vector up;
t_vector right;
double fov;
double half_width;
double half_height;
double pixel_width;
double pixel_height;
int sh_grain;
int anti_aliasing;
t_film film;
} t_camera;

void default_camera(t_camera *camera);
void initialize_camera(t_camera *camera, t_window *window);
void apply_camera_transform(t_camera *camera,
t_transform transf);
#endif
Loading

0 comments on commit 057c541

Please sign in to comment.