OpenSubdiv.OPENSUBDIV_VERSION.Bfr
OpenSubdiv.OPENSUBDIV_VERSION.Far
OpenSubdiv.OPENSUBDIV_VERSION.Osd
OpenSubdiv.OPENSUBDIV_VERSION.Sdc
OpenSubdiv.OPENSUBDIV_VERSION.Vtr

OpenSubdiv.OPENSUBDIV_VERSION.Far.StencilTable

简介

OpenSubdiv.OPENSUBDIV_VERSION.Far.StencilTable是用于存储Subdivision Surface(细分曲面)的建模过程中的Stencil数据的类。StencilTable存储了每个控制点的邻域信息,以便在构建细分曲面的过程中使用。

构造函数

Far::StencilTable::StencilTable(int numStencils, int const * sizes, unsigned char const * offsets, unsigned char const * indices, float const * weights);
  • 参数:
    • numStencils:Stencil的数量
    • sizes:每个Stencil的大小,即元素数量
    • offsets:每个Stencil的偏移量,即该Stencil在indices数组中的下标
    • indices:Stencil中每个元素的在控制点数组中的下标
    • weights:Stencil中每个元素的权重值

方法

GetNumStencils

int GetNumStencils() const;
  • 返回Stencil的数量

GetSizes

int const * GetSizes() const;
  • 返回每个Stencil的大小数组

GetOffsets

unsigned char const * GetOffsets() const;
  • 返回每个Stencil的偏移量数组

GetIndices

unsigned char const * GetIndices() const;
  • 返回Stencil中控制点下标数组

GetWeights

float const * GetWeights() const;
  • 返回Stencil中各个控制点的权重值数组

示例

Far::StencilTable const * stencilTable = 
    factory->CreateStencilTable(vertexBuffer, patchTable);

int numStencils = stencilTable->GetNumStencils();
int const * sizes = stencilTable->GetSizes();
unsigned char const * offsets = stencilTable->GetOffsets();
unsigned char const * indices = stencilTable->GetIndices();
float const * weights = stencilTable->GetWeights();

参考