Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/math/Vector3.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ class Vector3 {
}

/**
* Transforms the direction of this vector by a matrix (the upper left 3 x 3
* subset of the given 4x4 matrix and then normalizes the result.
* Transforms this vector by the upper left 3x3 sub-matrix of the given 4x4 matrix,
* and normalizes the result.
*
* @param {Matrix4} m - The matrix.
* @return {Vector3} A reference to this vector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ vec3 transformedNormal = objectNormal;
#ifdef USE_BATCHING

// this is in lieu of a per-instance normal-matrix
// shear transforms in the instance matrix are not supported
// non-uniform scaling in the instance matrix is supported
// shear transforms are not supported

mat3 bm = mat3( batchingMatrix );
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
Expand All @@ -27,7 +28,8 @@ vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING

// this is in lieu of a per-instance normal-matrix
// shear transforms in the instance matrix are not supported
// non-uniform scaling in the instance matrix is supported
// shear transforms are not supported

mat3 im = mat3( instanceMatrix );
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
Expand Down