diff options
author | petersont@chromium.org <petersont@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 21:07:42 +0000 |
---|---|---|
committer | petersont@chromium.org <petersont@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 21:07:42 +0000 |
commit | 02127f8772c83c5e53f66a9ad8267d4b343f8007 (patch) | |
tree | 7e0b7f110cbda919f66b39f7cdfe5be02f1143f3 /o3d/samples/o3djs | |
parent | d569a16535e85b517ff49138d0dd77d6fc6420c7 (diff) | |
download | chromium_src-02127f8772c83c5e53f66a9ad8267d4b343f8007.zip chromium_src-02127f8772c83c5e53f66a9ad8267d4b343f8007.tar.gz chromium_src-02127f8772c83c5e53f66a9ad8267d4b343f8007.tar.bz2 |
Added a new sample which implements basic shadow mapping.
Review URL: http://codereview.chromium.org/155401
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3djs')
-rw-r--r-- | o3d/samples/o3djs/debug.js | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/o3d/samples/o3djs/debug.js b/o3d/samples/o3djs/debug.js index 9589c50..2f4be54 100644 --- a/o3d/samples/o3djs/debug.js +++ b/o3d/samples/o3djs/debug.js @@ -263,6 +263,25 @@ o3djs.debug.VertexInfo.prototype.Offset = { }; /** + * Computes the number of vertices in this vertex info. + * @return {number} The number of vertices. + */ +o3djs.debug.VertexInfo.prototype.numVertices = function() { + return this.vertices.length / 3; +}; + + +/** + * Given the number of a vertex returns the index in the array where + * the coordinates of that vertex vertexIndex. + * @param {number} vertexNumber The vertex number. + * @return {number} The index where that vertex begins. + */ +o3djs.debug.VertexInfo.prototype.vertexIndex = function(vertexNumber) { + return vertexNumber * 3; +} + +/** * Adds a vertex. * @param {number} positionX The x position of the vertex. * @param {number} positionY The y position of the vertex. @@ -298,6 +317,7 @@ o3djs.debug.VertexInfo.prototype.createShape = function( this.indices); }; + /** * Reorients the vertex positions of this vertexInfo by the * given matrix. In other words it multiplies each vertex by the @@ -306,10 +326,6 @@ o3djs.debug.VertexInfo.prototype.createShape = function( */ o3djs.debug.VertexInfo.prototype.reorient = function(matrix) { var math = o3djs.math; - // Assume if it has a length it's not a Matrix4 - if (matrix.length) { - matrix = math.matrix4.copy(matrix); - } var numVerts = this.numVertices(); for (var v = 0; v < numVerts; ++v) { var index = this.vertexIndex(v); |