Implement shaders (#1)
Reviewed-on: #1 * Start implementing shaders and move vector code to dedicated files * Extract shader into its own header * Ensure pixel coordinates are within bounds * Refactor shader code and implement fragment shaders * Create shaders * Reorganise code Co-authored-by: Abdelrahman <said.abdelrahman89@gmail.com> Co-committed-by: Abdelrahman <said.abdelrahman89@gmail.com>
This commit is contained in:
10
src/utils/utils.c
Normal file
10
src/utils/utils.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include "utils.h"
|
||||
#include "aliases.h"
|
||||
|
||||
i64 absolute(i64 value) {
|
||||
if (value >= 0) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value * -1;
|
||||
}
|
||||
18
src/utils/utils.h
Normal file
18
src/utils/utils.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include "aliases.h"
|
||||
#define swap(T, v0, v1) \
|
||||
do { \
|
||||
T tmp = v0; \
|
||||
v0 = v1; \
|
||||
v1 = tmp; \
|
||||
} while (0)
|
||||
|
||||
#define min(a, b) (a <= b ? a : b)
|
||||
#define max(a, b) (a >= b ? a : b)
|
||||
#define clamp(val, minimum, maximum) (min(maximum, max(minimum, val)))
|
||||
|
||||
i64 absolute(i64 value);
|
||||
|
||||
#endif // UTILS_H
|
||||
Reference in New Issue
Block a user