Skip to content

Commit d3ac38c

Browse files
committed
fix refactored Shape methods
1 parent 1a6be5e commit d3ac38c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

glutil-mesh.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ Mesh.prototype.normal3=function(x,y,z){
365365
* @return {glutil.Mesh} This object.
366366
*/
367367
Mesh.prototype.vertex3=function(x,y,z){
368+
if(this.subMeshes.length==0){
369+
this.subMeshes.push(new SubMesh());
370+
}
368371
this.subMeshes[this.subMeshes.length-1].vertex3(x,y,z,this);
369372
return this;
370373
}

glutil.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,7 @@ Shape.prototype.primitiveCount=function(){
18971897

18981898
/**
18991899
* Makes a copy of this object. The copied object
1900-
* will have its own version of the transform and
1900+
* will have its own version of the transform and
19011901
* material data, but any texture
19021902
* image data and vertex buffers will not be duplicated,
19031903
* but rather just references to them will be used.
@@ -1910,6 +1910,7 @@ Shape.prototype.copy=function(){
19101910
return ret;
19111911
}
19121912

1913+
19131914
/**
19141915
* Sets this shape's transformation matrix. This method
19151916
* will set the position, rotation, and scale properties
@@ -1982,7 +1983,7 @@ Shape.prototype.resetTransform=function(){
19821983
* @return {glutil.Scene3D} This object.
19831984
*/
19841985
Shape.prototype.setScale=function(x,y,z){
1985-
this.transform.setScale();
1986+
this.transform.setScale(x,y,z);
19861987
return this;
19871988
}
19881989
/**
@@ -1995,7 +1996,7 @@ Shape.prototype.setScale=function(x,y,z){
19951996
* @return {glutil.Scene3D} This object.
19961997
*/
19971998
Shape.prototype.setPosition=function(x,y,z){
1998-
this.transform.setPosition();
1999+
this.transform.setPosition(x,y,z);
19992000
return this;
20002001
}
20012002
/**
@@ -2041,7 +2042,7 @@ Shape.prototype.multQuaternion=function(quat){
20412042
/**
20422043
* Combines this shape's current orientation with another orientation
20432044
* in the form of an angle and an axis of
2044-
* rotation.
2045+
* rotation.
20452046
* See {@link glutil.Transform.multOrientation}.
20462047
* @param {Array<number>|number} angle The desired angle
20472048
* to rotate in degrees, or a 4-element array as described in {@link glutil.Transform.setOrientation}.

0 commit comments

Comments
 (0)