1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 12:22:03 +08:00
trois/src/core/Scene.js

27 lines
400 B
JavaScript
Raw Normal View History

2020-09-14 22:57:11 +08:00
import { Scene } from 'three';
export default {
2020-09-15 04:53:30 +08:00
props: {
id: String,
},
setup () {
2020-09-14 22:57:11 +08:00
const scene = new Scene();
return { scene };
},
2020-09-15 04:53:30 +08:00
inject: ['three'],
2020-09-14 22:57:11 +08:00
provide() {
return {
scene: this.scene,
};
},
mounted() {
this.three.scene = this.scene;
},
render() {
2020-09-15 20:59:34 +08:00
if (this.$slots.default) {
return this.$slots.default();
}
return [];
2020-09-14 22:57:11 +08:00
},
};