srp
software rendering pipeline
Loading...
Searching...
No Matches
math_utils.h
Go to the documentation of this file.
1// Software Rendering Pipeline (SRP) library
2// Licensed under GNU GPLv3
3
4#pragma once
5
9#define _USE_MATH_DEFINES
10#include <math.h>
11
15#ifndef M_PI
16 #define M_PI 3.14159265358979323846
17#endif
18
20#define MIN(a, b) ( (a) > (b) ? (b) : (a) )
22#define MAX(a, b) ( (a) > (b) ? (a) : (b) )
23
28#define CLAMP(min, max, value) \
29 ( \
30 (value < min) ? \
31 (min) : \
32 (value > max) ? \
33 (max) : \
34 (value) \
35 )
36
38#define FRACTIONAL(x) ( (x) - floor(x) )
39
// ingroup Various_internal
41