summaryrefslogtreecommitdiffstats
path: root/o3d/samples
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 23:31:01 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-10 23:31:01 +0000
commitdf9e494541df50c6b975aa9003d2da54fe7c4fa0 (patch)
tree6121bcca8994895b23e29cab4cb318539db0462a /o3d/samples
parent726dcd538802d518fadb88700d5c5ed2c48f9d29 (diff)
downloadchromium_src-df9e494541df50c6b975aa9003d2da54fe7c4fa0.zip
chromium_src-df9e494541df50c6b975aa9003d2da54fe7c4fa0.tar.gz
chromium_src-df9e494541df50c6b975aa9003d2da54fe7c4fa0.tar.bz2
A bunch of jscompiler fixes including updating to
the latest jscompiler. There were a few issues. For some reason o3djs.math.matrix4 was not working in ff3.0 when compiled. I spent about 8 hours trying to reproduce the issue in a small case but had no luck. I finally just tried changing original code and it work. In the process of trying to figure that out I got the latest jscompiler and found there were a bunch of other problems with our js code which are now fixed. Also found out I was incorrectly striping @o3dparameter tags from our code in build_docs.py Also, I learned that properties of objects are strings when returned in an "in" statement as in for (key in object) key is a string regardless of what each key is in object. Review URL: http://codereview.chromium.org/200089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples')
-rw-r--r--o3d/samples/o3djs/debug.js17
-rw-r--r--o3d/samples/o3djs/math.js19
-rw-r--r--o3d/samples/o3djs/picking.js2
-rw-r--r--o3d/samples/o3djs/simple.js5
-rw-r--r--o3d/samples/o3djs/texture.js6
-rw-r--r--o3d/samples/o3djs/util.js1
6 files changed, 29 insertions, 21 deletions
diff --git a/o3d/samples/o3djs/debug.js b/o3d/samples/o3djs/debug.js
index 77dab97..429a75f 100644
--- a/o3d/samples/o3djs/debug.js
+++ b/o3d/samples/o3djs/debug.js
@@ -650,16 +650,16 @@ o3djs.debug.DebugLineGroup = function(debugHelper, root) {
this.currentColor_ = [1, 1, 1, 1];
/**
- * The transforms for all the lines in this group indexed by clientId.
+ * The lines in this group indexed by clientId.
* @private
- * @type {!Object.<number, !o3d.Transform>}
+ * @type {!Object.<number, !o3djs.debug.DebugLine>}
*/
this.lineTransforms_ = { };
/**
- * The transforms for all the unused lines in this group indexed by clientId.
+ * The unused lines in this group indexed by clientId.
* @private
- * @type {!Object.<number, !o3d.Transform>}
+ * @type {!Object.<number, !o3djs.debug.DebugLine>}
*/
this.freeLineTransforms_ = { };
@@ -725,7 +725,8 @@ o3djs.debug.DebugLineGroup.prototype.setColor = function(color) {
* @return {!o3djs.debug.DebugLine} The DebugLine.
*/
o3djs.debug.DebugLineGroup.prototype.getLine_ = function() {
- for (var id in this.freeLineTransforms_) {
+ for (var sid in this.freeLineTransforms_) {
+ var id = /** @type {number} */ (sid);
var line = this.freeLineTransforms_[id];
delete this.freeLineTransforms_[id];
return line;
@@ -755,7 +756,8 @@ o3djs.debug.DebugLineGroup.prototype.addLine = function(opt_start,
* Clears all the lines in this group.
*/
o3djs.debug.DebugLineGroup.prototype.clear = function() {
- for (var id in this.lineTransforms_) {
+ for (var sid in this.lineTransforms_) {
+ var id = /** @type {number} */ (sid);
var line = this.lineTransforms_[id];
line.setVisible(false);
this.freeLineTransforms_[id] = line;
@@ -768,7 +770,8 @@ o3djs.debug.DebugLineGroup.prototype.clear = function() {
*/
o3djs.debug.DebugLineGroup.prototype.destroy = function() {
this.clear();
- for (var id in this.freeLineTransforms_) {
+ for (var sid in this.freeLineTransforms_) {
+ var id = /** @type {number} */ (sid);
this.freeLineTransforms_[id].destroy();
}
this.freeLineTransforms_ = { };
diff --git a/o3d/samples/o3djs/math.js b/o3d/samples/o3djs/math.js
index a6bf33a..e840f23 100644
--- a/o3d/samples/o3djs/math.js
+++ b/o3d/samples/o3djs/math.js
@@ -213,8 +213,8 @@ o3djs.math.Matrix = goog.typedef;
*/
o3djs.math.pseudoRandom = function() {
var math = o3djs.math;
- return (math.randomSeed_ =
- (134775813 * math.randomSeed_ + 1) %
+ return (math.randomSeed_ =
+ (134775813 * math.randomSeed_ + 1) %
math.RANDOM_RANGE_) / math.RANDOM_RANGE_;
};
@@ -1441,31 +1441,32 @@ o3djs.math.inverse4 = function(m) {
var d = 1.0 / (m[0][0] * t0 + m[1][0] * t1 + m[2][0] * t2 + m[3][0] * t3);
- return [[d * t0, d * t1, d * t2, d * t3],
- [d * ((tmp_1 * m[1][0] + tmp_2 * m[2][0] + tmp_5 * m[3][0]) -
+ var row0 = [d * t0, d * t1, d * t2, d * t3];
+ var row1 = [d * ((tmp_1 * m[1][0] + tmp_2 * m[2][0] + tmp_5 * m[3][0]) -
(tmp_0 * m[1][0] + tmp_3 * m[2][0] + tmp_4 * m[3][0])),
d * ((tmp_0 * m[0][0] + tmp_7 * m[2][0] + tmp_8 * m[3][0]) -
(tmp_1 * m[0][0] + tmp_6 * m[2][0] + tmp_9 * m[3][0])),
d * ((tmp_3 * m[0][0] + tmp_6 * m[1][0] + tmp_11 * m[3][0]) -
(tmp_2 * m[0][0] + tmp_7 * m[1][0] + tmp_10 * m[3][0])),
d * ((tmp_4 * m[0][0] + tmp_9 * m[1][0] + tmp_10 * m[2][0]) -
- (tmp_5 * m[0][0] + tmp_8 * m[1][0] + tmp_11 * m[2][0]))],
- [d * ((tmp_12 * m[1][3] + tmp_15 * m[2][3] + tmp_16 * m[3][3]) -
+ (tmp_5 * m[0][0] + tmp_8 * m[1][0] + tmp_11 * m[2][0]))];
+ var row2 =[d * ((tmp_12 * m[1][3] + tmp_15 * m[2][3] + tmp_16 * m[3][3]) -
(tmp_13 * m[1][3] + tmp_14 * m[2][3] + tmp_17 * m[3][3])),
d * ((tmp_13 * m[0][3] + tmp_18 * m[2][3] + tmp_21 * m[3][3]) -
(tmp_12 * m[0][3] + tmp_19 * m[2][3] + tmp_20 * m[3][3])),
d * ((tmp_14 * m[0][3] + tmp_19 * m[1][3] + tmp_22 * m[3][3]) -
(tmp_15 * m[0][3] + tmp_18 * m[1][3] + tmp_23 * m[3][3])),
d * ((tmp_17 * m[0][3] + tmp_20 * m[1][3] + tmp_23 * m[2][3]) -
- (tmp_16 * m[0][3] + tmp_21 * m[1][3] + tmp_22 * m[2][3]))],
- [d * ((tmp_14 * m[2][2] + tmp_17 * m[3][2] + tmp_13 * m[1][2]) -
+ (tmp_16 * m[0][3] + tmp_21 * m[1][3] + tmp_22 * m[2][3]))];
+ var row3 = [d * ((tmp_14 * m[2][2] + tmp_17 * m[3][2] + tmp_13 * m[1][2]) -
(tmp_16 * m[3][2] + tmp_12 * m[1][2] + tmp_15 * m[2][2])),
d * ((tmp_20 * m[3][2] + tmp_12 * m[0][2] + tmp_19 * m[2][2]) -
(tmp_18 * m[2][2] + tmp_21 * m[3][2] + tmp_13 * m[0][2])),
d * ((tmp_18 * m[1][2] + tmp_23 * m[3][2] + tmp_15 * m[0][2]) -
(tmp_22 * m[3][2] + tmp_14 * m[0][2] + tmp_19 * m[1][2])),
d * ((tmp_22 * m[2][2] + tmp_16 * m[0][2] + tmp_21 * m[1][2]) -
- (tmp_20 * m[1][2] + tmp_23 * m[2][2] + tmp_17 * m[0][2]))]];
+ (tmp_20 * m[1][2] + tmp_23 * m[2][2] + tmp_17 * m[0][2]))];
+ return [row0, row1, row2, row3];
};
/**
diff --git a/o3d/samples/o3djs/picking.js b/o3d/samples/o3djs/picking.js
index 225d79f..409104d 100644
--- a/o3d/samples/o3djs/picking.js
+++ b/o3d/samples/o3djs/picking.js
@@ -384,7 +384,7 @@ o3djs.picking.TransformInfo = function(transform, parent) {
*/
this.transform = transform;
/**
- * The transform of this transform info.
+ * The parent of this transform info.
* @type {o3djs.picking.TransformInfo}
*/
this.parent = parent;
diff --git a/o3d/samples/o3djs/simple.js b/o3d/samples/o3djs/simple.js
index e875320..7252b76 100644
--- a/o3d/samples/o3djs/simple.js
+++ b/o3d/samples/o3djs/simple.js
@@ -284,7 +284,8 @@ o3djs.simple.SimpleInfo.prototype.createSimpleShape = function(shape) {
* @param {number} elapsedTime Time elapsed since last frame.
*/
o3djs.simple.SimpleInfo.prototype.onRender_ = function(elapsedTime) {
- for (var id in this.updateObjects_) {
+ for (var sid in this.updateObjects_) {
+ var id = /** @type {number} */ (sid);
this.updateObjects_[id].onUpdate(elapsedTime);
}
};
@@ -295,7 +296,7 @@ o3djs.simple.SimpleInfo.prototype.onRender_ = function(elapsedTime) {
*/
o3djs.simple.SimpleInfo.prototype.registerObjectForUpdate =
function (simpleObject) {
- this.updateObjects_[simpleObject.id] = true;
+ this.updateObjects_[simpleObject.id] = simpleObject;
};
/**
diff --git a/o3d/samples/o3djs/texture.js b/o3d/samples/o3djs/texture.js
index e741ed1..33678b2 100644
--- a/o3d/samples/o3djs/texture.js
+++ b/o3d/samples/o3djs/texture.js
@@ -199,7 +199,9 @@ o3djs.texture.createTextureFromBitmaps = function(
}
texture = pack.createTextureCUBE(dstWidth, format, targetMips, false);
for (var ii = 0; ii < 6; ++ii) {
- texture.setFromBitmap(ii, bitmaps[ii]);
+ texture.setFromBitmap(
+ /** @type {o3d.TextureCUBE.CubeFace} */ (ii),
+ bitmaps[ii]);
}
} else if (bitmaps.length == 1) {
texture = pack.createTexture2D(
@@ -207,7 +209,7 @@ o3djs.texture.createTextureFromBitmaps = function(
texture.setFromBitmap(bitmaps[0]);
}
- return texture;
+ return /** @type{!o3d.Texture} */ (texture);
};
/**
diff --git a/o3d/samples/o3djs/util.js b/o3d/samples/o3djs/util.js
index 7dbaa9b..0cc465e 100644
--- a/o3d/samples/o3djs/util.js
+++ b/o3d/samples/o3djs/util.js
@@ -561,6 +561,7 @@ o3djs.util.getElementById = function(id) {
/**
* Identifies a JavaScript engine.
+ * @enum {number}
*/
o3djs.util.Engine = {
/**