geo-data / cesium-terrain-builder

A C++ library and associated command line tools designed to create terrain tiles for use in the Cesium JavaScript library
Other
706 stars 338 forks source link

Quantized-mesh output support #63

Closed ahuarte47 closed 6 years ago

ahuarte47 commented 6 years ago

Provides some new features:

Details: https://www.linkedin.com/pulse/fast-cesium-terrain-rendering-new-quantized-mesh-output-alvaro-huarte/

bjpirt commented 6 years ago

@ahuarte47 following on from the comment in #55 this builds fine now - I still have to comment out the lines in GDALTiler.cpp containing GDALCreateOverviewDataset as this seems to be missing from my GDAL lib - from previous comments I'm hoping this won't affect mesh generation.

Thanks so much for the speedy response - hopefully it can get merged upstream soon.

markerikson commented 6 years ago

@bjpirt : the workaround is to manually drop a copy of gdaloverviewdataset.cpp into the project, and #include "gdaloverviewdataset.cpp" right above the place that function is used.

bjpirt commented 6 years ago

@markerikson thanks, I'll give that a shot

ahuarte47 commented 6 years ago

Thanks @bjpirt, I would like reopening the original PR, I did a disaster with git :-(

mrgloom commented 6 years ago

Catch GDAL 'Integer overflow' error when creating tiles of low levels.

Integer overflow problem is solved? Workaround is not needed? https://github.com/geo-data/cesium-terrain-builder/issues/28

ahuarte47 commented 6 years ago

Yes, I think so, but I have only tested it with my own data

mrgloom commented 6 years ago

ctb still have problem with integer overflow. https://github.com/geo-data/cesium-terrain-builder/issues/28

ahuarte47 commented 6 years ago

Master version doesn't include any fix about this, this pull (https://github.com/geo-data/cesium-terrain-builder/pull/64) contains a fix, but it has not been merged yet.

mrgloom commented 6 years ago
git clone https://github.com/geo-data/cesium-terrain-builder.git
cd cesium-terrain-builder
git reset --hard 8dd633c13582956a2bfdd9f447f62bde04682b9a
#git fetch origin pull/63/head:pull-63-branch
#git checkout pull-63-branch
git fetch origin pull/64/head:pull-64-branch
git checkout pull-64-branch
wget -O diff.patch https://github.com/geo-data/cesium-terrain-builder/files/2025776/diff.txt
git apply diff.patch
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
make all

Build of #63 fails with:

Scanning dependencies of target ctb
[  5%] Building CXX object src/CMakeFiles/ctb.dir/GDALTile.cpp.o
[ 11%] Building CXX object src/CMakeFiles/ctb.dir/GDALTiler.cpp.o
[ 17%] Building CXX object src/CMakeFiles/ctb.dir/GDALDatasetReader.cpp.o
[ 23%] Building CXX object src/CMakeFiles/ctb.dir/CTBFileTileSerializer.cpp.o
/home/my_user/temp/cesium-terrain-builder/src/CTBFileTileSerializer.cpp: In member function ‘virtual bool ctb::CTBFileTileSerializer::serializeTile(const ctb::GDALTile*, GDALDriver*, const char*, const CPLStringList&)’:
/home/my_user/temp/cesium-terrain-builder/src/CTBFileTileSerializer.cpp:117:98: error: passing ‘const CPLStringList’ as ‘this’ argument of ‘char** CPLStringList::List()’ discards qualifiers [-fpermissive]
   poDstDS = driver->CreateCopy(temp_filename.c_str(), tile->dataset, FALSE, creationOptions.List(), NULL, NULL);
                                                                                                  ^
make[2]: *** [src/CMakeFiles/ctb.dir/CTBFileTileSerializer.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/ctb.dir/all] Error 2
make: *** [all] Error 2

Build of #64 look ok, but with warnings:

/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp: In member function ‘void TerrainMetadata::writeJsonFile(const string&, const string&, const string&, const string&, bool) const’:
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=]
           level.finalY);
                       ^
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 4 has type ‘int’ [-Wformat=]
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 5 has type ‘int’ [-Wformat=]
/home/my_user/temp/cesium-terrain-builder/tools/ctb-tile.cpp:493:23: warning: format ‘%li’ expects argument of type ‘long int’, but argument 6 has type ‘int’ [-Wformat=]
Linking CXX executable ctb-tile
[100%] Built target ctb-tile

What is the difference between #63 and #64 ?

ahuarte47 commented 6 years ago

Sorry, https://github.com/geo-data/cesium-terrain-builder/pull/64 is the correct one. It is the open pull that contains the last code.

sunhongyue4500 commented 5 years ago

Thanks for the awesome PR. @ahuarte47 I use new q-mesh tiles in my proj. All current detail tiles appear when i zoom in. While some tiles don't load when i zoom out. Like this: bug2 How can i fix this? thanks.

sunhongyue4500 commented 5 years ago

Oops. It seems to be the problem of my data source. I re-tile it and now it works. Thanks