gKit2 light
Loading...
Searching...
No Matches
mesh.glsl
1
2#version 460
3#extension GL_EXT_mesh_shader : require
4
5#ifdef MESH_SHADER
6uniform mat4 mvpMatrix;
7
8layout(local_size_x= 4) in;
9layout(triangles, max_vertices = 4, max_primitives = 2) out;
10void main()
11{
12 SetMeshOutputsEXT(4, 2);
13
14 vec2 positions[4]= vec2[4]( vec2(-1, -1), vec2(1, -1), vec2(1, 1), vec2(-1, 1) );
15
16 if(gl_LocalInvocationIndex < 4)
17 gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position= mvpMatrix * vec4( positions[gl_LocalInvocationIndex], 0, 1);
18
19 if(gl_LocalInvocationIndex == 0)
20 gl_PrimitiveTriangleIndicesEXT[0] = uvec3(0, 1, 2);
21 if(gl_LocalInvocationIndex == 1)
22 gl_PrimitiveTriangleIndicesEXT[1] = uvec3(2, 3, 0);
23}
24#endif
25
26#ifdef FRAGMENT_SHADER
27uniform vec4 color;
28
29out vec4 fragment_color;
30void main()
31{
32 fragment_color= color;
33}
34#endif
vecteur generique, utilitaire.
Definition vec.h:152
vecteur generique 4d, ou 3d homogene, utilitaire.
Definition vec.h:192