index buffer
This commit is contained in:
parent
523852da08
commit
ebacb9540c
2 changed files with 10 additions and 32 deletions
16
test.mesh
16
test.mesh
|
|
@ -40,14 +40,14 @@ const vec4[3] colors = {
|
|||
void main()
|
||||
{
|
||||
uint iid = gl_LocalInvocationID.x;
|
||||
|
||||
SetMeshOutputsEXT(3, 1);
|
||||
mat4 mvp = ubo.projection * ubo.view * ubo.model;
|
||||
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];
|
||||
gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0, 1, 2);
|
||||
uint triangleID = gl_LocalInvocationIndex.x * 3;
|
||||
gl_MeshVerticesEXT[triangleID].gl_Position = mvp * vertex.pos[index.index[triangleID]];
|
||||
gl_MeshVerticesEXT[triangleID+1].gl_Position = mvp * vertex.pos[index.index[triangleID+1]];
|
||||
gl_MeshVerticesEXT[triangleID+2].gl_Position = mvp * vertex.pos[index.index[triangleID+2]];
|
||||
vertexOutput[triangleID].color = colors[triangleID];
|
||||
vertexOutput[triangleID+1].color = colors[triangleID+1];
|
||||
vertexOutput[triangleID+2].color = colors[triangleID+2];
|
||||
gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex.x] = uvec3(index.index[triangleID], index.index[triangleID+1], index.index[triangleID+2]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue