mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
update cameras to extend base component and render slot
This commit is contained in:
parent
eb1ca16b8a
commit
e66c347e69
11
src/core/Camera.js
Normal file
11
src/core/Camera.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// import Object3D from '../core/Object3D.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// TODO: eventually extend Object3D, for now: error 'injection "scene" not found'
|
||||||
|
// because camera is a sibling of scene in Trois
|
||||||
|
// extends: Object3D,
|
||||||
|
inject: ['three'],
|
||||||
|
render() {
|
||||||
|
return this.$slots.default ? this.$slots.default() : [];
|
||||||
|
},
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
import { OrthographicCamera } from 'three';
|
import { OrthographicCamera } from 'three';
|
||||||
import { watch } from 'vue';
|
import { watch } from 'vue';
|
||||||
import { bindProp } from '../tools.js';
|
import { bindProp } from '../tools.js';
|
||||||
|
import Camera from './Camera.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
extends: Camera,
|
||||||
name: 'OrthographicCamera',
|
name: 'OrthographicCamera',
|
||||||
inject: ['three'],
|
inject: ['three'],
|
||||||
props: {
|
props: {
|
||||||
@ -28,6 +30,5 @@ export default {
|
|||||||
|
|
||||||
this.three.camera = this.camera;
|
this.three.camera = this.camera;
|
||||||
},
|
},
|
||||||
render() { return []; },
|
|
||||||
__hmrId: 'OrthographicCamera',
|
__hmrId: 'OrthographicCamera',
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { PerspectiveCamera } from 'three';
|
import { PerspectiveCamera } from 'three';
|
||||||
import { watch } from 'vue';
|
import { watch } from 'vue';
|
||||||
import { bindProp } from '../tools.js';
|
import { bindProp } from '../tools.js';
|
||||||
|
import Camera from './Camera.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
extends: Camera,
|
||||||
name: 'PerspectiveCamera',
|
name: 'PerspectiveCamera',
|
||||||
inject: ['three'],
|
inject: ['three'],
|
||||||
props: {
|
props: {
|
||||||
@ -29,6 +31,5 @@ export default {
|
|||||||
|
|
||||||
this.three.camera = this.camera;
|
this.three.camera = this.camera;
|
||||||
},
|
},
|
||||||
render() { return []; },
|
|
||||||
__hmrId: 'PerspectiveCamera',
|
__hmrId: 'PerspectiveCamera',
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user