scimesh 0.3.2
Headless CPU-only 3D software renderer for scientific mesh visualization
Loading...
Searching...
No Matches
scimesh::Light Struct Reference

A light source for the Blinn-Phong shading model. More...

#include <types.h>

Collaboration diagram for scimesh::Light:

Public Attributes

Vec3 position = Vec3(0.0f, 0.0f, 1.0f)
 Position of the light.
 
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)
 Color of the light (default: white).
 
float intensity = 1.0f
 Brightness multiplier (default: 1.0).
 
bool is_directional = true
 Whether this is a directional light (default: true).
 

Detailed Description

A light source for the Blinn-Phong shading model.

Lights illuminate meshes during rendering. A directional light (the default) shines from a direction toward the origin — its position is treated as a direction vector. Point lights are not yet supported.

Example: setting up two lights
opts.lights.push_back(Light{Vec3(0, 0, 1), Color(1,1,1), 1.0f, true});
opts.lights.push_back(Light{Vec3(1, 0, 0), Color(1,0,0), 0.5f, true});
// Light 1: white from +Z, full intensity
// Light 2: red from +X, half intensity
glm::vec3 Vec3
3-component floating-point vector (xyz).
Definition types.h:46
An RGBA color with floating-point components.
Definition types.h:88
A light source for the Blinn-Phong shading model.
Definition types.h:179
All settings that control rendering output.
std::vector< Light > lights
List of light sources.
See also
RenderOptions, RenderOptions::lights, RenderOptions::ambient
shade_pixel(), shade_pixel_multi()

Definition at line 179 of file types.h.

Member Data Documentation

◆ color

Color scimesh::Light::color = Color(1.0f, 1.0f, 1.0f, 1.0f)

Color of the light (default: white).

Each channel multiplies the surface color during shading.

Definition at line 189 of file types.h.

◆ intensity

float scimesh::Light::intensity = 1.0f

Brightness multiplier (default: 1.0).

Values > 1.0 produce brighter-than-white illumination (may saturate).

Definition at line 194 of file types.h.

◆ is_directional

bool scimesh::Light::is_directional = true

Whether this is a directional light (default: true).

When true, light rays are parallel (like the sun). Point lights (not yet implemented) would set this to false.

Definition at line 200 of file types.h.

◆ position

Vec3 scimesh::Light::position = Vec3(0.0f, 0.0f, 1.0f)

Position of the light.

When is_directional == true (the default), this is interpreted as a direction vector (the light is infinitely far away).

Definition at line 184 of file types.h.


The documentation for this struct was generated from the following file: