Skip to content

Commit 87815fc

Browse files
fehnomenaltoddeTV
andauthored
docs: update idea behind the scenes section (#28)
Co-authored-by: Thorsten Seyschab <business@todde.tv>
1 parent 36afc48 commit 87815fc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,18 @@ Run `gltf-codegen --help` for more options and details.
228228

229229
## idea behind the scenes
230230

231-
On runtime it runs `useGLTF` under the hood. So no extra layer and therefore correct objects that
232-
[three.js](https://github.com/mrdoob/three.js/) would give you when importing it yourself in runtime.
231+
On runtime it runs the default glTF loader mechanics of [three.js](https://github.com/mrdoob/three.js/) under the
232+
hood. So, there is no extra layer of processing and therefore correct objects that three.js would give you when
233+
importing it yourself in your application.
233234

234-
To achieve this, we patch a `useGLTF` from `three.js` to be able to run it in CLI because originally you can only use
235-
this in a browser runtime.
235+
To achieve this, we use patched versions of `DRACOLoader` and `GLTFLoader` to be able to run it in CLI because
236+
originally you can only use them in a browser runtime.
236237

237238
So we do not parse the glTF JSON file ourself but work with the representation after the
238-
[three.js](https://github.com/mrdoob/three.js/) `useGLTF` parsing. For code completion and for working with the
239-
scene/ model graph, we store the paths in the graph by caching the child indices in the `childs` array from each
239+
[three.js](https://github.com/mrdoob/three.js/) parsing. For code completion and for working with the
240+
model graph, we store the paths in the graph by caching the child indices in the `children` array from each
240241
object. With this, we can O(1) look up what the user requests without the need of traversing - neither depth first
241-
(default approach from [three.js](https://github.com/mrdoob/three.js/)), nor breath first.
242+
(default approach from [three.js](https://github.com/mrdoob/three.js/)), nor breadth first.
242243

243244
One of the biggest challenges was making the plugin build tool agnostic bc not every build tool handles inner path
244245
references the same. Therefore, we have to reconstruct the buffers that link the glTF file with the binary and

0 commit comments

Comments
 (0)