Skip to content

Commit 7288d93

Browse files
committed
edit Transform's getMatrix
1 parent 74c970b commit 7288d93

File tree

5 files changed

+37
-35
lines changed

5 files changed

+37
-35
lines changed

camera.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* A class for controlling the projection and
43
* view of a 3D scene, in the nature of an abstract "camera".

glmath.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var GLMath={
4040
* (via {@link glmath.GLMath.vec3norm}), the absolute value
4141
* of the sine of the angle between them is equal to the length of their
4242
* cross product. <small>(More formally, the length of the cross
43-
* product equals |<b>a</b>| * |<b>b</b>| * |sin &theta|;
43+
* product equals |<b>a</b>| * |<b>b</b>| * |sin &theta;|;
4444
* where |<b>x</b>| is the length of vector <b>x</b>.)</small><p>
4545
* The cross product (<b>c</b>) of vectors <b>a</b> and <b>b</b> is found as
4646
* follows:<pre>

glutil-transform.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ Transform.prototype.getMatrix=function(){
262262
this._matrixDirty=false;
263263
// for best results, multiply in this order:
264264
// 1. translation
265-
this.matrix=GLMath.mat4translated(this.position[0],
266-
this.position[1],this.position[2]);
265+
this.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,
266+
this.position[0],
267+
this.position[1],
268+
this.position[2],0];
267269
// 2. rotation
268270
if(!GLMath.quatIsIdentity(this.rotation)){
269271
this.matrix=GLMath.mat4multiply(this.matrix,

glutil.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -653,12 +653,12 @@ function Material(ambient, diffuse, specular,shininess,emission) {
653653
this.shininess=(shininess==null) ? 0 : Math.min(Math.max(0,shininess),128);
654654
/** Ambient reflection of this material.<p>
655655
* Ambient reflection indicates how much an object reflects
656-
* ambient colors, those that color pixels the same way regardless
656+
* ambient colors, those that color pixels the same way regardless
657657
* of direction or distance.
658658
* Because every part of an object will be shaded the same way by ambient
659659
* light, an object with just ambient reflection will not look much like a 3D object.<p>
660660
* This value is a 3-element array giving the red, green, and blue
661-
* components of the ambient reflection; the final ambient color depends
661+
* components of the ambient reflection; the final ambient color depends
662662
* on the ambient color of the scene.
663663
* (0,0,0) means no ambient reflection,
664664
* and (1,1,1) means total ambient reflection.<p>
@@ -669,13 +669,13 @@ function Material(ambient, diffuse, specular,shininess,emission) {
669669
*/
670670
this.ambient=ambient ? ambient.slice(0,3) : [0.2,0.2,0.2];
671671
/**
672-
* Diffuse reflection of this material. Diffuse reflection is the color that a material
673-
* reflects equally in all directions. Because different parts of an object are shaded
672+
* Diffuse reflection of this material. Diffuse reflection is the color that a material
673+
* reflects equally in all directions. Because different parts of an object are shaded
674674
* differently depending
675675
* on how directly they face diffuse lights, diffuse reflection can contribute
676676
* much of the 3D effect of that object.<p>
677677
* This value is a 4-element array giving the red, green, blue, and
678-
* alpha components of the diffuse reflection; the final diffuse color depends
678+
* alpha components of the diffuse reflection; the final diffuse color depends
679679
* on the reflected colors of lights that shine on the material.
680680
* (0,0,0,1) means no diffuse reflection,
681681
* and (1,1,1,1) means total diffuse reflection.<p>
@@ -694,7 +694,7 @@ function Material(ambient, diffuse, specular,shininess,emission) {
694694
* specular light doesn't scatter very much to other parts of an object.
695695
* Specular reflection can make an object shiny.
696696
* This value is a 3-element array giving the red, green, and blue
697-
* components of the ambient reflection; the final specular color depends
697+
* components of the ambient reflection; the final specular color depends
698698
* on the specular color of lights that shine on the material.
699699
* (0,0,0) means no specular reflection,
700700
* and (1,1,1) means total specular reflection.<p>
@@ -708,7 +708,7 @@ function Material(ambient, diffuse, specular,shininess,emission) {
708708
* default shader if [Scene3D.disableLighting()]{@link glutil.Scene3D#disableLighting}
709709
* is called, disabling lighting calculations).<p>
710710
* This value is a 3-element array giving the red, green, and blue
711-
* components.
711+
* components.
712712
* For each of the three color components, positive values add to that component,
713713
* while negative values subtract from it. (0,0,0) means no additive color.
714714
*/
@@ -1642,8 +1642,8 @@ Scene3D.prototype.setViewMatrix=function(matrix){
16421642
* the point in world space that the camera is looking at. May be null or omitted,
16431643
* in which case the default is the coordinates (0,0,0).
16441644
* @param {Array<number>} [up] A 3-element vector specifying
1645-
* the direction from the center of the camera to its top. This parameter may
1646-
* be null or omitted, in which case the default is the vector (0, 1, 0),
1645+
* the direction from the center of the camera to its top. This parameter may
1646+
* be null or omitted, in which case the default is the vector (0, 1, 0),
16471647
* the vector that results when the camera is held upright. This
16481648
* vector must not point in the same or opposite direction as
16491649
* the camera's view direction. (For best results, rotate the vector (0, 1, 0)

0 commit comments

Comments
 (0)