diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/probe_geom.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/probe_geom.glsl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/probe_geom.glsl b/source/blender/draw/engines/eevee/shaders/probe_geom.glsl new file mode 100644 index 00000000000..ad112977e9f --- /dev/null +++ b/source/blender/draw/engines/eevee/shaders/probe_geom.glsl @@ -0,0 +1,28 @@ + +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; + +uniform int Layer; + +in vec4 vPos[]; +in int face[]; + +out vec3 worldPosition; +out vec3 worldNormal; + +const vec3 maj_axes[6] = vec3[6](vec3(1.0, 0.0, 0.0), vec3(-1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, -1.0, 0.0), vec3( 0.0, 0.0, 1.0), vec3( 0.0, 0.0, -1.0)); +const vec3 x_axis[6] = vec3[6](vec3(0.0, 0.0, -1.0), vec3( 0.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), vec3(1.0, 0.0, 0.0), vec3( 1.0, 0.0, 0.0), vec3(-1.0, 0.0, 0.0)); +const vec3 y_axis[6] = vec3[6](vec3(0.0, -1.0, 0.0), vec3( 0.0, -1.0, 0.0), vec3(0.0, 0.0, 1.0), vec3(0.0, 0.0, -1.0), vec3( 0.0, -1.0, 0.0), vec3( 0.0, -1.0, 0.0)); + +void main() { + int f = face[0]; + gl_Layer = Layer + f; + + for (int v = 0; v < 3; ++v) { + gl_Position = vPos[v]; + worldPosition = x_axis[f] * vPos[v].x + y_axis[f] * vPos[v].y + maj_axes[f]; + EmitVertex(); + } + + EndPrimitive(); +}
\ No newline at end of file |