Skip to content

Commit

Permalink
Added placing of light and volume in front of camera
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Stepura committed Aug 13, 2020
1 parent ef24d2d commit 0dcef2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
16 changes: 9 additions & 7 deletions src/js/shared/actions/scene-object-creators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions src/js/shot-generator/components/Toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 0dcef2b

Please sign in to comment.