Skip to content

Commit

Permalink
Minor code tidying - no API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Aug 24, 2010
1 parent b23f636 commit d93b400
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/scenejs/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ var SceneJS = {
}
return func.apply(this, args);
},

/**
* Fire an event at the node with teh given ID
*
Expand Down
1 change: 1 addition & 0 deletions src/scenejs/geometry/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SceneJS.Text.prototype._init = function(params) {
this._create = function() {
var geo = SceneJS._vectorTextModule.getGeometry(1, 0, 0, params.text); // Unit size
return {
type: this._id,
primitive : "lines",
positions : geo.positions,
normals: [],
Expand Down
6 changes: 3 additions & 3 deletions src/scenejs/geometry/text/vectorTextModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ SceneJS._vectorTextModule = new (function() {
continue;
}

geo.positions.push(x + a[0] * -mag);
geo.positions.push(x + a[0] * mag);
geo.positions.push(y + a[1] * mag);
geo.positions.push(0);

Expand All @@ -1486,10 +1486,10 @@ SceneJS._vectorTextModule = new (function() {
}
needLine = true;
}
x -= c.width * mag;
x += c.width * mag;

}
y -= 25 * mag;
y += 25 * mag;
}
return geo;
};
Expand Down
4 changes: 2 additions & 2 deletions src/scenejs/interpolation/interpolator.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*/
SceneJS.Interpolator = function() {
SceneJS.Node.apply(this, arguments);
this._nodeType = "interpolator";
this._nodeType = "interpolator";
this._input = null;
this._output = null;
this._outputValue = null;
Expand Down Expand Up @@ -284,7 +284,7 @@ SceneJS.Interpolator.prototype._render = function(traversalContext, data) {
if (key == undefined || key == null) {
throw SceneJS._errorModule.fatalError(
new SceneJS.errors.DataExpectedException(
"SceneJS.Interpolator failed to find input on data: '" + params.input + "'"));
"SceneJS.Interpolator failed to find input on data: '" + this._input + "'"));
}
this._update(key);
var obj = {};
Expand Down
11 changes: 10 additions & 1 deletion src/scenejs/node/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ SceneJS.Node = function() {
this._NODEINFO = null; // Big and bold, to stand out in debugger object graph inspectors
this._sid = null;
this._children = [];
this._fixedParams = true;
this._fixedParams = true;
this._parent = null;
this._listeners = {};
this._numListeners = 0; // Useful for quick check whether node observes any events
Expand Down Expand Up @@ -1013,6 +1013,15 @@ SceneJS.Node.prototype.addListener = function(eventName, fn, options) {
return this;
};

/**
* Destroys this node the next time it's rendered
* @return {SceneJS.Node} this
*/
SceneJS.Node.prototype.destroy = function() {
// alert("destroying");
return this;
};

/**
* Fires an event at this node
* @param {String} eventName Event name
Expand Down
99 changes: 99 additions & 0 deletions src/scenejs/transformation/modelView/lookAt.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,39 @@ SceneJS.LookAt.prototype.setEye = function(eye) {
return this;
};

/** Sets the eye X position.
*
* @param {float} x Eye X position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setEyeX = function(x) {
this._eyeX = x || 0;
this._memoLevel = 0;
return this;
};

/** Sets the eye Y position.
*
* @param {float} y Eye Y position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setEyeY = function(y) {
this._eyeY = y || 0;
this._memoLevel = 0;
return this;
};

/** Sets the eye Z position.
*
* @param {float} z Eye Z position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setEyeZ = function(z) {
this._eyeZ = z || 0;
this._memoLevel = 0;
return this;
};

/** Returns the eye position.
*
* @returns {Object} Eye position - Eg. { x: 0.0, y: 10.0, z: -15 }
Expand All @@ -81,6 +114,39 @@ SceneJS.LookAt.prototype.setLook = function(look) {
return this;
};

/** Sets the look X position.
*
* @param {float} x Look X position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setLookX = function(x) {
this._lookX = x || 0;
this._memoLevel = 0;
return this;
};

/** Sets the look Y position.
*
* @param {float} y Look Y position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setLookY = function(y) {
this._lookY = y || 0;
this._memoLevel = 0;
return this;
};

/** Sets the look Z position.
*
* @param {float} z Look Z position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setLookZ = function(z) {
this._lookZ = z || 0;
this._memoLevel = 0;
return this;
};

/** Returns the position being looked at.
* @returns {Object} Point looked at - Eg. { x: 0.0, y: 2.0, z: 0.0 }
*/
Expand Down Expand Up @@ -113,6 +179,39 @@ SceneJS.LookAt.prototype.setUp = function(up) {
return this;
};

/** Sets the up X position.
*
* @param {float} x Up X position
* @returns {SceneJS.UpAt} this
*/
SceneJS.LookAt.prototype.setUpX = function(x) {
this._upX = x || 0;
this._memoLevel = 0;
return this;
};

/** Sets the up Y position.
*
* @param {float} y Up Y position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setUpY = function(x) {
this._upY = y || 0;
this._memoLevel = 0;
return this;
};

/** Sets the up Z position.
*
* @param {float} z Up Z position
* @returns {SceneJS.LookAt} this
*/
SceneJS.LookAt.prototype.setUpZ = function(x) {
this._upZ = z || 0;
this._memoLevel = 0;
return this;
};


/** Returns the "up" vector - the direction that is considered "upwards".
*
Expand Down
2 changes: 1 addition & 1 deletion src/scenejs/transformation/modelView/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SceneJS.Translate = function() {
SceneJS.Node.apply(this, arguments);
this._nodeType = "translate";
this._mat = null;
this._xform = null;
this._xform = null;
this._x = 0;
this._y = 0;
this._z = 1;
Expand Down

0 comments on commit d93b400

Please sign in to comment.