Open LiXizhi opened 7 years ago
BMaxParser p(myFile.getBuffer(), myFile.getSize());
-- calling the ParseParaXModel the first time does not process LOD
lod.m_pParaXMesh = p.ParseParaXModel();
if( lod.m_pParaXMesh.GetVerticeCount() > XXXX) then
-- add a new lod : only process LOD related info, when it is queried the first time.
lod1.m_pParaXMesh = p.ParseLODParaXModel(nMaxTriangleCount);
---
lod2.m_pParaXMesh = p.ParseLODParaXModel(nMaxTriangleCount);
end
// block max model.
BMaxParser p(myFile.getBuffer(), myFile.getSize());
lod.m_pParaXMesh = p.ParseParaXModel();
auto pParaXMesh = lod.m_pParaXMesh;
if (m_MeshLODs.size() == 1)
{
// each LOD at least cut triangle count in half and no bigger than a given count.
const int nLodsMaxTriangleCounts[] = { 2000, 500, 100};
for (int i = 0; pParaXMesh && i < sizeof(nLodsMaxTriangleCounts)/sizeof(int); i++)
{
if ((int)pParaXMesh->GetPolyCount() >= nLodsMaxTriangleCounts[i])
{
MeshLOD lod;
lod.m_pParaXMesh = p.ParseParaXModel(std::min(nLodsMaxTriangleCounts[i], (int)(pParaXMesh->GetObjectNum().nVertices / 2)));
lod.m_fromDepthSquared = (float)(((30+i)*30) ^ 2);
if (lod.m_pParaXMesh)
{
pParaXMesh = lod.m_pParaXMesh;
pMeshLODs.push_back(lod);
}
}
}
}
This is how i used it. but...
遇到一个问题。 是否可以反复的使用p.ParserParaXModel(n) 可能前一次的中间数据结构没有清空。 导致,每次调用Triangle数量反而增多了。
@Winless
放到这里, 默认开启。
注意不需要转ParaX文件了, 直接变成1-3个内存对象即可。