From 5c01e709f9c3d40b606c8c4b4beed95cc1eb2258 Mon Sep 17 00:00:00 2001 From: Takahito Tejima Date: Wed, 3 Jun 2015 17:40:36 -0700 Subject: [PATCH] example fix: remove unnecessary debugging feature. --- examples/dxViewer/dxviewer.cpp | 17 +---------------- examples/dxViewer/shader.hlsl | 7 ------- examples/glViewer/glViewer.cpp | 17 +---------------- examples/glViewer/shader.glsl | 17 ----------------- 4 files changed, 2 insertions(+), 56 deletions(-) diff --git a/examples/dxViewer/dxviewer.cpp b/examples/dxViewer/dxviewer.cpp index a63765f2..905ac81a 100644 --- a/examples/dxViewer/dxviewer.cpp +++ b/examples/dxViewer/dxviewer.cpp @@ -98,9 +98,7 @@ enum DisplayStyle { kDisplayStyleWire = 0, enum ShadingMode { kShadingMaterial, kShadingPatchType, kShadingPatchCoord, - kShadingNormal, - kShadingCurvature, - kShadingAnalyticCurvature }; + kShadingNormal }; enum EndCap { kEndCapNone = 0, kEndCapBSplineBasis, @@ -556,13 +554,6 @@ public: case kShadingNormal: ss << "#define SHADING_NORMAL\n"; break; - case kShadingCurvature: - ss << "#define SHADING_CURVATURE\n"; - break; - case kShadingAnalyticCurvature: - ss << "#define OSD_COMPUTE_NORMAL_DERIVATIVES\n"; - ss << "#define SHADING_ANALYTIC_CURVATURE\n"; - break; } // need for patch color-coding : we need these defines in the fragment shader @@ -1212,12 +1203,6 @@ initHUD() { g_hud->AddPullDownButton(shading_pulldown, "Normal", kShadingNormal, g_shadingMode == kShadingNormal); - g_hud->AddPullDownButton(shading_pulldown, "Curvature", - kShadingCurvature, - g_shadingMode == kShadingCurvature); - g_hud->AddPullDownButton(shading_pulldown, "Analytic Curvature", - kShadingAnalyticCurvature, - g_shadingMode == kShadingAnalyticCurvature); g_hud->AddCheckBox("Patch CVs (L)", false, 10, 50, callbackCheckBox, kHUD_CB_DISPLAY_PATCH_CVs, 'L'); g_hud->AddCheckBox("Patch Color (P)", true, 10, 70, callbackCheckBox, kHUD_CB_DISPLAY_PATCH_COLOR, 'P'); diff --git a/examples/dxViewer/shader.hlsl b/examples/dxViewer/shader.hlsl index 21a3f419..cbc566ce 100644 --- a/examples/dxViewer/shader.hlsl +++ b/examples/dxViewer/shader.hlsl @@ -460,17 +460,10 @@ ps_main( in OutputVertex input, #endif float3 N = (isFrontFacing ? input.normal : -input.normal); - float3 Nobj = mul(ModelViewInverseMatrix, float4(input.normal, 0)).xyz; float4 Cf = lighting(color, input.position.xyz, N); #if defined(SHADING_NORMAL) Cf.rgb = N; -#elif defined(SHADING_CURVATURE) - float3 pc = fwidth(input.position.xyz); - Cf.rgb = 0.1 * fwidth(Nobj) / length(pc); -#elif defined(SHADING_ANALYTIC_CURVATURE) - int level = OsdGetPatchFaceLevel(OsdGetPatchParam(OsdGetPatchIndex(primitiveID))); - Cf.rgb = 0.1 * level *(abs(input.Nu) + abs(input.Nv)); #endif colorOut = edgeColor(Cf, input.edgeDistance); diff --git a/examples/glViewer/glViewer.cpp b/examples/glViewer/glViewer.cpp index a3e49429..5b91bedc 100644 --- a/examples/glViewer/glViewer.cpp +++ b/examples/glViewer/glViewer.cpp @@ -145,9 +145,7 @@ enum ShadingMode { kShadingMaterial, kShadingFaceVaryingColor, kShadingPatchType, kShadingPatchCoord, - kShadingNormal, - kShadingCurvature, - kShadingAnalyticCurvature }; + kShadingNormal }; enum EndCap { kEndCapNone = 0, kEndCapBSplineBasis, @@ -773,13 +771,6 @@ public: case kShadingNormal: ss << "#define SHADING_NORMAL\n"; break; - case kShadingCurvature: - ss << "#define SHADING_CURVATURE\n"; - break; - case kShadingAnalyticCurvature: - ss << "#define OSD_COMPUTE_NORMAL_DERIVATIVES\n"; - ss << "#define SHADING_ANALYTIC_CURVATURE\n"; - break; } if (type == Far::PatchDescriptor::TRIANGLES) { @@ -1512,12 +1503,6 @@ initHUD() { g_hud.AddPullDownButton(shading_pulldown, "Normal", kShadingNormal, g_shadingMode == kShadingNormal); - g_hud.AddPullDownButton(shading_pulldown, "Curvature", - kShadingCurvature, - g_shadingMode == kShadingCurvature); - g_hud.AddPullDownButton(shading_pulldown, "Analytic Curvature", - kShadingAnalyticCurvature, - g_shadingMode == kShadingAnalyticCurvature); int compute_pulldown = g_hud.AddPullDown("Compute (K)", 475, 10, 300, callbackKernel, 'k'); g_hud.AddPullDownButton(compute_pulldown, "CPU", kCPU); diff --git a/examples/glViewer/shader.glsl b/examples/glViewer/shader.glsl index fb6538b4..1b5613a3 100644 --- a/examples/glViewer/shader.glsl +++ b/examples/glViewer/shader.glsl @@ -177,16 +177,8 @@ void emit(int index, vec3 normal) outpt.v.patchCoord = inpt[index].v.patchCoord; #ifdef SMOOTH_NORMALS outpt.v.normal = inpt[index].v.normal; -#if defined(SHADING_ANALYTIC_CURVATURE) - outpt.v.Nu = inpt[index].v.Nu; - outpt.v.Nv = inpt[index].v.Nv; -#endif #else outpt.v.normal = normal; -#if defined(SHADING_ANALYTIC_CURVATURE) - outpt.v.Nu = vec3(0); - outpt.v.Nv = vec3(0); -#endif #endif #ifdef OSD_PATCH_ENABLE_SINGLE_CREASE @@ -486,7 +478,6 @@ getAdaptivePatchColor(ivec3 patchParam) void main() { - vec3 Nobj = (ModelViewInverseMatrix * vec4(inpt.v.normal, 0)).xyz; vec3 N = (gl_FrontFacing ? inpt.v.normal : -inpt.v.normal); #if defined(SHADING_VARYING_COLOR) @@ -509,16 +500,8 @@ main() #if defined(SHADING_NORMAL) Cf.rgb = N; -#elif defined(SHADING_CURVATURE) - vec3 pc = fwidth(inpt.v.position.xyz); - Cf.rgb = 0.1 * fwidth(Nobj) / length(pc); -#elif defined(SHADING_ANALYTIC_CURVATURE) - // XXX: why need to scale by level? - int level = OsdGetPatchFaceLevel(OsdGetPatchParam(OsdGetPatchIndex(gl_PrimitiveID))); - Cf.rgb = 0.1 * level *(abs(inpt.v.Nu) + abs(inpt.v.Nv)); #endif - #if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE) Cf = edgeColor(Cf, inpt.edgeDistance); #endif