mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
improve shadow
This commit is contained in:
parent
946c83388b
commit
1fa322e91a
@ -5,8 +5,8 @@
|
|||||||
<PhongMaterial id="material" color="#ff0000"></PhongMaterial>
|
<PhongMaterial id="material" color="#ff0000"></PhongMaterial>
|
||||||
|
|
||||||
<Scene id="scene1">
|
<Scene id="scene1">
|
||||||
<PointLight :position="{ x: 0, y: 150, z: 150 }" :castShadow="true"></PointLight>
|
<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" :castShadow="true" :receiveShadow="true">
|
<InstancedMesh ref="imesh" material="material" :count="1000" :cast-shadow="true" :receive-shadow="true">
|
||||||
<BoxGeometry :size="5"></BoxGeometry>
|
<BoxGeometry :size="5"></BoxGeometry>
|
||||||
</InstancedMesh>
|
</InstancedMesh>
|
||||||
</Scene>
|
</Scene>
|
||||||
|
@ -15,11 +15,15 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
shadowMapSize: Object,
|
||||||
position: Object,
|
position: Object,
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
setFromProp(this.light.position, this.position);
|
setFromProp(this.light.position, this.position);
|
||||||
|
|
||||||
this.light.castShadow = this.castShadow;
|
this.light.castShadow = this.castShadow;
|
||||||
|
setFromProp(this.light.shadow.mapSize, this.shadowMapSize);
|
||||||
|
|
||||||
this.scene.add(this.light);
|
this.scene.add(this.light);
|
||||||
if (this.light.target) this.scene.add(this.light.target);
|
if (this.light.target) this.scene.add(this.light.target);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user