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

An RGBA color with floating-point components. More...

#include <types.h>

Public Member Functions

constexpr Color ()=default
 
constexpr Color (float r_, float g_, float b_, float a_=1.0f)
 Construct a Color from RGBA values.
 

Public Attributes

float r = 0.0f
 Red channel, [0, 1].
 
float g = 0.0f
 Green channel, [0, 1].
 
float b = 0.0f
 Blue channel, [0, 1].
 
float a = 1.0f
 Alpha (opacity) channel, [0, 1]. 1.0 = fully opaque.
 

Detailed Description

An RGBA color with floating-point components.

Each channel is in the range [0.0, 1.0], where 0.0 is none and 1.0 is full intensity. The alpha channel (a) controls opacity: 1.0 is fully opaque, 0.0 is fully transparent.

Colors are used to describe vertex colors, face colors, light colors, background colors, and more throughout the engine.

Constructing colors
Color red(1.0f, 0.0f, 0.0f); // opaque red
Color half_blue(0.0f, 0.0f, 0.5f); // semi-dark blue
Color transparent_green(0.0f, 1.0f, 0.0f, 0.3f); // green, 30% opaque
An RGBA color with floating-point components.
Definition types.h:88
See also
DEFAULT_COLOR, TRANSPARENT_BLACK

Definition at line 88 of file types.h.

Constructor & Destructor Documentation

◆ Color() [1/2]

constexpr scimesh::Color::Color ( )
constexprdefault

◆ Color() [2/2]

constexpr scimesh::Color::Color ( float  r_,
float  g_,
float  b_,
float  a_ = 1.0f 
)
inlineconstexpr

Construct a Color from RGBA values.

Parameters
r_Red channel (0.0–1.0).
g_Green channel (0.0–1.0).
b_Blue channel (0.0–1.0).
a_Alpha channel (0.0–1.0), defaults to 1.0 (opaque).

Definition at line 101 of file types.h.

Member Data Documentation

◆ a

float scimesh::Color::a = 1.0f

Alpha (opacity) channel, [0, 1]. 1.0 = fully opaque.

Definition at line 92 of file types.h.

◆ b

float scimesh::Color::b = 0.0f

Blue channel, [0, 1].

Definition at line 91 of file types.h.

◆ g

float scimesh::Color::g = 0.0f

Green channel, [0, 1].

Definition at line 90 of file types.h.

◆ r

float scimesh::Color::r = 0.0f

Red channel, [0, 1].

Definition at line 89 of file types.h.


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