1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-23 20:02:32 +08:00

improve shadow

This commit is contained in:
Kevin Levron 2020-09-15 11:55:00 +02:00
parent 946c83388b
commit 1fa322e91a
2 changed files with 6 additions and 2 deletions

View File

@ -5,8 +5,8 @@
<PhongMaterial id="material" color="#ff0000"></PhongMaterial>
<Scene id="scene1">
<PointLight :position="{ x: 0, y: 150, z: 150 }" :castShadow="true"></PointLight>
<InstancedMesh ref="imesh" material="material" :count="1000" :castShadow="true" :receiveShadow="true">
<PointLight :position="{ x: 0, y: 150, z: 150 }" :cast-shadow="true" :shadow-map-size="{ width: 1024, height: 1024 }"></PointLight>
<InstancedMesh ref="imesh" material="material" :count="1000" :cast-shadow="true" :receive-shadow="true">
<BoxGeometry :size="5"></BoxGeometry>
</InstancedMesh>
</Scene>

View File

@ -15,11 +15,15 @@ export default {
type: Boolean,
default: false,
},
shadowMapSize: Object,
position: Object,
},
mounted() {
setFromProp(this.light.position, this.position);
this.light.castShadow = this.castShadow;
setFromProp(this.light.shadow.mapSize, this.shadowMapSize);
this.scene.add(this.light);
if (this.light.target) this.scene.add(this.light.target);
},