supermedium / aframe-react

:atom: Build virtual reality experiences with A-Frame and React.
https://ngokevin.github.io/aframe-react-boilerplate/
MIT License
1.42k stars 151 forks source link

Allow antialias property to be set on <Scene> element #112

Closed RSpace closed 5 years ago

RSpace commented 7 years ago

I already added this once: https://github.com/ngokevin/aframe-react/pull/68/files

It was removed later in an unrelated refactor it seems. Need it back now :)

RSpace commented 7 years ago

@ngokevin Actually there's a big problem with how React initializes custom elements and how antialias is initialised that wasn't there in earlier versions of A-Frame.

When React encounters the <a-scene> custom element, it first creates the element without passing the props in as attributes:

el = ownerDocument.createElement(this._currentElement.type);

Immediately after, it then sets the props as attributes:

this._updateDOMProperties(null, props, transaction);

However, the first line triggers the init method in a-scene, which looks for the antialias attribute, which hasn't been set yet by React at this point:

https://github.com/aframevr/aframe/blob/e0a2ebc24b7dd67ca60831c0af851dcb49c114cb/src/core/scene/a-scene.js#L71

I just want to be able to control if antialising it enable or not from the outside, in my A-Frame React app. Any suggestions?

ngokevin commented 5 years ago

antialias has moved to the renderer component in 0.9.0 coming soon, thanks!