Unravel Engine C++ Reference
Loading...
Searching...
No Matches
math::color Struct Reference

#include <color.h>

Public Member Functions

 color ()
 
 color (int r, int g, int b, int a=255)
 
 color (std::uint32_t rgba)
 
 color (float r, float g, float b, float a=1.0f)
 
 color (const vec4 &col)
 
 operator std::uint32_t () const
 
 operator vec4 () const
 
void set_hsv (float h, float s, float v, float a=1.0f)
 

Static Public Member Functions

static color white ()
 
static color black ()
 
static color transparent ()
 
static color red ()
 
static color purple ()
 
static color random (const char *seed)
 Generates a consistent random color based on a string seed.
 
static color random (const std::string &seed)
 Generates a consistent random color based on a string seed.
 
static color hsv (float h, float s, float v, float a=1.0f)
 
static vec4 u32_to_float4 (std::uint32_t in)
 
static std::uint32_t float4_to_u32 (const vec4 &in)
 
static void rgb_to_hsv (float r, float g, float b, float &out_h, float &out_s, float &out_v)
 
static void hsv_to_rgb (float h, float s, float v, float &out_r, float &out_g, float &out_b)
 

Public Attributes

vec4 value {}
 

Detailed Description

Definition at line 11 of file color.h.

Constructor & Destructor Documentation

◆ color() [1/5]

math::color::color ( )
inline

Definition at line 82 of file color.h.

◆ color() [2/5]

math::color::color ( int r,
int g,
int b,
int a = 255 )
inline

Definition at line 86 of file color.h.

◆ color() [3/5]

math::color::color ( std::uint32_t rgba)
inline

Definition at line 94 of file color.h.

◆ color() [4/5]

math::color::color ( float r,
float g,
float b,
float a = 1.0f )
inline

Definition at line 102 of file color.h.

◆ color() [5/5]

math::color::color ( const vec4 & col)
inline

Definition at line 109 of file color.h.

Member Function Documentation

◆ black()

static color math::color::black ( )
inlinestatic

Definition at line 18 of file color.h.

◆ float4_to_u32()

static std::uint32_t math::color::float4_to_u32 ( const vec4 & in)
inlinestatic

Definition at line 141 of file color.h.

◆ hsv()

static color math::color::hsv ( float h,
float s,
float v,
float a = 1.0f )
inlinestatic

Definition at line 128 of file color.h.

◆ hsv_to_rgb()

static void math::color::hsv_to_rgb ( float h,
float s,
float v,
float & out_r,
float & out_g,
float & out_b )
inlinestatic

Definition at line 181 of file color.h.

◆ operator std::uint32_t()

math::color::operator std::uint32_t ( ) const
inline

Definition at line 113 of file color.h.

◆ operator vec4()

math::color::operator vec4 ( ) const
inline

Definition at line 117 of file color.h.

◆ purple()

static color math::color::purple ( )
inlinestatic

Definition at line 33 of file color.h.

◆ random() [1/2]

static color math::color::random ( const char * seed)
inlinestatic

Generates a consistent random color based on a string seed.

Parameters
seedThe string to use as a seed for random generation.
Returns
A color generated deterministically from the seed.

Definition at line 44 of file color.h.

◆ random() [2/2]

static color math::color::random ( const std::string & seed)
inlinestatic

Generates a consistent random color based on a string seed.

Parameters
seedThe string to use as a seed for random generation.
Returns
A color generated deterministically from the seed.

Definition at line 54 of file color.h.

◆ red()

static color math::color::red ( )
inlinestatic

Definition at line 28 of file color.h.

◆ rgb_to_hsv()

static void math::color::rgb_to_hsv ( float r,
float g,
float b,
float & out_h,
float & out_s,
float & out_v )
inlinestatic

Definition at line 154 of file color.h.

◆ set_hsv()

void math::color::set_hsv ( float h,
float s,
float v,
float a = 1.0f )
inline

Definition at line 122 of file color.h.

◆ transparent()

static color math::color::transparent ( )
inlinestatic

Definition at line 23 of file color.h.

◆ u32_to_float4()

static vec4 math::color::u32_to_float4 ( std::uint32_t in)
inlinestatic

Definition at line 135 of file color.h.

◆ white()

static color math::color::white ( )
inlinestatic

Definition at line 13 of file color.h.

Member Data Documentation

◆ value

vec4 math::color::value {}

Definition at line 80 of file color.h.


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