mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-09-19 14:20:00 +00:00
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:
parent
9fe1284ae3
commit
ed3fa312e5
@ -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];
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user