本文整理汇总了C++中ogre::MeshPtr::getBoundingSphereRadius方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::getBoundingSphereRadius方法的具体用法?C++ MeshPtr::getBoundingSphereRadius怎么用?C++ MeshPtr::getBoundingSphereRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::getBoundingSphereRadius方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadAutomaticLod
void LodManager::loadAutomaticLod(Ogre::MeshPtr mesh)
{
LodConfig lodConfigs;
lodConfigs.mesh = mesh;
mesh->setLodStrategy(&Ogre::PixelCountLodStrategy::getSingleton());
LodLevel lodLevel;
lodLevel.reductionMethod = LodLevel::VRM_COLLAPSE_COST;
Ogre::Real radius = mesh->getBoundingSphereRadius();
for (int i = 2; i < 6; i++) {
Ogre::Real i4 = (Ogre::Real) (i * i * i * i);
Ogre::Real i5 = i4 * (Ogre::Real) i;
// Distance = pixel count
// Constant: zoom of the Lod. This could be scaled based on resolution.
// Higher constant means first Lod is nearer to camera. Smaller constant means the first Lod is further away from camera.
// i4: The stretching. Normally you want to have more Lods in the near, then in far away.
// i4 means distance is divided by 16=(2*2*2*2), 81, 256, 625=(5*5*5*5).
// if 16 would be smaller, the first Lod would be nearer. if 625 would be bigger, the last Lod would be further awaay.
// if you increase 16 and decrease 625, first and Last Lod distance would be smaller.
lodLevel.distance = 3388608.f / i4;
// reductionValue = collapse cost
// Radius: Edges are multiplied by the length, when calculating collapse cost. So as a base value we use radius, which should help in balancing collapse cost to any mesh size.
// The constant and i5 are playing together. 1/(1/100k*i5)
// You need to determine the quality of nearest Lod and the furthest away first.
// I have choosen 1/(1/100k*(2^5)) = 3125 for nearest Lod and 1/(1/100k*(5^5)) = 32 for nearest Lod.
// if you divide radius by a bigger number, it means smaller reduction. So radius/3125 is very small reduction for nearest Lod.
// if you divide radius by a smaller number, it means bigger reduction. So radius/32 means agressive reduction for furthest away lod.
// current values: 3125, 411, 97, 32
lodLevel.reductionValue = radius / 100000.f * i5;
lodConfigs.levels.push_back(lodLevel);
}
QueuedProgressiveMeshGenerator pm;
pm.build(lodConfigs);
}
示例2: fillBuffer
void LodInputBuffer::fillBuffer( Ogre::MeshPtr mesh )
{
meshName = mesh->getName();
boundingSphereRadius = mesh->getBoundingSphereRadius();
bool sharedVerticesAdded = false;
unsigned short submeshCount = mesh->getNumSubMeshes();
submesh.resize(submeshCount);
for (unsigned short i = 0; i < submeshCount; i++) {
const SubMesh* ogresubmesh = mesh->getSubMesh(i);
LodInputBuffer::Submesh& outsubmesh = submesh[i];
outsubmesh.indexBuffer.fillBuffer(ogresubmesh->indexData);
outsubmesh.useSharedVertexBuffer = ogresubmesh->useSharedVertices;
if (!outsubmesh.useSharedVertexBuffer) {
outsubmesh.vertexBuffer.fillBuffer(ogresubmesh->vertexData);
} else if (!sharedVerticesAdded) {
sharedVerticesAdded = true;
sharedVertexBuffer.fillBuffer(mesh->sharedVertexData);
}
}
}