xeolabs/xeogl

Scene clear() broken

xeolabs opened this issue · 0 comments

Describe the bug
Calling myScene.clear() destroys components that we should not destroy, like xeogl.Camera, xeogl.Viewport, xeogl.Canvas````.

To Reproduce

var myScene = new xeogl.Scene();
var myMesh = new xeogl.Mesh(myScene); // Gets default box geometry etc
myScene.destroy(); // Destroys all components, including xeogl.Camera, xeogl.Canvas, xeogl.Viewport, etc.

With the xeogl.Canvas getting destroyed, we also lose the HTML canvas and the WebGL context, which crashes xeogl.

Expected behavior

var myScene = new xeogl.Scene();
var myMesh = new xeogl.Mesh(myScene); 

// At this point we have a mesh with the default box geometry

myScene.destroy(); 

// Atthis point, myScene.camera, myScene.viewport, myScene.canvas
// should all still exist (not destroyed)

var myMesh2 = new xeogl.Mesh(myScene);

// At this point we once more have a mesh with the default box geometry

Desktop (please complete the following information):

  • OS: ALL
  • Browser ALL
  • Version v0.8

Smartphone (please complete the following information):

  • Device: ALL
  • OS: ALL
  • Browser ALL
  • Version v0.8