Nebula
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
11
#include "
core/types.h
"
12
#include "
math/vec4.h
"
13
14
//------------------------------------------------------------------------------
15
namespace
Util
16
{
17
class
Color
:
public
Math::vec4
18
{
19
public
:
20
Color
() =
default
;
21
Color
(
const
Color
& c) =
default
;
23
Color
(
float
r,
float
g,
float
b,
float
a);
25
Color
(
const
Math::vec4
&
v
);
27
Color
(
const
Math::vec3
&
v
);
29
Color
(uint32_t argb);
31
Color
(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
32
};
33
34
//------------------------------------------------------------------------------
37
__forceinline
38
Color::Color
(
float
r,
float
g,
float
b,
float
a) :
Math
::
vec4
(r,g,b,a)
39
{
40
}
41
42
//------------------------------------------------------------------------------
45
__forceinline
46
Color::Color
(
const
Math::vec4
& v) :
Math
::
vec4
(v)
47
{
48
}
49
50
//------------------------------------------------------------------------------
53
__forceinline
54
Color::Color
(
const
Math::vec3
& v) :
Math
::
vec4
(v,1.0f)
55
{
56
}
57
58
//------------------------------------------------------------------------------
61
__forceinline
62
Color::Color
(uint32_t argb)
63
{
64
const
float
scale = 1.0f / 255.0f;
65
this->
vec
= _mm_setr_ps(scale * ((argb >> 16) & 0xFF), scale * ((argb >> 8) & 0xFF), scale * (argb & 0xFF), scale * ((argb >> 24) & 0xFF));
66
}
67
//------------------------------------------------------------------------------
70
__forceinline
71
Color::Color
(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
72
{
73
const
float
scale = 1.0f / 255.0f;
74
this->
vec
= _mm_setr_ps(scale * r, scale * g, scale * b, scale * a);
75
}
76
}
Util::Color
For now just a wrapper around Math::vec4 for type safety.
Definition
color.h:18
Util::Color::Color
Color()=default
Util::Color::Color
Color(const Color &c)=default
Math
Different curves.
Definition
angularpfeedbackloop.h:17
Util
A pinned array is an array which manages its own virtual memory.
Definition
String.cs:6
Math::vec3
A 3D vector.
Definition
vec3.h:40
Math::vec4
A 4D vector.
Definition
vec4.h:24
Math::vec4::vec
__m128 vec
Definition
vec4.h:95
Math::vec4::v
float v[4]
Definition
vec4.h:96
types.h
vec4.h
code
foundation
util
color.h
Generated on Fri Nov 22 2024 12:50:53 for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.