|
@@ -177,16 +177,18 @@
|
|
|
//平行光
|
|
|
const light = new THREE.DirectionalLight(0xFFF8E5, 2.5);
|
|
|
light.position.set(5, 7, 3); //default; light shining from top
|
|
|
- light.castShadow = true; // default false
|
|
|
- // 默认情况下光投影相机区域是一个长宽高为10x10x500的长方体区域,光源投射方向为通过坐标原点
|
|
|
- light.shadow.camera.left = -100; // 这个区域内产生阴影
|
|
|
- light.shadow.camera.right = 100; // 这个区域内产生阴影
|
|
|
- light.shadow.camera.top = 100; // 这个区域内产生阴影
|
|
|
- light.shadow.camera.bottom = -100; // 这个区域内产生阴影
|
|
|
+ if(!that.isIOS){
|
|
|
+ light.castShadow = true; // default false
|
|
|
+ // 默认情况下光投影相机区域是一个长宽高为10x10x500的长方体区域,光源投射方向为通过坐标原点
|
|
|
+ light.shadow.camera.left = -100; // 这个区域内产生阴影
|
|
|
+ light.shadow.camera.right = 100; // 这个区域内产生阴影
|
|
|
+ light.shadow.camera.top = 100; // 这个区域内产生阴影
|
|
|
+ light.shadow.camera.bottom = -100; // 这个区域内产生阴影
|
|
|
+
|
|
|
+ light.shadow.mapSize.width = 1024; // 影响阴影的清晰度
|
|
|
+ light.shadow.mapSize.height = 1024; // 影响阴影的清晰度
|
|
|
+ }
|
|
|
|
|
|
- light.shadow.mapSize.width = 1024; // 影响阴影的清晰度
|
|
|
- light.shadow.mapSize.height = 1024; // 影响阴影的清晰度
|
|
|
-
|
|
|
scene.add(light);
|
|
|
|
|
|
//antialias 这个值得设置为false,不然IOS上截图会失效
|
|
@@ -196,10 +198,10 @@
|
|
|
antialias:true,
|
|
|
preserveDrawingBuffer: true,
|
|
|
});
|
|
|
- // if(!that.isIOS){
|
|
|
+ if(!that.isIOS){
|
|
|
renderer.shadowMap.enabled = true;//产生阴影
|
|
|
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // 阴影属性
|
|
|
- // }
|
|
|
+ }
|
|
|
renderer.outputEncoding = THREE.sRGBEncoding;
|
|
|
renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
|
// renderer.toneMappingExposure = 0.1;//色调映射的曝光级别。默认是1
|