mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-12 03:28:58 +08:00
Merge pull request #12 from louquillio/edit-readme-for-consistency
Edit README.md for consistent usage and formatting.
This commit is contained in:
commit
f0d913a715
124
README.md
124
README.md
@ -6,16 +6,24 @@
|
|||||||
Description
|
Description
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Draco is a library for compressing and decompressing 3D geometric [meshes] and [point clouds] intended to improve the storage and transmission of 3D graphics.
|
Draco is a library for compressing and decompressing 3D geometric [meshes] and
|
||||||
|
[point clouds]. It is intended to improve the storage and transmission of 3D
|
||||||
|
graphics.
|
||||||
|
|
||||||
Draco was designed and built for compression efficiency and speed. The code
|
Draco was designed and built for compression efficiency and speed. The code
|
||||||
supports compressing points, connectivity information, texture coordinates,
|
supports compressing points, connectivity information, texture coordinates,
|
||||||
color information, normals, and any other generic attributes associated with geometry. With Draco, applications using 3D graphics can be significantly smaller without compromising visual fidelity. For users this means apps can now be downloaded faster, 3D graphics in the browser can load quicker, and VR and AR scenes can now be transmitted with a fraction of the bandwidth and rendered quickly.
|
color information, normals, and any other generic attributes associated with
|
||||||
|
geometry. With Draco, applications using 3D graphics can be significantly
|
||||||
|
smaller without compromising visual fidelity. For users, this means apps can
|
||||||
|
now be downloaded faster, 3D graphics in the browser can load quicker, and VR
|
||||||
|
and AR scenes can now be transmitted with a fraction of the bandwidth and
|
||||||
|
rendered quickly.
|
||||||
|
|
||||||
Draco is released as C++ source code that can be used to compress 3D graphics as well as C++ and Javascript decoders for the encoded data.
|
Draco is released as C++ source code that can be used to compress 3D graphics
|
||||||
|
as well as C++ and Javascript decoders for the encoded data.
|
||||||
|
|
||||||
|
|
||||||
**Contents**
|
_**Contents**_
|
||||||
|
|
||||||
* [Building](#building)
|
* [Building](#building)
|
||||||
* [CMake Basics](#cmake-basics)
|
* [CMake Basics](#cmake-basics)
|
||||||
@ -39,32 +47,32 @@ Draco is released as C++ source code that can be used to compress 3D graphics as
|
|||||||
|
|
||||||
Building
|
Building
|
||||||
========
|
========
|
||||||
For all the platforms first you need to generate the project files, then you
|
For all platforms, you must first generate the project/make files and then
|
||||||
need to compile the examples.
|
compile the examples.
|
||||||
|
|
||||||
CMake Basics
|
CMake Basics
|
||||||
------------
|
------------
|
||||||
|
|
||||||
To generate project/make files for the default toolchain on your system simply
|
To generate project/make files for the default toolchain on your system, run
|
||||||
run `cmake` in the root of the Draco repo:
|
`cmake` in the root of your clone Draco repository:
|
||||||
|
|
||||||
~~~~~ bash
|
~~~~~ bash
|
||||||
cmake .
|
cmake .
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
On Windows the above command will produce Visual Studio project files for the
|
On Windows, the above command will produce Visual Studio project files for the
|
||||||
newest Visual Studio detected on the system. On Mac OS X and Linux systems, the
|
newest Visual Studio detected on the system. On Mac OS X and Linux systems,
|
||||||
above command will produce a makefile.
|
the above command will produce a `makefile`.
|
||||||
|
|
||||||
To control what types of projects are generated the `-G` parameter is added to
|
To control what types of projects are generated, add the `-G` parameter to the
|
||||||
the `cmake` command line. This argument must be followed by the name of a
|
`cmake` command. This argument must be followed by the name of a generator.
|
||||||
generator. Running `cmake` with the `--help` argument will list the available
|
Running `cmake` with the `--help` argument will list the available
|
||||||
generators for your system.
|
generators for your system.
|
||||||
|
|
||||||
Mac OS X
|
Mac OS X
|
||||||
---------
|
---------
|
||||||
|
|
||||||
On Mac OS X you would run the following command to generate Xcode projects:
|
On Mac OS X, run the following command to generate Xcode projects:
|
||||||
|
|
||||||
~~~~~ bash
|
~~~~~ bash
|
||||||
cmake . -G Xcode
|
cmake . -G Xcode
|
||||||
@ -90,9 +98,9 @@ cmake . "Visual Studio 14 2015 Win64"
|
|||||||
CMake Makefiles: Debugging and Optimization
|
CMake Makefiles: Debugging and Optimization
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
Unlike Visual Studio and Xcode projects, the build configuration for make builds
|
Unlike Visual Studio and Xcode projects, the build configuration for make
|
||||||
is controlled when you run `cmake`. The following examples demonstrate various
|
builds is controlled when you run `cmake`. The following examples demonstrate
|
||||||
build configurations.
|
various build configurations.
|
||||||
|
|
||||||
Omitting the build type produces makefiles that use build flags containing
|
Omitting the build type produces makefiles that use build flags containing
|
||||||
neither optimization nor debug flags:
|
neither optimization nor debug flags:
|
||||||
@ -122,9 +130,9 @@ cmake . -DCMAKE_BUILD_TYPE=debug
|
|||||||
Android Studio Project Integration
|
Android Studio Project Integration
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
To include Draco in an existing or new Android Studio project it simply needs
|
To include Draco in an existing or new Android Studio project, reference it
|
||||||
to be referenced from the `cmake` file of an existing native project that has a
|
from the `cmake` file of an existing native project that has a minimum SDK
|
||||||
minimum SDK version of 18 or higher. To add Draco to your project:
|
version of 18 or higher. To add Draco to your project:
|
||||||
|
|
||||||
1. Add the following somewhere within the `CMakeLists.txt` for your project
|
1. Add the following somewhere within the `CMakeLists.txt` for your project
|
||||||
before the `add_library()` for your project's native-lib:
|
before the `add_library()` for your project's native-lib:
|
||||||
@ -138,9 +146,10 @@ minimum SDK version of 18 or higher. To add Draco to your project:
|
|||||||
include_directories("${CMAKE_BINARY_DIR}" /path/to/draco)
|
include_directories("${CMAKE_BINARY_DIR}" /path/to/draco)
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
2. Add the library target "draco" to the `target_link_libraries()` call for your
|
2. Add the library target "draco" to the `target_link_libraries()` call for
|
||||||
project's native-lib. The `target_link_libraries()` call for an empty
|
your project's native-lib. The `target_link_libraries()` call for an
|
||||||
activity native project looks like this after the addition of Draco:
|
empty activity native project looks like this after the addition of
|
||||||
|
Draco:
|
||||||
|
|
||||||
~~~~~ cmake
|
~~~~~ cmake
|
||||||
target_link_libraries( # Specifies the target library.
|
target_link_libraries( # Specifies the target library.
|
||||||
@ -160,15 +169,15 @@ Usage
|
|||||||
Command Line Applications
|
Command Line Applications
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
The default target create from the build files will be the draco_encoder and
|
The default target created from the build files will be the `draco_encoder`
|
||||||
draco_decoder command line applications. For both applications if you run them
|
and `draco_decoder` command line applications. For both applications, if you
|
||||||
without any arguments or `-h`, the applications will output the usage and
|
run them without any arguments or `-h`, the applications will output usage and
|
||||||
options.
|
options.
|
||||||
|
|
||||||
Encoding Tool
|
Encoding Tool
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
`draco_encoder` will read OBJ or PLY files as input and output Draco encoded
|
`draco_encoder` will read OBJ or PLY files as input, and output Draco-encoded
|
||||||
files. We have included Stanford's [Bunny] mesh for testing. The basic command
|
files. We have included Stanford's [Bunny] mesh for testing. The basic command
|
||||||
line looks like this:
|
line looks like this:
|
||||||
|
|
||||||
@ -176,7 +185,8 @@ line looks like this:
|
|||||||
./draco_encoder -i testdata/bun_zipper.ply -o out.drc
|
./draco_encoder -i testdata/bun_zipper.ply -o out.drc
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
A value of `0` for the quantization parameters will not perform any quantization on the specified attribute. Any value other than `0` will quantize the input values for the specified attribute to that number of bits. For example:
|
A value of `0` for the quantization parameter will not perform any quantization on the specified attribute. Any value other than `0` will quantize the input values for the specified attribute to that number of bits.
|
||||||
|
For example:
|
||||||
|
|
||||||
~~~~~ bash
|
~~~~~ bash
|
||||||
./draco_encoder -i testdata/bun_zipper.ply -o out.drc -qp 14
|
./draco_encoder -i testdata/bun_zipper.ply -o out.drc -qp 14
|
||||||
@ -184,20 +194,21 @@ A value of `0` for the quantization parameters will not perform any quantization
|
|||||||
|
|
||||||
will quantize the positions to 14 bits (default for the position coordinates).
|
will quantize the positions to 14 bits (default for the position coordinates).
|
||||||
|
|
||||||
In general the more you quantize your attributes the better compression rate
|
In general, the more you quantize your attributes the better compression rate
|
||||||
you will get. It is up to your project on how much deviation it will tolerate.
|
you will get. It is up to your project to decide how much deviation it will
|
||||||
In general most projects can set quantizations values of about 14 without any
|
tolerate. In general, most projects can set quantizations values of about `14`
|
||||||
noticeable difference in quality.
|
without any noticeable difference in quality.
|
||||||
|
|
||||||
The compression level parameter turns on/off different compression features.
|
The compression level (`-cl`) parameter turns on/off different compression
|
||||||
|
features.
|
||||||
|
|
||||||
~~~~~ bash
|
~~~~~ bash
|
||||||
./draco_encoder -i testdata/bun_zipper.ply -o out.drc -cl 8
|
./draco_encoder -i testdata/bun_zipper.ply -o out.drc -cl 8
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
In general the highest setting, 10, will have the most compression but
|
In general, the highest setting, `10`, will have the most compression but
|
||||||
worst decompression speed. And 0 will have the least compression, but best
|
worst decompression speed. `0` will have the least compression, but best
|
||||||
decompression speed. The default setting is 5.
|
decompression speed. The default setting is `5`.
|
||||||
|
|
||||||
Encoding Point Clouds
|
Encoding Point Clouds
|
||||||
---------------------
|
---------------------
|
||||||
@ -219,8 +230,8 @@ and denser point clouds.
|
|||||||
Decoding Tool
|
Decoding Tool
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
`draco_decoder` will read Draco files as input and output OBJ or PLY files. The
|
`draco_decoder` will read Draco files as input, and output OBJ or PLY files.
|
||||||
basic command line looks like this:
|
The basic command line looks like this:
|
||||||
|
|
||||||
~~~~~ bash
|
~~~~~ bash
|
||||||
./draco_decoder -i in.drc -o out.obj
|
./draco_decoder -i in.drc -o out.obj
|
||||||
@ -229,7 +240,11 @@ basic command line looks like this:
|
|||||||
C++ Decoder API
|
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 initialize a DecoderBuffer with the compressed data. Then call DecodeMeshFromBuffer() to return a decoded Mesh object or call DecodePointCloudFromBuffer() to return a decoded PointCloud object. E.g.
|
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 initialize a `DecoderBuffer` with the compressed data. Then call
|
||||||
|
`DecodeMeshFromBuffer()` to return a decoded mesh object or call
|
||||||
|
`DecodePointCloudFromBuffer()` to return a decoded `PointCloud` object. For
|
||||||
|
example:
|
||||||
|
|
||||||
~~~~~ cpp
|
~~~~~ cpp
|
||||||
draco::DecoderBuffer buffer;
|
draco::DecoderBuffer buffer;
|
||||||
@ -244,17 +259,18 @@ const draco::EncodedGeometryType geom_type =
|
|||||||
}
|
}
|
||||||
~~~~~
|
~~~~~
|
||||||
|
|
||||||
Please see 'mesh/mesh.h' for the full Mesh class interface and 'point_cloud/point_cloud.h' for the full PointCloud class interface.
|
Please see `mesh/mesh.h` for the full Mesh class interface and `point_cloud/point_cloud.h` for the full `PointCloud` class interface.
|
||||||
|
|
||||||
Javascript Decoder
|
Javascript Decoder
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
The Javascript decoder is located in `javascript/draco_decoder.js`. The
|
The Javascript decoder is located in `javascript/draco_decoder.js`. The
|
||||||
Javascript decoder can decode mesh and point cloud. In order to use the
|
Javascript decoder can decode mesh and point cloud. In order to use the
|
||||||
decoder you must first create `DecoderBuffer` and `WebIDLWrapper` objects. Set the
|
decoder you must first create `DecoderBuffer` and `WebIDLWrapper` objects. Set
|
||||||
encoded data in the `DecoderBuffer`. Then call `GetEncodedGeometryType()` to identify
|
the encoded data in the `DecoderBuffer`. Then call `GetEncodedGeometryType()`
|
||||||
the type of geometry, e.g. mesh or point cloud. Then call either `DecodeMeshFromBuffer()` or
|
to identify the type of geometry, e.g. mesh or point cloud. Then call either
|
||||||
`DecodePointCloudFromBuffer()` which will return a Mesh object or a point cloud. E.g.
|
`DecodeMeshFromBuffer()` or `DecodePointCloudFromBuffer()`, which will return
|
||||||
|
a Mesh object or a point cloud. For example:
|
||||||
|
|
||||||
~~~~~ js
|
~~~~~ js
|
||||||
var buffer = new Module.DecoderBuffer();
|
var buffer = new Module.DecoderBuffer();
|
||||||
@ -282,13 +298,14 @@ Javascript Decoder Performance
|
|||||||
The Javascript decoder is built with dynamic memory. This will let the decoder
|
The Javascript decoder is built with dynamic memory. This will let the decoder
|
||||||
work with all of the compressed data. But this option is not the fastest.
|
work with all of the compressed data. But this option is not the fastest.
|
||||||
Pre-allocating the memory sees about a 2x decoder speed improvement. If you
|
Pre-allocating the memory sees about a 2x decoder speed improvement. If you
|
||||||
know all of your project's memory requirements you can turn on static memory
|
know all of your project's memory requirements, you can turn on static memory
|
||||||
by changing `Makefile.emcc` and running `make -f Makefile.emcc`.
|
by changing `Makefile.emcc` and running `make -f Makefile.emcc`.
|
||||||
|
|
||||||
three.js Renderer Example
|
three.js Renderer Example
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
Here's an [example] of a geometric compressed with Draco loaded via a Javascript decoder using the three.js renderer.
|
Here's an [example] of a geometric compressed with Draco loaded via a
|
||||||
|
Javascript decoder using the `three.js` renderer.
|
||||||
|
|
||||||
Please see the `javascript/example/README` file for more information.
|
Please see the `javascript/example/README` file for more information.
|
||||||
|
|
||||||
@ -299,15 +316,22 @@ For questions/comments please email <draco-3d-discuss@googlegroups.com>
|
|||||||
|
|
||||||
If you have found an error in this library, please file an issue at <https://github.com/google/draco/issues>
|
If you have found an error in this library, please file an issue at <https://github.com/google/draco/issues>
|
||||||
|
|
||||||
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub. See [CONTRIBUTING] for more detail.
|
Patches are encouraged, and may be submitted by forking this project and
|
||||||
|
submitting a pull request through GitHub. See [CONTRIBUTING] for more detail.
|
||||||
|
|
||||||
License
|
License
|
||||||
=======
|
=======
|
||||||
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
|
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>
|
<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.
|
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.
|
||||||
|
|
||||||
References
|
References
|
||||||
==========
|
==========
|
||||||
|
Loading…
x
Reference in New Issue
Block a user