mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2025-01-11 09:00:08 +00:00
Redefined face varying "boundary interpolation" to "linear interpolation":
- redefined and documented Sdc::Options::FVarLinearInterpolation - included "corners only" mode not possible with Hbr - updated usage within Vtr::FVarLevel
This commit is contained in:
parent
cea1dd1880
commit
4d84dfd7be
@ -56,22 +56,20 @@ namespace Sdc {
|
||||
// - "boundary interpolation" is a potential misnomer as it only affects corners
|
||||
// - its effect is to sharpen edges/corners, but edges are always sharpened
|
||||
// - the "None" case serves no purpose (and would be discouraged)
|
||||
// "FVarBoundaryInterpolation" and the bool "propagate corners"
|
||||
// - as above, both name and enumerations being reconsidered
|
||||
// - again "boundary interpolation" a misnomer interior interpolation affected
|
||||
// - consider "FVarInterpolation" or "FVarLinearInterpolation" which by default
|
||||
// (0) is linear throughout and specifies where FVar interpolation is to be
|
||||
// Linear instead of following the assigned scheme. Since the default (0) is
|
||||
// completely (bi)linear, each option successively removes linear features
|
||||
// making the last fully smooth:
|
||||
// FVAR_LINEAR_ALL,
|
||||
// FVAR_LINEAR_EDGE_AND_CORNER,
|
||||
// FVAR_LINEAR_CORNER,
|
||||
// FVAR_LINEAR_CORNER_PROPAGATE (incorporates "propagate corners")
|
||||
// FVAR_LINEAR_NONE,
|
||||
// - the "propgate corners" option only applied to one "interpolation option"
|
||||
// (formerly EDGE_AND_CORNER, now LINEAR_CORNER) and so has been added as a
|
||||
// new fifth choice.
|
||||
// "FVarLinearInterpolation":
|
||||
// - this replaces the combination of the "face varying boundary interpolation"
|
||||
// enum and "propagate corner" boolean
|
||||
// - functional equivalence with previous modes is as follows:
|
||||
// LINEAR_NONE == "edge only" (smooth everywhere)
|
||||
// LINEAR_CORNERS_ONLY == (no prior equivalent)
|
||||
// LINEAR_CORNERS_PLUS1 == "edge and corner"
|
||||
// LINEAR_CORNERS_PLUS2 == "edge and corner" with "propagate corners"
|
||||
// LINEAR_BOUNDARIES == "always sharp"
|
||||
// LINEAR_ALL == "bilinear"
|
||||
// - the new "corner only" mode will sharpen corners and NEVER sharpen smooth
|
||||
// boundaries, which we believe to be expected when sharping corners -- the
|
||||
// old "edge and corner" mode would sharpen boundaries under some situations
|
||||
// (e.g. more than three fvar values at a vertex)
|
||||
// "TriangleSubdivision":
|
||||
// - hoping we can get rid of this due to lack of interest/use
|
||||
// - specific to Catmark and only at level 0
|
||||
@ -85,12 +83,13 @@ public:
|
||||
VVAR_BOUNDARY_EDGE_ONLY,
|
||||
VVAR_BOUNDARY_EDGE_AND_CORNER
|
||||
};
|
||||
enum FVarBoundaryInterpolation {
|
||||
FVAR_BOUNDARY_BILINEAR = 0,
|
||||
FVAR_BOUNDARY_EDGE_ONLY,
|
||||
FVAR_BOUNDARY_EDGE_AND_CORNER,
|
||||
FVAR_BOUNDARY_ALWAYS_SHARP,
|
||||
FVAR_BOUNDARY_EDGE_AND_CORNER_PROP
|
||||
enum FVarLinearInterpolation {
|
||||
FVAR_LINEAR_NONE = 0,
|
||||
FVAR_LINEAR_CORNERS_ONLY,
|
||||
FVAR_LINEAR_CORNERS_PLUS1,
|
||||
FVAR_LINEAR_CORNERS_PLUS2,
|
||||
FVAR_LINEAR_BOUNDARIES,
|
||||
FVAR_LINEAR_ALL
|
||||
};
|
||||
enum CreasingMethod {
|
||||
CREASE_UNIFORM = 0,
|
||||
@ -111,7 +110,7 @@ public:
|
||||
|
||||
// Trivial constructor and destructor:
|
||||
Options() : _vvarBoundInterp(VVAR_BOUNDARY_NONE),
|
||||
_fvarBoundInterp(FVAR_BOUNDARY_BILINEAR),
|
||||
_fvarLinInterp(FVAR_LINEAR_ALL),
|
||||
_nonManInterp(NON_MANIFOLD_NONE),
|
||||
_creasingMethod(CREASE_UNIFORM),
|
||||
_triangleSub(TRI_SUB_NORMAL),
|
||||
@ -124,8 +123,8 @@ public:
|
||||
VVarBoundaryInterpolation GetVVarBoundaryInterpolation() const { return (VVarBoundaryInterpolation) _vvarBoundInterp; }
|
||||
void SetVVarBoundaryInterpolation(VVarBoundaryInterpolation b) { _vvarBoundInterp = b; }
|
||||
|
||||
FVarBoundaryInterpolation GetFVarBoundaryInterpolation() const { return (FVarBoundaryInterpolation) _fvarBoundInterp; }
|
||||
void SetFVarBoundaryInterpolation(FVarBoundaryInterpolation b) { _fvarBoundInterp = b; }
|
||||
FVarLinearInterpolation GetFVarLinearInterpolation() const { return (FVarLinearInterpolation) _fvarLinInterp; }
|
||||
void SetFVarLinearInterpolation(FVarLinearInterpolation b) { _fvarLinInterp = b; }
|
||||
|
||||
CreasingMethod GetCreasingMethod() const { return (CreasingMethod) _creasingMethod; }
|
||||
void SetCreasingMethod(CreasingMethod c) { _creasingMethod = c; }
|
||||
@ -147,7 +146,7 @@ public:
|
||||
private:
|
||||
// Bitfield members:
|
||||
unsigned int _vvarBoundInterp : 2;
|
||||
unsigned int _fvarBoundInterp : 3;
|
||||
unsigned int _fvarLinInterp : 3;
|
||||
unsigned int _nonManInterp : 2;
|
||||
unsigned int _creasingMethod : 2;
|
||||
unsigned int _triangleSub : 2;
|
||||
|
@ -112,15 +112,15 @@ FVarLevel::completeTopologyFromFaceValues() {
|
||||
using Sdc::Options;
|
||||
|
||||
Options::VVarBoundaryInterpolation geomOptions = _options.GetVVarBoundaryInterpolation();
|
||||
Options::FVarBoundaryInterpolation fvarOptions = _options.GetFVarBoundaryInterpolation();
|
||||
Options::FVarLinearInterpolation fvarOptions = _options.GetFVarLinearInterpolation();
|
||||
|
||||
_isLinear = (fvarOptions == Options::FVAR_BOUNDARY_BILINEAR);
|
||||
_isLinear = (fvarOptions == Options::FVAR_LINEAR_ALL);
|
||||
|
||||
_hasSmoothBoundaries = (fvarOptions != Options::FVAR_BOUNDARY_BILINEAR) &&
|
||||
(fvarOptions != Options::FVAR_BOUNDARY_ALWAYS_SHARP);
|
||||
_hasSmoothBoundaries = (fvarOptions != Options::FVAR_LINEAR_ALL) &&
|
||||
(fvarOptions != Options::FVAR_LINEAR_BOUNDARIES);
|
||||
|
||||
bool geomCornersAreSmooth = (geomOptions != Options::VVAR_BOUNDARY_EDGE_AND_CORNER);
|
||||
bool fvarCornersAreSharp = (fvarOptions != Options::FVAR_BOUNDARY_EDGE_ONLY);
|
||||
bool fvarCornersAreSharp = (fvarOptions != Options::FVAR_LINEAR_NONE);
|
||||
|
||||
bool makeCornersSharp = geomCornersAreSmooth && fvarCornersAreSharp;
|
||||
|
||||
@ -140,8 +140,9 @@ FVarLevel::completeTopologyFromFaceValues() {
|
||||
// values in cases where there are more than 2 values at a vertex, its unclear what the intent of
|
||||
// "propagate corners" is if more than 2 are present.
|
||||
//
|
||||
bool sharpenAllIfMoreThan2 = fvarCornersAreSharp;
|
||||
bool sharpenAllIfAnyCorner = (fvarOptions == Options::FVAR_BOUNDARY_EDGE_AND_CORNER_PROP);
|
||||
bool sharpenAllIfMoreThan2 = (fvarOptions == Options::FVAR_LINEAR_CORNERS_PLUS1) ||
|
||||
(fvarOptions == Options::FVAR_LINEAR_CORNERS_PLUS2);
|
||||
bool sharpenAllIfAnyCorner = (fvarOptions == Options::FVAR_LINEAR_CORNERS_PLUS2);
|
||||
|
||||
bool sharpenDarts = sharpenAllIfAnyCorner || !_hasSmoothBoundaries;
|
||||
|
||||
|
@ -78,8 +78,6 @@ namespace Vtr {
|
||||
class FVarLevel {
|
||||
|
||||
public:
|
||||
typedef Sdc::Options::FVarBoundaryInterpolation BoundaryInterpolation;
|
||||
|
||||
typedef LocalIndex Sibling;
|
||||
typedef LocalIndexArray SiblingArray;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user