Comments (4)
I simply associate threejs classes to our components.
Inheritance relations are represented by component mixins.
ex) AmbientLight class inherits Light class → VglAmbientLight component has VglLight component as mixin.
Component props are corresponding threejs class property.
WebGL objects are not DOM elements, so you have to implement watchers for props to be reactive.
Every modification has to call VglNamespace's update method. It flashes beforeRender queue and calls render method of the WebGLRenderers. Many classes inherit an abstract class which calls update method on beforeUpdate (like this), then we don't have to call it explicitly.
I made the beforeRender queue because some objects need another object's information to calculate their properties.
ex) Light helpers must calculate properties after setting lights. (source)
Object tree relationship is represented by provide/inject system. An object component in the slot of another object component would be a child object.
So first, create the component with mixin. Then implement props and watchers.
If it's a simple component, that's all. But some property needs anomalous implementation.
Note that we use vuedoc, it will automatically create documents from comments.
If you want to create an example, create a file in the docs/examples directory. After bundle install
, yarn start
will start jekyll server for checking the documentation. The example will appear in the component reference page.
I hope it will help your contribution.
from vue-gl.
We appreciate your support, and look forward to your PR!
#195
from vue-gl.
Is it possible to have a brief explanation on how you build usually your vue component based on a ThreeJs functionality?
from vue-gl.
Thanks for explanations, it does help!
from vue-gl.
Related Issues (20)
- VueGL is not defined HOT 1
- iFrame created with vgl-renderer HOT 6
- Example of rotation? HOT 2
- TypeError: h is not a function HOT 1
- Video texture support HOT 1
- [Question] Types not found in v1.0? HOT 2
- Feature Request : WebXR support (add webxr related features and tooling)
- Vue 3 support HOT 1
- VglShape path prop improvement HOT 1
- [Question] How can use the CanvasTexture? HOT 1
- Material Array not updating HOT 2
- The raw shader material component
- Unable to use VglObjLoader : "Unknown custom element: <vgl-obj-loader>" HOT 3
- How to use VglObjLoader HOT 4
- Cannot run dev build (rollup problem?) HOT 1
- Using inside a fluid container HOT 4
- SphericalReflectionMapping error HOT 3
- Transparent Sphere
- VueGL + Nuxt: Cannot read property 'trim' of undefined HOT 1
- Is EffectComposer supported? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-gl.