forked from mortennobel/SimpleRenderEngine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathColor.hpp
More file actions
31 lines (24 loc) · 793 Bytes
/
Copy pathColor.hpp
File metadata and controls
31 lines (24 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* SimpleRenderEngine (https://github.com/mortennobel/SimpleRenderEngine)
*
* Created by Morten Nobel-Jørgensen ( http://www.nobel-joergensen.com/ )
* License: MIT
*/
#pragma once
#include <glm/glm.hpp>
namespace sre {
// The color class represents a sRGBA color, (RGB is in gamma space, alpha is linear)
class Color {
public:
Color() = default;
Color(float r, float g, float b, float a = 1.0f);
explicit Color(glm::vec4 linearColor);
float& operator[] (int index);
glm::vec4 toLinear(); // Return color values in linear space
void setFromLinear(glm::vec4 linear); // Set sRGBA values from linear space
float r = 0;
float g = 0;
float b = 0;
float a = 1;
};
}