diff --git a/Platformer/PlatformWindow.cs b/Platformer/PlatformWindow.cs index 49f7257..a998de1 100644 --- a/Platformer/PlatformWindow.cs +++ b/Platformer/PlatformWindow.cs @@ -112,7 +112,7 @@ namespace Platformer GL.BindVertexArray(_polyVao); GL.BindBuffer(BufferTarget.ElementArrayBuffer, _pEdges); - GL.Uniform3(_render.UnifLoc("color"), .1f, .1f, .9f); + GL.Uniform3(_render.UnifLoc("color"), .1f, .1f, .6f); GL.DrawElements(BeginMode.Lines, _pEdges.Count, DrawElementsType.UnsignedInt, 0); GL.Flush(); diff --git a/Platformer/shaders/intersect.comp b/Platformer/shaders/intersect.comp index 78c0094..3b97030 100644 --- a/Platformer/shaders/intersect.comp +++ b/Platformer/shaders/intersect.comp @@ -15,11 +15,41 @@ layout(std430, binding=2) buffer PolyVerts vec4 polyVerts[]; }; -layout(std430, binding=3) buffer EdgeInds +layout(std430, binding=3) buffer PolyEdges { - uint edgeInds[]; + uint polyEdges[]; }; +uniform PlaneMats +{ + mat4 tform; +}; + +layout(local_size_x = 128, local_size_y = 1, local_size_z = 1) in; + void main () { + uint ti0 = gl_GlobalInvocationID.x * 4; + uint pv0 = gl_GlobalInvocationID.x * 4; + uint pe0 = gl_GlobalInvocationID.x * 8; + uint ii = 0; + uint vv = 0; + +// polyVerts[pv0 + vv++] = vec4(-1,0,0,1); +// polyVerts[pv0 + vv++] = vec4(1,0,0,1); +// +// polyEdges[pe0 + ii++] = pv0 + 0; +// polyEdges[pe0 + ii++] = pv0 + 1; + + for(uint i = 1; i < 4; i++) + { + polyVerts[pv0 + vv++] = (tetraVerts[ti0] + tetraVerts[ti0 + i]) / 2; + } + + polyEdges[pe0 + ii++] = pv0 + 0; + polyEdges[pe0 + ii++] = pv0 + 1; + polyEdges[pe0 + ii++] = pv0 + 1; + polyEdges[pe0 + ii++] = pv0 + 2; + polyEdges[pe0 + ii++] = pv0 + 2; + polyEdges[pe0 + ii++] = pv0 + 0; } \ No newline at end of file