Cache Test
by Julien Gobin
JavaScript
TEST = function() {};
// Node //////////////////////////////////////////
TEST.Node = function() {
console.log("TEST.Node");
TEST.Node.prototype._initCache.call(this);
console.log("Node.cache", this._cache);
};
TEST.Node.prototype._cache = null;
TEST.Node.prototype._initCache = function () {
console.log("TEST.Node.prototype._initCache");
this._cache = {};
TEST.Node.prototype._updateCache.call(this, true);
};
TEST.Node.prototype.updateCache = function () {
console.log("TEST.Node.prototype.updateCache");
this._updateCache();
};
TEST.Node.prototype._updateCache = function () {
console.log("TEST.Node.prototype._updateCache");
};
// Camera ////////////////////////////////////////
TEST.Camera = function() {
console.log("TEST.Camera");
TEST.Node.call(this);
TEST.Camera.prototype._initCache.call(this);
console.log("Camera.cache", this._cache);
};
TEST.Camera.prototype = Object.create(TEST.Node.prototype);
TEST.Camera.prototype.alpha = -1;
TEST.Camera.prototype._initCache = function () {
console.log("TEST.Camera.prototype._initCache");
this.alpha = 1;
TEST.Camera.prototype._updateCache.call(this, true);
};
TEST.Camera.prototype._updateCache = function (ignoreParent) {
console.log("TEST.Camera.prototype._updateCache");
if(!ignoreParent)
TEST.Node.prototype._updateCache.call(this);
this._cache.alpha = this.alpha;
};
// ArcRotateCamera ///////////////////////////////
TEST.ArcRotateCamera = function() {
console.log("TEST.ArcRotateCamera");
TEST.Camera.call(this);
TEST.ArcRotateCamera.prototype._initCache.call(this);
console.log("ArcRotateCamera.cache", this._cache);
};
TEST.ArcRotateCamera.prototype = Object.create(TEST.Camera.prototype);
TEST.ArcRotateCamera.prototype.beta = -1;
TEST.ArcRotateCamera.prototype._initCache = function () {
console.log("TEST.ArcRotateCamera.prototype._initCache");
...