Commit f5b67cfe by Philipp Adolf

Finish edge compute shader

parent cce97fe9
......@@ -21,8 +21,15 @@ layout(std430, binding=2) writeonly buffer Output {
};
void main(){
edges[gl_GlobalInvocationID.x].norm = vec3(0.0, 0.0, 0.0);
edges[gl_GlobalInvocationID.x].uv = vec2(0.0, 0.0);
edges[gl_GlobalInvocationID.x].pos = 3.0/8.0 * (vertices[indices[gl_GlobalInvocationID.x][0]].pos + vertices[indices[gl_GlobalInvocationID.x][1]].pos) + 1.0/8.0 * (vertices[indices[gl_GlobalInvocationID.x][2]].pos + vertices[indices[gl_GlobalInvocationID.y][3]].pos);
Vertex a = vertices[indices[gl_GlobalInvocationID.x][0]];
Vertex b = vertices[indices[gl_GlobalInvocationID.x][1]];
Vertex c = vertices[indices[gl_GlobalInvocationID.x][2]];
Vertex d = vertices[indices[gl_GlobalInvocationID.x][3]];
vec3 pos;
edges[gl_GlobalInvocationID.x].pos = 3.0f/8.0f * a.pos + 3.0f/8.0f * b.pos + 1.0f/8.0f * c.pos + 1.0f/8.0f * d.pos;
edges[gl_GlobalInvocationID.x].norm = normalize(3.0/8.0 * (vertices[indices[gl_GlobalInvocationID.x][0]].norm + vertices[indices[gl_GlobalInvocationID.x][1]].norm) + 1.0/8.0 * (vertices[indices[gl_GlobalInvocationID.x][2]].norm + vertices[indices[gl_GlobalInvocationID.y][3]].norm));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment