blob: e34e790c34c8d6650bdf66f7a2db2bf59c6c240d (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#pragma once
#include "maths_types.h"
#include "ral_types.h"
/** @brief shader layout for camera matrices */
typedef struct Binding_Camera {
Mat4 view;
Mat4 projection;
} Binding_Camera;
typedef struct Binding_Model {
Mat4 model;
} Binding_Model;
/** @brief data that is handy to have in any shader */
typedef struct Binding_Globals {
} Binding_Globals;
typedef struct pbr_point_light {
Vec3 pos;
f32 pad;
Vec3 color;
f32 pad2;
} pbr_point_light;
typedef struct Binding_PointLights {
pbr_point_light pointLights[4];
Vec4 viewPos;
} Binding_PointLights;
static ShaderDataLayout Binding_Camera_GetLayout(void* data) {
Binding_Camera* d = data;
bool has_data = data != NULL;
ShaderBinding b1 = {
.label = "Camera",
.kind = BINDING_BYTES
};
if (has_data) {
b1.data.bytes.data = d;
}
return (ShaderDataLayout) {.bindings = {b1 }, .binding_count = 1};
}
static ShaderDataLayout Binding_Model_GetLayout(void* data) {
Binding_Model* d = data;
bool has_data = data != NULL;
ShaderBinding b1 = {
.label = "Model",
.kind = BINDING_BYTES
};
if (has_data) {
b1.data.bytes.data = d;
}
return (ShaderDataLayout) {.bindings = {b1 }, .binding_count = 1};
}
|