Skip to content

Commit

Permalink
Version 1.3.0 release
Browse files Browse the repository at this point in the history
* Improved kD-tree based point cloud encoding
  * Now applicable to point clouds with any number of attributes
  * Support for all integer attribute types and quantized floating point types
* Improved mesh compression up to 10% (on average ~2%)
  * For meshes, the 1.3.0 bitstream is fully compatible with 1.2.x decoders
* Improved Javascript API
  * Added support for all signed and unsigned integer types
  * Added support for point clouds to our Javascript encoder API
* Added support for integer properties to the PLY decoder
* Bug fixes
  • Loading branch information
ondys committed Apr 18, 2018
1 parent 3b3cab3 commit 4b2788b
Show file tree
Hide file tree
Showing 137 changed files with 3,829 additions and 1,335 deletions.
81 changes: 45 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(draco C CXX)

set(draco_root "${CMAKE_CURRENT_SOURCE_DIR}")
Expand All @@ -7,13 +7,17 @@ set(draco_build_dir "${CMAKE_BINARY_DIR}")

if ("${draco_root}" STREQUAL "${draco_build_dir}")
message(FATAL_ERROR
"Building from within the Draco source tree is not supported.\n"
"Hint: mkdir -p draco_build && cd draco_build\n"
"Run cmake from there.")
"Building from within the Draco source tree is not supported.\n"
"Hint: Run these commands\n"
"$ rm -rf CMakeCache.txt CMakeFiles\n"
"$ mkdir -p ../draco_build\n"
"$ cd ../draco_build\n"
"And re-run CMake from the draco_build directory.")
endif ()

include(CMakePackageConfigHelpers)
include("${draco_root}/cmake/compiler_flags.cmake")
include("${draco_root}/cmake/draco_features.cmake")
include("${draco_root}/cmake/sanitizers.cmake")
include("${draco_root}/cmake/util.cmake")

Expand All @@ -40,30 +44,29 @@ option(BUILD_UNITY_PLUGIN "Build plugin library for Unity" OFF)
option(BUILD_FOR_GLTF "" OFF)

if (BUILD_FOR_GLTF)
# Override settings when building for GLTF.
add_cxx_preproc_definition("DRACO_MESH_COMPRESSION_SUPPORTED")
add_cxx_preproc_definition("DRACO_STANDARD_EDGEBREAKER_SUPPORTED")
# Override settings when building for GLTF.
draco_enable_feature(FEATURE "DRACO_MESH_COMPRESSION_SUPPORTED")
draco_enable_feature(FEATURE "DRACO_STANDARD_EDGEBREAKER_SUPPORTED")
else ()
if (ENABLE_POINT_CLOUD_COMPRESSION)
add_cxx_preproc_definition("DRACO_POINT_CLOUD_COMPRESSION_SUPPORTED")
draco_enable_feature(FEATURE "DRACO_POINT_CLOUD_COMPRESSION_SUPPORTED")
endif ()
if (ENABLE_MESH_COMPRESSION)
add_cxx_preproc_definition("DRACO_MESH_COMPRESSION_SUPPORTED")
draco_enable_feature(FEATURE "DRACO_MESH_COMPRESSION_SUPPORTED")

if (ENABLE_STANDARD_EDGEBREAKER)
add_cxx_preproc_definition("DRACO_STANDARD_EDGEBREAKER_SUPPORTED")
draco_enable_feature(FEATURE "DRACO_STANDARD_EDGEBREAKER_SUPPORTED")
endif ()
if (ENABLE_PREDICTIVE_EDGEBREAKER)
add_cxx_preproc_definition("DRACO_PREDICTIVE_EDGEBREAKER_SUPPORTED")
draco_enable_feature(FEATURE "DRACO_PREDICTIVE_EDGEBREAKER_SUPPORTED")
endif ()
endif ()

if (ENABLE_BACKWARDS_COMPATIBILITY)
add_cxx_preproc_definition("DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED")
draco_enable_feature(FEATURE "DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED")
endif ()
endif ()


# Turn on more compiler warnings.
if (ENABLE_EXTRA_WARNINGS)
if (MSVC)
Expand Down Expand Up @@ -103,7 +106,7 @@ if (ENABLE_GOMA)
endif ()
if (BUILD_UNITY_PLUGIN)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared library for unity plugin.")
add_cxx_preproc_definition("BUILD_UNITY_PLUGIN")
draco_enable_feature(FEATURE "BUILD_UNITY_PLUGIN")
endif ()

