Skip to content

Commit

Permalink
✨ Add headset and rotating chair
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosimon committed Sep 2, 2021
1 parent e769c7c commit 387da41
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
55 changes: 55 additions & 0 deletions src/Experience/TopChair.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import * as THREE from 'three'
import { gsap } from 'gsap'

import Experience from './Experience.js'

export default class TopChair
{
constructor()
{
this.experience = new Experience()
this.resources = this.experience.resources
this.debug = this.experience.debug
this.scene = this.experience.scene
this.world = this.experience.world
this.time = this.experience.time

// Debug
if(this.debug)
{
this.debugFolder = this.debug.addFolder({
title: 'topChair',
expanded: true
})
}

this.setModel()
this.setAnimation()
}

setModel()
{
this.model = {}

this.model.group = this.resources.items.topChairModel.scene.children[0]
this.scene.add(this.model.group)

this.model.group.traverse((_child) =>
{
if(_child instanceof THREE.Mesh)
{
_child.material = this.world.room.material
}
})
}

setAnimation()
{
this.animation = {}
}

update()
{
this.model.group.rotation.y = Math.sin(this.time.elapsed * 0.0005) * 0.5
}
}
14 changes: 10 additions & 4 deletions src/Experience/World.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Experience from './Experience.js'
import GoogleLeds from './GoogleLeds.js'
import LoupedeckButtons from './LoupedeckButtons.js'
import CoffeeSteam from './CoffeeSteam.js'
import TopChair from './TopChair.js'

export default class World
{
Expand All @@ -22,6 +23,7 @@ export default class World
this.setGoogleLeds()
this.setLoupedeckButtons()
this.setCoffeeSteam()
this.setTopChair()
}
})
}
Expand Down Expand Up @@ -56,10 +58,6 @@ export default class World
})

this.scene.add(this.room.model)

const directionalLight = new THREE.DirectionalLight('#ffffff', 3)
directionalLight.position.set(5, 5, 5)
this.scene.add(directionalLight)
}

setGoogleLeds()
Expand All @@ -77,6 +75,11 @@ export default class World
this.coffeeSteam = new CoffeeSteam()
}

setTopChair()
{
this.topChair = new TopChair()
}

resize()
{
}
Expand All @@ -91,6 +94,9 @@ export default class World

if(this.coffeeSteam)
this.coffeeSteam.update()

if(this.topChair)
this.topChair.update()
}

destroy()
Expand Down
2 changes: 2 additions & 0 deletions src/Experience/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export default [

{ name: 'loupedeckButtonsModel', source: '/assets/loupedeckButtonsModel.glb', type: 'model' },

{ name: 'topChairModel', source: '/assets/topChairModel.glb', type: 'model' },

{ name: 'coffeeSteamModel', source: '/assets/coffeeSteamModel.glb', type: 'model' },

{ name: 'bakedTexture', source: '/assets/baked.jpg', type: 'texture' },
Expand Down
Binary file modified static/assets/roomModel.glb
Binary file not shown.
Binary file added static/assets/topChairModel.glb
Binary file not shown.

1 comment on commit 387da41

@vercel
Copy link

@vercel vercel bot commented on 387da41 Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.