@@ -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 */
540541Mesh . 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
0 commit comments