Proposal to Promote Best Practices in Using TresJS Library #670
alvarosabu
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
TresJS has been an invaluable tool in integrating Three.js with Vue, allowing developers to manage complex 3D scenes using a more declarative approach. Historically, our examples and documentation have emphasized a single-file component approach. While this method simplifies initial learning and setup, it may not promote the best practices for scalability and maintainability in larger applications.
Problem Statement
The current single-file usage pattern encouraged by TresJS documentation and examples limits the scalability and maintainability of applications built with the library. Most composables require the context of the TresCanvas, making it cumbersome to manage larger, more complex scenes within a single file.
Proposal
To address these limitations, we propose revising our examples, documentation, and other resources to demonstrate and encourage a modular approach. Specifically, we aim to promote a structure where components related to the 3D scene are encapsulated in separate subcomponents, much like how UI elements are managed in larger Vue applications.
Instead of
We promote:
App.vue
:TheExperience.vue
:Detailed Changes
Rationale
The proposed changes align with the core philosophy of Vue, which is to build applications through a modular and declarative approach. By promoting a structure that separates concerns and encapsulates functionality, we can enhance the development experience, making TresJS projects easier to manage, scale, and understand.
Benefits
Conclusion
Transitioning to a component-based architecture for TresJS examples and documentation will set a standard that helps developers create more robust and maintainable applications. This proposal aims to foster a shift in how TresJS is used and perceived, from a tool for quick 3D integrations to a powerful framework for building sophisticated 3D web applications.
Beta Was this translation helpful? Give feedback.
All reactions