This repository was archived by the owner on Dec 12, 2022. It is now read-only.
This repository was archived by the owner on Dec 12, 2022. It is now read-only.
Explain how to use the extension in the README file #67
Open
Description
Hi there,
I just got started with ThreeJS and the devtool is very nice to experiment with the lights and the scene's composition! Thank you!
I saw on the Chrome Store comments that some users have trouble using the extension though.
Wouldn't it be nice to add an example in the README file to explain to new users how to implement the observer code?
Maybe something like this:
Current API
This API has not been thought out at all, but this will register your
THREE.Scene and THREE.Renderer to be observed by the tools.
// Observe a scene or a renderer
if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', { detail: scene }));
__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', { detail: renderer }));
}
Simply add it at the end of your animate loop, like this:
function animate() {
requestAnimationFrame(animate);
// ...
// Observe a scene or a renderer
if (typeof __THREE_DEVTOOLS__ !== "undefined") {
__THREE_DEVTOOLS__.dispatchEvent(
new CustomEvent("observe", { detail: scene })
);
__THREE_DEVTOOLS__.dispatchEvent(
new CustomEvent("observe", { detail: renderer })
);
}
}
Metadata
Metadata
Assignees
Labels
No labels