Untitled
Toggle main menu visibility
Loading...
Searching...
No Matches
point_light_shadows.vert
Go to the documentation of this file.
1
2
#version 460
3
layout
(location = 0) in
vec3
aPosition;
4
layout
(location = 1) in
vec3
aNormal;
5
layout
(location = 2) in
vec4
aTangent;
6
layout
(location = 3) in
ivec4
aJointIndices;
7
layout
(location = 4) in
vec4
aWeights;
8
layout
(location = 5) in
vec2
aUV;
9
layout
(location = 6) in
mat4
aInstanceMatrix;
10
layout
(location = 10) in
ivec2
aPointLight;
11
layout
(location = 11) in
ivec2
aDirectionalLight;
12
layout
(location = 12) in
ivec2
aSpotLight;
13
layout
(location = 13) in
int
aSkinOffset;
14
15
16
struct
DrawArraysIndirectCommand
{
17
uint count;
18
uint instanceCount;
19
uint first;
20
uint baseInstance;
21
uint instanceOffset;
// the amount of instances pushed this frame
22
uint pad0;
23
};
24
25
26
layout
(std430, binding = 5) buffer DrawArraysData {
27
28
DrawArraysIndirectCommand
draw_arrays_commands[];
29
};
30
layout
(std140, binding = 0) uniform CameraData {
31
vec4
cam_pos;
32
vec4
cam_vel;
33
mat4
projection
;
34
mat4
unjittered_projection;
35
mat4
view
;
36
mat4
inv_projection;
37
mat4
unjittered_inv_projection;
38
mat4
inv_view;
39
};
40
layout
(std140, binding = 1) uniform RenderingData {
41
ivec4
resolution;
42
};
43
layout
(std140, binding = 2) uniform LightCameraData {
44
mat4
light_proj[4];
45
mat4
light_view[4];
46
};
47
48
layout
(std140, binding = 4) uniform PrevCameraData {
49
vec4
prev_cam_pos;
50
vec4
prev_cam_vel;
51
mat4
prev_projection;
52
mat4
prev_unjittered_projection;
53
mat4
prev_view;
54
mat4
prev_inv_projection;
55
mat4
prev_unjittered_inv_projection;
56
mat4
prev_inv_view;
57
};
58
struct
Transform
59
{
60
uint
mn_id
;
61
uint
command_id
;
62
uvec2
directional_lights
;
63
uvec2
spot_lights
;
64
uint
skin_offset
;
65
uint
material
;
66
mat4
mat
;
67
};
68
layout
(std430, binding = 7) buffer TransformData {
69
70
Transform
trs[];
71
72
};
73
struct
MeshNode
74
{
75
vec4
min
;
76
vec4
max
;
77
vec4
center
;
78
vec4
extents
;
79
uint
instance_count
;
80
uint
static_mesh
;
81
uint
lm_offset
;
82
uint
material
;
83
uint
first
;
84
uint
count
;
85
uint
pad0
;
86
uint
pad1
;
87
};
88
89
#define MAX_MESH_NODES 1024
90
layout
(std430, binding = 15) buffer MeshNodeData {
91
92
float
focal_distance;
93
uint pad0;
94
uint pad1;
95
uint pad2;
96
MeshNode
mns[
MAX_MESH_NODES
];
97
98
};
99
100
#define MAX_INSTANCES 1024
101
layout
(std430, binding = 4) buffer VisibleData {
102
103
uint visible_indices[];
104
105
};
106
107
layout
(std430, binding = 11) buffer JointData {
108
109
mat4
joint_mats[];
110
111
};
112
113
114
uniform uint
uOffset
;
115
uniform uint
uDynamicPass
;
116
117
uniform uint
uStartArr
;
118
out
VS_OUT
119
{
120
uint
Mat
;
121
vec2
UV
;
122
123
}
gs_in
;
124
125
void
main
()
126
{
127
128
vec3
pos = aPosition;
129
130
uint off = 0;
131
uint
index_offset
=
uStartArr
+ gl_DrawID;
132
if
(
uDynamicPass
== 1)
133
{
134
135
DrawArraysIndirectCommand
com = draw_arrays_commands[
uOffset
-1];
136
off = com.
instanceCount
+ com.
baseInstance
;
137
index_offset
+=
uOffset
;
138
}
139
uint visible_offset =
index_offset
*
MAX_INSTANCES
;
140
Transform
tr = trs[visible_indices[visible_offset + gl_InstanceID]];
141
mat4
skinMat =
142
joint_mats[aJointIndices.x] * aWeights.x +
143
joint_mats[aJointIndices.y] * aWeights.y +
144
joint_mats[aJointIndices.z] * aWeights.z +
145
joint_mats[aJointIndices.w] * aWeights.w;
146
vec4
skinned_pos = skinMat *
vec4
(pos, 1.0);
147
gs_in
.Mat = tr.
material
;
148
gs_in
.UV = aUV;
149
vec4
worldPos = tr.
mat
* skinned_pos;
150
gl_Position = worldPos;
151
}
layout
layout(local_size_x=16, local_size_y=16) in
main
void main()
Definition
audio_probe_bake.comp:465
UV
in vec2 UV
Definition
depth_pre_pass.frag:70
Mat
flat in uint Mat
Definition
depth_pre_pass.frag:69
uDynamicPass
uniform uint uDynamicPass
Definition
depth_pre_pass.vert:114
uOffset
uniform uint uOffset
Definition
depth_pre_pass.vert:113
uStartArr
uniform uint uStartArr
Definition
depth_pre_pass_no_gbuffer.vert:129
index_offset
uniform int index_offset
Definition
dynamic.frag:234
MAX_INSTANCES
#define MAX_INSTANCES
Maximum amount of TransformGPU instances to push in one frame (used for SSBO sizing).
Definition
engine_types.h:111
MAX_MESH_NODES
#define MAX_MESH_NODES
Maximum MeshNodes in a scene (used for SSBO sizing).
Definition
engine_types.h:108
Transform::mat
mat4 mat
Definition
cull_draw_calls.comp:79
MeshNode::pad1
uint pad1
Definition
coc.frag:55
MeshNode::first
uint first
Definition
coc.frag:52
MeshNode::min
vec4 min
Definition
coc.frag:44
Transform::skin_offset
uint skin_offset
Definition
cull_draw_calls.comp:77
MeshNode::material
uint material
Definition
coc.frag:51
MeshNode::max
vec4 max
Definition
coc.frag:45
MeshNode::lm_offset
uint lm_offset
Definition
coc.frag:50
Transform::directional_lights
uvec2 directional_lights
Definition
cull_draw_calls.comp:75
Transform::mn_id
uint mn_id
Definition
cull_draw_calls.comp:73
Transform::material
uint material
Definition
cull_draw_calls.comp:78
Transform::command_id
uint command_id
Definition
cull_draw_calls.comp:74
DrawArraysIndirectCommand::instanceCount
uint32_t instanceCount
Definition
engine_types.h:845
DrawArraysIndirectCommand::baseInstance
uint32_t baseInstance
Definition
engine_types.h:847
MeshNode::pad0
uint pad0
Definition
coc.frag:54
MeshNode::center
vec4 center
Definition
coc.frag:46
MeshNode::instance_count
uint instance_count
Definition
coc.frag:48
MeshNode::static_mesh
bool static_mesh
If this mesh is static (DrawArrays) or dynamic (DrawElements), used to indicate Lightmap status.
Definition
engine_types.h:2399
MeshNode::count
size_t count
Count of vertices pushed into the MAIN_VBO.
Definition
engine_types.h:2402
MeshNode::extents
vec4 extents
Definition
coc.frag:47
Transform::spot_lights
uvec2 spot_lights
Definition
cull_draw_calls.comp:76
DrawArraysIndirectCommand
DrawArraysIndirect commands are used for static meshes (eg.
Definition
engine_types.h:842
MeshNode
MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to ...
Definition
audio_probe_bake.comp:85
Transform
Transforms for MeshNode models.
Definition
cull_draw_calls.comp:72
gs_in
gs_in
Definition
point_light_shadows.vert:123
VS_OUT
out VS_OUT
Definition
point_light_shadows.vert:119
projection
uniform mat4 projection
Definition
shadow.vert:15
view
uniform mat4 view
Definition
shadow.vert:16
ivec2
Definition
types.h:14
ivec4
Definition
types.h:16
mat4
Definition
types.h:21
vec2
Definition
types.h:11
vec3
Definition
types.h:12
vec4
Definition
types.h:13
src
render
point_light_shadows.vert
Generated by
1.18.0