cangine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
cangine::Color Struct Reference

RGBA color stored as normalized floating-point components. More...

#include <color.hpp>

Public Member Functions

 Color ()
 Constructs an opaque white color.
 
 Color (float r, float g, float b, float a)
 Constructs a color from 0-255 RGB values and an alpha.
 
 Color (float r, float g, float b)
 Constructs a fully opaque color from 0-255 RGB values.
 

Public Attributes

float r = 0
 Red channel, normalized to [0, 1].
 
float g = 0
 Green channel, normalized to [0, 1].
 
float b = 0
 Blue channel, normalized to [0, 1].
 
float a = 0
 Alpha channel in [0, 1].
 

Detailed Description

RGBA color stored as normalized floating-point components.

RGB channels are stored in the range [0, 1] (constructors accept 0-255 values and divide by 255), while alpha is stored directly in [0, 1].

Constructor & Destructor Documentation

◆ Color() [1/3]

cangine::Color::Color ( )
inline

Constructs an opaque white color.

◆ Color() [2/3]

cangine::Color::Color ( float  r,
float  g,
float  b,
float  a 
)
inline

Constructs a color from 0-255 RGB values and an alpha.

Parameters
rRed channel in the range [0, 255].
gGreen channel in the range [0, 255].
bBlue channel in the range [0, 255].
aAlpha in the range [0, 1] (asserted).

◆ Color() [3/3]

cangine::Color::Color ( float  r,
float  g,
float  b 
)
inline

Constructs a fully opaque color from 0-255 RGB values.

Parameters
rRed channel in the range [0, 255].
gGreen channel in the range [0, 255].
bBlue channel in the range [0, 255].

Member Data Documentation

◆ a

float cangine::Color::a = 0

Alpha channel in [0, 1].

◆ b

float cangine::Color::b = 0

Blue channel, normalized to [0, 1].

◆ g

float cangine::Color::g = 0

Green channel, normalized to [0, 1].

◆ r

float cangine::Color::r = 0

Red channel, normalized to [0, 1].


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