mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
wip
This commit is contained in:
parent
5060b6eea8
commit
bfc9edba0f
@ -102,11 +102,12 @@ I first made a simple *Proof of Concept*, take a look at [Example1.vue](/src/com
|
||||
```html
|
||||
<template>
|
||||
<Renderer ref="renderer">
|
||||
<Camera :position="{ z: 100 }" />
|
||||
<LambertMaterial id="material" />
|
||||
<Camera :position="{ z: 10 }" />
|
||||
<Scene>
|
||||
<PointLight :position="{ y: 50, z: 50 }" />
|
||||
<Box ref="box" :size="10" :rotation="{ y: Math.PI / 4, z: Math.PI / 4 }" material-id="material" />
|
||||
<Box ref="box" :size="1" :rotation="{ y: Math.PI / 4, z: Math.PI / 4 }">
|
||||
<LambertMaterial />
|
||||
</Box>
|
||||
</Scene>
|
||||
</Renderer>
|
||||
</template>
|
||||
@ -116,7 +117,6 @@ export default {
|
||||
mounted() {
|
||||
const renderer = this.$refs.renderer;
|
||||
const box = this.$refs.box.mesh;
|
||||
|
||||
renderer.onBeforeRender(() => {
|
||||
box.rotation.x += 0.01;
|
||||
});
|
||||
|
@ -54,6 +54,10 @@ export default {
|
||||
this.geometry = geometry;
|
||||
if (this.mesh) this.mesh.geometry = geometry;
|
||||
},
|
||||
setMaterial(material) {
|
||||
this.material = material;
|
||||
if (this.mesh) this.mesh.material = material;
|
||||
},
|
||||
},
|
||||
render() {
|
||||
return this.$slots.default();
|
||||
|
Loading…
Reference in New Issue
Block a user