Removed obsolete LOOP define from example shaders

Removed the use of the LOOP preprocessor symbol from
the remaining example shader code. The shader code is now
configured according to the types of the resulting patches
without depending on the subdivision scheme of the mesh
topology.
This commit is contained in:
David G Yu 2019-06-17 17:23:16 -07:00
parent 9fe1284ae3
commit ed3fa312e5
8 changed files with 18 additions and 32 deletions

View File

@ -465,13 +465,7 @@ getAdaptivePatchColor(int3 patchParam, float sharpness)
};
int patchType = 0;
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
if (sharpness > 0) {
pattern = 1;
}
#endif
int pattern = countbits(OsdGetPatchTransitionMask(patchParam));
int edgeCount = countbits(OsdGetPatchBoundaryMask(patchParam));
if (edgeCount == 1) {
patchType = 2; // BOUNDARY
@ -480,9 +474,11 @@ getAdaptivePatchColor(int3 patchParam, float sharpness)
patchType = 3; // CORNER
}
// XXX: it looks like edgeCount != 0 for some gregory boundary patches.
// there might be a bug somewhere...
#if defined OSD_PATCH_GREGORY
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
if (sharpness > 0) {
patchType = 1;
}
#elif defined OSD_PATCH_GREGORY
patchType = 4;
#elif defined OSD_PATCH_GREGORY_BOUNDARY
patchType = 5;
@ -490,6 +486,8 @@ getAdaptivePatchColor(int3 patchParam, float sharpness)
patchType = 6;
#endif
int pattern = countbits(OsdGetPatchTransitionMask(patchParam));
return patchColors[6*patchType + pattern];
}

View File

@ -416,11 +416,7 @@ getAdaptivePatchColor(int3 patchParam, float2 vSegments)
if (vSegments.y > 0) {
patchType = 1;
}
#endif
// XXX: it looks like edgeCount != 0 for gregory_boundary.
// there might be a bug somewhere.
#if defined OSD_PATCH_GREGORY
#elif defined OSD_PATCH_GREGORY
patchType = 4;
#elif defined OSD_PATCH_GREGORY_BOUNDARY
patchType = 5;

View File

@ -117,11 +117,6 @@ public:
} else if (type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
ss << "#define OSD_PATCH_GREGORY_TRIANGLE\n";
}
if (type == Far::PatchDescriptor::TRIANGLES ||
type == Far::PatchDescriptor::LOOP ||
type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
ss << "#define LOOP\n";
}
if (desc.IsAdaptive()) {
ss << "#define SMOOTH_NORMALS\n";

View File

@ -44,6 +44,13 @@
mix(mix(inpt[a].color, inpt[b].color, UV.x), \
mix(inpt[c].color, inpt[d].color, UV.x), UV.y)
#undef OSD_USER_VARYING_PER_EVAL_POINT_TRIANGLE
#define OSD_USER_VARYING_PER_EVAL_POINT_TRIANGLE(UV, a, b, c) \
outpt.color = \
inpt[a].color * (1.0f - UV.x - UV.y) + \
inpt[b].color * UV.x + \
inpt[c].color * UV.y;
//--------------------------------------------------------------
// Uniforms / Uniform Blocks
//--------------------------------------------------------------
@ -358,7 +365,7 @@ getAdaptivePatchColor(ivec3 patchParam)
patchType = 3; // CORNER (not correct for patches that are not isolated)
}
#if defined(OSD_PATCH_ENABLE_SINGLE_CREASE) && !defined(LOOP)
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
// check this after boundary/corner since single crease patch also has edgeCount.
if (inpt.vSegments.y > 0) {
patchType = 1;

View File

@ -704,11 +704,6 @@ public:
} else if (type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
ss << "#define OSD_PATCH_GREGORY_TRIANGLE\n";
}
if (type == Far::PatchDescriptor::TRIANGLES ||
type == Far::PatchDescriptor::LOOP ||
type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
ss << "#define LOOP\n";
}
// include osd PatchCommon
ss << Osd::GLSLPatchShaderSource::GetCommonShaderSource();

View File

@ -475,7 +475,7 @@ GetOverrideColor(ivec3 patchParam)
patchType = 3; // CORNER (not correct for patches that are not isolated)
}
#if defined(OSD_PATCH_ENABLE_SINGLE_CREASE) && !defined(LOOP)
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
// check this after boundary/corner since single crease patch also has edgeCount.
if (inpt.vSegments.y > 0) {
patchType = 1;

View File

@ -378,11 +378,6 @@ public:
} else if (type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
ss << "#define OSD_PATCH_GREGORY_TRIANGLE\n";
}
if (type == Far::PatchDescriptor::TRIANGLES ||
type == Far::PatchDescriptor::LOOP ||
type == Far::PatchDescriptor::GREGORY_TRIANGLE) {
ss << "#define LOOP\n";
}
// for legacy gregory
ss << "#define OSD_MAX_VALENCE " << effectDesc.maxValence << "\n";

View File

@ -424,7 +424,7 @@ getAdaptivePatchColor(ivec3 patchParam)
patchType = 3; // CORNER (not correct for patches that are not isolated)
}
#if defined(OSD_PATCH_ENABLE_SINGLE_CREASE) && !defined(LOOP)
#if defined OSD_PATCH_ENABLE_SINGLE_CREASE
// check this after boundary/corner since single crease patch also has edgeCount.
if (inpt.vSegments.y > 0) {
patchType = 1;