mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-24 04:20:21 +00:00
Fix edge-only face-varying interpolation.
For face-varying interpolation, sharpness should be interpreted as an infintely sharp boundary. Hbr implements this correctly for vertex sharpness, but inconsistently for edge sharpness: both the fvarbits cache and methods that gather face-varying sharpness need to be corrected. fixes #231
This commit is contained in:
parent
dd8cc1a3b7
commit
404ec9649d
@ -187,7 +187,12 @@ public:
|
||||
if (fvarinfsharp) {
|
||||
const int fvarcount = GetMesh()->GetFVarCount();
|
||||
int fvarbitsSizePerEdge = ((fvarcount + 15) / 16);
|
||||
memcpy(fvarinfsharp, edge->getFVarInfSharp(), fvarbitsSizePerEdge * sizeof(unsigned int));
|
||||
|
||||
if (edge->IsSharp(true)) {
|
||||
memset(fvarinfsharp, 0x55555555, fvarbitsSizePerEdge * sizeof(unsigned int));
|
||||
} else {
|
||||
memcpy(fvarinfsharp, edge->getFVarInfSharp(), fvarbitsSizePerEdge * sizeof(unsigned int));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,6 +668,11 @@ HbrHalfedge<T>::GetFVarInfiniteSharp(int datum) {
|
||||
template <class T>
|
||||
bool
|
||||
HbrHalfedge<T>::IsFVarInfiniteSharpAnywhere() {
|
||||
|
||||
if (sharpness > k_Smooth) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetMesh()->GetFVarCount(); ++i) {
|
||||
if (GetFVarInfiniteSharp(i)) return true;
|
||||
}
|
||||
@ -673,14 +683,13 @@ template <class T>
|
||||
float
|
||||
HbrHalfedge<T>::GetFVarSharpness(int datum, bool ignoreGeometry) {
|
||||
|
||||
bool infsharp = GetFVarInfiniteSharp(datum);
|
||||
|
||||
if (infsharp) return k_InfinitelySharp;
|
||||
if (GetFVarInfiniteSharp(datum)) return k_InfinitelySharp;
|
||||
|
||||
if (!ignoreGeometry) {
|
||||
// If it's a geometrically sharp edge it's going to be a
|
||||
// facevarying sharp edge too
|
||||
if (sharpness > k_Smooth) {
|
||||
SetFVarInfiniteSharp(datum, true);
|
||||
return k_InfinitelySharp;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user