Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draco v1.5.0. #779

Merged
merged 1 commit into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .cmake-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# If comment markup is enabled, don't reflow the first comment block in
# eachlistfile. Use this to preserve formatting of your
# copyright/licensestatements.
first_comment_is_literal = False
first_comment_is_literal = True

# If comment markup is enabled, don't reflow any comment block which matchesthis
# (regex) pattern. Default is `None` (disabled).
Expand Down
13 changes: 11 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git
path = third_party/googletest
url = https://github.com/google/googletest.git
[submodule "third_party/eigen"]
path = third_party/eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "third_party/tinygltf"]
path = third_party/tinygltf
url = https://github.com/syoyo/tinygltf.git
[submodule "third_party/filesystem"]
path = third_party/filesystem
url = https://github.com/gulrak/filesystem
39 changes: 39 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ _**Contents**_
* [Mac OS X](#mac-os-x)
* [Windows](#windows)
* [CMake Build Configuration](#cmake-build-configuration)
* [Transcoder](#transcoder)
* [Debugging and Optimization](#debugging-and-optimization)
* [Googletest Integration](#googletest-integration)
* [Third Party Libraries](#third-party-libraries)
* [Javascript Encoder/Decoder](#javascript-encoderdecoder)
* [WebAssembly Decoder](#webassembly-decoder)
* [WebAssembly Mesh Only Decoder](#webassembly-mesh-only-decoder)
Expand Down Expand Up @@ -72,6 +74,21 @@ C:\Users\nobody> cmake ../ -G "Visual Studio 16 2019" -A x64
CMake Build Configuration
-------------------------

Transcoder
----------

In order to build the `draco_transcoder` target, the transcoding support needs
to be explicitly enabled when you run `cmake`, for example:

~~~~~ bash
$ cmake ../ -DDRACO_TRANCODER_SUPPORTED=ON
~~~~~

The above option is currently not compatible with our Javascript or WebAssembly
builds but all other use cases are supported. Note that binaries and libraries
built with the transcoder support may result in increased binary sizes of the
produced libraries and executables compared to the default CMake settings.

Debugging and Optimization
--------------------------

Expand Down Expand Up @@ -135,6 +152,28 @@ To run the tests execute `draco_tests` from your build output directory:
$ ./draco_tests
~~~~~

Third Party Libraries
---------------------

When Draco is built with transcoding and/or testing support enabled the project
has dependencies on third party libraries:

- [Eigen](https://eigen.tuxfamily.org/)
- Provides various math utilites.
- [Googletest](https://github.com/google/googletest)
- Provides testing support.
- [Gulrak/filesystem](https://github.com/gulrak/filesystem)
- Provides C++17 std::filesystem emulation for pre-C++17 environments.
- [TinyGLTF](https://github.com/syoyo/tinygltf)
- Provides GLTF I/O support.

These dependencies are managed as Git submodules. To obtain the dependencies
run the following command in your Draco repository:

~~~~~ bash
$ git submodule update --init
~~~~~

WebAssembly Decoder
-------------------

Expand Down
136 changes: 131 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

# Draco requires C++11.
# Draco requires modern compiler support.
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
project(draco C CXX)

Expand Down Expand Up @@ -81,6 +82,7 @@ draco_reset_target_lists()
draco_setup_options()
draco_set_build_definitions()
draco_set_cxx_flags()
draco_set_exe_linker_flags()
draco_generate_features_h()

# Draco source file listing variables.
Expand Down Expand Up @@ -508,12 +510,77 @@ list(APPEND draco_maya_plug_sources
"${draco_src_root}/maya/draco_maya_plugin.cc"
"${draco_src_root}/maya/draco_maya_plugin.h")

if(DRACO_TRANSCODER_SUPPORTED)
list(APPEND draco_animation_sources
"${draco_src_root}/animation/animation.cc"
"${draco_src_root}/animation/animation.h"
"${draco_src_root}/animation/node_animation_data.h"
"${draco_src_root}/animation/skin.cc"
"${draco_src_root}/animation/skin.h")

list(APPEND draco_io_sources
"${draco_src_root}/io/gltf_decoder.cc"
"${draco_src_root}/io/gltf_decoder.h"
"${draco_src_root}/io/gltf_encoder.cc"
"${draco_src_root}/io/gltf_encoder.h"
"${draco_src_root}/io/gltf_utils.cc"
"${draco_src_root}/io/gltf_utils.h"
"${draco_src_root}/io/image_compression_options.h"
"${draco_src_root}/io/scene_io.cc"
"${draco_src_root}/io/scene_io.h"
"${draco_src_root}/io/texture_io.cc"
"${draco_src_root}/io/texture_io.h"
"${draco_src_root}/io/tiny_gltf_utils.cc"
"${draco_src_root}/io/tiny_gltf_utils.h")

list(APPEND draco_material_sources
"${draco_src_root}/material/material.cc"
"${draco_src_root}/material/material.h"
"${draco_src_root}/material/material_library.cc"
"${draco_src_root}/material/material_library.h")

list(APPEND draco_mesh_sources
"${draco_src_root}/mesh/mesh_splitter.cc"
"${draco_src_root}/mesh/mesh_splitter.h"
"${draco_src_root}/mesh/mesh_utils.cc"
"${draco_src_root}/mesh/mesh_utils.h")

list(APPEND draco_scene_sources
"${draco_src_root}/scene/mesh_group.h"
"${draco_src_root}/scene/scene.cc"
"${draco_src_root}/scene/scene.h"
"${draco_src_root}/scene/scene_indices.h"
"${draco_src_root}/scene/scene_node.h"
"${draco_src_root}/scene/scene_utils.cc"
"${draco_src_root}/scene/scene_utils.h"
"${draco_src_root}/scene/trs_matrix.cc"
"${draco_src_root}/scene/trs_matrix.h")

list(APPEND draco_texture_sources
"${draco_src_root}/texture/source_image.cc"
"${draco_src_root}/texture/source_image.h"
"${draco_src_root}/texture/texture.h"
"${draco_src_root}/texture/texture_library.cc"
"${draco_src_root}/texture/texture_library.h"
"${draco_src_root}/texture/texture_map.cc"
"${draco_src_root}/texture/texture_map.h"
"${draco_src_root}/texture/texture_transform.cc"
"${draco_src_root}/texture/texture_transform.h"
"${draco_src_root}/texture/texture_utils.cc"
"${draco_src_root}/texture/texture_utils.h")
endif()

#
# Draco targets.
#
if(EMSCRIPTEN AND DRACO_JS_GLUE)
# Draco decoder and encoder "executable" targets in various flavors for
# Emsscripten.
# Emscripten.

if(DRACO_TRANSCODER_SUPPORTED)
message(FATAL_ERROR "The transcoder is not supported in Emscripten.")
endif()

list(APPEND draco_decoder_src
${draco_attributes_sources}
${draco_compression_attributes_dec_sources}
Expand Down Expand Up @@ -788,7 +855,45 @@ else()
INCLUDES
${draco_include_paths})

set(draco_object_library_deps
if(DRACO_TRANSCODER_SUPPORTED)
draco_add_library(
NAME
draco_material
TYPE
OBJECT
SOURCES
${draco_material_sources}
DEFINES
${draco_defines}
INCLUDES
${draco_include_paths})

draco_add_library(
NAME
draco_scene
TYPE
OBJECT
SOURCES
${draco_scene_sources}
DEFINES
${draco_defines}
INCLUDES
${draco_include_paths})

draco_add_library(
NAME
draco_texture
TYPE
OBJECT
SOURCES
${draco_texture_sources}
DEFINES
${draco_defines}
INCLUDES
${draco_include_paths})
endif()

list(APPEND draco_object_library_deps
draco_attributes
draco_compression_attributes_dec
draco_compression_attributes_enc
Expand Down Expand Up @@ -817,14 +922,19 @@ else()
draco_points_dec
draco_points_enc)

if(DRACO_TRANSCODER_SUPPORTED)
list(APPEND draco_object_library_deps
draco_material draco_scene draco_texture)
endif()

# Library targets that consume the object collections.
if(MSVC)
# In order to produce a DLL and import library the Windows tools require
# that the exported symbols are part of the DLL target. The unfortunate side
# effect of this is that a single configuration cannot output both the
# static library and the DLL: This results in an either/or situation.
# Windows users of the draco build can have a DLL and an import library,
# or they can have a static library; they cannot have both from a single
# Windows users of the draco build can have a DLL and an import library, or
# they can have a static library; they cannot have both from a single
# configuration of the build.
if(BUILD_SHARED_LIBS)
set(draco_lib_type SHARED)
Expand Down Expand Up @@ -955,6 +1065,22 @@ else()
LIB_DEPS
${draco_dependency})

if(DRACO_TRANSCODER_SUPPORTED)
draco_add_executable(NAME
draco_transcoder
SOURCES
"${draco_src_root}/tools/draco_transcoder.cc"
"${draco_src_root}/tools/draco_transcoder_lib.cc"
"${draco_src_root}/tools/draco_transcoder_lib.h"
${draco_io_sources}
DEFINES
${draco_defines}
INCLUDES
${draco_include_paths}
LIB_DEPS
${draco_dependency})
endif()

draco_setup_install_target()
draco_setup_test_targets()
endif()
Expand Down
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@ delays can result in transient errors that can be difficult to diagnose when
new Draco releases are launched. To avoid the issue pin your sites to a
versioned release.

### Version 1.5.0 release
* Adds the draco_transcoder tool. See the section below on the glTF transcoding
tool, and BUILDING.md for build and dependency information.
* Some changes to configuration variables have been made for this release:
- The DRACO_GLTF flag has been renamed to DRACO_GLTF_BITSTREAM to help
increase understanding of its purpose, which is to limit Draco features to
those included in the Draco glTF specification.
- Variables exported in CMake via draco-config.cmake and find-draco.cmake
(formerly FindDraco.cmake) have been renamed. It's unlikely that this
impacts any existing projects as the aforementioned files were not formed
correctly. See [PR775](https://github.com/google/draco/pull/775) for full
details of the changes.
* A CMake version file has been added.
* The CMake install target now uses absolute paths direct from CMake instead
of building them using CMAKE_INSTALL_PREFIX. This was done to make Draco
easier to use for downstream packagers and should have little to no impact on
users picking up Draco from source.
* Certain MSVC warnings have had their levels changed via compiler flag to
reduce the amount of noise output by the MSVC compilers. Set MSVC warning
level to 4, or define DRACO_DEBUG_MSVC_WARNINGS at CMake configuration time
to restore previous behavior.
* Bug fixes.

### Version 1.4.3 release
* Using the versioned www.gstatic.com WASM and Javascript decoders continues
to be recommended. To use v1.4.3, use this URL:
Expand Down Expand Up @@ -143,6 +166,7 @@ _**Contents**_
* [Encoding Tool](#encoding-tool)
* [Encoding Point Clouds](#encoding-point-clouds)
* [Decoding Tool](#decoding-tool)
* [glTF Transcoding Tool](#gltf-transcoding-tool)
* [C++ Decoder API](#c-decoder-api)
* [Javascript Encoder API](#javascript-encoder-api)
* [Javascript Decoder API](#javascript-decoder-api)
Expand Down Expand Up @@ -185,9 +209,11 @@ Command Line Applications
------------------------

The default target created from the build files will be the `draco_encoder`
and `draco_decoder` command line applications. For both applications, if you
run them without any arguments or `-h`, the applications will output usage and
options.
and `draco_decoder` command line applications. Additionally, `draco_transcoder`
is generated when CMake is run with the DRACO_TRANSCODER_SUPPORTED variable set
to ON (see [BUILDING](BUILDING.md#transcoder) for more details). For all
applications, if you run them without any arguments or `-h`, the applications
will output usage and options.

Encoding Tool
-------------
Expand Down Expand Up @@ -254,8 +280,27 @@ The basic command line looks like this:
./draco_decoder -i in.drc -o out.obj
~~~~~

glTF Transcoding Tool
---------------------

`draco_transcoder` can be used to add Draco compression to glTF assets. The
basic command line looks like this:

~~~~~ bash
./draco_transcoder -i in.glb -o out.glb
~~~~~

This command line will add geometry compression to all meshes in the `in.glb`
file. Quantization values for different glTF attributes can be specified
similarly to the `draco_encoder` tool. For example `-qp` can be used to define
quantization of the position attribute:

~~~~~ bash
./draco_transcoder -i in.glb -o out.glb -qp 12
~~~~~

C++ Decoder API
-------------
---------------

If you'd like to add decoding to your applications you will need to include
the `draco_dec` library. In order to use the Draco decoder you need to
Expand Down
Loading