Replies: 2 comments
-
I find it quite difficult to implement something I am satisfied with. In general it is easy to split the <Canvas
{engineProps}
{sceneProps}
>
<!-- Stuff -->
</Canvas> which I personally find counter intuitiv. Since you would have to know the difference between However, since this is nothing but an opinion of mine, and I don't really like basing decisions on opinions. I am open to implementing this in the future. If you want you surely can create a pull request. However it is required
|
Beta Was this translation helpful? Give feedback.
-
The point of having sub components (here I am not aware about the global complexity that Babylon gives us the possibility to do, so my vision may be very simple and narrowed by my limited knowledge about WebGL. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
As I explained in this comment, I believe it would be nicer to have more detailed / fragmented components.
Here is why I think that way...
The massive Canvas component gives a feeling of obligation to fill soooo many parameters.
This gives a feeling that this component does everything. Then, it forces the developer to create a lot of code to inject as props to the Canvas.
Impossible to know what is mandatory or not, it's very confusing for somebody who is not familiar with WebGL and / or Babylon.
Also, having a hierarchy of components is more visual to know where parameters belong to.
You know that a Canvas builds an Engine that builds a Scene. You know that this polygon has an animation bound to it, etc.
I think the best expression of that is when creating Lights and choosing to bind it to the scene globally, or to the Camera, or how you cast shadows, etc.
Aside of that, Svelte allows typing of components as
HTMLCanvasElement
properties (for<canvas />
), so it allows to pass the usual properties to the Canvas, which will be in the instance bound to the tag.The same can go with any component, typing it as its Babylon type to use props or subcomponents.
That way, it gives the choice to use the type properties or subcomponents.
It also allows to set some properties as mandatory for building the object behind the component.
Finally, I also think that it is a better way to build the scene, because using components with properties gives the hints of what you have to put and where to put it.
The code stay separated in the place where it's needed, and so it's also easier to debug when the code is spread is smaller units of code dedicated to one purpose / task.
If a scene fails, the components can be put in comment one by one to see what went wrong and where it went wrong.
Thank you for reading ;-)
Beta Was this translation helpful? Give feedback.
All reactions