本文整理汇总了C++中EntityTreeElement::bestFitEntityBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ EntityTreeElement::bestFitEntityBounds方法的具体用法?C++ EntityTreeElement::bestFitEntityBounds怎么用?C++ EntityTreeElement::bestFitEntityBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityTreeElement
的用法示例。
在下文中一共展示了EntityTreeElement::bestFitEntityBounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: entityTreeTests
//.........这里部分代码省略.........
glm::vec3 randomPositionInTreeUnits = randomPositionInMeters / (float)TREE_SCALE;
properties.setPosition(randomPositionInMeters);
// TODO: fix these unit tests
//properties.setRadius(halfMeter);
//properties.setModelURL("http://s3.amazonaws.com/hifi-public/ozan/theater.fbx");
if (extraVerbose) {
qDebug() << "iteration:" << i
<< "ading entity at x/y/z=" << randomX << "," << randomY << "," << randomZ;
qDebug() << "before:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
}
quint64 startAdd = usecTimestampNow();
tree.addEntity(entityID, properties);
quint64 endAdd = usecTimestampNow();
totalElapsedAdd += (endAdd - startAdd);
if (extraVerbose) {
qDebug() << "after:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
}
quint64 startFind = usecTimestampNow();
float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units
const EntityItem* foundEntityByRadius = tree.findClosestEntity(randomPositionInTreeUnits, targetRadius);
const EntityItem* foundEntityByID = tree.findEntityByEntityItemID(entityID);
quint64 endFind = usecTimestampNow();
totalElapsedFind += (endFind - startFind);
EntityTreeElement* containingElement = tree.getContainingElement(entityID);
AACube elementCube = containingElement ? containingElement->getAACube() : AACube();
bool elementIsBestFit = containingElement->bestFitEntityBounds(foundEntityByID);
if (extraVerbose) {
qDebug() << "foundEntityByRadius=" << foundEntityByRadius;
qDebug() << "foundEntityByID=" << foundEntityByID;
qDebug() << "containingElement=" << containingElement;
qDebug() << "containingElement.box="
<< elementCube.getCorner().x * TREE_SCALE << ","
<< elementCube.getCorner().y * TREE_SCALE << ","
<< elementCube.getCorner().z * TREE_SCALE << ":"
<< elementCube.getScale() * TREE_SCALE;
qDebug() << "elementCube.getScale()=" << elementCube.getScale();
//containingElement->printDebugDetails("containingElement");
qDebug() << "elementIsBestFit=" << elementIsBestFit;
}
// Every 1000th test, show the size of the tree...
if (extraVerbose && (i % 1000 == 0)) {
qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
}
bool passed = foundEntityByRadius && foundEntityByID && (foundEntityByRadius == foundEntityByID) && elementIsBestFit;
if (passed) {
iterationsPassed++;
} else {
if (extraVerbose) {
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName) << "iteration:" << i
<< "foundEntityByRadius=" << foundEntityByRadius << "foundEntityByID=" << foundEntityByID
<< "x/y/z=" << randomX << "," << randomY << "," << randomZ
<< "elementIsBestFit=" << elementIsBestFit;
}
}
}