naev 0.12.5
colour.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
7#include "glad.h"
9
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" // IWYU pragma: export
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,
38 float alpha );
void col_blend(glColour *blend, const glColour *fg, const glColour *bg, float alpha)
Blends two colours.
Definition colour.c:206
void col_rgb2hsv(float *H, float *S, float *V, float R, float G, float B)
Changes colour space from RGB to HSV.
Definition colour.c:125
void col_hsv2rgb(glColour *c, float h, float s, float v)
Changes colour space from HSV to RGB.
Definition colour.c:61
static const double c[]
Definition rng.c:256
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