本文整理汇总了C++中TriangleMesh::addTriangle方法的典型用法代码示例。如果您正苦于以下问题:C++ TriangleMesh::addTriangle方法的具体用法?C++ TriangleMesh::addTriangle怎么用?C++ TriangleMesh::addTriangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriangleMesh
的用法示例。
在下文中一共展示了TriangleMesh::addTriangle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
//.........这里部分代码省略.........
: presentation->getNode()->getMaterial(i);
video::ITexture* t=irrMaterial.getTexture(0);
const Material* material=0;
TriangleMesh *tmesh = triangle_mesh;
if(t)
{
std::string image =
std::string(core::stringc(t->getName()).c_str());
material = material_manager
->getMaterial(StringUtils::getBasename(image));
if(material->isIgnore())
continue;
}
u16 *mbIndices = mb->getIndices();
Vec3 vertices[3];
Vec3 normals[3];
if (mb->getVertexType() == video::EVT_STANDARD)
{
irr::video::S3DVertex* mbVertices =
(video::S3DVertex*)mb->getVertices();
for(unsigned int j=0; j<mb->getIndexCount(); j+=3)
{
for(unsigned int k=0; k<3; k++)
{
int indx=mbIndices[j+k];
core::vector3df v = mbVertices[indx].Pos;
//mat.transformVect(v);
vertices[k]=v;
normals[k]=mbVertices[indx].Normal;
} // for k
if(tmesh) tmesh->addTriangle(vertices[0], vertices[1],
vertices[2], normals[0],
normals[1], normals[2],
material );
} // for j
}
else
{
if (mb->getVertexType() == video::EVT_2TCOORDS)
{
irr::video::S3DVertex2TCoords* mbVertices =
(video::S3DVertex2TCoords*)mb->getVertices();
for(unsigned int j=0; j<mb->getIndexCount(); j+=3)
{
for(unsigned int k=0; k<3; k++)
{
int indx=mbIndices[j+k];
core::vector3df v = mbVertices[indx].Pos;
//mat.transformVect(v);
vertices[k]=v;
normals[k]=mbVertices[indx].Normal;
} // for k
if(tmesh) tmesh->addTriangle(vertices[0], vertices[1],
vertices[2], normals[0],
normals[1], normals[2],
material );
} // for j
}
}
} // for i<getMeshBufferCount
triangle_mesh->createCollisionShape();