Nebula
Loading...
Searching...
No Matches
colour.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
Colour
:
public
Math::vec4
18
{
19
public
:
20
Colour
() =
default
;
21
Colour
(
const
Colour
& c) =
default
;
23
Colour
(
float
r,
float
g,
float
b,
float
a);
25
Colour
(
const
Math::vec4
&
v
);
27
Colour
(
const
Math::vec3
&
v
);
29
Colour
(uint32_t argb);
31
Colour
(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
32
};
33
34
//------------------------------------------------------------------------------
37
__forceinline
38
Colour::Colour
(
float
r,
float
g,
float
b,
float
a) :
Math
::
vec4
(r,g,b,a)
39
{
40
}
41
42
//------------------------------------------------------------------------------
45
__forceinline
46
Colour::Colour
(
const
Math::vec4
& v) :
Math
::
vec4
(v)
47
{
48
}
49
50
//------------------------------------------------------------------------------
53
__forceinline
54
Colour::Colour
(
const
Math::vec3
& v) :
Math
::
vec4
(v,1.0f)
55
{
56
}
57
58
//------------------------------------------------------------------------------
61
__forceinline
62
Colour::Colour
(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
Colour::Colour
(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::Colour
For now just a wrapper around Math::vec4 for type safety.
Definition
colour.h:18
Util::Colour::Colour
Colour(const Colour &c)=default
Util::Colour::Colour
Colour()=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
colour.h
Generated on Wed Nov 13 2024 21:37:32 for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.