snapsvg
Version:
JavaScript Vector Library
28 lines (26 loc) • 738 B
JavaScript
/**
* @class Scene
* @author Matthew Wagerfield
*/
FSS.Scene = function() {
this.meshes = [];
this.lights = [];
};
FSS.Scene.prototype = {
add: function(object) {
if (object instanceof FSS.Mesh && !~this.meshes.indexOf(object)) {
this.meshes.push(object);
} else if (object instanceof FSS.Light && !~this.lights.indexOf(object)) {
this.lights.push(object);
}
return this;
},
remove: function(object) {
if (object instanceof FSS.Mesh && ~this.meshes.indexOf(object)) {
this.meshes.splice(this.meshes.indexOf(object), 1);
} else if (object instanceof FSS.Light && ~this.lights.indexOf(object)) {
this.lights.splice(this.lights.indexOf(object), 1);
}
return this;
}
};