Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
| #pragma BLENDER_REQUIRE(common_view_lib.glsl) | #pragma BLENDER_REQUIRE(common_view_lib.glsl) | ||||
| #ifdef STANDALONE | |||||
| layout(triangles) in; | |||||
| layout(triangle_strip, max_vertices = 3) out; | |||||
| #endif | |||||
| in vec4 vPos[]; | |||||
| flat out int slice; | |||||
| RESOURCE_ID_VARYING | |||||
| #ifdef MESH_SHADER | #ifdef MESH_SHADER | ||||
| /* TODO: tight slices. */ | /* TODO: tight slices. */ | ||||
| void main() | void main() | ||||
| { | { | ||||
| gl_Layer = slice = int(vPos[0].z); | gl_Layer = volumetric_geom_iface.slice = int(volumetric_vert_iface[0].vPos.z); | ||||
| PASS_RESOURCE_ID | PASS_RESOURCE_ID | ||||
| # ifdef USE_ATTR | # ifdef USE_ATTR | ||||
| pass_attr(0); | pass_attr(0); | ||||
| # endif | # endif | ||||
| gl_Position = vPos[0].xyww; | gl_Position = volumetric_vert_iface[0].vPos.xyww; | ||||
| EmitVertex(); | EmitVertex(); | ||||
| # ifdef USE_ATTR | # ifdef USE_ATTR | ||||
| pass_attr(1); | pass_attr(1); | ||||
| # endif | # endif | ||||
| gl_Position = vPos[1].xyww; | gl_Position = volumetric_vert_iface[1].vPos.xyww; | ||||
| EmitVertex(); | EmitVertex(); | ||||
| # ifdef USE_ATTR | # ifdef USE_ATTR | ||||
| pass_attr(2); | pass_attr(2); | ||||
| # endif | # endif | ||||
| gl_Position = vPos[2].xyww; | gl_Position = volumetric_vert_iface[2].vPos.xyww; | ||||
| EmitVertex(); | EmitVertex(); | ||||
| EndPrimitive(); | EndPrimitive(); | ||||
| } | } | ||||
| #else /* World */ | #else /* World */ | ||||
| /* This is just a pass-through geometry shader that send the geometry | /* This is just a pass-through geometry shader that send the geometry | ||||
| * to the layer corresponding to its depth. */ | * to the layer corresponding to its depth. */ | ||||
| void main() | void main() | ||||
| { | { | ||||
| gl_Layer = slice = int(vPos[0].z); | gl_Layer = volumetric_geom_iface.slice = int(volumetric_vert_iface[0].vPos.z); | ||||
| PASS_RESOURCE_ID | PASS_RESOURCE_ID | ||||
| # ifdef USE_ATTR | # ifdef USE_ATTR | ||||
| pass_attr(0); | pass_attr(0); | ||||
| # endif | # endif | ||||
| gl_Position = vPos[0].xyww; | gl_Position = volumetric_vert_iface[0].vPos.xyww; | ||||
| EmitVertex(); | EmitVertex(); | ||||
| # ifdef USE_ATTR | # ifdef USE_ATTR | ||||
| pass_attr(1); | pass_attr(1); | ||||
| # endif | # endif | ||||
| gl_Position = vPos[1].xyww; | gl_Position = volumetric_vert_iface[1].vPos.xyww; | ||||
| EmitVertex(); | EmitVertex(); | ||||
| # ifdef USE_ATTR | # ifdef USE_ATTR | ||||
| pass_attr(2); | pass_attr(2); | ||||
| # endif | # endif | ||||
| gl_Position = vPos[2].xyww; | gl_Position = volumetric_vert_iface[2].vPos.xyww; | ||||
| EmitVertex(); | EmitVertex(); | ||||
| EndPrimitive(); | EndPrimitive(); | ||||
| } | } | ||||
| #endif | #endif | ||||