diff --git a/PotreeConverter/include/PotreeConverter.h b/PotreeConverter/include/PotreeConverter.h index 9f5baba9..f9761691 100644 --- a/PotreeConverter/include/PotreeConverter.h +++ b/PotreeConverter/include/PotreeConverter.h @@ -56,6 +56,8 @@ class PotreeConverter{ bool showSkybox = false; string material = "RGB"; string executablePath; + int storeSize = 20'000; + int flushLimit = 10'000'000; PotreeConverter(string executablePath, string workDir, vector sources); diff --git a/PotreeConverter/include/PotreeWriter.h b/PotreeConverter/include/PotreeWriter.h index 4867b7e2..19c87515 100644 --- a/PotreeConverter/include/PotreeWriter.h +++ b/PotreeConverter/include/PotreeWriter.h @@ -38,7 +38,7 @@ class PWNode{ bool addCalledSinceLastFlush = false; PotreeWriter *potreeWriter; vector cache; - int storeLimit = 20'000; + //int storeLimit = 20'000; vector store; bool isInMemory = true; @@ -115,6 +115,7 @@ class PotreeWriter{ int pointsInMemory = 0; string projection = ""; ConversionQuality quality = ConversionQuality::DEFAULT; + int storeSize = 20'000; PotreeWriter(string workDir, ConversionQuality quality); diff --git a/PotreeConverter/src/PotreeConverter.cpp b/PotreeConverter/src/PotreeConverter.cpp index d02d280e..9e9d28ba 100644 --- a/PotreeConverter/src/PotreeConverter.cpp +++ b/PotreeConverter/src/PotreeConverter.cpp @@ -400,6 +400,8 @@ void PotreeConverter::convert(){ return; } + writer->storeSize = storeSize; + vector boundingBoxes; vector numPoints; vector sourceFilenames; @@ -445,7 +447,7 @@ void PotreeConverter::convert(){ cout << ssMessage.str() << endl; } - if((pointsProcessed % (10'000'000)) == 0){ + if((pointsProcessed % (flushLimit)) == 0){ cout << "FLUSHING: "; auto start = high_resolution_clock::now(); diff --git a/PotreeConverter/src/PotreeWriter.cpp b/PotreeConverter/src/PotreeWriter.cpp index 8ecd8feb..304f8a26 100644 --- a/PotreeConverter/src/PotreeWriter.cpp +++ b/PotreeConverter/src/PotreeWriter.cpp @@ -171,7 +171,7 @@ PWNode *PWNode::add(Point &point){ if(isLeafNode()){ store.push_back(point); - if(int(store.size()) >= storeLimit){ + if(int(store.size()) >= potreeWriter->storeSize){ split(); } diff --git a/PotreeConverter/src/main.cpp b/PotreeConverter/src/main.cpp index e729c6d0..9b8c71f3 100644 --- a/PotreeConverter/src/main.cpp +++ b/PotreeConverter/src/main.cpp @@ -64,6 +64,8 @@ struct PotreeArguments { bool showSkybox = false; string material = "RGB"; string executablePath; + int storeSize; + int flushLimit; }; PotreeArguments parseArguments(int argc, char **argv){ @@ -95,6 +97,8 @@ PotreeArguments parseArguments(int argc, char **argv){ args.addArgument("edl-enabled", "Enable Eye-Dome-Lighting."); args.addArgument("show-skybox", ""); args.addArgument("material", "RGB, ELEVATION, INTENSITY, INTENSITY_GRADIENT, CLASSIFICATION, RETURN_NUMBER, SOURCE, LEVEL_OF_DETAIL"); + args.addArgument("store-size", "A node is split once more than store-size points are added. Reduce for better results at cost of performance. Default is 20000"); + args.addArgument("flush-limit", "Flush after X points. Default is 10000000"); PotreeArguments a; @@ -125,6 +129,8 @@ PotreeArguments parseArguments(int argc, char **argv){ } a.outdir = args.get("outdir").as(); a.spacing = args.get("spacing").as(0.0); + a.storeSize = args.get("store-size").as(20'000); + a.flushLimit= args.get("flush-limit").as(10'000'000); a.diagonalFraction = args.get("d").as(0.0); a.levels = args.get("levels").as(-1); a.format = args.get("input-format").as(); @@ -308,6 +314,8 @@ int main(int argc, char **argv){ pc.edlEnabled = a.edlEnabled; pc.material = a.material; pc.showSkybox = a.showSkybox; + pc.storeSize = a.storeSize; + pc.flushLimit = a.flushLimit; pc.convert(); }catch(exception &e){