本文整理汇总了C++中SubMesh::Build方法的典型用法代码示例。如果您正苦于以下问题:C++ SubMesh::Build方法的具体用法?C++ SubMesh::Build怎么用?C++ SubMesh::Build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubMesh
的用法示例。
在下文中一共展示了SubMesh::Build方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Build
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
bool Mesh::Build(const MeshDescriptor& in_meshDesc)
{
bool bSuccess = true;
//set the bounds
SetBounds(in_meshDesc.mvMinBounds, in_meshDesc.mvMaxBounds);
if (in_meshDesc.mFeatures.mbHasAnimationData == true)
{
m_skeleton = SkeletonUPtr(new Skeleton());
m_skeleton->Build(in_meshDesc.m_skeletonDesc);
}
//iterate through each mesh
int count = 0;
for (auto it = in_meshDesc.mMeshes.begin(); it != in_meshDesc.mMeshes.end(); ++it)
{
//caclulate the mesh capacities
u32 udwVertexDataCapacity = it->mudwNumVertices * in_meshDesc.mVertexDeclaration.GetTotalSize();
u32 udwIndexDataCapacity = it->mudwNumIndices * in_meshDesc.mudwIndexSize;
//prepare the mesh if it needs it, otherwise just update the vertex and index declarations.
SubMesh* newSubMesh = CreateSubMesh(it->mstrName);
newSubMesh->Prepare(Core::Application::Get()->GetRenderSystem(), in_meshDesc.mVertexDeclaration, in_meshDesc.mudwIndexSize, udwVertexDataCapacity, udwIndexDataCapacity, BufferAccess::k_read, it->ePrimitiveType);
//check that the buffers are big enough to hold this data. if not throw an error.
if (udwVertexDataCapacity <= newSubMesh->GetInternalMeshBuffer()->GetVertexCapacity() &&
udwIndexDataCapacity <= newSubMesh->GetInternalMeshBuffer()->GetIndexCapacity())
{
newSubMesh->Build(it->mpVertexData, it->mpIndexData, it->mudwNumVertices, it->mudwNumIndices, it->mvMinBounds, it->mvMaxBounds);
}
else
{
CS_LOG_ERROR("Sub mesh data exceeds its buffer capacity. Mesh will return empty!");
bSuccess = false;
}
//add the skeleton controller
if (in_meshDesc.mFeatures.mbHasAnimationData == true)
{
InverseBindPosePtr ibp(new InverseBindPose());
ibp->mInverseBindPoseMatrices = it->mInverseBindPoseMatrices;
newSubMesh->SetInverseBindPose(ibp);
}
count++;
}
CalcVertexAndIndexCounts();
//return success
return bSuccess;
}