MESH BUFFER
This commit is contained in:
parent
86d7adb07f
commit
523852da08
11 changed files with 93 additions and 51 deletions
23
test.mesh
23
test.mesh
|
|
@ -14,6 +14,15 @@ layout (binding = 0) uniform UBO
|
|||
mat4 view;
|
||||
} ubo;
|
||||
|
||||
layout (binding = 1) buffer VERTEX
|
||||
{
|
||||
vec4 pos[];
|
||||
} vertex;
|
||||
layout (binding = 2) buffer INDEX {
|
||||
uint index[];
|
||||
} index;
|
||||
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
layout(triangles, max_vertices = 3, max_primitives = 1) out;
|
||||
|
||||
|
|
@ -22,12 +31,6 @@ layout(location = 0) out VertexOutput
|
|||
vec4 color;
|
||||
} vertexOutput[];
|
||||
|
||||
const vec4[3] positions = {
|
||||
vec4( 0.0, -1.0, 0.0, 1.0),
|
||||
vec4(-1.0, 1.0, 0.0, 1.0),
|
||||
vec4( 1.0, 1.0, 0.0, 1.0)
|
||||
};
|
||||
|
||||
const vec4[3] colors = {
|
||||
vec4(0.0, 1.0, 0.0, 1.0),
|
||||
vec4(0.0, 0.0, 1.0, 1.0),
|
||||
|
|
@ -38,13 +41,11 @@ void main()
|
|||
{
|
||||
uint iid = gl_LocalInvocationID.x;
|
||||
|
||||
vec4 offset = vec4(0.0, 0.0, gl_GlobalInvocationID.x, 0.0);
|
||||
|
||||
SetMeshOutputsEXT(3, 1);
|
||||
mat4 mvp = ubo.projection * ubo.view * ubo.model;
|
||||
gl_MeshVerticesEXT[0].gl_Position = mvp * (positions[0] + offset);
|
||||
gl_MeshVerticesEXT[1].gl_Position = mvp * (positions[1] + offset);
|
||||
gl_MeshVerticesEXT[2].gl_Position = mvp * (positions[2] + offset);
|
||||
gl_MeshVerticesEXT[0].gl_Position = mvp * vertex.pos[0];
|
||||
gl_MeshVerticesEXT[1].gl_Position = mvp * vertex.pos[1];
|
||||
gl_MeshVerticesEXT[2].gl_Position = mvp * vertex.pos[2];
|
||||
vertexOutput[0].color = colors[0];
|
||||
vertexOutput[1].color = colors[1];
|
||||
vertexOutput[2].color = colors[2];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue