Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将BMAX LOD逻辑应用到C++ #10

Open
LiXizhi opened this issue Jun 19, 2017 · 2 comments
Open

将BMAX LOD逻辑应用到C++ #10

LiXizhi opened this issue Jun 19, 2017 · 2 comments
Assignees
Labels

Comments

@LiXizhi
Copy link
Contributor

LiXizhi commented Jun 19, 2017

image

放到这里, 默认开启。

注意不需要转ParaX文件了, 直接变成1-3个内存对象即可。

@LiXizhi
Copy link
Contributor Author

LiXizhi commented Jul 11, 2017

BMAXParser 接口

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

@LiXizhi
Copy link
Contributor Author

LiXizhi commented Jul 13, 2017

// 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

@LiXizhi LiXizhi added the bug label Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants