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

#include <math.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 283 of file math.h.

Constructor & Destructor Documentation

◆ color() [1/5]

math::color::color ( )
inline

Definition at line 356 of file math.h.

◆ color() [2/5]

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

Definition at line 360 of file math.h.

◆ color() [3/5]

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

Definition at line 368 of file math.h.

◆ color() [4/5]

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

Definition at line 376 of file math.h.

◆ color() [5/5]

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

Definition at line 383 of file math.h.

Member Function Documentation

◆ black()

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

Definition at line 292 of file math.h.

◆ float4_to_u32()

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

Definition at line 415 of file math.h.

◆ hsv()

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

Definition at line 402 of file math.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 455 of file math.h.

◆ operator std::uint32_t()

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

Definition at line 387 of file math.h.

◆ operator vec4()

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

Definition at line 391 of file math.h.

◆ purple()

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

Definition at line 307 of file math.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 318 of file math.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 328 of file math.h.

◆ red()

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

Definition at line 302 of file math.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 428 of file math.h.

◆ set_hsv()

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

Definition at line 396 of file math.h.

◆ transparent()

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

Definition at line 297 of file math.h.

◆ u32_to_float4()

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

Definition at line 409 of file math.h.

◆ white()

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

Definition at line 287 of file math.h.

Member Data Documentation

◆ value

vec4 math::color::value {}

Definition at line 354 of file math.h.


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