Merge pull request #8636 from florentpoujol/three.js_r74

Update definitions to THREE.js r74
This commit is contained in:
Masahiro Wakame
2016-03-29 16:06:49 +09:00
6 changed files with 1454 additions and 1159 deletions
+76 -61
View File
@@ -212,23 +212,23 @@
ok( b.distanceToPoint( new THREE.Vector2( -2, -2 ) ) == Math.sqrt( 2 ), "Passed!" );
});
test( "isIntersectionBox", function() {
test( "intersectsBox", function() {
var a = new THREE.Box2( zero2.clone(), zero2.clone() );
var b = new THREE.Box2( zero2.clone(), one2.clone() );
var c = new THREE.Box2( one2.clone().negate(), one2.clone() );
ok( a.isIntersectionBox( a ), "Passed!" );
ok( a.isIntersectionBox( b ), "Passed!" );
ok( a.isIntersectionBox( c ), "Passed!" );
ok( a.intersectsBox( a ), "Passed!" );
ok( a.intersectsBox( b ), "Passed!" );
ok( a.intersectsBox( c ), "Passed!" );
ok( b.isIntersectionBox( a ), "Passed!" );
ok( c.isIntersectionBox( a ), "Passed!" );
ok( b.isIntersectionBox( c ), "Passed!" );
ok( b.intersectsBox( a ), "Passed!" );
ok( c.intersectsBox( a ), "Passed!" );
ok( b.intersectsBox( c ), "Passed!" );
b.translate( new THREE.Vector2( 2, 2 ) );
ok( ! a.isIntersectionBox( b ), "Passed!" );
ok( ! b.isIntersectionBox( a ), "Passed!" );
ok( ! b.isIntersectionBox( c ), "Passed!" );
ok( ! a.intersectsBox( b ), "Passed!" );
ok( ! b.intersectsBox( a ), "Passed!" );
ok( ! b.intersectsBox( c ), "Passed!" );
});
test( "intersect", function() {
@@ -468,23 +468,23 @@
ok( b.distanceToPoint( new THREE.Vector3( -2, -2, -2 ) ) == Math.sqrt( 3 ), "Passed!" );
});
test( "isIntersectionBox", function() {
test( "intersectsBox", function() {
var a = new THREE.Box3( zero3.clone(), zero3.clone() );
var b = new THREE.Box3( zero3.clone(), one3.clone() );
var c = new THREE.Box3( one3.clone().negate(), one3.clone() );
ok( a.isIntersectionBox( a ), "Passed!" );
ok( a.isIntersectionBox( b ), "Passed!" );
ok( a.isIntersectionBox( c ), "Passed!" );
ok( a.intersectsBox( a ), "Passed!" );
ok( a.intersectsBox( b ), "Passed!" );
ok( a.intersectsBox( c ), "Passed!" );
ok( b.isIntersectionBox( a ), "Passed!" );
ok( c.isIntersectionBox( a ), "Passed!" );
ok( b.isIntersectionBox( c ), "Passed!" );
ok( b.intersectsBox( a ), "Passed!" );
ok( c.intersectsBox( a ), "Passed!" );
ok( b.intersectsBox( c ), "Passed!" );
b.translate( new THREE.Vector3( 2, 2, 2 ) );
ok( ! a.isIntersectionBox( b ), "Passed!" );
ok( ! b.isIntersectionBox( a ), "Passed!" );
ok( ! b.isIntersectionBox( c ), "Passed!" );
ok( ! a.intersectsBox( b ), "Passed!" );
ok( ! b.intersectsBox( a ), "Passed!" );
ok( ! b.intersectsBox( c ), "Passed!" );
});
test( "getBoundingSphere", function() {
@@ -1149,7 +1149,8 @@
var a = new THREE.Matrix3();
ok( a.determinant() == 1, "Passed!" );
var b = new THREE.Matrix3( 0, 1, 2, 3, 4, 5, 6, 7, 8 );
var b = new THREE.Matrix3();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8);
ok( b.elements[0] == 0 );
ok( b.elements[1] == 3 );
ok( b.elements[2] == 6 );
@@ -1164,7 +1165,8 @@
});
test( "copy", function() {
var a = new THREE.Matrix3( 0, 1, 2, 3, 4, 5, 6, 7, 8 );
var a = new THREE.Matrix3();
a.set(0, 1, 2, 3, 4, 5, 6, 7, 8);
var b = new THREE.Matrix3().copy( a );
ok( matrixEquals3( a, b ), "Passed!" );
@@ -1191,7 +1193,8 @@
});
test( "identity", function() {
var b = new THREE.Matrix3( 0, 1, 2, 3, 4, 5, 6, 7, 8 );
var b = new THREE.Matrix3();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8);
ok( b.elements[0] == 0 );
ok( b.elements[1] == 3 );
ok( b.elements[2] == 6 );
@@ -1210,7 +1213,8 @@
});
test( "multiplyScalar", function() {
var b = new THREE.Matrix3( 0, 1, 2, 3, 4, 5, 6, 7, 8 );
var b = new THREE.Matrix3();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8);
ok( b.elements[0] == 0 );
ok( b.elements[1] == 3 );
ok( b.elements[2] == 6 );
@@ -1252,8 +1256,10 @@
test( "getInverse", function() {
var identity = new THREE.Matrix4();
var a = new THREE.Matrix4();
var b = new THREE.Matrix3( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
var c = new THREE.Matrix4( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
var b = new THREE.Matrix3();
b.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
var c = new THREE.Matrix4();
c.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
ok( ! matrixEquals3( a, b ), "Passed!" );
b.getInverse( a, false );
@@ -1299,7 +1305,8 @@
var b = a.clone().transpose();
ok( matrixEquals3( a, b ), "Passed!" );
b = new THREE.Matrix3( 0, 1, 2, 3, 4, 5, 6, 7, 8 );
b = new THREE.Matrix3();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8);
var c = b.clone().transpose();
ok( ! matrixEquals3( b, c ), "Passed!" );
c.transpose();
@@ -1307,7 +1314,8 @@
});
test( "clone", function() {
var a = new THREE.Matrix3( 0, 1, 2, 3, 4, 5, 6, 7, 8 );
var a = new THREE.Matrix3();
a.set(0, 1, 2, 3, 4, 5, 6, 7, 8);
var b = a.clone();
ok( matrixEquals3( a, b ), "Passed!" );
@@ -1337,7 +1345,8 @@
var a = new THREE.Matrix4();
ok( a.determinant() == 1, "Passed!" );
var b = new THREE.Matrix4( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 );
var b = new THREE.Matrix4();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ok( b.elements[0] == 0 );
ok( b.elements[1] == 4 );
ok( b.elements[2] == 8 );
@@ -1359,7 +1368,8 @@
});
test( "copy", function() {
var a = new THREE.Matrix4( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 );
var a = new THREE.Matrix4();
a.set(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
var b = new THREE.Matrix4().copy( a );
ok( matrixEquals4( a, b ), "Passed!" );
@@ -1393,7 +1403,8 @@
});
test( "identity", function() {
var b = new THREE.Matrix4( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 );
var b = new THREE.Matrix4();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ok( b.elements[0] == 0 );
ok( b.elements[1] == 4 );
ok( b.elements[2] == 8 );
@@ -1419,7 +1430,8 @@
});
test( "multiplyScalar", function() {
var b = new THREE.Matrix4( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 );
var b = new THREE.Matrix4();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ok( b.elements[0] == 0 );
ok( b.elements[1] == 4 );
ok( b.elements[2] == 8 );
@@ -1475,8 +1487,8 @@
var identity = new THREE.Matrix4();
var a = new THREE.Matrix4();
var b = new THREE.Matrix4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
var c = new THREE.Matrix4( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
var b = new THREE.Matrix4().set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
var c = new THREE.Matrix4().set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
ok( ! matrixEquals4( a, b ), "Passed!" );
b.getInverse( a, false );
@@ -1561,7 +1573,8 @@
var b = a.clone().transpose();
ok( matrixEquals4( a, b ), "Passed!" );
b = new THREE.Matrix4( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 );
b = new THREE.Matrix4();
b.set(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
var c = b.clone().transpose();
ok( ! matrixEquals4( b, c ), "Passed!" );
c.transpose();
@@ -1569,7 +1582,8 @@
});
test( "clone", function() {
var a = new THREE.Matrix4( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 );
var a = new THREE.Matrix4();
a.set(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
var b = a.clone();
ok( matrixEquals4( a, b ), "Passed!" );
@@ -1773,23 +1787,23 @@
var a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 0 );
var l1 = new THREE.Line3( new THREE.Vector3( -10, 0, 0 ), new THREE.Vector3( 10, 0, 0 ) );
ok( a.isIntersectionLine( l1 ), "Passed!" );
ok( a.intersectsLine( l1 ), "Passed!" );
ok( a.intersectLine( l1 ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -3 );
ok( a.isIntersectionLine( l1 ), "Passed!" );
ok( a.intersectsLine( l1 ), "Passed!" );
ok( a.intersectLine( l1 ).equals( new THREE.Vector3( 3, 0, 0 ) ), "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), -11 );
ok( ! a.isIntersectionLine( l1 ), "Passed!" );
ok( ! a.intersectsLine( l1 ), "Passed!" );
ok( a.intersectLine( l1 ) === undefined, "Passed!" );
a = new THREE.Plane( new THREE.Vector3( 1, 0, 0 ), 11 );
ok( ! a.isIntersectionLine( l1 ), "Passed!" );
ok( ! a.intersectsLine( l1 ), "Passed!" );
ok( a.intersectLine( l1 ) === undefined, "Passed!" );
});
@@ -2136,7 +2150,7 @@
ok( d === 0, "Passed!" );
});
test( "isIntersectionSphere", function() {
test( "intersectsSphere", function() {
var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) );
var b = new THREE.Sphere( zero3, 0.5 );
var c = new THREE.Sphere( zero3, 1.5 );
@@ -2144,11 +2158,11 @@
var e = new THREE.Sphere( two3, 0.1 );
var f = new THREE.Sphere( two3, 1 );
ok( ! a.isIntersectionSphere( b ), "Passed!" );
ok( ! a.isIntersectionSphere( c ), "Passed!" );
ok( a.isIntersectionSphere( d ), "Passed!" );
ok( ! a.isIntersectionSphere( e ), "Passed!" );
ok( ! a.isIntersectionSphere( f ), "Passed!" );
ok( ! a.intersectsSphere( b ), "Passed!" );
ok( ! a.intersectsSphere( c ), "Passed!" );
ok( a.intersectsSphere( d ), "Passed!" );
ok( ! a.intersectsSphere( e ), "Passed!" );
ok( ! a.intersectsSphere( f ), "Passed!" );
});
test( "intersectSphere", function() {
@@ -2210,28 +2224,28 @@
});
test( "isIntersectionPlane", function() {
test( "intersectsPlane", function() {
var a = new THREE.Ray( one3.clone(), new THREE.Vector3( 0, 0, 1 ) );
// parallel plane in front of the ray
var b = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), one3.clone().sub( new THREE.Vector3( 0, 0, -1 ) ) );
ok( a.isIntersectionPlane( b ), "Passed!" );
ok( a.intersectsPlane( b ), "Passed!" );
// parallel plane coincident with origin
var c = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), one3.clone().sub( new THREE.Vector3( 0, 0, 0 ) ) );
ok( a.isIntersectionPlane( c ), "Passed!" );
ok( a.intersectsPlane( c ), "Passed!" );
// parallel plane behind the ray
var d = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 0, 0, 1 ), one3.clone().sub( new THREE.Vector3( 0, 0, 1 ) ) );
ok( ! a.isIntersectionPlane( d ), "Passed!" );
ok( ! a.intersectsPlane( d ), "Passed!" );
// perpendical ray that overlaps exactly
var e = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 1, 0, 0 ), one3 );
ok( a.isIntersectionPlane( e ), "Passed!" );
ok( a.intersectsPlane( e ), "Passed!" );
// perpendical ray that doesn't overlap
var f = new THREE.Plane().setFromNormalAndCoplanarPoint( new THREE.Vector3( 1, 0, 0 ), zero3 );
ok( ! a.isIntersectionPlane( f ), "Passed!" );
ok( ! a.intersectsPlane( f ), "Passed!" );
});
test( "intersectPlane", function() {
@@ -2327,32 +2341,32 @@
var a = new THREE.Ray( new THREE.Vector3( -2, 0, 0 ), new THREE.Vector3( 1, 0, 0) );
//ray should intersect box at -1,0,0
ok( a.isIntersectionBox(box) === true, "Passed!" );
ok( a.intersectsBox(box) === true, "Passed!" );
ok( a.intersectBox(box).distanceTo( new THREE.Vector3( -1, 0, 0 ) ) < TOL, "Passed!" );
var b = new THREE.Ray( new THREE.Vector3( -2, 0, 0 ), new THREE.Vector3( -1, 0, 0) );
//ray is point away from box, it should not intersect
ok( b.isIntersectionBox(box) === false, "Passed!" );
ok( b.intersectsBox(box) === false, "Passed!" );
ok( b.intersectBox(box) === null, "Passed!" );
var c = new THREE.Ray( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 1, 0, 0) );
// ray is inside box, should return exit point
ok( c.isIntersectionBox(box) === true, "Passed!" );
ok( c.intersectsBox(box) === true, "Passed!" );
ok( c.intersectBox(box).distanceTo( new THREE.Vector3( 1, 0, 0 ) ) < TOL, "Passed!" );
var d = new THREE.Ray( new THREE.Vector3( 0, 2, 1 ), new THREE.Vector3( 0, -1, -1).normalize() );
//tilted ray should intersect box at 0,1,0
ok( d.isIntersectionBox(box) === true, "Passed!" );
ok( d.intersectsBox(box) === true, "Passed!" );
ok( d.intersectBox(box).distanceTo( new THREE.Vector3( 0, 1, 0 ) ) < TOL, "Passed!" );
var e = new THREE.Ray( new THREE.Vector3( 1, -2, 1 ), new THREE.Vector3( 0, 1, 0).normalize() );
//handle case where ray is coplanar with one of the boxes side - box in front of ray
ok( e.isIntersectionBox(box) === true, "Passed!" );
ok( e.intersectsBox(box) === true, "Passed!" );
ok( e.intersectBox(box).distanceTo( new THREE.Vector3( 1, -1, 1 ) ) < TOL, "Passed!" );
var f = new THREE.Ray( new THREE.Vector3( 1, -2, 0 ), new THREE.Vector3( 0, -1, 0).normalize() );
//handle case where ray is coplanar with one of the boxes side - box behind ray
ok( f.isIntersectionBox(box) === false, "Passed!" );
ok( f.intersectsBox(box) === false, "Passed!" );
ok( f.intersectBox(box) == null, "Passed!" );
});
@@ -3527,13 +3541,14 @@
test( "setAxisAngleFromRotationMatrix", function() {
var TOL = 1e-9;
var r = new THREE.Matrix4().makeRotationZ(Math.PI / 2);
// not sure what to do here since THREE.Vector4().setAxisAngleFromRotationMatrix() only accept Matrix3s
/*var r = new THREE.Matrix4().makeRotationZ(Math.PI / 2);
var v = new THREE.Vector4().setAxisAngleFromRotationMatrix(r);
ok( v.x == 0, "Passed!" );
ok( v.y == 0, "Passed!" );
ok( v.z == 1, "Passed!" );
ok( Math.abs(v.w - Math.PI / 2) < TOL, "Passed!" );
ok( Math.abs(v.w - Math.PI / 2) < TOL, "Passed!" );*/
});
};
@@ -186,8 +186,6 @@
var clipBones = geometry.animations[0];
mixer = new THREE.AnimationMixer( mesh );
mixer.addAction( new THREE.AnimationAction( clipMorpher ) );
mixer.addAction( new THREE.AnimationAction( clipBones ) );
}
function initGUI() {
@@ -130,7 +130,6 @@
scene.add( mesh );
var mixer = new THREE.AnimationMixer( mesh );
mixer.addAction( new THREE.AnimationAction( geometry.animations[ 0 ] ).warpToDuration( 1 ) );
mixers.push( mixer );
} );
+1 -1
View File
@@ -62,7 +62,7 @@
materials.push(new THREE.MeshLambertMaterial({ color: 0xdddddd }));
materials.push(new THREE.MeshPhongMaterial({ color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.SmoothShading, map: texture, transparent: true }));
materials.push(new THREE.MeshNormalMaterial({ shading: THREE.SmoothShading }));
materials.push(new THREE.MeshNormalMaterial({}));
materials.push(new THREE.MeshBasicMaterial({ color: 0xffaa00, wireframe: true }));
materials.push(new THREE.MeshDepthMaterial());
+1 -1
View File
@@ -35,7 +35,7 @@ THE SOFTWARE.
/// <reference path="./tests/webgl/webgl_interactive_cubes.ts" />
/// <reference path="./tests/webgl/webgl_interactive_raycasting_points.ts" />
/// <reference path="./tests/webgl/webgl_lensflares.ts" />
/// <reference path="./tests/webgl/webgl_lights_heimsphere.ts" />
/// <reference path="./tests/webgl/webgl_lights_hemisphere.ts" />
/// <reference path="./tests/webgl/webgl_lines_colors.ts" />
/// <reference path="./tests/webgl/webgl_loader_awd.ts" />
/// <reference path="./tests/webgl/webgl_materials.ts" />
+1376 -1093
View File
File diff suppressed because it is too large Load Diff