Open fallenoak opened 8 years ago
@timkurvers Any thoughts on this?
I've started playing around with this idea here: https://github.com/fallenoak/wowser/tree/refactor/world-handler
I'm definitely liking the idea of moving anything relating to camera / rendering logic out of GameScreen
and into a dedicated WorldRenderer
.
Down the road, we could conceivably create a few more renderers unique to other contexts-- such as MenuRenderer
and PortraitRenderer
.
Fully :+1: on all of this. I might have a peek at some of the main menu or introduction cinematics, where this would definitely come in handy.
GameScreen
is potentially a not-so-great place to set up the renderer and camera.For starters, as rendering gets more sophisticated (for instance, if we begin to use multiple render passes), the
WorldHandler
will need to dip in to theGameScreen
to interact with the renderer, or vice versa.Additionally, at present, the initialization of
WorldHandler
begins loading a map-- prior to logging in or otherwise starting to interact with the game. It'd be better if the world didn't begin to load at least until the game screen is selected from the screen dropdown.An alternative approach to this is outlined below.
Progress
WorldRenderer
class Responsible for: managingTHREE.WebGLRenderer
and render passes; managing world camera(s); updating the renderer in response to resize events; managing theRequestAnimationFrame
loopGameScreen
to no longer handle the camera, renderer, or the animation loop These aspects of rendering would instead be managed byWorldRenderer
.WorldHandler
Instead, wait untilGameScreen
mounts to do the worldport. Eventually, worldport should only happen after character selection.GameScreen
mounts to do the model load. Eventually, player model loading should only happen after character selection.