24#ifndef OPENSUBDIV3_VTR_COMPONENT_INTERFACES_H
25#define OPENSUBDIV3_VTR_COMPONENT_INTERFACES_H
27#include "../version.h"
29#include "../sdc/types.h"
30#include "../sdc/crease.h"
31#include "../vtr/types.h"
32#include "../vtr/stackBuffer.h"
38namespace OPENSUBDIV_VERSION {
59 FaceInterface(
int vertCount) : _vertCount(vertCount) { }
63 int GetNumVertices()
const {
return _vertCount; }
76 EdgeInterface(Level
const& level) : _level(&level) { }
79 void SetIndex(
int edgeIndex) { _eIndex = edgeIndex; }
82 int GetNumFaces()
const {
return _level->getEdgeFaces(_eIndex).size(); }
83 float GetSharpness()
const {
return _level->getEdgeSharpness(_eIndex); }
85 void GetChildSharpnesses(Sdc::Crease
const&,
float s[2])
const {
87 s[0] = s[1] = GetSharpness() - 1.0f;
90 void GetNumVerticesPerFace(
int vertsPerFace[])
const {
92 for (
int i = 0; i < eFaces.size(); ++i) {
93 vertsPerFace[i] = _level->getFaceVertices(eFaces[i]).size();
107class VertexInterface {
109 VertexInterface() { }
110 VertexInterface(Level
const& parent, Level
const& child) : _parent(&parent), _child(&child) { }
111 ~VertexInterface() { }
113 void SetIndex(
int parentIndex,
int childIndex) {
114 _pIndex = parentIndex;
115 _cIndex = childIndex;
116 _eCount = _parent->getVertexEdges(_pIndex).size();
117 _fCount = _parent->getVertexFaces(_pIndex).size();
121 int GetNumEdges()
const {
return _eCount; }
122 int GetNumFaces()
const {
return _fCount; }
124 float GetSharpness()
const {
return _parent->getVertexSharpness(_pIndex); }
125 float* GetSharpnessPerEdge(
float pSharpness[])
const {
127 for (
int i = 0; i < _eCount; ++i) {
128 pSharpness[i] = _parent->getEdgeSharpness(pEdges[i]);
133 float GetChildSharpness(Sdc::Crease
const&)
const {
return _child->getVertexSharpness(_cIndex); }
134 float* GetChildSharpnessPerEdge(Sdc::Crease
const& crease,
float cSharpness[])
const {
135 internal::StackBuffer<float,16> pSharpness(_eCount);
136 GetSharpnessPerEdge(pSharpness);
137 crease.SubdivideEdgeSharpnessesAroundVertex(_eCount, pSharpness, cSharpness);
142 const Level* _parent;
155using namespace OPENSUBDIV_VERSION;
ConstArray< Index > ConstIndexArray