2014-09-05 22:07:46 +00:00
|
|
|
//
|
|
|
|
// Copyright 2014 DreamWorks Animation LLC.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
// with the following modification; you may not use this file except in
|
|
|
|
// compliance with the Apache License and the following modification to it:
|
|
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
|
|
|
//
|
|
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
// the License and to reproduce the content of the NOTICE file.
|
|
|
|
//
|
|
|
|
// You may obtain a copy of the Apache License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the Apache License with the above modification is
|
|
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
|
|
// language governing permissions and limitations under the Apache License.
|
|
|
|
//
|
2015-05-19 18:22:37 +00:00
|
|
|
#ifndef OPENSUBDIV3_SDC_OPTIONS_H
|
|
|
|
#define OPENSUBDIV3_SDC_OPTIONS_H
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
|
|
|
namespace Sdc {
|
|
|
|
|
2014-12-12 19:10:17 +00:00
|
|
|
///
|
|
|
|
/// \brief All supported options applying to subdivision scheme.
|
|
|
|
///
|
|
|
|
/// The Options class contains all supported options that can be applied to a
|
|
|
|
/// subdivision scheme to affect the shape of the limit surface. These differ from
|
|
|
|
/// approximations that may be applied at a higher level, i.e. options to limit the
|
|
|
|
/// level of feature adaptive subdivision, options to ignore fractional creasing,
|
|
|
|
/// or creasing entirely, etc. These options define the shape of a particular
|
|
|
|
/// limit surface, including the "shape" of primitive variable data associated with
|
|
|
|
/// it.
|
|
|
|
///
|
|
|
|
/// The intent is that these sets of options be defined at a high-level and
|
|
|
|
/// propagated into the lowest-level computation in support of each subdivision
|
|
|
|
/// scheme. Ideally it remains a set of bit-fields (essentially an int) and so
|
2015-06-19 00:30:15 +00:00
|
|
|
/// remains light weight and easily passed around by value.
|
2014-12-12 19:10:17 +00:00
|
|
|
///
|
2014-12-23 08:09:26 +00:00
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
class Options {
|
|
|
|
public:
|
2014-12-12 19:10:17 +00:00
|
|
|
enum VtxBoundaryInterpolation {
|
|
|
|
VTX_BOUNDARY_NONE = 0, ///< do not interpolate boundaries
|
|
|
|
VTX_BOUNDARY_EDGE_ONLY, ///< sharpen edges
|
|
|
|
VTX_BOUNDARY_EDGE_AND_CORNER ///< sharpen edges and corners
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
2014-10-10 02:36:25 +00:00
|
|
|
enum FVarLinearInterpolation {
|
2014-12-12 19:10:17 +00:00
|
|
|
FVAR_LINEAR_NONE = 0, ///< smooth everywhere ("edge only")
|
|
|
|
FVAR_LINEAR_CORNERS_ONLY, ///< sharpen corners only
|
|
|
|
FVAR_LINEAR_CORNERS_PLUS1, ///< ("edge corner")
|
|
|
|
FVAR_LINEAR_CORNERS_PLUS2, ///< ("edge and corner + propagate corner")
|
|
|
|
FVAR_LINEAR_BOUNDARIES, ///< sharpen all boundaries ("always sharp")
|
2014-12-19 19:31:59 +00:00
|
|
|
FVAR_LINEAR_ALL ///< bilinear interpolation ("bilinear")
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
|
|
|
enum CreasingMethod {
|
2014-12-12 19:10:17 +00:00
|
|
|
CREASE_UNIFORM = 0, ///< Catmark rule
|
|
|
|
CREASE_CHAIKIN ///< Chaikin rule
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
|
|
|
enum TriangleSubdivision {
|
2014-12-12 19:10:17 +00:00
|
|
|
TRI_SUB_CATMARK = 0, ///< Catmark weights (Catmark scheme only)
|
|
|
|
TRI_SUB_SMOOTH ///< "smooth triangle" weights (Catmark scheme only)
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-12-12 19:10:17 +00:00
|
|
|
Options() : _vtxBoundInterp(VTX_BOUNDARY_NONE),
|
2014-10-10 02:36:25 +00:00
|
|
|
_fvarLinInterp(FVAR_LINEAR_ALL),
|
2014-09-30 01:46:33 +00:00
|
|
|
_creasingMethod(CREASE_UNIFORM),
|
2014-12-11 17:19:41 +00:00
|
|
|
_triangleSub(TRI_SUB_CATMARK) { }
|
2014-09-05 22:07:46 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Trivial get/set methods:
|
|
|
|
//
|
|
|
|
|
2014-12-12 19:10:17 +00:00
|
|
|
/// \brief Set vertex boundary interpolation rule
|
|
|
|
VtxBoundaryInterpolation GetVtxBoundaryInterpolation() const { return (VtxBoundaryInterpolation) _vtxBoundInterp; }
|
|
|
|
|
|
|
|
/// \brief Get vertex boundary interpolation rule
|
|
|
|
void SetVtxBoundaryInterpolation(VtxBoundaryInterpolation b) { _vtxBoundInterp = b; }
|
|
|
|
|
|
|
|
/// \brief Get face-varying interpolation rule
|
2014-10-10 02:36:25 +00:00
|
|
|
FVarLinearInterpolation GetFVarLinearInterpolation() const { return (FVarLinearInterpolation) _fvarLinInterp; }
|
2014-12-12 19:10:17 +00:00
|
|
|
|
|
|
|
/// \brief Set face-varying interpolation rule
|
2014-10-10 02:36:25 +00:00
|
|
|
void SetFVarLinearInterpolation(FVarLinearInterpolation b) { _fvarLinInterp = b; }
|
2014-09-05 22:07:46 +00:00
|
|
|
|
2014-12-12 19:10:17 +00:00
|
|
|
/// \brief Get edge crease rule
|
2014-09-05 22:07:46 +00:00
|
|
|
CreasingMethod GetCreasingMethod() const { return (CreasingMethod) _creasingMethod; }
|
2014-12-12 19:10:17 +00:00
|
|
|
|
|
|
|
/// \brief Set edge crease rule
|
2014-09-05 22:07:46 +00:00
|
|
|
void SetCreasingMethod(CreasingMethod c) { _creasingMethod = c; }
|
|
|
|
|
2014-12-12 19:10:17 +00:00
|
|
|
/// \brief Get triangle subdivsion weights rule (Catmark scheme only !)
|
2014-09-05 22:07:46 +00:00
|
|
|
TriangleSubdivision GetTriangleSubdivision() const { return (TriangleSubdivision) _triangleSub; }
|
2014-12-12 19:10:17 +00:00
|
|
|
|
|
|
|
/// \brief Set triangle subdivsion weights rule (Catmark scheme only !)
|
2014-09-05 22:07:46 +00:00
|
|
|
void SetTriangleSubdivision(TriangleSubdivision t) { _triangleSub = t; }
|
|
|
|
|
|
|
|
private:
|
2014-12-12 19:10:17 +00:00
|
|
|
|
2014-09-05 22:07:46 +00:00
|
|
|
// Bitfield members:
|
2014-12-12 19:10:17 +00:00
|
|
|
unsigned int _vtxBoundInterp : 2,
|
2014-12-09 23:03:37 +00:00
|
|
|
_fvarLinInterp : 3,
|
|
|
|
_creasingMethod : 2,
|
|
|
|
_triangleSub : 2;
|
2014-09-05 22:07:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace sdc
|
|
|
|
|
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
using namespace OPENSUBDIV_VERSION;
|
|
|
|
} // end namespace OpenSubdiv
|
|
|
|
|
2015-05-19 18:22:37 +00:00
|
|
|
#endif /* OPENSUBDIV3_SDC_OPTIONS_H */
|