From 0dcef2ba1881123d231d41815971b3de478ce59f Mon Sep 17 00:00:00 2001 From: Vlad Stepura Date: Thu, 13 Aug 2020 13:34:22 +0300 Subject: [PATCH] Added placing of light and volume in front of camera --- src/js/shared/actions/scene-object-creators.js | 16 +++++++++------- .../shot-generator/components/Toolbar/index.js | 8 ++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/js/shared/actions/scene-object-creators.js b/src/js/shared/actions/scene-object-creators.js index e16436a8d6..1f35bbd292 100644 --- a/src/js/shared/actions/scene-object-creators.js +++ b/src/js/shared/actions/scene-object-creators.js @@ -118,13 +118,14 @@ const createCharacter = (id, camera, room) => { }) } -const createLight = (id) => { +const createLight = (id, camera, room) => { + let { x, y, z, rotation } = generatePositionAndRotation(camera, room) return createObject({ id, type: 'light', - x: 0, y: 0, z: 2, - rotation: 0, tilt: 0, roll: 0, + x: x, y: y, z: 2, + rotation: rotation, tilt: 0, roll: 0, intensity: 0.8, visible: true, @@ -135,16 +136,17 @@ const createLight = (id) => { }) } -const createVolume = (id) => { +const createVolume = (id, camera, room) => { + let { x, y, z, rotation } = generatePositionAndRotation(camera, room) return createObject({ id, type: 'volume', - x: 0, y: 2, z: 0, + x: x, y: y, z: z, width: 5, height: 5, depth: 5, - rotation: 0, + rotation: rotation, visible: true, opacity: 0.3, @@ -157,7 +159,7 @@ const createVolume = (id) => { const createImage = (id, camera, room) => { let { x, y, z, rotation } = generatePositionAndRotation(camera, room) - + return createObject({ id, type: 'image', diff --git a/src/js/shot-generator/components/Toolbar/index.js b/src/js/shot-generator/components/Toolbar/index.js index b96e4eb741..ed524a4b01 100644 --- a/src/js/shot-generator/components/Toolbar/index.js +++ b/src/js/shot-generator/components/Toolbar/index.js @@ -136,18 +136,18 @@ const Toolbar = connect( const onCreateLightClick = () => { let id = THREE.Math.generateUUID() - + initCamera() undoGroupStart() - createLight(id) + createLight(id, camera.current, room.visible && roomObject3d) selectObject(id) undoGroupEnd() } const onCreateVolumeClick = () => { let id = THREE.Math.generateUUID() - + initCamera() undoGroupStart() - createVolume(id) + createVolume(id, camera.current, room.visible && roomObject3d) selectObject(id) undoGroupEnd() }