You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our team write a mixin library to improve and extend babylon builtin Class functions, such as Scene/AbstractMesh/Material, because wirting extension for builtin Class used XXX.prototype is so tedius.
But, the implementation of mixin library need to observe builtin type object creation, to copy property descriptors.
Now, we are using apis Engine.onNewSceneAddedObservable, Scene.onNewMeshAddedObservable, Material.OnEventObservable to achieve the goal. But these apis are not perfect:
Engine.onNewSceneAddedObservable can not be used observing non-virtual scene creation, so we hacked engine._virtualScenes to listen the calling of engine._virtualScenes.push.
Scene.onNewMeshAddedObservable can not be used observing abstract mesh creation when importing gltf file, because babylon need to create and collect all entities from gltf first, and then add them into current scene.
Material.OnEventObservable is closed to perfect, but only emit one event MaterialPluginEvent.Created. Name of th event is not perfect.
So, we want some perfect observables to exactly observe Scene/AbstractMesh/Material objects creation, like Material.OnEventObservable, but has more appropriate event name.
Our team write a mixin library to improve and extend babylon builtin Class functions, such as
Scene
/AbstractMesh
/Material
, because wirting extension for builtin Class usedXXX.prototype
is so tedius.the mixin is used as follows:
But, the implementation of mixin library need to observe builtin type object creation, to copy property descriptors.
Now, we are using apis
Engine.onNewSceneAddedObservable
,Scene.onNewMeshAddedObservable
,Material.OnEventObservable
to achieve the goal. But these apis are not perfect:Engine.onNewSceneAddedObservable
can not be used observing non-virtual scene creation, so we hackedengine._virtualScenes
to listen the calling ofengine._virtualScenes.push
.Scene.onNewMeshAddedObservable
can not be used observing abstract mesh creation when importing gltf file, because babylon need to create and collect all entities from gltf first, and then add them into current scene.Material.OnEventObservable
is closed to perfect, but only emit one eventMaterialPluginEvent.Created
. Name of th event is not perfect.So, we want some perfect observables to exactly observe
Scene
/AbstractMesh
/Material
objects creation, likeMaterial.OnEventObservable
, but has more appropriate event name.for example
It would be nice if there were other observables to notify other type objects creation, such as
PBRMaterial
,Mesh
,InstancedMesh
.The text was updated successfully, but these errors were encountered: