Skip to content

Commit 0b438f0

Browse files
committed
bug fix in setVertexNormal; edit docs
1 parent 7d7ddf2 commit 0b438f0

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

glutil-eval.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,8 @@ function CurveEval(){
256256
/**
257257
* Specifies a parametric curve function for generating vertex positions.
258258
* @param {object} evaluator An object that must contain a function
259-
* named "evaluate". It takes the following parameters in this order:<ul>
260-
* <li><code>u</code> - Horizontal-axis coordinate, generally from 0 to 1.
261-
* <li><code>v</code> - Vertical-axis coordinate, generally from 0 to 1.
259+
* named "evaluate". It takes the following parameter:<ul>
260+
* <li><code>u</code> - A curve coordinate, generally from 0 to 1.
262261
* </ul>
263262
* The evaluator function returns an array of the result of the evaluation.
264263
* @return {CurveEval} This object.
@@ -413,7 +412,7 @@ CurveEval.prototype.evalOne=function(mesh,u){
413412
* @param {number} [n] Number of subdivisions of the curve to be drawn.
414413
* May be omitted; default is 24.
415414
* @param {number} [u1] Starting point of the curve (within the range
416-
* given in the <code>vector</code>, normal</code>,
415+
* given in the <code>vector</code>, <code>normal</code>,
417416
* <code>color</code>, and <code>texCoord</code> methods).
418417
*May be omitted; default is 0.
419418
* @param {number} [u2] Ending point of the curve (within the range

glutil-mesh.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ Mesh.prototype.normal3=function(x,y,z){
297297
/**
298298
* Transforms the positions and normals of all the vertices currently
299299
* in this mesh, using a 4x4 matrix. The matrix won't affect
300-
* vertices added afterwards.
300+
* vertices added afterwards. Future vertices should not be
301+
* added after calling this method without calling mode() first.
301302
* @param {Array<number>} matrix A 4x4 matrix describing
302303
* the transformation.
303304
* @return {glutil.Mesh} This object.
@@ -520,8 +521,8 @@ Mesh.prototype.setVertex=function(index,x,y,z){
520521
}
521522
/**
522523
* Sets the normal associated with the vertex with the
523-
* given index. Has no effect if the index exceeds the number
524-
* of vertices in the mesh.
524+
* given index. Has no effect if the index is less than 0 or
525+
* equals the number of vertices in this mesh or greater.
525526
* @param {number} index Zero-based index of
526527
* the vertex to set.
527528
* The index ranges from 0 to less than
@@ -538,6 +539,7 @@ Mesh.prototype.setVertex=function(index,x,y,z){
538539
* @return {glutil.Mesh} This object.
539540
*/
540541
Mesh.prototype.setVertexNormal=function(index,x,y,z){
542+
if(index<0)return this;
541543
var count=0;
542544
if(typeof y=="undefined" && typeof z=="undefined"){
543545
y=x[1];
@@ -864,6 +866,11 @@ SubMesh.prototype.transform=function(matrix){
864866
v[i+normalOffset+2]=xform[2];
865867
}
866868
}
869+
// TODO: Planned for 2.0. Once implemented,
870+
// Mesh#transform will say: "Also, resets the primitive
871+
// mode (see {@link glutil.Mesh#mode}) so that future vertices given
872+
// will not build upon previous vertices."
873+
//this.newPrimitive();
867874
return this;
868875
}
869876

glutil.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ var GLUtil={
156156
* @return {Promise} A promise that is never rejected and resolves when
157157
* all of the promises are each resolved or rejected. The result
158158
* of the promise will be an object with
159-
* three keys:
160-
* "successes" - contains a list of results from the
159+
* three keys:<ul>
160+
* <li>"successes" - contains a list of results from the
161161
* promises that succeeded, in the order in which those promises were listed.
162-
* "failures" - contains a list of results from the
162+
* <li>"failures" - contains a list of results from the
163163
* promises that failed, in the order in which those promises were listed.
164-
* "results" - contains a list of boolean values for each
165-
* promise, in the order in which the promises were listed.
164+
* <li>"results" - contains a list of boolean values for each
165+
* promise, in the order in which the promises were listed.</ul>
166166
* True means success, and false means failure.
167167
*/
168168
"getPromiseResults":function(promises,

0 commit comments

Comments
 (0)