当前位置: 首页>>代码示例>>C++>>正文


C++ CConversionMesh::AddEdge方法代码示例

本文整理汇总了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());
开发者ID:dfk789,项目名称:CodenameInfinite,代码行数:67,代码来源:silo.cpp

示例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());
开发者ID:BSVino,项目名称:SMAK,代码行数:67,代码来源:silo.cpp


注:本文中的CConversionMesh::AddEdge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。