Skip to content

Commit

Permalink
Changed PotreeConverter to use LeftofHere fork to ensure mac compatib…
Browse files Browse the repository at this point in the history
…ility
  • Loading branch information
tobiaobr committed Nov 10, 2025
1 parent 48fbac9 commit 4c159ed
Show file tree
Hide file tree
Showing 21 changed files with 1,043 additions and 442 deletions.
20 changes: 20 additions & 0 deletions PotreeConverter/.vscode/keybindings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+l",
"command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
},{
"key": "ctrl+shift+i",
"command": "editor.action.toggleRenderWhitespace"
},{
"key": "ctrl+d",
"command": "editor.action.copyLinesDownAction"
},{
"key": "alt+2",
"command": "type",
"args": {
"text": "`"
}
}
]
113 changes: 113 additions & 0 deletions PotreeConverter/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/Release/PotreeConverter.exe",
"args": [




// ===================
// SYSTEM 1
// ===================
// "D:/dev/pointclouds/bunny_20M.las",
// "D:/dev/pointclouds/mschuetz/lion.las",
// "D:/dev/pointclouds/riegl/retz.laz",
// "D:/dev/pointclouds/pix4d/eclepens.las",
// "D:/dev/pointclouds/pix4d/matterhorn.laz",
// "D:/dev/pointclouds/archpro/heidentor.las",
// "D:/dev/pointclouds/hg_v2_clip.las",
// "D:/dev/pointclouds/CA13",

// "D:/dev/pointclouds/CA13/ot_35120D8108C_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120D8108D_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120D8109A_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120D8109B_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120D8109C_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120D8109D_1.laz",

// "D:/temp/crashreport2/cube.laz",
// "D:/temp/crashreport2/trott_crashing",
// "D:/temp/crashreport/3dbuildings_walls_azimuth.laz",
// "-o", "D:/temp/crashreport2/converted",

// "D:/dev/pointclouds/CA13/ot_35120B4122C_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4121D_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4301B_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4301D_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4302C_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4302B_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4122D_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4302D_1.laz",
// "D:/dev/pointclouds/CA13/ot_35120B4302A_1.laz",

// "D:/temp/C_25ez1.laz",

// "F:/pointclouds/AHN3/files/C_25ez1.laz",
// "F:/pointclouds/AHN3/files/C_25gn1.laz",
// "F:/pointclouds/AHN3/files/C_25bz1.laz",
// "F:/pointclouds/AHN3/files/C_25bz2.laz",
// "F:/pointclouds/AHN3/files/C_25ez2.laz",
// "F:/pointclouds/AHN3/files/C_25dn1.laz",
// "F:/pointclouds/AHN3/files/C_25dn2.laz",
// "F:/pointclouds/AHN3/files/C_25gn2.laz",

// "D:/temp/compression/C_05DN2.LAZ",

// "D:/dev/pointclouds/tuwien_baugeschichte/candi Banyunibo",


"D:/dev/pointclouds/sitn/potree2/aerial_lidar2019_2524_1197_laz14_dip.laz",
// "D:/dev/pointclouds/sitn/potree2/aerial_lidar2019_2524_1197_las14.las",

// "D:/temp/Bargello10Mtest.las",


// "D:/dev/pointclouds/testdata/Bargello10Mtest.las",
// "D:/dev/pointclouds/testdata/crash.las",
// "D:/dev/pointclouds/testdata/eclepens.laz",
// "D:/dev/pointclouds/testdata/Grab15.laz",
// "D:/dev/pointclouds/testdata/heidentor.las",
// "D:/dev/pointclouds/testdata/lion.laz",
// "D:/dev/pointclouds/testdata/3dbuildings_walls_azimuth.laz",


"-o", "D:/temp/cpotree/sitn_dip_2.0",

// ===================
// SYSTEM 2
// ===================
// "C:/dev/pointclouds/nvidia.las",
// "C:/dev/pointclouds/eclepens.las",
// "-o", "C:/temp/test/converter",

// ===================
// OPTIONS
// ===================
// "--flags", "just-stats",
// "--flags", "no-chunking",
// "--flags", "no-indexing", "keep-chunks",
// "--flags", "no-chunking", "keep-chunks",
// "--flags", "keep-chunks",
// "--keep-chunks",
// "--generate-page", "heidentor",
// "-m", "poisson", // ["poisson", "poisson_average", "random"]
// "--chunkMethod", "SKIP" // [LASZIP, LAS_CUSTOM, SKIP]
// "--attributes", "rgb", "Dip (degrees)", "Dip direction (degrees)", "NormalX", "NormalY", "NormalZ",
// "--attributes" , "rgb", "intensity", "classification", "mjpmie",
"--encoding", "BROTLI",
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false
}
]
}
106 changes: 106 additions & 0 deletions PotreeConverter/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"workbench.editor.enablePreview": false,
"files.associations": {
"*.cs": "cpp",
"*.wgsl": "cpp",
"*.vs": "cpp",
"*.fs": "cpp",
"filesystem": "cpp",
"xstring": "cpp",
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"concepts": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"execution": "cpp",
"resumable": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"ostream": "cpp",
"queue": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"valarray": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"random": "cpp",
"hash_map": "cpp",
"set": "cpp",
"condition_variable": "cpp",
"regex": "cpp",
"stack": "cpp",
"variant": "cpp",
"bit": "cpp",
"charconv": "cpp",
"compare": "cpp",
"format": "cpp",
"optional": "cpp",
"stop_token": "cpp"
},
"files.trimTrailingWhitespace": false,
"editor.fontSize": 28,
"editor.autoIndent": "advanced",
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.minimap.enabled": false,
"editor.autoClosingBrackets": "never",
"editor.formatOnType": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.mouseWheelZoom": true,
"editor.renderWhitespace": "all",
"editor.autoClosingQuotes": "never",
"editor.autoSurround": "never",
}
2 changes: 1 addition & 1 deletion PotreeConverter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 2.)
set(CMAKE_SUPPRESS_REGENERATION true)

