本文整理汇总了C++中GeometryPtr::AddIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryPtr::AddIndex方法的具体用法?C++ GeometryPtr::AddIndex怎么用?C++ GeometryPtr::AddIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeometryPtr
的用法示例。
在下文中一共展示了GeometryPtr::AddIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exception
//.........这里部分代码省略.........
int faceSize = -1;
for(int f = 0; f < d.elementCount; ++f)
{
void** raw = d.data.at(f);
PlyDataArray<int>* idxs = reinterpret_cast<PlyDataArray<int>*>(raw[0]);
if( -1 == faceSize)
faceSize = idxs->length;
else if(faceSize != idxs->length)
throw new std::exception("Expected each face to have the same number of indexes");
}
if(withAdjacency)
{
MeshPtr->SetPrimitiveType( (D3D11_PRIMITIVE_TOPOLOGY)(D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + ((2*faceSize) - 1)) );
// Grab all of the faces so we can search for adjacency
int* pRaw = new int[d.elementCount * faceSize];
int pRawIdx = 0;
for(int f = 0; f < d.elementCount; ++f)
{
void** raw = d.data.at(f);
PlyDataArray<int>* idxs = reinterpret_cast<PlyDataArray<int>*>(raw[0]);
for(unsigned int fi = 0; fi < idxs->length; ++fi)
pRaw[pRawIdx++] = idxs->data[fi];
}
// We can now go and add the actual indices
for(int f = 0; f < (d.elementCount * faceSize); f+=3)
{
MeshPtr->AddIndex( pRaw[f + 0] );
MeshPtr->AddIndex( pRaw[f + 1] );
MeshPtr->AddIndex( pRaw[f + 2] );
// We now need to find an adjacency for each
// edge where possible
int a0 = FindAdjacentIndex( pRaw[f + 0], pRaw[f + 1], pRaw[f + 2], pRaw, d.elementCount * faceSize );
int a1 = FindAdjacentIndex( pRaw[f + 1], pRaw[f + 2], pRaw[f + 0], pRaw, d.elementCount * faceSize );
int a2 = FindAdjacentIndex( pRaw[f + 2], pRaw[f + 0], pRaw[f + 1], pRaw, d.elementCount * faceSize );
std::wstringstream out;
out << "Actual indices <" << pRaw[f+0] << ", " << pRaw[f+1] << ", " << pRaw[f+2] << "> have adjacency <" << a0 << ", " << a1 << ", " << a2 << ">.";
OutputDebugString( out.str().c_str() );
OutputDebugString( L"\n" );
MeshPtr->AddIndex( a0 );
MeshPtr->AddIndex( a1 );
MeshPtr->AddIndex( a2 );
}
delete[] pRaw;
}
else
{
// Thirdly, can now set the appropriate topology
MeshPtr->SetPrimitiveType( (D3D11_PRIMITIVE_TOPOLOGY)(D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST + (faceSize - 1)) );
// Finally, extract this data
for(int f = 0; f < d.elementCount; ++f)
{
void** raw = d.data.at(f);
PlyDataArray<int>* idxs = reinterpret_cast<PlyDataArray<int>*>(raw[0]);