46 lines
768 B
GLSL
46 lines
768 B
GLSL
#extension GL_ARB_bindless_texture : require
|
|
|
|
#include "camera.glsl"
|
|
#include "draw_cmds_data.glsl"
|
|
|
|
|
|
VERTEX_EXPORT flat uint DrawID;
|
|
|
|
VERTEX_EXPORT VertexData {
|
|
vec2 uv;
|
|
} VertexOut;
|
|
|
|
#if VERTEX_SHADER
|
|
|
|
layout(location = 0) in vec3 aPos;
|
|
layout(location = 2) in vec2 aUV;
|
|
|
|
void main() {
|
|
DrawID = gl_BaseInstance + gl_InstanceID;
|
|
mat4 model = draw_data[DrawID].transform;
|
|
mat4 viewModel = view * model;
|
|
vec4 vPos = viewModel * vec4(aPos.xyz, 1.0);
|
|
gl_Position = projection * vPos;
|
|
VertexOut.uv = aUV;
|
|
}
|
|
|
|
#endif
|
|
|
|
#if FRAGMENT_SHADER
|
|
|
|
#include "material.glsl"
|
|
|
|
out vec4 FragColor;
|
|
|
|
void main() {
|
|
#if BLEND_MODE == 1
|
|
// Alpha Mask material
|
|
int matIdx = draw_data[DrawID].materialIdx;
|
|
if (getAlbedo(matIdx).a < 0.5) {
|
|
discard;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
#endif
|