本文整理汇总了C++中SubMesh::getVerticesSize方法的典型用法代码示例。如果您正苦于以下问题:C++ SubMesh::getVerticesSize方法的具体用法?C++ SubMesh::getVerticesSize怎么用?C++ SubMesh::getVerticesSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubMesh
的用法示例。
在下文中一共展示了SubMesh::getVerticesSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateSkinning
void FixedRenderer::updateSkinning(Mesh * mesh, Armature * armature)
{
unsigned int s;
unsigned int sSize = mesh->getSubMeshsNumber();
for(s=0; s<sSize; s++)
{
SubMesh * subMesh = &mesh->getSubMeshs()[s];
// data
Vector3 * vertices = subMesh->getVertices();
if(! vertices)
continue;
SkinData * skinData = subMesh->getSkinData();
if(armature && skinData)
{
unsigned int verticesSize = subMesh->getVerticesSize();
Vector3 * skinVertices = getVertices(verticesSize);
computeSkinning(armature, skinData, vertices, NULL, NULL, skinVertices, NULL, NULL);
subMesh->getBoundingBox()->initFromPoints(skinVertices, verticesSize);
}
}
mesh->updateBoundingBox();
}
示例2: createSubMesh
//.........这里部分代码省略.........
if(nodeMesh->mTangents)
{
Vector3 * tangents = subMesh->allocTangents(nodeMesh->mNumVertices);
for(i=0; i<nodeMesh->mNumVertices; i++)
tangents[i] = matrix.getRotatedVector3(Vector3(nodeMesh->mTangents[i].x, nodeMesh->mTangents[i].y, nodeMesh->mTangents[i].z)).getNormalized();
}
// colors
if(nodeMesh->mColors[0])
{
Color * colors = subMesh->allocColors(nodeMesh->mNumVertices);
for(i=0; i<nodeMesh->mNumVertices; i++)
colors[i] = Color(nodeMesh->mColors[0][i].r, nodeMesh->mColors[0][i].g, nodeMesh->mColors[0][i].b, nodeMesh->mColors[0][i].a);
}
// uvcoords
{
unsigned int t, nb_texLayers = 0;
for(t=0; t<AI_MAX_NUMBER_OF_TEXTURECOORDS; t++)
{
if(nodeMesh->mTextureCoords[t])
nb_texLayers++;
}
Vector2 * uvCoords = subMesh->allocTexCoords(nodeMesh->mNumVertices*nb_texLayers);
nb_texLayers = 0;
for(t=0; t<AI_MAX_NUMBER_OF_TEXTURECOORDS; t++)
{
if(nodeMesh->mTextureCoords[t])
{
unsigned int offset = nodeMesh->mNumVertices*nb_texLayers;
subMesh->setMapChannelOffset(t, offset);
for(i=0; i<nodeMesh->mNumVertices; i++){
uvCoords[offset+i] = Vector2(nodeMesh->mTextureCoords[t][i].x, 1-nodeMesh->mTextureCoords[t][i].y);
}
nb_texLayers++;
}
}
}
// indices
{
unsigned int f;
if(nodeMesh->mNumVertices < 65536)
{
unsigned short * indices = (unsigned short *)subMesh->allocIndices(nodeMesh->mNumFaces*3, VAR_USHORT);
for(f=0; f<nodeMesh->mNumFaces; f++)
{
aiFace * face = &nodeMesh->mFaces[f];
for(i=0; i<3; i++){
indices[f*3+i] = face->mIndices[i];
}
}
}
else
{
unsigned int * indices = (unsigned int *)subMesh->allocIndices(nodeMesh->mNumFaces*3, VAR_UINT);
for(f=0; f<nodeMesh->mNumFaces; f++)
{
aiFace * face = &nodeMesh->mFaces[f];
for(i=0; i<3; i++){
indices[f*3+i] = face->mIndices[i];
}
}
}
}
// bones
initBones(scene, nodeMesh, mesh, subMesh);
// display
subMesh->allocDisplays(1);
MaterialDisplay * display = subMesh->addNewDisplay(PRIMITIVE_TRIANGLES, 0, subMesh->getIndicesSize());
display->setMaterial(mesh->getMaterial(nodeMesh->mMaterialIndex));
// cull mode
int twosided = 0;
aiMaterial * mtl = scene->mMaterials[nodeMesh->mMaterialIndex];
if(AI_SUCCESS == aiGetMaterialInteger(mtl, AI_MATKEY_TWOSIDED, &twosided))
{
if(twosided != 0)
display->setCullMode(CULL_NONE);
}
// bounding box
subMesh->getBoundingBox()->initFromPoints(vertices, subMesh->getVerticesSize());
(*count)++;
}
for(unsigned int n=0; n<nd->mNumChildren; n++)
createSubMesh(scene, nd->mChildren[n], mesh, subMeshs, count, matrix);
}