|
@@ -36,11 +36,11 @@
|
|
<script src="js/utils/ShadowMapViewer.js"></script>
|
|
<script src="js/utils/ShadowMapViewer.js"></script>
|
|
|
|
|
|
<script src="js/Detector.js"></script>
|
|
<script src="js/Detector.js"></script>
|
|
-
|
|
|
|
|
|
+
|
|
<script src="js/libs/stats.min.js"></script>
|
|
<script src="js/libs/stats.min.js"></script>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-
|
|
|
|
|
|
+
|
|
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
|
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
|
|
|
|
|
var camera, scene, renderer, clock, stats;
|
|
var camera, scene, renderer, clock, stats;
|
|
@@ -71,22 +71,24 @@
|
|
scene = new THREE.Scene();
|
|
scene = new THREE.Scene();
|
|
|
|
|
|
// Lights
|
|
// Lights
|
|
- var ambient = new THREE.AmbientLight( 0x404040 );
|
|
|
|
- scene.add( ambient );
|
|
|
|
|
|
+
|
|
|
|
+ scene.add( new THREE.AmbientLight( 0x404040 ) );
|
|
|
|
|
|
spotLight = new THREE.SpotLight( 0xffffff );
|
|
spotLight = new THREE.SpotLight( 0xffffff );
|
|
|
|
+ spotLight.name = 'Spot Light';
|
|
spotLight.position.set( 10, 10, 5 );
|
|
spotLight.position.set( 10, 10, 5 );
|
|
spotLight.castShadow = true;
|
|
spotLight.castShadow = true;
|
|
spotLight.shadowCameraNear = 8;
|
|
spotLight.shadowCameraNear = 8;
|
|
spotLight.shadowCameraFar = 30;
|
|
spotLight.shadowCameraFar = 30;
|
|
spotLight.shadowDarkness = 0.5;
|
|
spotLight.shadowDarkness = 0.5;
|
|
- spotLight.shadowCameraVisible = true;
|
|
|
|
spotLight.shadowMapWidth = 1024;
|
|
spotLight.shadowMapWidth = 1024;
|
|
spotLight.shadowMapHeight = 1024;
|
|
spotLight.shadowMapHeight = 1024;
|
|
- spotLight.name = 'Spot Light';
|
|
|
|
scene.add( spotLight );
|
|
scene.add( spotLight );
|
|
|
|
|
|
|
|
+ scene.add( new THREE.CameraHelper( spotLight.shadow.camera ) );
|
|
|
|
+
|
|
dirLight = new THREE.DirectionalLight( 0xffffff, 1 );
|
|
dirLight = new THREE.DirectionalLight( 0xffffff, 1 );
|
|
|
|
+ dirLight.name = 'Dir. Light';
|
|
dirLight.position.set( 0, 10, 0 );
|
|
dirLight.position.set( 0, 10, 0 );
|
|
dirLight.castShadow = true;
|
|
dirLight.castShadow = true;
|
|
dirLight.shadowCameraNear = 1;
|
|
dirLight.shadowCameraNear = 1;
|
|
@@ -96,12 +98,11 @@
|
|
dirLight.shadowCameraTop = 15;
|
|
dirLight.shadowCameraTop = 15;
|
|
dirLight.shadowCameraBottom = -15;
|
|
dirLight.shadowCameraBottom = -15;
|
|
dirLight.shadowDarkness = 0.5;
|
|
dirLight.shadowDarkness = 0.5;
|
|
- dirLight.shadowCameraVisible = true;
|
|
|
|
dirLight.shadowMapWidth = 1024;
|
|
dirLight.shadowMapWidth = 1024;
|
|
dirLight.shadowMapHeight = 1024;
|
|
dirLight.shadowMapHeight = 1024;
|
|
- dirLight.name = 'Dir. Light';
|
|
|
|
scene.add( dirLight );
|
|
scene.add( dirLight );
|
|
|
|
|
|
|
|
+ scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) );
|
|
|
|
|
|
// Geometry
|
|
// Geometry
|
|
var geometry = new THREE.TorusKnotGeometry( 25, 8, 75, 20 );
|
|
var geometry = new THREE.TorusKnotGeometry( 25, 8, 75, 20 );
|