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
|
```html
|
||||||
<template>
|
<template>
|
||||||
<Renderer ref="renderer">
|
<Renderer ref="renderer">
|
||||||
<Camera :position="{ z: 100 }" />
|
<Camera :position="{ z: 10 }" />
|
||||||
<LambertMaterial id="material" />
|
|
||||||
<Scene>
|
<Scene>
|
||||||
<PointLight :position="{ y: 50, z: 50 }" />
|
<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>
|
</Scene>
|
||||||
</Renderer>
|
</Renderer>
|
||||||
</template>
|
</template>
|
||||||
@ -116,7 +117,6 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
const renderer = this.$refs.renderer;
|
const renderer = this.$refs.renderer;
|
||||||
const box = this.$refs.box.mesh;
|
const box = this.$refs.box.mesh;
|
||||||
|
|
||||||
renderer.onBeforeRender(() => {
|
renderer.onBeforeRender(() => {
|
||||||
box.rotation.x += 0.01;
|
box.rotation.x += 0.01;
|
||||||
});
|
});
|
||||||
|
@ -54,6 +54,10 @@ export default {
|
|||||||
this.geometry = geometry;
|
this.geometry = geometry;
|
||||||
if (this.mesh) this.mesh.geometry = geometry;
|
if (this.mesh) this.mesh.geometry = geometry;
|
||||||
},
|
},
|
||||||
|
setMaterial(material) {
|
||||||
|
this.material = material;
|
||||||
|
if (this.mesh) this.mesh.material = material;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return this.$slots.default();
|
return this.$slots.default();
|
||||||
|
Loading…
Reference in New Issue
Block a user