mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 13:49:46 +02:00
octree tests tweaks
Conflicts: tests/octree/src/ModelTests.cpp tests/octree/src/main.cpp
This commit is contained in:
parent
9e0f010edd
commit
142fc02ec5
2 changed files with 16 additions and 5 deletions
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
void ModelTests::modelTreeTests(bool verbose) {
|
void ModelTests::modelTreeTests(bool verbose) {
|
||||||
bool extraVerbose = false;
|
bool extraVerbose = true;
|
||||||
int testsTaken = 0;
|
int testsTaken = 0;
|
||||||
int testsPassed = 0;
|
int testsPassed = 0;
|
||||||
int testsFailed = 0;
|
int testsFailed = 0;
|
||||||
|
@ -240,9 +240,10 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
{
|
{
|
||||||
// seed the random number generator so that our tests are reproducible
|
// seed the random number generator so that our tests are reproducible
|
||||||
srand(0xFEEDBEEF);
|
srand(0xFEEDBEEF);
|
||||||
|
ModelTree tree;
|
||||||
|
|
||||||
testsTaken++;
|
testsTaken++;
|
||||||
const int TEST_ITERATIONS = 10000;
|
const int TEST_ITERATIONS = 10;
|
||||||
QString testName = "Performance - add model to tree " + QString::number(TEST_ITERATIONS) + " times";
|
QString testName = "Performance - add model to tree " + QString::number(TEST_ITERATIONS) + " times";
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
qDebug() << "Test" << testsTaken <<":" << qPrintable(testName);
|
||||||
|
@ -266,11 +267,21 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
properties.setRadius(halfMeter);
|
properties.setRadius(halfMeter);
|
||||||
properties.setModelURL("https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/theater.fbx");
|
properties.setModelURL("https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/theater.fbx");
|
||||||
|
|
||||||
|
if (extraVerbose) {
|
||||||
|
qDebug() << "iteration:" << i
|
||||||
|
<< "ading model at x/y/z=" << randomX << "," << randomY << "," << randomZ;
|
||||||
|
qDebug() << "before:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
||||||
|
}
|
||||||
|
|
||||||
quint64 startAdd = usecTimestampNow();
|
quint64 startAdd = usecTimestampNow();
|
||||||
tree.addModel(modelID, properties);
|
tree.addModel(modelID, properties);
|
||||||
quint64 endAdd = usecTimestampNow();
|
quint64 endAdd = usecTimestampNow();
|
||||||
totalElapsedAdd += (endAdd - startAdd);
|
totalElapsedAdd += (endAdd - startAdd);
|
||||||
|
|
||||||
|
if (extraVerbose) {
|
||||||
|
qDebug() << "after:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
||||||
|
}
|
||||||
|
|
||||||
quint64 startFind = usecTimestampNow();
|
quint64 startFind = usecTimestampNow();
|
||||||
float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units
|
float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units
|
||||||
const ModelItem* foundModelByRadius = tree.findClosestModel(randomPositionInTreeUnits, targetRadius);
|
const ModelItem* foundModelByRadius = tree.findClosestModel(randomPositionInTreeUnits, targetRadius);
|
||||||
|
|
|
@ -17,8 +17,8 @@ int main(int argc, const char* argv[]) {
|
||||||
const char* VERBOSE = "--verbose";
|
const char* VERBOSE = "--verbose";
|
||||||
bool verbose = cmdOptionExists(argc, argv, VERBOSE);
|
bool verbose = cmdOptionExists(argc, argv, VERBOSE);
|
||||||
qDebug() << "OctreeTests::runAllTests()";
|
qDebug() << "OctreeTests::runAllTests()";
|
||||||
OctreeTests::runAllTests(verbose);
|
//OctreeTests::runAllTests(verbose);
|
||||||
AABoxCubeTests::runAllTests(verbose);
|
//AABoxCubeTests::runAllTests(verbose);
|
||||||
ModelTests::runAllTests(verbose);
|
ModelTests::runAllTests(verbose);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue