BABYLON.Mesh.prototype.dispose = function (doNotRecurse) {
if (this._vertexBuffers) {
for (var index = 0; index < this._vertexBuffers.length; index++) {
this._vertexBuffers[index].dispose();
}
this._vertexBuffers = null;
}
if (this._indexBuffer) {
this._scene.getEngine()._releaseBuffer(this._indexBuffer);
this._indexBuffer = null;
}
// Remove from scene
var index = this._scene.meshes.indexOf(this);
if(index == -1) {
return;
}
this._scene.meshes.splice(index, 1);
if (!doNotRecurse) {
// Particles
for (var index = 0; index < this._scene.particleSystems.length; index++) {
if (this._scene.particleSystems[index].emitter == this) {
this._scene.particleSystems[index].dispose();
index--;
}
}
// Children
var objects = this._scene.meshes.slice(0);
for (var index = 0; index < objects.length; index++) {
if (objects[index].parent == this) {
objects[index].dispose();
}
}
}
else { // the parent is deleted, we remove the reference of every child.
var objects = this._scene.meshes.slice(0);
for (var index = 0; index < objects.length; index++) {
if (objects[index].parent == this) {
delete objects[index].parent;
}
}
}
this._isDisposed = true;
// Callback
if (this.onDispose) {
this.onDispose();
}
};
// Get the Canvas element from our HTML below
var canvas = document.getElementById("renderCanvas");
// Load BABYLON 3D engine
var engine = new BABYLON.Engine(canvas, true);
window.scene = new BABYLON.Scene(engine);
var scene = window.scene;
// Creating a camera looking to the zero point (0,0,0), a light, and a sphere of size 1
var camera = new BABYLON.ArcRotateCamera("Camera", 1, 0.8, 30, new...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.