update format
This commit is contained in:
+3
-21
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 20:15:13 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/13 20:15:46 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/13 21:08:51 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -36,24 +36,6 @@ float vec3_dot(t_vec3 a, t_vec3 b)
|
||||
|
||||
t_vec3 vec3_cross(t_vec3 a, t_vec3 b)
|
||||
{
|
||||
return ((t_vec3){a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y
|
||||
- a.y * b.x});
|
||||
}
|
||||
|
||||
float vec3_length(t_vec3 a)
|
||||
{
|
||||
return (sqrtf(vec3_dot(a, a)));
|
||||
}
|
||||
|
||||
t_vec3 vec3_normalize(t_vec3 a)
|
||||
{
|
||||
float len;
|
||||
|
||||
len = vec3_length(a);
|
||||
return ((len > 0) ? vec3_scale(a, 1.0f / len) : a);
|
||||
}
|
||||
|
||||
t_vec3 vec3_mul(t_vec3 a, t_vec3 b)
|
||||
{
|
||||
return ((t_vec3){a.x * b.x, a.y * b.y, a.z * b.z});
|
||||
return ((t_vec3){a.y * b.z - a.z * b.y, \
|
||||
a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* calcul_de_vecteur2.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 20:59:38 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/13 21:08:27 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
float vec3_length(t_vec3 a)
|
||||
{
|
||||
return (sqrtf(vec3_dot(a, a)));
|
||||
}
|
||||
|
||||
t_vec3 vec3_normalize(t_vec3 a)
|
||||
{
|
||||
float len;
|
||||
|
||||
len = vec3_length(a);
|
||||
if (len > 0)
|
||||
return (vec3_scale(a, 1.0f / len));
|
||||
return (a);
|
||||
}
|
||||
|
||||
t_vec3 vec3_mul(t_vec3 a, t_vec3 b)
|
||||
{
|
||||
return ((t_vec3){a.x * b.x, a.y * b.y, a.z * b.z});
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 20:02:36 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/13 20:16:50 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/13 21:24:29 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -39,28 +39,28 @@ typedef struct s_vec3
|
||||
} t_vec3;
|
||||
|
||||
// ----- Ray -----
|
||||
typedef struct s_vec3
|
||||
typedef struct s_ray
|
||||
{
|
||||
t_vec3 origin;
|
||||
t_vec3 dir;
|
||||
} t_ray;
|
||||
|
||||
// ----- Objets de la scène -----
|
||||
typedef struct s_vec3
|
||||
typedef struct s_sphere
|
||||
{
|
||||
t_vec3 center;
|
||||
float radius;
|
||||
t_vec3 color;
|
||||
} t_sphere;
|
||||
|
||||
typedef struct s_vec3
|
||||
typedef struct s_plane
|
||||
{
|
||||
t_vec3 point;
|
||||
t_vec3 normal;
|
||||
t_vec3 color;
|
||||
} t_plane;
|
||||
|
||||
typedef struct s_vec3
|
||||
typedef struct s_cylinder
|
||||
{
|
||||
t_vec3 center;
|
||||
t_vec3 axis; // Axe normalisé
|
||||
@@ -69,13 +69,24 @@ typedef struct s_vec3
|
||||
t_vec3 color;
|
||||
} t_cylinder;
|
||||
|
||||
typedef struct s_vec3
|
||||
typedef struct s_light
|
||||
{
|
||||
t_vec3 pos;
|
||||
float brightness;
|
||||
t_vec3 color;
|
||||
} t_light;
|
||||
|
||||
typedef struct s_scene
|
||||
{
|
||||
t_sphere spheres[MAX_SPHERES];
|
||||
t_plane planes[MAX_PLANES];
|
||||
t_cylinder cylinders[MAX_CYLINDERS];
|
||||
t_light lights[MAX_LIGHTS];
|
||||
int numSpheres;
|
||||
int numPlanes;
|
||||
int numCylinders;
|
||||
int numLights;
|
||||
} t_scene;
|
||||
|
||||
// Calcul de vecteur
|
||||
t_vec3 vec3_add(t_vec3 a, t_vec3 b);
|
||||
@@ -86,4 +97,5 @@ t_vec3 vec3_cross(t_vec3 a, t_vec3 b);
|
||||
float vec3_length(t_vec3 a);
|
||||
t_vec3 vec3_normalize(t_vec3 a);
|
||||
t_vec3 vec3_mul(t_vec3 a, t_vec3 b);
|
||||
t_scene create_scene(void);
|
||||
#endif
|
||||
|
||||
+1
-12
@@ -6,7 +6,7 @@
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 19:56:17 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/13 20:16:00 by yantoine ### ########.fr */
|
||||
/* Updated: 2025/02/13 21:23:47 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -21,17 +21,6 @@
|
||||
*Si aucun fichier n'est passé en argument, une scène par défaut est utilisée.
|
||||
*/
|
||||
|
||||
Sphere spheres[MAX_SPHERES];
|
||||
int numSpheres = 0;
|
||||
|
||||
Plane planes[MAX_PLANES];
|
||||
int numPlanes = 0;
|
||||
|
||||
Cylinder cylinders[MAX_CYLINDERS];
|
||||
int numCylinders = 0;
|
||||
|
||||
Light lights[MAX_LIGHTS];
|
||||
int numLights = 0;
|
||||
|
||||
// Ambient et caméra
|
||||
float ambient_ratio = 0.1f;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* scene.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: yantoine <yantoine@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 21:23:32 by yantoine #+# #+# */
|
||||
/* Updated: 2025/02/13 21:26:52 by yantoine ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "miniRT.h"
|
||||
|
||||
t_scene create_scene(void)
|
||||
{
|
||||
t_scene scene;
|
||||
|
||||
scene = ft_bzero(sizeof(t_scene));
|
||||
return (scene);
|
||||
}
|
||||
@@ -35,14 +35,23 @@
|
||||
!_TAG_KIND_DESCRIPTION!C++ t,typedef /typedefs/
|
||||
!_TAG_KIND_DESCRIPTION!C++ u,union /union names/
|
||||
!_TAG_KIND_DESCRIPTION!C++ v,variable /variable definitions/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown S,subsection /level 2 sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown T,l4subsection /level 4 sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown c,chapter /chapters/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown h,hashtag /hashtags/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown n,footnote /footnotes/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown s,section /sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown t,subsubsection /level 3 sections/
|
||||
!_TAG_KIND_DESCRIPTION!Markdown u,l5subsection /level 5 sections/
|
||||
!_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/
|
||||
!_TAG_OUTPUT_FILESEP slash /slash or backslash/
|
||||
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
|
||||
!_TAG_OUTPUT_VERSION 0.0 /current.age/
|
||||
!_TAG_PARSER_VERSION!C 1.1 /current.age/
|
||||
!_TAG_PARSER_VERSION!C++ 1.1 /current.age/
|
||||
!_TAG_PARSER_VERSION!Markdown 1.1 /current.age/
|
||||
!_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/
|
||||
!_TAG_PROC_CWD /home/null/Documents/final/new_better_ray/ //
|
||||
!_TAG_PROC_CWD /home/null/Documents/better_ray_tracer/ //
|
||||
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
|
||||
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
|
||||
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
|
||||
@@ -69,50 +78,63 @@ MINIRT_H miniRT.h /^# define MINIRT_H$/;" d
|
||||
WIDTH miniRT.h /^# define WIDTH /;" d
|
||||
ambient_color raytracer_formatted.c /^t_vec3 ambient_color = {0.1f, 0.1f, 0.1f};$/;" v typeref:typename:t_vec3
|
||||
ambient_ratio raytracer_formatted.c /^float ambient_ratio = 0.1f;$/;" v typeref:typename:float
|
||||
axis miniRT.h /^ t_vec3 axis;\/\/ Axe normalisé$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
brightness miniRT.h /^ float brightness;$/;" m struct:s_vec3 typeref:typename:float
|
||||
axis miniRT.h /^ t_vec3 axis; \/\/ Axe normalisé$/;" m struct:s_cylinder typeref:typename:t_vec3
|
||||
better_ray_tracer README.md /^# better_ray_tracer/;" c
|
||||
brightness miniRT.h /^ float brightness;$/;" m struct:s_light typeref:typename:float
|
||||
camDir raytracer_formatted.c /^t_vec3 camDir = {0.0f, 0.0f, -1.0f};$/;" v typeref:typename:t_vec3
|
||||
camPos raytracer_formatted.c /^t_vec3 camPos = {0.0f, 0.0f, 0.0f};$/;" v typeref:typename:t_vec3
|
||||
center miniRT.h /^ t_vec3 center;$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
cylinders raytracer_formatted.c /^Cylinder cylinders[MAX_CYLINDERS];$/;" v typeref:typename:Cylinder[]
|
||||
dir miniRT.h /^ t_vec3 dir;$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
center miniRT.h /^ t_vec3 center;$/;" m struct:s_cylinder typeref:typename:t_vec3
|
||||
center miniRT.h /^ t_vec3 center;$/;" m struct:s_sphere typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_cylinder typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_light typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_plane typeref:typename:t_vec3
|
||||
color miniRT.h /^ t_vec3 color;$/;" m struct:s_sphere typeref:typename:t_vec3
|
||||
create_scene scene.c /^t_scene create_scene(void)$/;" f typeref:typename:t_scene
|
||||
cylinders miniRT.h /^ t_cylinder cylinders[MAX_CYLINDERS];$/;" m struct:s_scene typeref:typename:t_cylinder[]
|
||||
dir miniRT.h /^ t_vec3 dir;$/;" m struct:s_ray typeref:typename:t_vec3
|
||||
fov raytracer_formatted.c /^float fov = 90.0f;$/;" v typeref:typename:float
|
||||
height miniRT.h /^ float height;$/;" m struct:s_vec3 typeref:typename:float
|
||||
height miniRT.h /^ float height;$/;" m struct:s_cylinder typeref:typename:float
|
||||
intersectCylinder raytracer_formatted.c /^float intersectCylinder(Ray ray, Cylinder cy, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
intersectPlane raytracer_formatted.c /^float intersectPlane(Ray ray, Plane p, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
intersectSphere raytracer_formatted.c /^float intersectSphere(Ray ray, Sphere s, t_vec3 *hitNormal)$/;" f typeref:typename:float
|
||||
isInShadow raytracer_formatted.c /^bool isInShadow(t_vec3 hitPoint, t_vec3 lightPos)$/;" f typeref:typename:bool
|
||||
lights raytracer_formatted.c /^Light lights[MAX_LIGHTS];$/;" v typeref:typename:Light[]
|
||||
lights miniRT.h /^ t_light lights[MAX_LIGHTS];$/;" m struct:s_scene typeref:typename:t_light[]
|
||||
load_config raytracer_formatted.c /^void load_config(const char *filename)$/;" f typeref:typename:void
|
||||
main raytracer_formatted.c /^int main(int argc, char *argv[])$/;" f typeref:typename:int
|
||||
normal miniRT.h /^ t_vec3 normal;$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
numCylinders raytracer_formatted.c /^int numCylinders = 0;$/;" v typeref:typename:int
|
||||
numLights raytracer_formatted.c /^int numLights = 0;$/;" v typeref:typename:int
|
||||
numPlanes raytracer_formatted.c /^int numPlanes = 0;$/;" v typeref:typename:int
|
||||
numSpheres raytracer_formatted.c /^int numSpheres = 0;$/;" v typeref:typename:int
|
||||
origin miniRT.h /^ t_vec3 origin;$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
normal miniRT.h /^ t_vec3 normal;$/;" m struct:s_plane typeref:typename:t_vec3
|
||||
numCylinders miniRT.h /^ int numCylinders;$/;" m struct:s_scene typeref:typename:int
|
||||
numLights miniRT.h /^ int numLights;$/;" m struct:s_scene typeref:typename:int
|
||||
numPlanes miniRT.h /^ int numPlanes;$/;" m struct:s_scene typeref:typename:int
|
||||
numSpheres miniRT.h /^ int numSpheres;$/;" m struct:s_scene typeref:typename:int
|
||||
origin miniRT.h /^ t_vec3 origin;$/;" m struct:s_ray typeref:typename:t_vec3
|
||||
pitch raytracer_formatted.c /^float yaw = 0.0f, pitch = 0.0f; \/\/ en radians$/;" v typeref:typename:float
|
||||
planes raytracer_formatted.c /^Plane planes[MAX_PLANES];$/;" v typeref:typename:Plane[]
|
||||
point miniRT.h /^ t_vec3 point;$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
pos miniRT.h /^ t_vec3 pos;$/;" m struct:s_vec3 typeref:typename:t_vec3
|
||||
radius miniRT.h /^ float radius;$/;" m struct:s_vec3 typeref:typename:float
|
||||
radius miniRT.h /^ float radius;\/\/ Demi-diamètre$/;" m struct:s_vec3 typeref:typename:float
|
||||
planes miniRT.h /^ t_plane planes[MAX_PLANES];$/;" m struct:s_scene typeref:typename:t_plane[]
|
||||
point miniRT.h /^ t_vec3 point;$/;" m struct:s_plane typeref:typename:t_vec3
|
||||
pos miniRT.h /^ t_vec3 pos;$/;" m struct:s_light typeref:typename:t_vec3
|
||||
radius miniRT.h /^ float radius;$/;" m struct:s_sphere typeref:typename:float
|
||||
radius miniRT.h /^ float radius; \/\/ Demi-diamètre$/;" m struct:s_cylinder typeref:typename:float
|
||||
s_cylinder miniRT.h /^typedef struct s_cylinder$/;" s
|
||||
s_light miniRT.h /^typedef struct s_light$/;" s
|
||||
s_plane miniRT.h /^typedef struct s_plane$/;" s
|
||||
s_ray miniRT.h /^typedef struct s_ray$/;" s
|
||||
s_scene miniRT.h /^typedef struct s_scene$/;" s
|
||||
s_sphere miniRT.h /^typedef struct s_sphere$/;" s
|
||||
s_vec3 miniRT.h /^typedef struct s_vec3$/;" s
|
||||
spheres raytracer_formatted.c /^Sphere spheres[MAX_SPHERES];$/;" v typeref:typename:Sphere[]
|
||||
t_cylinder miniRT.h /^} t_cylinder;$/;" t typeref:struct:s_vec3
|
||||
t_light miniRT.h /^} t_light;$/;" t typeref:struct:s_vec3
|
||||
t_plane miniRT.h /^} t_plane;$/;" t typeref:struct:s_vec3
|
||||
t_ray miniRT.h /^} t_ray;$/;" t typeref:struct:s_vec3
|
||||
t_sphere miniRT.h /^} t_sphere;$/;" t typeref:struct:s_vec3
|
||||
spheres miniRT.h /^ t_sphere spheres[MAX_SPHERES];$/;" m struct:s_scene typeref:typename:t_sphere[]
|
||||
t_cylinder miniRT.h /^} t_cylinder;$/;" t typeref:struct:s_cylinder
|
||||
t_light miniRT.h /^} t_light;$/;" t typeref:struct:s_light
|
||||
t_plane miniRT.h /^} t_plane;$/;" t typeref:struct:s_plane
|
||||
t_ray miniRT.h /^} t_ray;$/;" t typeref:struct:s_ray
|
||||
t_scene miniRT.h /^} t_scene;$/;" t typeref:struct:s_scene
|
||||
t_sphere miniRT.h /^} t_sphere;$/;" t typeref:struct:s_sphere
|
||||
t_vec3 miniRT.h /^} t_vec3;$/;" t typeref:struct:s_vec3
|
||||
trace raytracer_formatted.c /^t_vec3 trace(Ray ray)$/;" f typeref:typename:t_vec3
|
||||
vec3_add calcul_de_vecteur.c /^t_vec3 vec3_add(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
vec3_cross calcul_de_vecteur.c /^t_vec3 vec3_cross(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
vec3_dot calcul_de_vecteur.c /^float vec3_dot(t_vec3 a, t_vec3 b)$/;" f typeref:typename:float
|
||||
vec3_length calcul_de_vecteur.c /^float vec3_length(t_vec3 a)$/;" f typeref:typename:float
|
||||
vec3_mul calcul_de_vecteur.c /^t_vec3 vec3_mul(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
vec3_normalize calcul_de_vecteur.c /^t_vec3 vec3_normalize(t_vec3 a)$/;" f typeref:typename:t_vec3
|
||||
vec3_length calcul_de_vecteur2.c /^float vec3_length(t_vec3 a)$/;" f typeref:typename:float
|
||||
vec3_mul calcul_de_vecteur2.c /^t_vec3 vec3_mul(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
vec3_normalize calcul_de_vecteur2.c /^t_vec3 vec3_normalize(t_vec3 a)$/;" f typeref:typename:t_vec3
|
||||
vec3_scale calcul_de_vecteur.c /^t_vec3 vec3_scale(t_vec3 a, float s)$/;" f typeref:typename:t_vec3
|
||||
vec3_sub calcul_de_vecteur.c /^t_vec3 vec3_sub(t_vec3 a, t_vec3 b)$/;" f typeref:typename:t_vec3
|
||||
x miniRT.h /^ float x;$/;" m struct:s_vec3 typeref:typename:float
|
||||
|
||||
Reference in New Issue
Block a user