Skip to content

Commit

Permalink
solve the routing issue for brain stem.
Browse files Browse the repository at this point in the history
  • Loading branch information
Annie Taylor Chen committed Apr 28, 2022
1 parent de3eb58 commit 6508408
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 39 deletions.
1 change: 0 additions & 1 deletion src/lib/organism/BrainStem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<section>
<p>Click on the debug button below for control access to make magic happen!</p>
<p>TODO: I need to fix the loading issue. If it doesn't load, refresh or reload the page!</p>
<a href="/brain-stem#debug">debug</a>
<canvas bind:this={canvasEl} />
</section>
Expand Down
12 changes: 6 additions & 6 deletions src/lib/organism/Experience/Experience.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export default class Experience
{
constructor(_canvas)
{
// Singleton
if(instance)
{
return instance
}
instance = this
// Singleton: note this might not work with SvelteKit with the routing
// if(instance)
// {
// return instance
// }
// instance = this

// Global access
window.experience = this
Expand Down
12 changes: 5 additions & 7 deletions src/lib/organism/Experience/World/BrainStem.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as THREE from 'three'
import Experience from '../Experience.js'

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

// Debug
if(this.debug.active)
Expand Down
12 changes: 5 additions & 7 deletions src/lib/organism/Experience/World/Environment.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import * as THREE from 'three'
import Experience from '../Experience.js'

export default class Environment
{
constructor()
constructor(_experience)
{
this.experience = new Experience()
this.scene = this.experience.scene
this.resources = this.experience.resources
this.debug = this.experience.debug

this.scene = _experience.scene
this.resources = _experience.resources
this.debug = _experience.debug

// Debug
if(this.debug.active)
Expand Down
9 changes: 3 additions & 6 deletions src/lib/organism/Experience/World/Floor.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import * as THREE from 'three'
import Experience from '../Experience.js'

export default class Floor
{
constructor()
constructor(_experience)
{
this.experience = new Experience()
this.scene = this.experience.scene
this.resources = this.experience.resources
this.scene = _experience.scene
this.resources = _experience.resources

this.setGeometry()
this.setTextures()
Expand Down
13 changes: 5 additions & 8 deletions src/lib/organism/Experience/World/Fox.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import * as THREE from 'three'
import Experience from '../Experience.js'

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

// Debug
if(this.debug.active)
Expand Down
8 changes: 4 additions & 4 deletions src/lib/organism/Experience/World/World.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export default class World
this.resources.on('ready', () =>
{
// Setup
this.floor = new Floor()
this.fox = new Fox()
this.brainStem = new BrainStem()
this.environment = new Environment()
this.floor = new Floor(_experience)
this.fox = new Fox(_experience)
this.brainStem = new BrainStem(_experience)
this.environment = new Environment(_experience)
})
}

Expand Down

1 comment on commit 6508408

@vercel
Copy link

@vercel vercel bot commented on 6508408 Apr 28, 2022

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.