25#ifndef OPENSUBDIV3_BFR_VERTEX_DESCRIPTOR_H
26#define OPENSUBDIV3_BFR_VERTEX_DESCRIPTOR_H
28#include "../version.h"
30#include "../vtr/stackBuffer.h"
33namespace OPENSUBDIV_VERSION {
239 float trailingEdgeSharp);
278 float * leadingEdgeSharp,
float * trailingEdgeSharp)
const;
283 friend class FaceVertex;
288 typedef Vtr::internal::StackBuffer<int,8,true> IntBuffer;
289 typedef Vtr::internal::StackBuffer<float,16,true> FloatBuffer;
291 void initFaceSizes();
292 void initEdgeSharpness();
298 unsigned short _isValid : 1;
299 unsigned short _isInitialized : 1;
300 unsigned short _isFinalized : 1;
302 unsigned short _isManifold : 1;
303 unsigned short _isBoundary : 1;
305 unsigned short _hasFaceSizes : 1;
306 unsigned short _hasEdgeSharpness : 1;
309 float _vertSharpness;
311 FloatBuffer _faceEdgeSharpness;
312 IntBuffer _faceSizeOffsets;
326 _isManifold = isManifold;
335 _isBoundary = isBoundary;
347 return _hasFaceSizes;
351 _hasFaceSizes =
false;
357 if (!_hasFaceSizes) initFaceSizes();
359 _faceSizeOffsets[incFaceIndex] = faceSize;
364 return _isFinalized ?
365 (_faceSizeOffsets[incFaceIndex+1] - _faceSizeOffsets[incFaceIndex]) :
366 _faceSizeOffsets[incFaceIndex];
374 return _vertSharpness > 0.0f;
378 _vertSharpness = 0.0f;
383 _vertSharpness = vertSharpness;
387 return _vertSharpness;
395 return _hasEdgeSharpness;
399 _hasEdgeSharpness =
false;
405 if (!_hasEdgeSharpness) initEdgeSharpness();
408 if (edgeIndex < _numFaces) {
409 _faceEdgeSharpness[2*edgeIndex] = sharpness;
414 _faceEdgeSharpness[2*edgeIndex-1] = sharpness;
416 _faceEdgeSharpness[2*_numFaces-1] = sharpness;
423 return _faceEdgeSharpness[2*edgeIndex - (edgeIndex == _numFaces)];
428 float leadingEdgeSharpness,
float trailingEdgeSharpness) {
430 if (!_hasEdgeSharpness) initEdgeSharpness();
432 _faceEdgeSharpness[2*faceIndex ] = leadingEdgeSharpness;
433 _faceEdgeSharpness[2*faceIndex+1] = trailingEdgeSharpness;
437 float * leadingEdgeSharpness,
float * trailingEdgeSharpness)
const {
439 *leadingEdgeSharpness = _faceEdgeSharpness[2*faceIndex];
440 *trailingEdgeSharpness = _faceEdgeSharpness[2*faceIndex+1];
446using namespace OPENSUBDIV_VERSION;
Simple class used by subclasses of SurfaceFactory to describe a vertex.
float GetVertexSharpness() const
Return the sharpness of the vertex.
bool Finalize()
Terminate the sequence of specifications.
void SetManifold(bool isManifold)
Declare the vertex neighborhood as manifold (ordered)
bool Initialize(int numIncidentFaces)
Initialize specification with the number of incident faces.
bool IsManifold() const
Return if vertex neighborhood is manifold.
bool HasEdgeSharpness() const
Return if sharpness was assigned to the incident edges.
int GetIncidentFaceSize(int faceIndex) const
Return the size of an incident face.
float GetManifoldEdgeSharpness(int edgeIndex) const
Return the sharpness assigned to a manifold edge.
void SetIncidentFaceEdgeSharpness(int faceIndex, float leadingEdgeSharp, float trailingEdgeSharp)
Assign sharpness to the edges of an incident face.
bool HasVertexSharpness() const
Return if sharpness was assigned to the vertex.
void ClearIncidentFaceSizes()
Remove any assigned sizes of incident faces.
void SetVertexSharpness(float sharpness)
Assign sharpness to the vertex.
void ClearVertexSharpness()
Remove any sharpness assigned to the vertex.
void ClearEdgeSharpness()
Remove any sharpness assigned to the incident edges.
void GetIncidentFaceEdgeSharpness(int faceIndex, float *leadingEdgeSharp, float *trailingEdgeSharp) const
Return the sharpness assigned to edges of an incident face.
bool IsBoundary() const
Return if vertex neighborhood is on a boundary.
bool IsValid() const
Return if instance is valid.
bool HasIncidentFaceSizes() const
Return if the sizes of incident faces are assigned.
void SetBoundary(bool isOnBoundary)
Declare the vertex neighborhood as being on a boundary.
void SetIncidentFaceSize(int faceIndex, int faceSize)
Assign the size of an incident face.
void SetManifoldEdgeSharpness(int edgeIndex, float edgeSharpness)
Assign sharpness to the edge of a manifold neighborhood.