if(ENABLE_EXTRA_SPEED)
Expand Down Expand Up @@ -149,25 +152,24 @@ configure_file("${draco_root}/cmake/draco_version.cc.cmake"
configure_file("${draco_root}/cmake/draco_version.h.cmake"
"${draco_build_dir}/draco_version.h" COPYONLY)

# When a build type is not specified, default to producing a release mode Draco
# library to avoid benchmarking shenanigans, but only when Draco is not being
# pulled in via another cmake file.
if (CMAKE_BUILD_TYPE STREQUAL "" AND NOT IGNORE_EMPTY_BUILD_TYPE)
if (CMAKE_CURRENT_LIST_FILE STREQUAL CMAKE_PARENT_LIST_FILE)
message(INFO "|Draco: ignoring empty build type, forcing release mode.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Draco overridden build type"
FORCE)
endif ()
endif ()

if (EMSCRIPTEN)
include(FindPythonInterp)
if (NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR
"Python required for Emscripten builds, but cmake cannot find it.")
endif ()
else ()
# When not building the JS library, and when a build type is not specified,
# default to producing a release mode Draco library to avoid benchmarking
# shenanigans, but only when Draco is not being pulled in via another cmake
# file.
if (CMAKE_BUILD_TYPE STREQUAL "" AND NOT IGNORE_EMPTY_BUILD_TYPE)
if (CMAKE_CURRENT_LIST_FILE STREQUAL CMAKE_PARENT_LIST_FILE)
message(INFO "|Draco: ignoring empty build type, forcing release mode.")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Draco overridden build type"
FORCE)
endif ()
endif ()

if (ENABLE_TESTS)
if (MSVC)
# Default runtime selected by cmake collides with Googletest settings,
Expand Down Expand Up @@ -229,6 +231,7 @@ set(draco_compression_attributes_dec_sources
"${draco_src_root}/compression/attributes/mesh_attribute_indices_encoding_data.h"
"${draco_src_root}/compression/attributes/mesh_traversal_sequencer.h"
"${draco_src_root}/compression/attributes/normal_compression_utils.h"
"${draco_src_root}/compression/attributes/point_d_vector.h"
"${draco_src_root}/compression/attributes/sequential_attribute_decoder.cc"
"${draco_src_root}/compression/attributes/sequential_attribute_decoder.h"
"${draco_src_root}/compression/attributes/sequential_attribute_decoders_controller.cc"
Expand Down Expand Up @@ -489,7 +492,8 @@ set(draco_mesh_sources
"${draco_src_root}/mesh/mesh_stripifier.cc"
"${draco_src_root}/mesh/mesh_stripifier.h"
"${draco_src_root}/mesh/triangle_soup_mesh_builder.cc"
"${draco_src_root}/mesh/triangle_soup_mesh_builder.h")
"${draco_src_root}/mesh/triangle_soup_mesh_builder.h"
"${draco_src_root}/mesh/valence_cache.h")