project(PotreeConverter LANGUAGES CXX)
Expand Down
8 changes: 6 additions & 2 deletions PotreeConverter/Converter/include/PotreeConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,13 @@ inline Attributes computeOutputAttributes(vector<Source>& sources, vector<string
// compute scale and offset from all sources
{
mutex mtx;
auto parallel = std::execution::par;
for_each(parallel, sources.begin(), sources.end(), [&mtx, &sources, &scaleMin, &min, &max, requestedAttributes, &fullAttributeList, &acceptedAttributeNames](Source source) {

#if defined(__APPLE__)
for_each(sources.begin(), sources.end(), [&mtx, &sources, &scaleMin, &min, &max, requestedAttributes, &fullAttributeList, &acceptedAttributeNames](Source source) {
#else
auto parallel = std::execution::par;
for_each(parallel, sources.begin(), sources.end(), [&mtx, &sources, &scaleMin, &min, &max, requestedAttributes, &fullAttributeList, &acceptedAttributeNames](Source source) {
#endif
auto header = loadLasHeader(source.path);

vector<Attribute> attributes = computeOutputAttributes(header);
Expand Down
14 changes: 13 additions & 1 deletion PotreeConverter/Converter/include/sampler_poisson.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ struct SamplerPoisson : public Sampler {
double y = (xyz[1] * scale.y) + offset.y;
double z = (xyz[2] * scale.z) + offset.z;

Point point = { x, y, z, i, childIndex };
#if defined(__APPLE__)
// convert int64_t to int32_t for apple to be happy
int32_t apple_i = i;
int32_t apple_childIndex = childIndex;

Point point = { x, y, z, apple_i, apple_childIndex };
#else
Point point = { x, y, z, i, childIndex };
#endif

points.push_back(point);
}
Expand Down Expand Up @@ -179,8 +187,12 @@ struct SamplerPoisson : public Sampler {

};

#if defined(__APPLE__)
std::sort(points.begin(), points.end(), [center](Point a, Point b) -> bool {
#else
auto parallel = std::execution::par_unseq;
std::sort(parallel, points.begin(), points.end(), [center](Point a, Point b) -> bool {
#endif

auto ax = a.x - center.x;
auto ay = a.y - center.y;
Expand Down
7 changes: 6 additions & 1 deletion PotreeConverter/Converter/include/sampler_poisson_average.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,14 @@ struct SamplerPoissonAverage : public Sampler {

};


#if defined(__APPLE__)
std::sort(points.begin(), points.end(), [center](Point a, Point b) -> bool {
#else
auto parallel = std::execution::par_unseq;
std::sort(parallel, points.begin(), points.end(), [center](Point a, Point b) -> bool {

#endif

auto ax = a.x - center.x;
auto ay = a.y - center.y;
auto az = a.z - center.z;
Expand Down
4 changes: 2 additions & 2 deletions PotreeConverter/Converter/libs/laszip/src/lasindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,9 @@ BOOL LASindex::append(const char* file_name) const
bytestreamout->seek(offset_to_special_evlrs);

LASevlr lax_evlr;
sprintf(lax_evlr.user_id, "LAStools");
snprintf(lax_evlr.user_id, sizeof(lax_evlr.user_id), "LAStools");
lax_evlr.record_id = 30;
sprintf(lax_evlr.description, "LAX spatial indexing (LASindex)");
snprintf(lax_evlr.description, sizeof(lax_evlr.description), "LAX spatial indexing (LASindex)");

bytestreamout->put16bitsLE((const U8*)&(lax_evlr.reserved));
bytestreamout->putBytes((const U8*)lax_evlr.user_id, 16);
Expand Down
20 changes: 10 additions & 10 deletions PotreeConverter/Converter/libs/laszip/src/lasreadpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,17 +508,17 @@ BOOL LASreadPoint::read(U8* const * point)
// end-of-file
if (dec)
{
sprintf(last_error, "end-of-file during chunk with index %u", current_chunk);
snprintf(last_error, sizeof(last_error), "end-of-file during chunk with index %u", current_chunk);
}
else
{
sprintf(last_error, "end-of-file");
snprintf(last_error, sizeof(last_error), "end-of-file");
}
}
else
{
// decompression error
sprintf(last_error, "chunk with index %u of %u is corrupt", current_chunk, tabled_chunks);
snprintf(last_error, sizeof(last_error), "chunk with index %u of %u is corrupt", current_chunk, tabled_chunks);
// if we know where the next chunk starts ...
if ((current_chunk+1) < tabled_chunks)
{
Expand Down Expand Up @@ -550,7 +550,7 @@ BOOL LASreadPoint::check_end()
// create error string
if (last_error == 0) last_error = new CHAR[128];
// report error
sprintf(last_error, "chunk with index %u of %u is corrupt", current_chunk, tabled_chunks);
snprintf(last_error, sizeof(last_error), "chunk with index %u of %u is corrupt", current_chunk, tabled_chunks);
return FALSE;
}
}
Expand Down Expand Up @@ -606,7 +606,7 @@ BOOL LASreadPoint::read_chunk_table()
// create error string
if (last_error == 0) last_error = new CHAR[128];
// report error
sprintf(last_error, "compressor was interrupted before writing adaptive chunk table of LAZ file");
snprintf(last_error, sizeof(last_error), "compressor was interrupted before writing adaptive chunk table of LAZ file");
return FALSE;
}
// otherwise we build the chunk table as we read the file
Expand All @@ -621,7 +621,7 @@ BOOL LASreadPoint::read_chunk_table()
// create warning string
if (last_warning == 0) last_warning = new CHAR[128];
// report warning
sprintf(last_warning, "compressor was interrupted before writing chunk table of LAZ file");
snprintf(last_warning, sizeof(last_warning), "compressor was interrupted before writing chunk table of LAZ file");
return TRUE;
}

Expand Down Expand Up @@ -751,21 +751,21 @@ BOOL LASreadPoint::read_chunk_table()
// report warning
if (last_position == chunk_table_start_position)
{
sprintf(last_warning, "chunk table is missing. improper use of LAZ compressor?");
snprintf(last_warning, sizeof(last_warning), "chunk table is missing. improper use of LAZ compressor?");
}
else
{
#ifdef _WIN32
sprintf(last_warning, "chunk table and %I64d bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
snprintf(last_warning, sizeof(last_warning), "chunk table and %I64d bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
#else
sprintf(last_warning, "chunk table and %lld bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
snprintf(last_warning, sizeof(last_warning), "chunk table and %lld bytes are missing. LAZ file truncated during copy or transfer?", chunk_table_start_position - last_position);
#endif
}
}
else
{
// report warning
sprintf(last_warning, "corrupt chunk table");
snprintf(last_warning, sizeof(last_warning), "corrupt chunk table");
}
}
if (!instream->seek(chunks_start))
Expand Down
Loading

0 comments on commit 4c159ed

Please sign in to comment.