mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-27 05:50:05 +00:00
example fix: remove unnecessary debugging feature.
This commit is contained in:
parent
f2d5ed8919
commit
5c01e709f9
@ -98,9 +98,7 @@ enum DisplayStyle { kDisplayStyleWire = 0,
|
|||||||
enum ShadingMode { kShadingMaterial,
|
enum ShadingMode { kShadingMaterial,
|
||||||
kShadingPatchType,
|
kShadingPatchType,
|
||||||
kShadingPatchCoord,
|
kShadingPatchCoord,
|
||||||
kShadingNormal,
|
kShadingNormal };
|
||||||
kShadingCurvature,
|
|
||||||
kShadingAnalyticCurvature };
|
|
||||||
|
|
||||||
enum EndCap { kEndCapNone = 0,
|
enum EndCap { kEndCapNone = 0,
|
||||||
kEndCapBSplineBasis,
|
kEndCapBSplineBasis,
|
||||||
@ -556,13 +554,6 @@ public:
|
|||||||
case kShadingNormal:
|
case kShadingNormal:
|
||||||
ss << "#define SHADING_NORMAL\n";
|
ss << "#define SHADING_NORMAL\n";
|
||||||
break;
|
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
|
// need for patch color-coding : we need these defines in the fragment shader
|
||||||
@ -1212,12 +1203,6 @@ initHUD() {
|
|||||||
g_hud->AddPullDownButton(shading_pulldown, "Normal",
|
g_hud->AddPullDownButton(shading_pulldown, "Normal",
|
||||||
kShadingNormal,
|
kShadingNormal,
|
||||||
g_shadingMode == 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 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');
|
g_hud->AddCheckBox("Patch Color (P)", true, 10, 70, callbackCheckBox, kHUD_CB_DISPLAY_PATCH_COLOR, 'P');
|
||||||
|
@ -460,17 +460,10 @@ ps_main( in OutputVertex input,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
float3 N = (isFrontFacing ? input.normal : -input.normal);
|
float3 N = (isFrontFacing ? input.normal : -input.normal);
|
||||||
float3 Nobj = mul(ModelViewInverseMatrix, float4(input.normal, 0)).xyz;
|
|
||||||
float4 Cf = lighting(color, input.position.xyz, N);
|
float4 Cf = lighting(color, input.position.xyz, N);
|
||||||
|
|
||||||
#if defined(SHADING_NORMAL)
|
#if defined(SHADING_NORMAL)
|
||||||
Cf.rgb = N;
|
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
|
#endif
|
||||||
|
|
||||||
colorOut = edgeColor(Cf, input.edgeDistance);
|
colorOut = edgeColor(Cf, input.edgeDistance);
|
||||||
|
@ -145,9 +145,7 @@ enum ShadingMode { kShadingMaterial,
|
|||||||
kShadingFaceVaryingColor,
|
kShadingFaceVaryingColor,
|
||||||
kShadingPatchType,
|
kShadingPatchType,
|
||||||
kShadingPatchCoord,
|
kShadingPatchCoord,
|
||||||
kShadingNormal,
|
kShadingNormal };
|
||||||
kShadingCurvature,
|
|
||||||
kShadingAnalyticCurvature };
|
|
||||||
|
|
||||||
enum EndCap { kEndCapNone = 0,
|
enum EndCap { kEndCapNone = 0,
|
||||||
kEndCapBSplineBasis,
|
kEndCapBSplineBasis,
|
||||||
@ -773,13 +771,6 @@ public:
|
|||||||
case kShadingNormal:
|
case kShadingNormal:
|
||||||
ss << "#define SHADING_NORMAL\n";
|
ss << "#define SHADING_NORMAL\n";
|
||||||
break;
|
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) {
|
if (type == Far::PatchDescriptor::TRIANGLES) {
|
||||||
@ -1512,12 +1503,6 @@ initHUD() {
|
|||||||
g_hud.AddPullDownButton(shading_pulldown, "Normal",
|
g_hud.AddPullDownButton(shading_pulldown, "Normal",
|
||||||
kShadingNormal,
|
kShadingNormal,
|
||||||
g_shadingMode == 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');
|
int compute_pulldown = g_hud.AddPullDown("Compute (K)", 475, 10, 300, callbackKernel, 'k');
|
||||||
g_hud.AddPullDownButton(compute_pulldown, "CPU", kCPU);
|
g_hud.AddPullDownButton(compute_pulldown, "CPU", kCPU);
|
||||||
|
@ -177,16 +177,8 @@ void emit(int index, vec3 normal)
|
|||||||
outpt.v.patchCoord = inpt[index].v.patchCoord;
|
outpt.v.patchCoord = inpt[index].v.patchCoord;
|
||||||
#ifdef SMOOTH_NORMALS
|
#ifdef SMOOTH_NORMALS
|
||||||
outpt.v.normal = inpt[index].v.normal;
|
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
|
#else
|
||||||
outpt.v.normal = normal;
|
outpt.v.normal = normal;
|
||||||
#if defined(SHADING_ANALYTIC_CURVATURE)
|
|
||||||
outpt.v.Nu = vec3(0);
|
|
||||||
outpt.v.Nv = vec3(0);
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OSD_PATCH_ENABLE_SINGLE_CREASE
|
#ifdef OSD_PATCH_ENABLE_SINGLE_CREASE
|
||||||
@ -486,7 +478,6 @@ getAdaptivePatchColor(ivec3 patchParam)
|
|||||||
void
|
void
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
vec3 Nobj = (ModelViewInverseMatrix * vec4(inpt.v.normal, 0)).xyz;
|
|
||||||
vec3 N = (gl_FrontFacing ? inpt.v.normal : -inpt.v.normal);
|
vec3 N = (gl_FrontFacing ? inpt.v.normal : -inpt.v.normal);
|
||||||
|
|
||||||
#if defined(SHADING_VARYING_COLOR)
|
#if defined(SHADING_VARYING_COLOR)
|
||||||
@ -509,16 +500,8 @@ main()
|
|||||||
|
|
||||||
#if defined(SHADING_NORMAL)
|
#if defined(SHADING_NORMAL)
|
||||||
Cf.rgb = N;
|
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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE)
|
#if defined(GEOMETRY_OUT_WIRE) || defined(GEOMETRY_OUT_LINE)
|
||||||
Cf = edgeColor(Cf, inpt.edgeDistance);
|
Cf = edgeColor(Cf, inpt.edgeDistance);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user