Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing ThreejsRenderer class and Threejs refs #180

Merged
merged 16 commits into from
May 22, 2021
Merged

Conversation

kalwalt
Copy link
Member

@kalwalt kalwalt commented May 19, 2021

Introduction

This PR will remove the ThreejsRenderer class and all the references to Three.js in the code. It's a necessary step to make the library free from any rendering engine and to provide alternative packages for different rendering engines.

Code details and changes

I removed the ThreejsRenderer class, but how a Threejs object is attached to te NFT marker? The most important thing is to pass the MatrixGL_RH coming from the Worker to the Threejs Object3d. To achieve this we use an event listener to pass the matrix data to the Threejs Object3D (the root object). This is done in the ARnftThreejs dev branch package now, that part of the code was originallly in the ThreejsRenderer class.

Possible issues

What happens if we use multi NFT markers in a row? They will pass the right NFT marker matrix? to prevent this issue i propose to add a uuid to the eventListener for every marker so it will get the right matrix data.
Inside Arnft we have:

ARnft/src/utils/Utils.js

Lines 133 to 134 in d4511c0

const matrixGLrhEvent = new CustomEvent('getMatrixGL_RH', { detail: { matrixGL_RH: world } })
document.dispatchEvent(matrixGLrhEvent)

If we add:

- const matrixGLrhEvent = new CustomEvent('getMatrixGL_RH', { detail: { matrixGL_RH: world } })
+ const matrixGLrhEvent = new CustomEvent('getMatrixGL_RH_<uuuid>', { detail: { matrixGL_RH: world } })

and providing the same uuid to ARnft-Threejs, wouldn't works?

  • add a raw uuid mechanism to the EventListeners

- removing all three.js reference in the code
@kalwalt kalwalt added 🚀 enhancement New feature or request Three.js WIP issue or PR Works In Progress code-design labels May 19, 2021
@kalwalt kalwalt self-assigned this May 19, 2021
This was referenced May 19, 2021
@kalwalt kalwalt changed the title Removing from ARnft ThreejsRenderer and Threejs Removing ThreejsRenderer class and Threejs refs May 19, 2021
@kalwalt kalwalt mentioned this pull request May 19, 2021
- objVisiblity not working ( need to be added inside ARnft-threejs)
- updated container example
@kalwalt kalwalt deleted the removing-ThreejsRenderer branch May 27, 2021 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-design 🚀 enhancement New feature or request Three.js WIP issue or PR Works In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant