本文整理汇总了C++中CConversionMesh::AddEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ CConversionMesh::AddEdge方法的具体用法?C++ CConversionMesh::AddEdge怎么用?C++ CConversionMesh::AddEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConversionMesh
的用法示例。
在下文中一共展示了CConversionMesh::AddEdge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadSIAShape
//.........这里部分代码省略.........
}
pMesh->AddVertex(v[0], v[1], v[2]);
}
else if (tstrncmp(pszToken, _T("-edge"), 5) == 0)
{
if (m_pWorkListener)
{
if (sLastTask == pszToken)
m_pWorkListener->WorkProgress(0);
else
{
m_pWorkListener->SetAction(_T("Reading edge data"), 0);
sLastTask = tstring(pszToken);
}
}
// An edge. We only need them so we can tell where the creases are, so we can calculate normals properly.
int e[2];
// scanf is pretty slow even for such a short string due to lots of mallocs.
const tchar* pszToken = pszLine+5;
int iDimension = 0;
while (*pszToken)
{
while (pszToken[0] == _T(' '))
pszToken++;
e[iDimension++] = (int)stoi(pszToken);
if (iDimension >= 2)
break;
while (pszToken[0] != _T(' '))
pszToken++;
}
pMesh->AddEdge(e[0]+iAddV, e[1]+iAddV);
}
else if (tstrncmp(pszToken, _T("-creas"), 6) == 0)
{
// An edge. We only need them so we can tell where the creases are, so we can calculate normals properly.
tstring sCreases = pszLine+7;
eastl::vector<tstring> aCreases;
tstrtok(sCreases, aCreases, _T(" "));
size_t iCreases = aCreases.size();
// The first one is the number of creases, skip it
for (size_t i = 1; i < iCreases; i++)
{
int iEdge = stoi(aCreases[i].c_str());
pMesh->GetEdge(iEdge+iAddE)->m_bCreased = true;
}
}
else if (tstrncmp(pszToken, _T("-setmat"), 7) == 0)
{
const tchar* pszMaterial = pszLine+8;
size_t iNewMaterial = stoi(pszMaterial);
if (iNewMaterial == (size_t)(-1))
iCurrentMaterial = ~0;
else
{
CConversionMaterial* pMaterial = m_pScene->GetMaterial(iNewMaterial);
if (pMaterial)
{
iCurrentMaterial = pMesh->FindMaterialStub(pMaterial->GetName());
if (iCurrentMaterial == (size_t)~0)
{
size_t iMaterialStub = pMesh->AddMaterialStub(pMaterial->GetName());
示例2: ReadSIAShape
//.........这里部分代码省略.........
}
pMesh->AddVertex(v[0], v[1], v[2]);
}
else if (tstrncmp(pszToken, "-edge", 5) == 0)
{
if (m_pWorkListener)
{
if (sLastTask == pszToken)
m_pWorkListener->WorkProgress(0);
else
{
m_pWorkListener->SetAction("Reading edge data", 0);
sLastTask = tstring(pszToken);
}
}
// An edge. We only need them so we can tell where the creases are, so we can calculate normals properly.
int e[2];
// scanf is pretty slow even for such a short string due to lots of mallocs.
const tchar* pszToken = pszLine+5;
int iDimension = 0;
while (*pszToken)
{
while (pszToken[0] == ' ')
pszToken++;
e[iDimension++] = (int)stoi(pszToken);
if (iDimension >= 2)
break;
while (pszToken[0] != ' ')
pszToken++;
}
pMesh->AddEdge(e[0]+iAddV, e[1]+iAddV);
}
else if (tstrncmp(pszToken, "-creas", 6) == 0)
{
// An edge. We only need them so we can tell where the creases are, so we can calculate normals properly.
tstring sCreases = pszLine+7;
tvector<tstring> aCreases;
tstrtok(sCreases, aCreases, " ");
size_t iCreases = aCreases.size();
// The first one is the number of creases, skip it
for (size_t i = 1; i < iCreases; i++)
{
int iEdge = stoi(aCreases[i].c_str());
pMesh->GetEdge(iEdge+iAddE)->m_bCreased = true;
}
}
else if (tstrncmp(pszToken, "-setmat", 7) == 0)
{
const tchar* pszMaterial = pszLine+8;
size_t iNewMaterial = stoi(pszMaterial);
if (iNewMaterial == (size_t)(-1))
iCurrentMaterial = ~0;
else
{
CConversionMaterial* pMaterial = m_pScene->GetMaterial(iNewMaterial);
if (pMaterial)
{
iCurrentMaterial = pMesh->FindMaterialStub(pMaterial->GetName());
if (iCurrentMaterial == (size_t)~0)
{
size_t iMaterialStub = pMesh->AddMaterialStub(pMaterial->GetName());