25 # define ERROR_UNEXPECTED_ELEMENT "Unexpected element"
26 # define ERROR_EXPECTED_NUMBER "Expected a number"
27 # define ERROR_EXPECTED_NEWLINE "Expected newline"
28 # define ERROR_EXPECTED_COMMA "Expected a comma"
30 # define INVALID_NUMBER "Invalid number"
31 # define INVALID_VECTOR "Vector components must be between -1 and 1.\n"
32 # define INVALID_COLOR "Color values must be between 0 and 255.\n"
33 # define INVALID_LIGHT "Light ratio must be between 0 and 1.\n"
34 # define INVALID_FOV "Field of view must be between 0 and 180.\n"
35 # define INVALID_DIMENSION "Dimensions should be positive.\n"
36 # define INVALID_FILE "Invalid texture file"
37 # define NON_NORMALIZED "Vector should be normalized"
39 # define ERROR_CAMERA "Only one camera allowed.\n"
40 # define ERROR_AMBIENT "Only one ambient light allowed.\n"
void save_position(t_scanner *scanner)
Saves the current position of the scanner for later restoration and synchronization with the parser.
Definition: scanner_utils.c:32
void sync_position(t_scanner *scanner)
Synchronizes the scanner with the parser by restoring its position to a previously saved position.
Definition: scanner_utils.c:38
t_bool parse_cone(t_scanner *scanner, t_scene *scene)
Convert a cone from the input and add it to the scene.
Definition: parse_shapes_2.c:69
t_bool parse_light(t_scanner *scanner, t_scene *scene)
Convert light point from input and add to scene.
Definition: parse_ambient.c:49
t_bool parse_dimension(t_scanner *scanner, double *dimension)
Convert dimension from input and store it in dimension.
Definition: parse_basic.c:47
void set_error_state(t_scanner *scanner, const char *error_message)
Determine the error message based on the state of the scanner.
Definition: parse_utils.c:36
t_bool parse(char *filename, t_scene *scene)
Parse.
Definition: parse.c:27
t_bool parse_color(t_scanner *scanner, t_color *result)
Parse grouped.
Definition: parse_grouped.c:18
t_bool parse_position(t_scanner *scanner, t_point *position)
Convert a position from the input and store it in position.
Definition: parse_grouped.c:29
t_bool scan_integer(t_scanner *scanner)
Identify if input character sequence forms an integer.
Definition: scanner.c:27
void add_light_to_world(t_light *light, t_world *world)
Add a light source to the world.
Definition: parse_element.c:60
t_bool check_extension(const char *filename, const char *extension)
Check if a filename has a specified extension.
Definition: parse.c:74
t_bool parse_element(t_scanner *scanner, t_scene *scene, int totals[])
Parse element.
Definition: parse_element.c:17
void skip_whitespace(t_scanner *scanner)
Skip all encountered whitespace characters.
Definition: scanner_utils.c:20
t_bool parse_camera(t_scanner *scanner, t_scene *scene)
Convert camera from input and add to scene.
Definition: parse_ambient.c:30
void add_object_to_world(t_shape *shape, t_world *world)
Add a shape to the world.
Definition: parse_element.c:53
t_bool parse_field_of_view(t_scanner *scanner, int *fov)
Convert field of view from input and store it in fov.
Definition: parse_basic.c:36
void advance(t_scanner *scanner)
Scanner utils.
Definition: scanner_utils.c:15
int get_error_column(t_scanner *scanner)
Get the column where an error occurred.
Definition: parse_utils.c:57
t_bool parse_pattern(t_scanner *scanner, t_shape *shape)
Parse a pattern from the input and assign it to a shape.
Definition: parse_pattern.c:22
int is_sign(int c)
Check if character is a sign.
Definition: scanner_utils.c:27
t_bool parse_direction(t_scanner *scanner, t_vector *direction)
Convert a direction from the input and store it in direction.
Definition: parse_grouped.c:41
t_bool scan_double(t_scanner *scanner)
Identify if input character sequence forms a double number.
Definition: scanner.c:42
t_bool scan_newline(t_scanner *scanner)
Verify presence of a newline in the input.
Definition: scanner.c:67
void init_scanner(t_scanner *scanner, const char *source)
Scanner.
Definition: scanner.c:15
t_token parse_type(t_scanner *scanner)
Parse types.
Definition: parse_types.c:18
struct s_scanner t_scanner
Represents a scanner.
t_bool parse_light_ratio(t_scanner *scanner, double *light)
Parse the light ratio from the input.
Definition: parse_basic.c:25
t_bool parse_ambient_light(t_scanner *scanner, t_scene *scene)
Parse ambient.
Definition: parse_ambient.c:17
t_bool parse_sphere(t_scanner *scanner, t_scene *scene)
Parse shapes.
Definition: parse_shapes_1.c:15
t_bool parse_texture(t_scanner *scanner, t_shape *shape)
Parse textures.
Definition: parse_textures.c:19
t_bool scan_comma(t_scanner *scanner)
Verify presence of a comma in the input.
Definition: scanner.c:55
t_bool parse_double(t_scanner *scanner, double *result)
Parse basic.
Definition: parse_basic.c:15
t_bool parse_cylinder(t_scanner *scanner, t_scene *scene)
Convert a cylinder from the input and add it to the scene.
Definition: parse_shapes_2.c:29
t_bool report_error(t_scanner *scanner)
Parse utils.
Definition: parse_utils.c:21
t_bool parse_plane(t_scanner *scanner, t_scene *scene)
Convert a plane from the input and add it to the scene.
Definition: parse_shapes_1.c:38
t_bool validate_range(double value, double start, double end)
Validate if a number is within a certain range.
Definition: parse_utils.c:50
t_bool parse_comment(t_scanner *scanner)
Parse comments.
Definition: parse_element.c:44
t_point position(t_ray ray, float distance)
The function position() finds the position of a given ray and a given time or distance....
Definition: rays.c:22
The struct s_color stores the color values of ray tracing. It contains a field for red,...
Definition: tuples.h:63
The struct s_light represents a light's source. This source has a position in space and an intensity ...
Definition: lights.h:44
Represents a scanner.
Definition: parser.h:76
The structure t_scene is how the user sees the ray tracing rendering. There is a camera from which th...
Definition: canvas.h:75
Tuple means a list of ordered things. The struct t_tuple stores coordinates for a left-handed coordin...
Definition: tuples.h:33
This struct contains everything related to the building of a ray tracing's world. The world has objec...
Definition: world.h:37
Represents a shape in a scene.