@@ -54,7 +54,7 @@ const CONFIG = {
5454 "galleryImageClass" : "field--type-image"
5555} ;
5656
57- let camera , scene , renderer , stats , controls , loader , ambientLight , dirLight , dirLightTarget ;
57+ let camera , scene , renderer , stats , controls , loader , ambientLight , dirLight , dirLightTarget , cameraLight , cameraLightTarget ;
5858let imported ;
5959var mainObject = [ ] ;
6060var metadataContentTech ;
@@ -509,6 +509,8 @@ function setupObject (_object, _camera, _light, _data, _controls) {
509509 }
510510 }
511511 }
512+ cameraLightTarget . position . set ( _object . position . x , _object . position . y , _object . position . z ) ;
513+ cameraLight . target . updateMatrixWorld ( ) ;
512514}
513515
514516function setupClippingPlanes ( _geometry , _size , _distance ) {
@@ -1563,6 +1565,11 @@ function onPointerUp( e ) {
15631565function onPointerMove ( e ) {
15641566 pointer . x = ( ( e . clientX - container . getBoundingClientRect ( ) . left ) / renderer . domElement . clientWidth ) * 2 - 1 ;
15651567 pointer . y = - ( ( e . clientY - container . getBoundingClientRect ( ) . top ) / renderer . domElement . clientHeight ) * 2 + 1 ;
1568+ if ( e . buttons === 1 ) {
1569+ if ( pointer . x !== onDownPosition . x && pointer . y !== onDownPosition . y ) {
1570+ cameraLight . position . set ( camera . position . x , camera . position . y , camera . position . z ) ;
1571+ }
1572+ }
15661573 if ( e . buttons !== 1 ) {
15671574 if ( EDITOR ) {
15681575 raycaster . setFromCamera ( pointer , camera ) ;
@@ -1695,6 +1702,18 @@ function init() {
16951702 dirLight . shadow . mapSize . height = 1024 * 4 ;
16961703 scene . add ( dirLight ) ;
16971704 lightObjects . push ( dirLight ) ;
1705+
1706+ cameraLightTarget = new THREE . Object3D ( ) ;
1707+ cameraLightTarget . position . set ( camera . position . x , camera . position . y , camera . position . z ) ;
1708+ scene . add ( cameraLightTarget ) ;
1709+
1710+ cameraLight = new THREE . DirectionalLight ( 0xffffff ) ;
1711+ cameraLight . position . set ( camera . position ) ;
1712+ cameraLight . castShadow = false ;
1713+ cameraLight . intensity = 0.3 ;
1714+ scene . add ( cameraLight ) ;
1715+ cameraLight . target = cameraLightTarget ;
1716+ cameraLight . target . updateMatrixWorld ( ) ;
16981717
16991718 renderer = new THREE . WebGLRenderer ( { antialias : true , logarithmicDepthBuffer : true , colorManagement : true , sortObjects : true , preserveDrawingBuffer : true , powerPreference : "high-performance" } ) ;
17001719 renderer . setPixelRatio ( window . devicePixelRatio ) ;
0 commit comments