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

Go to the source code of this file.

Data Structures

struct  s_material
 A material has a surface color and four attributes from the Phong Reflection Model: ambient, diffuse, specular and shininess. Each one of these attributes accept a non negative floating point number. For ambient, diffuse and specular, the typical values are between 0 and 1. For shininess, values between 10 (very large highlight) and 200 (very small) highlight seem to work best, though there is no actual upper bound. More...
 
struct  s_exposure
 The struct s_exposure contains the necessary fields to calculate the a scene's lighting. Exposure is a technical term from photography that means exposition to light. More...
 

Typedefs

typedef struct s_material t_material
 A material has a surface color and four attributes from the Phong Reflection Model: ambient, diffuse, specular and shininess. Each one of these attributes accept a non negative floating point number. For ambient, diffuse and specular, the typical values are between 0 and 1. For shininess, values between 10 (very large highlight) and 200 (very small) highlight seem to work best, though there is no actual upper bound. More...
 
typedef struct s_exposure t_exposure
 The struct s_exposure contains the necessary fields to calculate the a scene's lighting. Exposure is a technical term from photography that means exposition to light. More...
 

Functions

t_material material (void)
 The function material() instances a new material of struct type t_material with the following default values: color = {1, 1, 1}, ambient = {0.1, 0.1, 0.1}, diffuse = 0.9, specular = 0.9 and shininess = 200. Thus, as default no pattern is applied. More...
 

Typedef Documentation

◆ t_exposure

typedef struct s_exposure t_exposure

The struct s_exposure contains the necessary fields to calculate the a scene's lighting. Exposure is a technical term from photography that means exposition to light.

Parameters
effective_colorCombines the surface colo with light's color/ intensity.
lightvFinds the direction to the light source.
reflectvFinds the direction to the light reflection.
light_dot_normalRepresents the cosine of the angle between the light vector and the normal vector. A negative number means the light is on the other side of the surface.
reflect_dot_eyeRepresents the cosine of the angle between the reflection vector and the eye vector. A negative number means the light reflects away from the eye.
factorComputes the specular contribution.

◆ t_material

typedef struct s_material t_material

A material has a surface color and four attributes from the Phong Reflection Model: ambient, diffuse, specular and shininess. Each one of these attributes accept a non negative floating point number. For ambient, diffuse and specular, the typical values are between 0 and 1. For shininess, values between 10 (very large highlight) and 200 (very small) highlight seem to work best, though there is no actual upper bound.

Parameters
colorStores the material's color in RGB values.
ambientRepresents the background lighting or the light reflected from other objects in the enviroment.
diffuseRepresents the light reflected from a matted surface. It depends only on the angle between the light source and surface normal.
specularRepresents the reflection of the light source itself and results in the bright sport on a curved surface. It depends on the angle between the reflection vector and the eye vector. Thus, it's also controlled by the parameter shininess.
shininessRepresents the shininess. The higher the shininess, the smaller and tigher the specular highlight.
patternRepresents the pattern texture of a given material. It can be a striped or a checkered pattern.

Function Documentation

◆ material()

t_material material ( void  )

The function material() instances a new material of struct type t_material with the following default values: color = {1, 1, 1}, ambient = {0.1, 0.1, 0.1}, diffuse = 0.9, specular = 0.9 and shininess = 200. Thus, as default no pattern is applied.

Returns
Returns a default instance of the new material.