set(draco_point_cloud_sources
"${draco_src_root}/point_cloud/point_cloud.cc"
Expand Down Expand Up @@ -543,6 +547,7 @@ set(draco_test_sources
"${draco_src_root}/attributes/point_attribute_test.cc"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_test.cc"
"${draco_src_root}/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_test.cc"
"${draco_src_root}/compression/attributes/point_d_vector_test.cc"
"${draco_src_root}/compression/attributes/sequential_integer_attribute_encoding_test.cc"
"${draco_src_root}/compression/decode_test.cc"
"${draco_src_root}/compression/encode_test.cc"
Expand All @@ -558,6 +563,7 @@ set(draco_test_sources
"${draco_src_root}/core/draco_tests.cc"
"${draco_src_root}/core/math_utils_test.cc"
"${draco_src_root}/core/quantization_utils_test.cc"
"${draco_src_root}/core/shannon_entropy_test.cc"
"${draco_src_root}/core/status_test.cc"
"${draco_src_root}/core/symbol_coding_test.cc"
"${draco_src_root}/core/vector_d_test.cc"
Expand All @@ -582,7 +588,7 @@ set(draco_unity_plug_sources
"${draco_src_root}/unity/draco_unity_plugin.cc"
"${draco_src_root}/unity/draco_unity_plugin.h")

include_directories("${draco_root}/src")
include_directories("${draco_root}/src" "${draco_build_dir}")

#
# Draco targets.
Expand Down Expand Up @@ -657,9 +663,6 @@ if (EMSCRIPTEN)
VERBATIM)


# Add path to glue_decoder.cpp to draco include paths.
include_directories("${draco_build_dir}")

set(draco_decoder_src
${draco_attributes_sources}
${draco_compression_attributes_dec_sources}
Expand Down Expand Up @@ -708,11 +711,11 @@ if (EMSCRIPTEN)
append_link_flag_to_target(draco_encoder
"-s EXPORT_NAME=\"'DracoEncoderModule'\"")

target_compile_definitions(draco_encoder PRIVATE
DRACO_ATTRIBUTE_DEDUPLICATION_SUPPORTED)
draco_enable_feature(FEATURE DRACO_ATTRIBUTE_DEDUPLICATION_SUPPORTED
TARGETS draco_encoder)
if (ENABLE_DECODER_ATTRIBUTE_DEDUPLICATION)
target_compile_definitions(draco_decoder PRIVATE
DRACO_ATTRIBUTE_DEDUPLICATION_SUPPORTED)
draco_enable_feature(FEATURE DRACO_ATTRIBUTE_DEDUPLICATION_SUPPORTED
TARGETS draco_decoder)
endif ()

# Make $draco_js_sources source files depend on glue_decoder.cpp.
Expand Down Expand Up @@ -869,7 +872,7 @@ else ()
# For now, enable deduplication for both encoder and decoder.
# TODO(ostava): Support for disabling attribute deduplication for the C++
# decoder is planned in future releases.
add_preproc_definition(DRACO_ATTRIBUTE_DEDUPLICATION_SUPPORTED)
draco_enable_feature(FEATURE DRACO_ATTRIBUTE_DEDUPLICATION_SUPPORTED)

if (BUILD_SHARED_LIBS)
set_target_properties(dracodec PROPERTIES SOVERSION 1)
Expand Down Expand Up @@ -923,6 +926,9 @@ else ()
"${CMAKE_INSTALL_PREFIX}/include/draco/${file_directory}")
endforeach()

install(FILES "${draco_build_dir}/draco/draco_features.h"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/draco/")

if (NOT MSVC)
# Install our pkg-config file.
install(FILES "${draco_build_dir}/draco.pc"
Expand Down Expand Up @@ -980,3 +986,6 @@ else ()
add_dummy_source_file_to_target("${target}" "cc")
endforeach ()
endif ()

# Generate $draco_build_dir/draco/draco_features.h.
draco_generate_features_h()
65 changes: 32 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,20 @@

News
=======
### Version 1.2.5 release
* On average 10% faster decoding
* Improved Javascript metadata API
### Version 1.3.0 release
* Improved kD-tree based point cloud encoding
* Now applicable to point clouds with any number of attributes
* Support for all integer attribute types and quantized floating point types
* Improved mesh compression up to 10% (on average ~2%)
* For meshes, the 1.3.0 bitstream is fully compatible with 1.2.x decoders
* Improved Javascript API
* Added support for all signed and unsigned integer types
* Added support for point clouds to our Javascript encoder API
* Added support for integer properties to the PLY decoder
* Bug fixes

### Version 1.2.4 release
* Up to 20% faster decoding
* Added support for integer attributes to our Javascript Encoder
* Fixed issues with THREE.DracoLoader not releasing memory associated with the Draco module
* OBJ decoder can now be used to parse pure point clouds
* Added Unity plugins to support runtime loading and design-time importing of encoded Draco files

### Version 1.2.3 release
* Fixed Visual Studio building issue

### Version 1.2.2 release
The latest version of Draco brings a number of small bug fixes
* Fixed issues when parsing ill-formatted .obj files

### Version 1.2.1 release
The 1.2.1 version of Draco brings a number of enhancements to reduce decoder size and various other fixes
* Javascript and WebAssembly decoder size reduced by 35%
* Added specialized Javascript and Webassembly decoders for GLTF (size reduction about 50% compared to the previous version)
### Previous releases
https://github.com/google/draco/releases

Description
===========
Expand Down Expand Up @@ -55,10 +46,10 @@ _**Contents**_
* [CMake Basics](#cmake-basics)
* [Mac OS X](#mac-os-x)
* [Windows](#windows)
* [CMake Build Configuration](#cmake-build-config)
* [CMake Build Configuration](#cmake-build-configuration)
* [Debugging and Optimization](#debugging-and-optimization)
* [Googletest Integration](#googletest-integration)
* [Javascript Encoder/Decoder](#javascript-encoder/decoder)
* [Javascript Encoder/Decoder](#javascript-encoderdecoder)
* [Android Studio Project Integration](#android-studio-project-integration)
* [Usage](#usage)
* [Command Line Applications](#command-line-applications)
Expand Down Expand Up @@ -368,15 +359,15 @@ features.

In general, the highest setting, `10`, will have the most compression but
worst decompression speed. `0` will have the least compression, but best
decompression speed. The default setting is `5`.
decompression speed. The default setting is `7`.

Encoding Point Clouds
---------------------

You can encode point cloud data with `draco_encoder` by specifying the
`-point_cloud` parameter. If you specify the `-point_cloud` parameter with a mesh
input file, `draco_encoder` will ignore the connectivity data and encode the
positions from the mesh file.
`-point_cloud` parameter. If you specify the `-point_cloud` parameter with a
mesh input file, `draco_encoder` will ignore the connectivity data and encode
the positions from the mesh file.

~~~~~ bash
./draco_encoder -point_cloud -i testdata/bun_zipper.ply -o out.drc
Expand Down Expand Up @@ -420,7 +411,7 @@ if (geom_type == draco::TRIANGULAR_MESH) {
}
~~~~~
Please see [src/draco/mesh/mesh.h](src/draco/mesh/mesh.h) for the full Mesh class interface and
Please see [src/draco/mesh/mesh.h](src/draco/mesh/mesh.h) for the full `Mesh` class interface and
[src/draco/point_cloud/point_cloud.h](src/draco/point_cloud/point_cloud.h) for the full `PointCloud` class interface.
Expand Down Expand Up @@ -468,13 +459,13 @@ if (mesh.hasOwnProperty('texcoords')) {
dracoMesh, encoderModule.TEX_COORD, numPoints, 3, mesh.texcoords);
}
const encodedData = new encoderModule.DracoInt8Array();
if (method === "edgebreaker") {
encoder.SetEncodingMethod(encoderModule.MESH_EDGEBREAKER_ENCODING);
} else if (method === "sequential") {
encoder.SetEncodingMethod(encoderModule.MESH_SEQUENTIAL_ENCODING);
}
const encodedData = new encoderModule.DracoInt8Array();
// Use default encoding setting.
const encodedLen = encoder.EncodeMeshToDracoBuffer(dracoMesh,
encodedData);
Expand All @@ -498,26 +489,34 @@ to identify the type of geometry, e.g. mesh or point cloud. Then call either
a Mesh object or a point cloud. For example:

~~~~~ js
// Create the Draco decoder.
const decoderModule = DracoDecoderModule();
const buffer = new decoderModule.DecoderBuffer();
buffer.Init(encodedFileData, encodedFileData.length);
buffer.Init(byteArray, byteArray.length);

// Create a buffer to hold the encoded data.
const decoder = new decoderModule.Decoder();
const geometryType = decoder.GetEncodedGeometryType(buffer);

// Decode the encoded geometry.
let outputGeometry;
let status;
if (geometryType == decoderModule.TRIANGULAR_MESH) {
outputGeometry = decoder.DecodeBufferToMesh(buffer);
outputGeometry = new decoderModule.Mesh();
status = decoder.DecodeBufferToMesh(buffer, outputGeometry);
} else {
outputGeometry = decoder.DecodeBufferToPointCloud(buffer);
outputGeometry = new decoderModule.PointCloud();
status = decoder.DecodeBufferToPointCloud(buffer, outputGeometry);
}

// You must explicitly delete objects created from the DracoDecoderModule
// or Decoder.
decoderModule.destroy(outputGeometry);
decoderModule.destroy(decoder);
decoderModule.destroy(buffer);
~~~~~

Please see [src/draco/javascript/emscripten/draco_web_encoder.idl](src/draco/javascript/emscripten/draco_web_encoder.idl) for the full API.
Please see [src/draco/javascript/emscripten/draco_web_decoder.idl](src/draco/javascript/emscripten/draco_web_decoder.idl) for the full API.

Javascript Decoder Performance
------------------------------
Expand Down
27 changes: 14 additions & 13 deletions javascript/draco_decoder.js

Large diffs are not rendered by default.

Binary file modified javascript/draco_decoder.wasm
Binary file not shown.
25 changes: 13 additions & 12 deletions javascript/draco_decoder_gltf.js

Large diffs are not rendered by default.

Binary file modified javascript/draco_decoder_gltf.wasm
Binary file not shown.
28 changes: 15 additions & 13 deletions javascript/draco_encoder.js

Large diffs are not rendered by default.

Loading

0 comments on commit 4b2788b

Please sign in to comment.