example fix: remove unnecessary debugging feature.

This commit is contained in:
Takahito Tejima 2015-06-03 17:40:36 -07:00
parent f2d5ed8919
commit 5c01e709f9
4 changed files with 2 additions and 56 deletions

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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