mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-04-22 05:39:54 +08:00
27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
The code shows a simple example of integration of threejs and draco javascript
|
|
decoder. From the example, you should be able to loading an encoded draco mesh
|
|
file and visualize it through threejs's fancy 3D tools.
|
|
|
|
How to run the example code:
|
|
|
|
(1) Create your working directory, e.g. draco_example/.
|
|
|
|
(2) Download the latest three.js file from:
|
|
https://github.com/mrdoob/three.js/blob/dev/build/three.js
|
|
You could clone the repository and copy three.js from build/ to your
|
|
working directory.
|
|
|
|
(3) Copy DRACOLoader.js and webgl_loader_draco.html from
|
|
draco/javascript/example to your working directory. Copy draco_decoder.js
|
|
from draco/javascript to your working directory.
|
|
|
|
(4) From your working directory, start a local http server.
|
|
E.g, with Python, you could run "python -m SimpleHTTPServer".
|
|
|
|
(5) Load webgl_loader_draco.html. You should be able to see an empty scene
|
|
rendered by threejs.
|
|
|
|
(6) Click "Choose File" to select a draco encoded file (.drc) and you should be
|
|
able to see the model. e.g. bunny.drc. This is model encoded using Draco
|
|
default compression. The original ply is located here "testdata/bun_zipper.ply".
|