#include "matrices.h"
Go to the source code of this file.
Data Structures | |
struct | s_checker |
This structure encapsulates the function uv_checkers(). More... | |
struct | s_uv_image |
The struct of type t_uv_image represents an image used for texturing another image. More... | |
struct | s_text_map |
This structure creates a t_pattern subclass (the same as t_pttr_at, which calls stripe_at() or checkered_at()). t_text_map is a subclass that uses spherical_map(), planar_map() or cylindrical_map() to define how to apply a pattern on a given 2D or 3D shape's surface. More... | |
struct | s_pattern |
The type t_pattern contatins all the necessary information to apply a texture on a given shape's surface. More... | |
Typedefs | |
typedef struct s_pattern | t_pattern |
The type t_pattern contatins all the necessary information to apply a texture on a given shape's surface. More... | |
typedef struct s_checker | t_checker |
This structure encapsulates the function uv_checkers(). More... | |
typedef t_color(* | t_pttr_at) (t_pattern pattern, t_point world_point) |
t_pttr_at is a function-type that receives the function's name of a pattern to be applied. For example, to apply a checkered pattern, the t_pttr_at is "checkered_at", which is the function that computes a checkered pattern on a given shape. To apply a striped pattern, use stripe_at instead. | |
typedef t_checker(* | t_uv_map) (t_point point) |
typedef struct s_uv_image | t_uv_image |
The struct of type t_uv_image represents an image used for texturing another image. More... | |
typedef struct s_text_map | t_text_map |
This structure creates a t_pattern subclass (the same as t_pttr_at, which calls stripe_at() or checkered_at()). t_text_map is a subclass that uses spherical_map(), planar_map() or cylindrical_map() to define how to apply a pattern on a given 2D or 3D shape's surface. More... | |
Functions | |
t_pattern | new_pattern (t_color a, t_color b) |
This function creates a new default pattern with the following properties: it has a stripe pattern and it receives the color passed as parameter to the function. More... | |
t_color | stripe_at (t_pattern pattern, t_point world_point) |
This function applies a stripe pattern on shape's surface located at a given world point. It checks which pattern color should or not be applied at a specific point of the world. More... | |
t_color | checkered_at (t_pattern pattern, t_point world_point) |
This function applies a checkered pattern on shape's surface located at a given world point. It checks which pattern color should or not be applied at a specific point of the world. More... | |
t_color | bumped_at (t_pattern pattern, t_point point) |
Calculates the color of a bumped pattern applied to a shape's surface at a given point. More... | |
void | set_pattern_transform (t_pattern *pattern, t_matrix transform) |
This function assigns a transformation matrix to a pattern, which is used to manipulate the way the pattern is rendered. More... | |
t_checker | uv_checkers (double width, double height, t_color a, t_color b) |
This function creates a checker structure to be used by pattern functions. More... | |
t_color | uv_pattern_at (t_checker checkers, double u, double v) |
This function gets the pattern's color and at the given width (v) and height (v) coordinates stored at the structure t_checker. More... | |
void | texture_map (t_pattern *pattern, t_checker checkers, t_uv_map uv_map) |
This function saves t_checker struct to t_pattern struct. It sends information to t_pattern about how to apply a given pattern (uv_map) and what is the pattern to be applied (checkers). More... | |
t_checker | spherical_map (t_point point) |
This function renders a 3D point of a sphere on its surface to a 2D point (u, v) on the flattered surface. More... | |
t_checker | cylindrical_map (t_point point) |
This function renders a 3D point of a cylinder on its surface to a 2D point (u, v) on the flattered surface. More... | |
t_checker | planar_map (t_point point) |
This function renders a 3D point of a plane on its surface to a 2D point (u, v) on the flattered surface. More... | |
This structure encapsulates the function uv_checkers().
width | Describes how many squares the pattern creates in u, that is, in the vertical axis. |
height | Describes how many squares the pattern creates in v, that is, in the horizontal axis. |
color_a | Describes the first color of the square to be applied. |
color_a | Describes the second color of the square to be applied. |
The type t_pattern contatins all the necessary information to apply a texture on a given shape's surface.
has_pattern | Stores TRUE if shape has a pattern or FALSE, if not. |
pattern_at | Receives a pattern function to apply the corresponding pattern. For more information, see t_pttr_at description. |
texture_map | This structure creates a t_pattern subclass (the same as t_pttr_at, which calls stripe_at() or checkered_at()). t_text_map is a subclass that uses spherical_map(), planar_map() or cylindrical_map() to define how to apply a pattern on a given 2D or 3D shape's surface. |
width | Receives u, the horizontal value of checkers squares. |
height | Receives v, the vertical value of checkers squares. |
a | Receives the first color of a given pattern to be applied. |
b | Receives the second color of a given pattern to be applied. |
transform | Stores matrix transformation so that pattern be manipulated. |
typedef struct s_text_map t_text_map |
This structure creates a t_pattern subclass (the same as t_pttr_at, which calls stripe_at() or checkered_at()). t_text_map is a subclass that uses spherical_map(), planar_map() or cylindrical_map() to define how to apply a pattern on a given 2D or 3D shape's surface.
uv_pattern | Contains information about the pattern to applied on a given shape's surface. |
uv_map | Contains the corresponding shape's function that will correctly apply the texture on its surface. For example, if the shape is a plane, this field must be planar_map. If it's a cylinder, it must be cylindrical_map and if it's a sphere, it must be spherical_map. |
typedef struct s_uv_image t_uv_image |
The struct of type t_uv_image represents an image used for texturing another image.
The t_uv_image structure contains the necessary fields for storing image data and relevant information used for texturing operations. It is used to define an image that can be applied as a texture on another image or rendered onto a canvas.
mlx_ptr | A pointer to a connection with the Xserver. |
win_ptr | A pointer to a window created with MLX (MinilibX). |
img_ptr | A pointer to an image created with MLX (MinilibX). |
addr | A pointer to the image data, indicating how to write data on pixels of the image. |
bpp | The bits per pixel value of the image. |
line_len | The line length value of the image. |
endian | The endianness order of the image. |
width | The width of the image in pixels. |
height | The height of the image in pixels. |
Calculates the color of a bumped pattern applied to a shape's surface at a given point.
A bumped pattern is a pattern that adds a sense of depth or texture to a surface. This function applies a bumped pattern on the surface of a shape at the specified point. It determines the color of the pattern at that point based on the pattern and the position of the point.
pattern | A structure of type t_pattern that stores the bumped pattern to be applied. |
point | A structure of type t_point representing the point on the shape's surface. |
This function applies a checkered pattern on shape's surface located at a given world point. It checks which pattern color should or not be applied at a specific point of the world.
pattern | Stores the pattern to be applied. |
world_point | Contains the world's point to be evaluated. |
This function renders a 3D point of a cylinder on its surface to a 2D point (u, v) on the flattered surface.
point | Specifies the point to be converted. |
This function creates a new default pattern with the following properties: it has a stripe pattern and it receives the color passed as parameter to the function.
a | Receives the first color of a given pattern to be applied. |
b | Receives the second color of a given pattern to be applied. |
This function renders a 3D point of a plane on its surface to a 2D point (u, v) on the flattered surface.
point | Specifies the point to be converted. |
This function assigns a transformation matrix to a pattern, which is used to manipulate the way the pattern is rendered.
pattern | Receives the pattern structure to alter transform's field. |
transform | Receives the matrix transformation to be assigned. |
This function renders a 3D point of a sphere on its surface to a 2D point (u, v) on the flattered surface.
point | Specifies the point to be converted. |
This function applies a stripe pattern on shape's surface located at a given world point. It checks which pattern color should or not be applied at a specific point of the world.
pattern | Stores the pattern to be applied. |
world_point | Contains the world's point to be evaluated. |
This function saves t_checker struct to t_pattern struct. It sends information to t_pattern about how to apply a given pattern (uv_map) and what is the pattern to be applied (checkers).
pattern | Stores the pattern to be applied. |
checkers | Contains the how many squares in x and y axes there are and which colors are to be applied on a surface. |
uv_map | Contains the corresponding shape's function that will correctly apply the texture on its surface. For example, if the shape is a plane, this field must be planar_map. If it's a cylinder, it must be cylindrical_map and if it's a sphere, it must be spherical_map. |
This function creates a checker structure to be used by pattern functions.
width | Describes how many squares the pattern creates in u, that is, in the vertical axis. |
height | Describes how many squares the pattern creates in v, that is, in the horizontal axis. |
a | Describes the first color of the square to be applied. |
b | Describes the second color of the square to be applied. |
This function gets the pattern's color and at the given width (v) and height (v) coordinates stored at the structure t_checker.
checkers | Contains the how many squares in x and y axes there are and which colors are to be applied on a surface. |
u | This parameter specifies the x location. |
v | This parameter specifies the y location. |