Esri / i3s-lib

Apache License 2.0
28 stars 14 forks source link

i3s-lib - Indexed 3D SceneLayers library

A C++ library for producing Scene Layer Package (SLPK) files. Currently it does not provide reading / validating capabilities, this is planned for the future. For a sample program please see here.

Features

-Create SLPK from elevation image(PNG) and color image(PNG)

Installing dependencies

There is a number of third-party libraries needed for i3s-lib to build and run:

These dependency libraries need to be present in the 3rdparty directory. You can download, build and install them manually, but it is recommended to do this by performing a CMake build on projects/3rdparty (see instructions below). NB: the only library from the above list that has an external dependency is libpng, and its only dependency is zlib.

On Windows with Visual Studio + CMake

Start Visual Studio, choose "Open folder" command, point to projects/3rdparty. A CMake project will open. Select a configuration to build. Run "Project -> Generate Cache for i3s_3rdparty", then "Build -> Build All".

You can build everything with Clang instead of the MSVC compiler, select "x64-Clang-" configurations for that. NB: you'll need to have the C++ Clang tools for Windows component installed.

On Linux with CMake

$ mkdir -p build/3rdparty
$ cd build/3rdparty
$ cmake ../../projects/3rdparty
$ cmake --build .

The CMake script downloads the source code for all third-party dependencies, builds them and installs into the 3rdparty directory. After the build process completes3rdparty should contain subdirectories draco, etc2comp, lepcc, libjpeg, libpng, zlib.

To build with particular compiler, do something like this before the build:

export CC=/usr/bin/clang-9 CXX=/usr/bin/clang++-9

or use -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER options for CMake configuration run. Note that you should configure both C and C++ compilers since libjpeg, libpng and zlib are C libraries. NB: the current version of the 3rdparty build script relies on ExternalProject_Add() feature, which has some peculiarities. An alternative to consider is using git submodules to checkout the third-party repositories explicitly, in a more controllable manner.

NB: In a typical Linux distribution some of the libraries listed above (zlib, libjpeg, libpng) and their development headers can be easily installed from packages available in the distribution. On most systems zlib, libjpeg and libpng are installed system-wide with the base system setup. Future implementation build options would allow to use the existing instances of basic libraries, which would avoid downloading and building them.

Building the i3s library

On Windows with Visual Studio + CMake

Start Visual Stusio, choose "Open folder" command, point to the root of the i3s-lib source tree. A CMake project will open. Select a configuration to build. Run "Project -> Generate Cache for i3s", then "Build -> Build All". The build will produce i3s DLL and the demo application executable.

You can build everything with Clang instead of the MSVC compiler, select "x64-Clang-" configurations for that. NB: you'll need to have the C++ Clang tools for Windows component installed.

On Linux with CMake

$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

By default, the Release configuration is built. You can specify the build configuration (Debug or Release) with CMAKE_BUILD_TYPE option:

$ cmake . -DCMAKE_BUILD_TYPE="Debug"
$ cmake --build .

The library should build correctly with GCC 8+ or Clang 6+. The code uses C++17 features, so you need an appropriate release of libstdc++ (the one coming with GCC 8 is good). To build with particular compiler, do something like this before the build:

export CXX=/usr/bin/clang++-9

or use -DCMAKE_CXX_COMPILER option at configuration step:

$ cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/g++-8
$ cmake --build .

On Windows with Visual Studio

Open the i3s-lib/projects/3rdparty/i3s.sln solution. It contains three projects:

Select configuration and build the solution.

Known issues / limitations

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Licensing

Copyright 2020-2024 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is also available in the LICENSE file.