voxel c00b
This commit is contained in:
parent
941e076857
commit
cb500f5eda
1 changed files with 15 additions and 4 deletions
|
|
@ -39,12 +39,12 @@ layout (binding = 1) buffer VOXELS
|
|||
VoxelType voxel[];
|
||||
} voxels;
|
||||
|
||||
/*
|
||||
|
||||
layout (location = 0) out PerVertexData
|
||||
{
|
||||
vec4 color;
|
||||
} outVert[];
|
||||
*/
|
||||
|
||||
|
||||
shared uint writeCounter;
|
||||
|
||||
|
|
@ -72,6 +72,10 @@ void main()
|
|||
|
||||
uint oldVertexOffset = old*8;
|
||||
|
||||
float xC = xF / float((ubo.sizeX) - 1);
|
||||
float yC = yF / float((ubo.sizeY) - 1);
|
||||
float zC = zF / float((ubo.sizeZ) - 1);
|
||||
|
||||
gl_MeshVerticesEXT[oldVertexOffset + 0].gl_Position = ubo.modelProjectionView * vec4(xF - 0.5, yF - 0.5, zF - 0.5, 1.0);
|
||||
gl_MeshVerticesEXT[oldVertexOffset + 1].gl_Position = ubo.modelProjectionView * vec4(xF + 0.5, yF - 0.5, zF - 0.5, 1.0);
|
||||
gl_MeshVerticesEXT[oldVertexOffset + 2].gl_Position = ubo.modelProjectionView * vec4(xF + 0.5, yF + 0.5, zF - 0.5, 1.0);
|
||||
|
|
@ -81,6 +85,15 @@ void main()
|
|||
gl_MeshVerticesEXT[oldVertexOffset + 6].gl_Position = ubo.modelProjectionView * vec4(xF + 0.5, yF + 0.5, zF + 0.5, 1.0);
|
||||
gl_MeshVerticesEXT[oldVertexOffset + 7].gl_Position = ubo.modelProjectionView * vec4(xF - 0.5, yF + 0.5, zF + 0.5, 1.0);
|
||||
|
||||
outVert[oldVertexOffset + 0].color = vec4(xC, yC, zC, 1);
|
||||
outVert[oldVertexOffset + 1].color = vec4(xC, yC, zC, 1);
|
||||
outVert[oldVertexOffset + 2].color = vec4(xC, yC, zC, 1);
|
||||
outVert[oldVertexOffset + 3].color = vec4(xC, yC, zC, 1);
|
||||
outVert[oldVertexOffset + 4].color = vec4(xC, yC, zC, 1);
|
||||
outVert[oldVertexOffset + 5].color = vec4(xC, yC, zC, 1);
|
||||
outVert[oldVertexOffset + 6].color = vec4(xC, yC, zC, 1);
|
||||
outVert[oldVertexOffset + 7].color = vec4(xC, yC, zC, 1);
|
||||
|
||||
uint oldPrimOffset = old*12;
|
||||
|
||||
gl_PrimitiveTriangleIndicesEXT[oldPrimOffset + 0] = uvec3(oldVertexOffset + 2, oldVertexOffset + 1, oldVertexOffset + 0);
|
||||
|
|
@ -105,8 +118,6 @@ void main()
|
|||
barrier();
|
||||
|
||||
SetMeshOutputsEXT(writeCounter*8, writeCounter*12);
|
||||
|
||||
SetMeshOutputsEXT(128, 192);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue