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
2 changes: 1 addition & 1 deletion test/unit/src/cameras/PerspectiveCamera.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default QUnit.module( 'Cameras', () => {

for ( let i = 0, il = a.elements.length; i < il; i ++ ) {

const delta = a.elements[ i ] - b.elements[ i ];
const delta = Math.abs( a.elements[ i ] - b.elements[ i ] );
if ( delta > tolerance ) {

return false;
Expand Down
21 changes: 11 additions & 10 deletions test/unit/src/core/BufferGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function bufferAttributeEquals( a, b, tolerance ) {

for ( let i = 0, il = a.count * a.itemSize; i < il; i ++ ) {

const delta = a[ i ] - b[ i ];
const delta = Math.abs( a.array[ i ] - b.array[ i ] );
if ( delta > tolerance ) {

return false;
Expand Down Expand Up @@ -390,19 +390,19 @@ export default QUnit.module( 'Core', () => {
a.setAttribute( 'position', new BufferAttribute( vertices, 3 ) );

const sqrt = Math.sqrt( 2 );
const expected = new Float32Array( [
const expected = new BufferAttribute( new Float32Array( [
1, 0, - sqrt,
- 1, 0, - sqrt,
- 1, sqrt, 0,

- 1, sqrt, 0,
1, sqrt, 0,
1, 0, - sqrt
] );
] ), 3 );

a.lookAt( new Vector3( 0, 1, - 1 ) );

assert.ok( bufferAttributeEquals( a.attributes.position.array, expected ), 'Rotation is correct' );
assert.ok( bufferAttributeEquals( a.attributes.position, expected ), 'Rotation is correct' );

} );

Expand Down Expand Up @@ -568,16 +568,17 @@ export default QUnit.module( 'Core', () => {
const sqrt = 0.5 * Math.sqrt( 2 );
const normal = new BufferAttribute( new Float32Array( [
- 1, 0, 0, - 1, 0, 0, - 1, 0, 0,
sqrt, sqrt, 0, sqrt, sqrt, 0, sqrt, sqrt, 0,
- 1, 0, 0
sqrt, sqrt, 0, sqrt, sqrt, 0, sqrt, sqrt, 0
] ), 3 );
const position = new BufferAttribute( new Float32Array( [
0.5, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, - 0.5, 0.5,
0.5, - 0.5, - 0.5, - 0.5, 0.5, - 0.5, - 0.5, 0.5, 0.5,
- 0.5, - 0.5, - 0.5
0.5, - 0.5, - 0.5, - 0.5, 0.5, - 0.5, - 0.5, 0.5, 0.5
] ), 3 );
// the index buffer defines the same two triangles but in counter-clockwise order,
// which should result in flipped normals.
const flippedNormals = normal.clone().applyMatrix4( new Matrix4().makeScale( - 1, - 1, - 1 ) );
const index = new BufferAttribute( new Uint16Array( [
0, 2, 1, 2, 3, 1, 4, 6, 5, 6, 7, 5
0, 2, 1, 3, 5, 4
] ), 1 );

let a = new BufferGeometry();
Expand All @@ -600,7 +601,7 @@ export default QUnit.module( 'Core', () => {
a.setAttribute( 'position', position );
a.setIndex( index );
a.computeVertexNormals();
assert.ok( bufferAttributeEquals( normal, a.getAttribute( 'normal' ) ), 'Indexed geometry: computed normals are correct' );
assert.ok( bufferAttributeEquals( flippedNormals, a.getAttribute( 'normal' ) ), 'Indexed geometry: computed normals are correct' );

} );

Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/math/Euler.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function matrixEquals4( a, b, tolerance ) {

for ( let i = 0, il = a.elements.length; i < il; i ++ ) {

const delta = a.elements[ i ] - b.elements[ i ];
const delta = Math.abs( a.elements[ i ] - b.elements[ i ] );
if ( delta > tolerance ) {

return false;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/src/math/Matrix3.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Matrix3 } from '../../../../src/math/Matrix3.js';
import { Matrix4 } from '../../../../src/math/Matrix4.js';

function matrixEquals3( a, b, tolerance ) {
function matrixEquals3( b, a, tolerance ) {

tolerance = tolerance || 0.0001;
if ( a.elements.length != b.elements.length ) {
Expand All @@ -14,7 +14,7 @@ function matrixEquals3( a, b, tolerance ) {

for ( let i = 0, il = a.elements.length; i < il; i ++ ) {

const delta = a.elements[ i ] - b.elements[ i ];
const delta = Math.abs( a.elements[ i ] - b.elements[ i ] );
if ( delta > tolerance ) {

return false;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/math/Matrix4.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function matrixEquals4( a, b, tolerance ) {

for ( let i = 0, il = a.elements.length; i < il; i ++ ) {

const delta = a.elements[ i ] - b.elements[ i ];
const delta = Math.abs( a.elements[ i ] - b.elements[ i ] );
if ( delta > tolerance ) {

return false;
Expand Down