naev 0.11.5
colour.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
7#include "glad.h"
13typedef struct glColour_ {
14 GLfloat r;
15 GLfloat g;
16 GLfloat b;
17 GLfloat a;
18} __attribute__((packed)) glColour;
19
20/*
21 * default colours
22 */
23#include "colours.gen.h"
24
25#define COL_ALPHA( col, alpha ) \
26{ .r = (col).r, .g = (col).g, .b = (col).b, .a = alpha }
27
28/*
29 * Colour space conversion routines.
30 */
31__attribute__((const)) double linearToGamma( double x );
32__attribute__((const)) double gammaToLinear( double x );
33void col_linearToGamma( glColour *c );
34void col_gammaToLinear( glColour *c );
35void col_hsv2rgb( glColour *c, float h, float s, float v );
36void col_rgb2hsv( float *h, float *s, float *v, float r, float g, float b );
37void col_blend( glColour *blend, const glColour *fg, const glColour *bg, float alpha );
static const double c[]
Definition rng.c:264
represents a colour via its RGBA values.
Definition colour.h:13
GLfloat r
Definition colour.h:14
GLfloat g
Definition colour.h:15
GLfloat a
Definition colour.h:17
GLfloat b
Definition colour.h:16