gohyperr / hecs

A high performance lightweight ECS with a plugin ecosystem!
MIT License
23 stars 1 forks source link

[hecs-plugin-three] Be able to set WebGLRenderer constructor params #23

Open canadaduane opened 3 years ago

canadaduane commented 3 years ago

Currently, there is no way to configure the renderer created in Presentation:

  createRenderer() {
    const renderer = new THREE.WebGLRenderer({
      antialias: true,
    })
...

As far as I can tell, these constructor params cannot be set after-the-fact.

Use Case: In order to get mixed-mode CSS3D+WebGL working, I need the alpha: true setting for WebGLRenderer.

ashconnell commented 3 years ago

Yeah for now it's just using some hardcoded defaults. It could probably have a method world.presentation.configure(options) to rebuild the WebGLRenderer/Camera/Scene etc based on some options if needed

canadaduane commented 3 years ago

Oh, that's an interesting approach. So basically throw away what was already configured, and build it again. You get the advantage of reasonable "default settings" as well as a way to customize settings.

This might also be a good way to handle the default lighting situation.

ashconnell commented 3 years ago

I'd be happy to update hecs-plugin-three to support replacing the scene, camera, renderer etc using this flow

https://github.com/gohyperr/hecs/pull/26#issuecomment-730060336

And if the option doesn't exist it just falls back to what it currently does

canadaduane commented 3 years ago

Yes, that would be perfect.