25#ifndef OPENSUBDIV3_BFR_TESSELLATION_H
26#define OPENSUBDIV3_BFR_TESSELLATION_H
28#include "../version.h"
30#include "../bfr/parameterization.h"
33namespace OPENSUBDIV_VERSION {
67 Options() : _preserveQuads(false), _facetSize4(false),
68 _coordStride(0), _facetStride(0) { }
93 unsigned int _preserveQuads : 1;
94 unsigned int _facetSize4 : 1;
205 int GetNumCoords()
const {
return _numInteriorPoints + _numBoundaryPoints; }
221 template <
typename REAL>
225 template <
typename REAL>
229 template <
typename REAL>
233 template <
typename REAL>
238 template <
typename REAL>
290 int const boundaryIndices[],
295 int const boundaryIndices[],
296 int const interiorIndices[]);
302 int nRates,
int const rates[],
Options const & options);
305 int nRates,
int const rates[],
Options const & options);
307 void initializeDefaults();
308 int initializeRates(
int nRates,
int const rates[]);
309 void initializeInventoryForParamTri(
int sumOfOuterRates);
310 void initializeInventoryForParamQuad(
int sumOfOuterRates);
311 void initializeInventoryForParamQPoly(
int sumOfOuterRates);
317 unsigned short _isValid : 1;
318 unsigned short _isUniform : 1;
319 unsigned short _triangulate : 1;
320 unsigned short _singleFace : 1;
321 unsigned short _segmentedFace : 1;
322 unsigned short _triangleFan : 1;
323 unsigned short _splitQuad : 1;
330 int _numBoundaryPoints;
331 int _numInteriorPoints;
336 int _outerRatesLocal[4];
349 _facetSize4 = (numIndices == 4);
354 _facetStride = (short) stride;
359 _coordStride = (short) stride;
363template <
typename REAL>
370template <
typename REAL>
381using namespace OPENSUBDIV_VERSION;
Simple class defining the 2D parameterization of a face.
int GetFaceSize() const
Returns the size (number of vertices) of the corresponding face.
void GetVertexCoord(int vertexIndex, REAL uvCoord[2]) const
Returns the (u,v) coordinate of a given vertex.
Encapsulates a specific tessellation pattern of a Parameterization.
int GetFaceSize() const
Return the size of the face.
int GetNumBoundaryCoords() const
Return the number of boundary coordinates.
void TransformFacetCoordIndices(int facetTuples[], int const boundaryIndices[], int const interiorIndices[])
Reassign all facet coordinate indices.
int GetCoordStride() const
Return the number of elements between each coordinate.
int GetNumEdgeCoords(int edge) const
Return the number of coordinates within a given edge (excluding those at its end vertices)
int GetInteriorCoords(REAL coordTuples[]) const
Retrieve the coordinates for the boundary.
int GetFacetStride() const
Return the number of elements between each facet.
bool IsUniform() const
Return if the pattern is uniform.
int GetNumCoords() const
Return the number of coordinates in the entire pattern.
int GetCoords(REAL coordTuples[]) const
Retrieve the coordinates for the entire pattern.
void TransformFacetCoordIndices(int facetTuples[], int commonOffset)
Apply a common offset to all facet coordinate indices.
Tessellation(Parameterization const &p, int numRates, int const rates[], Options const &options=Options())
General constructor providing multiple tessellation rates for a non-uniform tessellation.
Parameterization GetParameterization() const
Return the Parameterization.
void TransformFacetCoordIndices(int facetTuples[], int const boundaryIndices[], int interiorOffset)
Reassign indices of boundary coordinates while offseting those of interior coordinates.
int GetFacetSize() const
Return the number of indices assigned to each facet.
Tessellation()=delete
Default construction is unavailable.
Tessellation(Parameterization const &p, int uniformRate, Options const &options=Options())
Simple constructor providing a single uniform tessellation rate.
int GetFacets(int facetTuples[]) const
Retrieve the facet indices for the entire pattern.
int GetNumFacets() const
Return the number of facets in the entire pattern.
int GetNumInteriorCoords() const
Return the number of interior coordinates.
int GetVertexCoord(int vertex, REAL coordTuples[]) const
Retrieve the coordinate for a given vertex of the face.
int GetBoundaryCoords(REAL coordTuples[]) const
Retrieve the coordinates for the boundary.
Tessellation(Tessellation const &)=delete
int GetRates(int rates[]) const
Retrieve the rates assigned.
bool IsValid() const
Return true if correctly initialized.
Tessellation & operator=(Tessellation const &)=delete
int GetEdgeCoords(int edge, REAL coordTuples[]) const
Retrieve the coordinates for a given edge of the face (excluding those at its end vertices)
Options configure a Tessellation to specify the nature of both its results and the structure of the c...
int GetCoordStride() const
Return the stride between (u,v) pairs.
Options & SetFacetSize(int numIndices)
Assign the number of indices per facet (must be 3 or 4, default is 3)
int GetFacetStride() const
Return the stride between facets.
Options & SetCoordStride(int stride)
Assign the stride between (u,v) pairs (default is 2)
Options & SetFacetStride(int stride)
Assign the stride between facets (default is facet size)
bool PreserveQuads() const
Return if preservation of quads is set.