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


C++ SubMesh::GetInternalMeshBuffer方法代码示例

本文整理汇总了C++中SubMesh::GetInternalMeshBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ SubMesh::GetInternalMeshBuffer方法的具体用法?C++ SubMesh::GetInternalMeshBuffer怎么用?C++ SubMesh::GetInternalMeshBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SubMesh的用法示例。


在下文中一共展示了SubMesh::GetInternalMeshBuffer方法的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;
 }
开发者ID:DNSMorgan,项目名称:ChilliSource,代码行数:55,代码来源:Mesh.cpp


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