#include "lights.h"
#include "patterns.h"
Go to the source code of this file.
|
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...
|
|
|
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...
|
|
|
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...
|
|
◆ 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_color | Combines the surface colo with light's color/ intensity. |
lightv | Finds the direction to the light source. |
reflectv | Finds the direction to the light reflection. |
light_dot_normal | Represents 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_eye | Represents the cosine of the angle between the reflection vector and the eye vector. A negative number means the light reflects away from the eye. |
factor | Computes the specular contribution. |
◆ 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
-
color | Stores the material's color in RGB values. |
ambient | Represents the background lighting or the light reflected from other objects in the enviroment. |
diffuse | Represents the light reflected from a matted surface. It depends only on the angle between the light source and surface normal. |
specular | Represents 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. |
shininess | Represents the shininess. The higher the shininess, the smaller and tigher the specular highlight. |
pattern | Represents the pattern texture of a given material. It can be a striped or a checkered pattern. |
◆ material()
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.