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//------------------------------------------------------------------------------
15namespace Util
16{
17class 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
38Colour::Colour(float r, float g, float b, float a) : Math::vec4(r,g,b,a)
39{
40}
41
42//------------------------------------------------------------------------------
45__forceinline
47{
48}
49
50//------------------------------------------------------------------------------
53__forceinline
54Colour::Colour(const Math::vec3& v) : Math::vec4(v,1.0f)
55{
56}
57
58//------------------------------------------------------------------------------
61__forceinline
62Colour::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
71Colour::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}
For now just a wrapper around Math::vec4 for type safety.
Definition colour.h:18
Colour(const Colour &c)=default
Colour()=default
Different curves.
Definition angularpfeedbackloop.h:17
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6
A 3D vector.
Definition vec3.h:40
A 4D vector.
Definition vec4.h:24
__m128 vec
Definition vec4.h:95
float v[4]
Definition vec4.h:96