miniRT
By Marcelo Magalhães and Ygor G. Sena, 2023.
lights.h File Reference
#include "tuples.h"
#include "helpers.h"
#include "libft.h"
Include dependency graph for lights.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  s_light
 The struct s_light represents a light's source. This source has a position in space and an intensity color, i.e., red, purple etc. More...
 
struct  s_sight
 The struct s_sight represents the human eye looking forwards. More...
 

Typedefs

typedef struct s_light t_light
 The struct s_light represents a light's source. This source has a position in space and an intensity color, i.e., red, purple etc. More...
 
typedef struct s_sight t_sight
 The struct s_sight represents the human eye looking forwards. More...
 

Functions

t_light point_light (t_point position, t_color intensity)
 The function point_light() instances a light's source of type t_light with a given position in space and a light color intensity. More...
 

Typedef Documentation

◆ t_light

typedef struct s_light t_light

The struct s_light represents a light's source. This source has a position in space and an intensity color, i.e., red, purple etc.

ABOUT THE HEADER LIGHTS.H

The light algorithm implemented on this project is called The Phong Reflection Model, named by its creator Bui Tuong Phong. It simulates the interaction between three light sources. They are: ambient reflection, diffuse reflection and specular reflection. In other words, respectively, background light, the light reflected from a matte surface and the reflection of the source light itself. The last one, depends only on the angle between the reflection vector and the eye vector and is controlled by a parameter that's called shininess. The higher the shininess, the smaller and tigher the specular highlight is.

Parameters
positionStores the point light's position.
intensityStores the information about how bright a point light is.
in_shadowStores TRUE or FALSE whether the light is being shadowed or not.

◆ t_sight

typedef struct s_sight t_sight

The struct s_sight represents the human eye looking forwards.

For the Phong Reflection Model algorithm, this human sight has an eye vision, which is the direction where the eyes are looking at and it also has a normal vision, i.e., the perpendicular vector from where the eye vision is looking at.

Parameters
eyevRepresents the eye's vector looking at something.
normalvRepresents the normal vector of some surface.

Function Documentation

◆ point_light()

t_light point_light ( t_point  position,
t_color  intensity 
)

The function point_light() instances a light's source of type t_light with a given position in space and a light color intensity.

Parameters
positionA struct of type t_tuple storing the light's source location in space.
intensityA struct of type t_color containing the light's source color intensity.
Returns
Returns a light's source with a given location in space and a color intensity in RGB values.