diff --git a/examples/glBatchViewer/shader.glsl b/examples/glBatchViewer/shader.glsl index fd419faf..2b317bd9 100644 --- a/examples/glBatchViewer/shader.glsl +++ b/examples/glBatchViewer/shader.glsl @@ -121,6 +121,7 @@ void main() out block { OutputVertex v; + noperspective out vec4 edgeDistance; } outpt; void emit(int index, vec3 normal) @@ -147,18 +148,18 @@ float edgeDistance(vec4 p, vec4 p0, vec4 p1) void emit(int index, vec3 normal, vec4 edgeVerts[EDGE_VERTS]) { - outpt.v.edgeDistance[0] = + outpt.edgeDistance[0] = edgeDistance(edgeVerts[index], edgeVerts[0], edgeVerts[1]); - outpt.v.edgeDistance[1] = + outpt.edgeDistance[1] = edgeDistance(edgeVerts[index], edgeVerts[1], edgeVerts[2]); #ifdef PRIM_TRI - outpt.v.edgeDistance[2] = + outpt.edgeDistance[2] = edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[0]); #endif #ifdef PRIM_QUAD - outpt.v.edgeDistance[2] = + outpt.edgeDistance[2] = edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[3]); - outpt.v.edgeDistance[3] = + outpt.edgeDistance[3] = edgeDistance(edgeVerts[index], edgeVerts[3], edgeVerts[0]); #endif @@ -241,6 +242,7 @@ void main() in block { OutputVertex v; + noperspective in vec4 edgeDistance; } inpt; out vec4 outColor; @@ -303,12 +305,12 @@ edgeColor(vec4 Cfill, vec4 edgeDistance) #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) #ifdef PRIM_TRI float d = - min(inpt.v.edgeDistance[0], min(inpt.v.edgeDistance[1], inpt.v.edgeDistance[2])); + min(inpt.edgeDistance[0], min(inpt.edgeDistance[1], inpt.edgeDistance[2])); #endif #ifdef PRIM_QUAD float d = - min(min(inpt.v.edgeDistance[0], inpt.v.edgeDistance[1]), - min(inpt.v.edgeDistance[2], inpt.v.edgeDistance[3])); + min(min(inpt.edgeDistance[0], inpt.edgeDistance[1]), + min(inpt.edgeDistance[2], inpt.edgeDistance[3])); #endif vec4 Cedge = vec4(1.0, 1.0, 0.0, 1.0); float p = exp2(-2 * d * d); @@ -330,7 +332,7 @@ main() vec4 Cf = lighting(inpt.v.position.xyz, N); #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) - Cf = edgeColor(Cf, inpt.v.edgeDistance); + Cf = edgeColor(Cf, inpt.edgeDistance); #endif outColor = Cf; diff --git a/examples/glViewer/shader.glsl b/examples/glViewer/shader.glsl index fd419faf..2b317bd9 100644 --- a/examples/glViewer/shader.glsl +++ b/examples/glViewer/shader.glsl @@ -121,6 +121,7 @@ void main() out block { OutputVertex v; + noperspective out vec4 edgeDistance; } outpt; void emit(int index, vec3 normal) @@ -147,18 +148,18 @@ float edgeDistance(vec4 p, vec4 p0, vec4 p1) void emit(int index, vec3 normal, vec4 edgeVerts[EDGE_VERTS]) { - outpt.v.edgeDistance[0] = + outpt.edgeDistance[0] = edgeDistance(edgeVerts[index], edgeVerts[0], edgeVerts[1]); - outpt.v.edgeDistance[1] = + outpt.edgeDistance[1] = edgeDistance(edgeVerts[index], edgeVerts[1], edgeVerts[2]); #ifdef PRIM_TRI - outpt.v.edgeDistance[2] = + outpt.edgeDistance[2] = edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[0]); #endif #ifdef PRIM_QUAD - outpt.v.edgeDistance[2] = + outpt.edgeDistance[2] = edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[3]); - outpt.v.edgeDistance[3] = + outpt.edgeDistance[3] = edgeDistance(edgeVerts[index], edgeVerts[3], edgeVerts[0]); #endif @@ -241,6 +242,7 @@ void main() in block { OutputVertex v; + noperspective in vec4 edgeDistance; } inpt; out vec4 outColor; @@ -303,12 +305,12 @@ edgeColor(vec4 Cfill, vec4 edgeDistance) #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) #ifdef PRIM_TRI float d = - min(inpt.v.edgeDistance[0], min(inpt.v.edgeDistance[1], inpt.v.edgeDistance[2])); + min(inpt.edgeDistance[0], min(inpt.edgeDistance[1], inpt.edgeDistance[2])); #endif #ifdef PRIM_QUAD float d = - min(min(inpt.v.edgeDistance[0], inpt.v.edgeDistance[1]), - min(inpt.v.edgeDistance[2], inpt.v.edgeDistance[3])); + min(min(inpt.edgeDistance[0], inpt.edgeDistance[1]), + min(inpt.edgeDistance[2], inpt.edgeDistance[3])); #endif vec4 Cedge = vec4(1.0, 1.0, 0.0, 1.0); float p = exp2(-2 * d * d); @@ -330,7 +332,7 @@ main() vec4 Cf = lighting(inpt.v.position.xyz, N); #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) - Cf = edgeColor(Cf, inpt.v.edgeDistance); + Cf = edgeColor(Cf, inpt.edgeDistance); #endif outColor = Cf; diff --git a/examples/paintTest/shader.glsl b/examples/paintTest/shader.glsl index 93ec142e..6856c269 100644 --- a/examples/paintTest/shader.glsl +++ b/examples/paintTest/shader.glsl @@ -101,6 +101,7 @@ vec4 displacement(vec4 position, vec3 normal, vec4 patchCoord) out block { OutputVertex v; + noperspective out vec4 edgeDistance; } outpt; void emit(int index, vec4 position, vec3 normal, vec4 patchCoord) @@ -124,11 +125,11 @@ float edgeDistance(vec4 p, vec4 p0, vec4 p1) void emit(int index, vec4 position, vec3 normal, vec4 patchCoord, vec4 edgeVerts[EDGE_VERTS]) { - outpt.v.edgeDistance[0] = + outpt.edgeDistance[0] = edgeDistance(edgeVerts[index], edgeVerts[0], edgeVerts[1]); - outpt.v.edgeDistance[1] = + outpt.edgeDistance[1] = edgeDistance(edgeVerts[index], edgeVerts[1], edgeVerts[2]); - outpt.v.edgeDistance[2] = + outpt.edgeDistance[2] = edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[0]); emit(index, position, normal, patchCoord); } @@ -193,6 +194,7 @@ void main() in block { OutputVertex v; + noperspective in vec4 edgeDistance; } inpt; out vec4 outColor; @@ -281,7 +283,7 @@ edgeColor(vec4 Cfill, vec4 edgeDistance) { #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) float d = - min(inpt.v.edgeDistance[0], min(inpt.v.edgeDistance[1], inpt.v.edgeDistance[2])); + min(inpt.edgeDistance[0], min(inpt.edgeDistance[1], inpt.edgeDistance[2])); vec4 Cedge = vec4(0.5, 0.5, 0.5, 1.0); float p = exp2(-2 * d * d); @@ -306,7 +308,7 @@ main() vec4 Cf = vec4(1.0); #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) - Cf = edgeColor(Cf, inpt.v.edgeDistance); + Cf = edgeColor(Cf, inpt.edgeDistance); #endif #ifdef USE_PTEX_COLOR diff --git a/examples/ptexViewer/shader.glsl b/examples/ptexViewer/shader.glsl index 5cf8fc7d..090954e4 100644 --- a/examples/ptexViewer/shader.glsl +++ b/examples/ptexViewer/shader.glsl @@ -171,6 +171,7 @@ void main() out block { OutputVertex v; + noperspective out vec4 edgeDistance; } outpt; // -------------------------------------- @@ -196,18 +197,18 @@ float edgeDistance(vec4 p, vec4 p0, vec4 p1) void emit(int index, vec4 position, vec3 normal, vec4 patchCoord, vec4 edgeVerts[EDGE_VERTS]) { - outpt.v.edgeDistance[0] = + outpt.edgeDistance[0] = edgeDistance(edgeVerts[index], edgeVerts[0], edgeVerts[1]); - outpt.v.edgeDistance[1] = + outpt.edgeDistance[1] = edgeDistance(edgeVerts[index], edgeVerts[1], edgeVerts[2]); #ifdef PRIM_TRI - outpt.v.edgeDistance[2] = + outpt.edgeDistance[2] = edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[0]); #endif #ifdef PRIM_QUAD - outpt.v.edgeDistance[2] = + outpt.edgeDistance[2] = edgeDistance(edgeVerts[index], edgeVerts[2], edgeVerts[3]); - outpt.v.edgeDistance[3] = + outpt.edgeDistance[3] = edgeDistance(edgeVerts[index], edgeVerts[3], edgeVerts[0]); #endif @@ -346,6 +347,7 @@ void main() in block { OutputVertex v; + noperspective in vec4 edgeDistance; } inpt; out vec4 outColor; @@ -487,12 +489,12 @@ edgeColor(vec4 Cfill, vec4 edgeDistance) #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) #ifdef PRIM_TRI float d = - min(inpt.v.edgeDistance[0], min(inpt.v.edgeDistance[1], inpt.v.edgeDistance[2])); + min(inpt.edgeDistance[0], min(inpt.edgeDistance[1], inpt.edgeDistance[2])); #endif #ifdef PRIM_QUAD float d = - min(min(inpt.v.edgeDistance[0], inpt.v.edgeDistance[1]), - min(inpt.v.edgeDistance[2], inpt.v.edgeDistance[3])); + min(min(inpt.edgeDistance[0], inpt.edgeDistance[1]), + min(inpt.edgeDistance[2], inpt.edgeDistance[3])); #endif vec4 Cedge = vec4(1.0, 1.0, 0.0, 1.0); float p = exp2(-2 * d * d); @@ -530,7 +532,7 @@ main() if (overrideColorEnable) { texColor = overrideColor; vec4 Cf = lighting(texColor, inpt.v.position.xyz, normal); - outColor = edgeColor(Cf, inpt.v.edgeDistance); + outColor = edgeColor(Cf, inpt.edgeDistance); return; } @@ -572,7 +574,7 @@ main() vec4 Cf = lighting(texColor, inpt.v.position.xyz, normal); #endif - outColor = edgeColor(Cf, inpt.v.edgeDistance); + outColor = edgeColor(Cf, inpt.edgeDistance); } #endif diff --git a/opensubdiv/osd/glslPatchCommon.glsl b/opensubdiv/osd/glslPatchCommon.glsl index fb201c3f..08742099 100644 --- a/opensubdiv/osd/glslPatchCommon.glsl +++ b/opensubdiv/osd/glslPatchCommon.glsl @@ -85,7 +85,6 @@ struct OutputVertex { vec3 tangent; centroid vec4 patchCoord; // u, v, level, faceID centroid vec2 tessCoord; // tesscoord.st - noperspective vec4 edgeDistance; #if OSD_NUM_VARYINGS > 0 float varyings[OSD_NUM_VARYINGS]; #endif