提交 28894ccb 编写于 作者: M Mr.doob

r91

上级 935739be
......@@ -19,7 +19,7 @@ Please also include a live example if possible. You can start from these templat
##### Three.js version
- [ ] Dev
- [ ] r90
- [ ] r91
- [ ] ...
##### Browser
......
......@@ -185,7 +185,7 @@
} );
var REVISION = '91dev';
var REVISION = '91';
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
var CullFaceNone = 0;
var CullFaceBack = 1;
......@@ -13749,15 +13749,15 @@
Object.assign( Triangle, {
normal: function () {
getNormal: function () {
var v0 = new Vector3();
return function normal( a, b, c, target ) {
return function getNormal( a, b, c, target ) {
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .normal() target is now required' );
console.warn( 'THREE.Triangle: .getNormal() target is now required' );
target = new Vector3();
}
......@@ -13781,13 +13781,13 @@
// static/instance method to calculate barycentric coordinates
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
barycoordFromPoint: function () {
getBarycoord: function () {
var v0 = new Vector3();
var v1 = new Vector3();
var v2 = new Vector3();
return function barycoordFromPoint( point, a, b, c, target ) {
return function getBarycoord( point, a, b, c, target ) {
v0.subVectors( c, a );
v1.subVectors( b, a );
......@@ -13803,7 +13803,7 @@
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .barycoordFromPoint() target is now required' );
console.warn( 'THREE.Triangle: .getBarycoord() target is now required' );
target = new Vector3();
}
......@@ -13834,7 +13834,7 @@
return function containsPoint( point, a, b, c ) {
Triangle.barycoordFromPoint( point, a, b, c, v1 );
Triangle.getBarycoord( point, a, b, c, v1 );
return ( v1.x >= 0 ) && ( v1.y >= 0 ) && ( ( v1.x + v1.y ) <= 1 );
......@@ -13882,12 +13882,12 @@
},
area: function () {
getArea: function () {
var v0 = new Vector3();
var v1 = new Vector3();
return function area() {
return function getArea() {
v0.subVectors( this.c, this.b );
v1.subVectors( this.a, this.b );
......@@ -13898,11 +13898,11 @@
}(),
midpoint: function ( target ) {
getMidpoint: function ( target ) {
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .midpoint() target is now required' );
console.warn( 'THREE.Triangle: .getMidpoint() target is now required' );
target = new Vector3();
}
......@@ -13911,17 +13911,17 @@
},
normal: function ( target ) {
getNormal: function ( target ) {
return Triangle.normal( this.a, this.b, this.c, target );
return Triangle.getNormal( this.a, this.b, this.c, target );
},
plane: function ( target ) {
getPlane: function ( target ) {
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .plane() target is now required' );
console.warn( 'THREE.Triangle: .getPlane() target is now required' );
target = new Vector3();
}
......@@ -13930,9 +13930,9 @@
},
barycoordFromPoint: function ( point, target ) {
getBarycoord: function ( point, target ) {
return Triangle.barycoordFromPoint( point, this.a, this.b, this.c, target );
return Triangle.getBarycoord( point, this.a, this.b, this.c, target );
},
......@@ -14156,7 +14156,7 @@
function uvIntersection( point, p1, p2, p3, uv1, uv2, uv3 ) {
Triangle.barycoordFromPoint( point, p1, p2, p3, barycoord );
Triangle.getBarycoord( point, p1, p2, p3, barycoord );
uv1.multiplyScalar( barycoord.x );
uv2.multiplyScalar( barycoord.y );
......@@ -14220,7 +14220,7 @@
}
var face = new Face3( a, b, c );
Triangle.normal( vA, vB, vC, face.normal );
Triangle.getNormal( vA, vB, vC, face.normal );
intersection.face = face;
intersection.faceIndex = a;
......@@ -19644,7 +19644,7 @@
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext );
var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext ); /* global WebGL2RenderingContext */
var _videoTextures = {};
var _canvas;
......@@ -19654,6 +19654,13 @@
if ( image.width > maxSize || image.height > maxSize ) {
if ( 'data' in image ) {
console.warn( 'THREE.WebGLRenderer: image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );
return;
}
// Warning: Scaling through the canvas will only work with images that use
// premultiplied alpha.
......@@ -20929,6 +20936,8 @@
}
var matrixWorldInverse = new Matrix4();
var tempQuaternion = new Quaternion();
var tempPosition = new Vector3();
var cameraL = new PerspectiveCamera();
cameraL.bounds = new Vector4( 0.0, 0.0, 0.5, 1.0 );
......@@ -21007,38 +21016,42 @@
//
var pose = frameData.pose;
var poseObject = poseTarget !== null ? poseTarget : camera;
var stageParameters = device.stageParameters;
if ( pose.position !== null ) {
if ( stageParameters ) {
poseObject.position.fromArray( pose.position );
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
} else {
poseObject.position.set( 0, 0, 0 );
standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
}
if ( pose.orientation !== null ) {
poseObject.quaternion.fromArray( pose.orientation );
var pose = frameData.pose;
var poseObject = poseTarget !== null ? poseTarget : camera;
}
// We want to manipulate poseObject by its position and quaternion components since users may rely on them.
poseObject.matrix.copy( standingMatrix );
poseObject.matrix.decompose( poseObject.position, poseObject.quaternion, poseObject.scale );
var stageParameters = device.stageParameters;
if ( pose.orientation !== null ) {
if ( stageParameters ) {
tempQuaternion.fromArray( pose.orientation );
poseObject.quaternion.multiply( tempQuaternion );
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
}
} else {
if ( pose.position !== null ) {
standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
tempQuaternion.setFromRotationMatrix( standingMatrix );
tempPosition.fromArray( pose.position );
tempPosition.applyQuaternion( tempQuaternion );
poseObject.position.add( tempPosition );
}
poseObject.position.applyMatrix4( standingMatrix );
poseObject.updateMatrixWorld();
if ( device.isPresenting === false ) return camera;
......@@ -25441,7 +25454,7 @@
// vertex
p0 = func( u, v, p0 );
func( u, v, p0 );
vertices.push( p0.x, p0.y, p0.z );
// normal
......@@ -25450,24 +25463,24 @@
if ( u - EPS >= 0 ) {
p1 = func( u - EPS, v, p1 );
func( u - EPS, v, p1 );
pu.subVectors( p0, p1 );
} else {
p1 = func( u + EPS, v, p1 );
func( u + EPS, v, p1 );
pu.subVectors( p1, p0 );
}
if ( v - EPS >= 0 ) {
p1 = func( u, v - EPS, p1 );
func( u, v - EPS, p1 );
pv.subVectors( p0, p1 );
} else {
p1 = func( u, v + EPS, p1 );
func( u, v + EPS, p1 );
pv.subVectors( p1, p0 );
}
......@@ -28148,7 +28161,7 @@
}
scope.addGroup( start, verticesArray.length / 3 - start, options.material !== undefined ? options.material : 0 );
scope.addGroup( start, verticesArray.length / 3 - start, 0 );
}
......@@ -28172,7 +28185,7 @@
}
scope.addGroup( start, verticesArray.length / 3 - start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1 );
scope.addGroup( start, verticesArray.length / 3 - start, 1 );
}
......@@ -42123,9 +42136,9 @@
},
intersectObject: function ( object, recursive ) {
intersectObject: function ( object, recursive, optionalTarget ) {
var intersects = [];
var intersects = optionalTarget || [];
intersectObject( object, this, intersects, recursive );
......@@ -42135,9 +42148,9 @@
},
intersectObjects: function ( objects, recursive ) {
intersectObjects: function ( objects, recursive, optionalTarget ) {
var intersects = [];
var intersects = optionalTarget || [];
if ( Array.isArray( objects ) === false ) {
......@@ -44731,6 +44744,58 @@
} );
Object.assign( Triangle.prototype, {
area: function () {
console.warn( 'THREE.Triangle: .area() has been renamed to .getArea().' );
return this.getArea();
},
barycoordFromPoint: function ( point, target ) {
console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );
return this.getBarycoord( point, target );
},
midpoint: function ( target ) {
console.warn( 'THREE.Triangle: .midpoint() has been renamed to .getMidpoint().' );
return this.getMidpoint( target );
},
normal: function ( target ) {
console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );
return this.getNormal( target );
},
plane: function ( target ) {
console.warn( 'THREE.Triangle: .plane() has been renamed to .getPlane().' );
return this.getPlane( target );
}
} );
Object.assign( Triangle, {
barycoordFromPoint: function ( point, a, b, c, target ) {
console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );
return Triangle.getBarycoord( point, a, b, c, target );
},
normal: function ( a, b, c, target ) {
console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );
return Triangle.getNormal( a, b, c, target );
}
} );
Object.assign( Shape.prototype, {
extractAllPoints: function ( divisions ) {
此差异已折叠。
......@@ -179,7 +179,7 @@ Object.assign( EventDispatcher.prototype, {
} );
var REVISION = '91dev';
var REVISION = '91';
var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
var CullFaceNone = 0;
var CullFaceBack = 1;
......@@ -13743,15 +13743,15 @@ function Triangle( a, b, c ) {
Object.assign( Triangle, {
normal: function () {
getNormal: function () {
var v0 = new Vector3();
return function normal( a, b, c, target ) {
return function getNormal( a, b, c, target ) {
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .normal() target is now required' );
console.warn( 'THREE.Triangle: .getNormal() target is now required' );
target = new Vector3();
}
......@@ -13775,13 +13775,13 @@ Object.assign( Triangle, {
// static/instance method to calculate barycentric coordinates
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
barycoordFromPoint: function () {
getBarycoord: function () {
var v0 = new Vector3();
var v1 = new Vector3();
var v2 = new Vector3();
return function barycoordFromPoint( point, a, b, c, target ) {
return function getBarycoord( point, a, b, c, target ) {
v0.subVectors( c, a );
v1.subVectors( b, a );
......@@ -13797,7 +13797,7 @@ Object.assign( Triangle, {
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .barycoordFromPoint() target is now required' );
console.warn( 'THREE.Triangle: .getBarycoord() target is now required' );
target = new Vector3();
}
......@@ -13828,7 +13828,7 @@ Object.assign( Triangle, {
return function containsPoint( point, a, b, c ) {
Triangle.barycoordFromPoint( point, a, b, c, v1 );
Triangle.getBarycoord( point, a, b, c, v1 );
return ( v1.x >= 0 ) && ( v1.y >= 0 ) && ( ( v1.x + v1.y ) <= 1 );
......@@ -13876,12 +13876,12 @@ Object.assign( Triangle.prototype, {
},
area: function () {
getArea: function () {
var v0 = new Vector3();
var v1 = new Vector3();
return function area() {
return function getArea() {
v0.subVectors( this.c, this.b );
v1.subVectors( this.a, this.b );
......@@ -13892,11 +13892,11 @@ Object.assign( Triangle.prototype, {
}(),
midpoint: function ( target ) {
getMidpoint: function ( target ) {
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .midpoint() target is now required' );
console.warn( 'THREE.Triangle: .getMidpoint() target is now required' );
target = new Vector3();
}
......@@ -13905,17 +13905,17 @@ Object.assign( Triangle.prototype, {
},
normal: function ( target ) {
getNormal: function ( target ) {
return Triangle.normal( this.a, this.b, this.c, target );
return Triangle.getNormal( this.a, this.b, this.c, target );
},
plane: function ( target ) {
getPlane: function ( target ) {
if ( target === undefined ) {
console.warn( 'THREE.Triangle: .plane() target is now required' );
console.warn( 'THREE.Triangle: .getPlane() target is now required' );
target = new Vector3();
}
......@@ -13924,9 +13924,9 @@ Object.assign( Triangle.prototype, {
},
barycoordFromPoint: function ( point, target ) {
getBarycoord: function ( point, target ) {
return Triangle.barycoordFromPoint( point, this.a, this.b, this.c, target );
return Triangle.getBarycoord( point, this.a, this.b, this.c, target );
},
......@@ -14150,7 +14150,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
function uvIntersection( point, p1, p2, p3, uv1, uv2, uv3 ) {
Triangle.barycoordFromPoint( point, p1, p2, p3, barycoord );
Triangle.getBarycoord( point, p1, p2, p3, barycoord );
uv1.multiplyScalar( barycoord.x );
uv2.multiplyScalar( barycoord.y );
......@@ -14214,7 +14214,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
}
var face = new Face3( a, b, c );
Triangle.normal( vA, vB, vC, face.normal );
Triangle.getNormal( vA, vB, vC, face.normal );
intersection.face = face;
intersection.faceIndex = a;
......@@ -19638,7 +19638,7 @@ function WebGLState( gl, extensions, utils ) {
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext );
var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof WebGL2RenderingContext ); /* global WebGL2RenderingContext */
var _videoTextures = {};
var _canvas;
......@@ -19648,6 +19648,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if ( image.width > maxSize || image.height > maxSize ) {
if ( 'data' in image ) {
console.warn( 'THREE.WebGLRenderer: image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );
return;
}
// Warning: Scaling through the canvas will only work with images that use
// premultiplied alpha.
......@@ -20923,6 +20930,8 @@ function WebVRManager( renderer ) {
}
var matrixWorldInverse = new Matrix4();
var tempQuaternion = new Quaternion();
var tempPosition = new Vector3();
var cameraL = new PerspectiveCamera();
cameraL.bounds = new Vector4( 0.0, 0.0, 0.5, 1.0 );
......@@ -21001,38 +21010,42 @@ function WebVRManager( renderer ) {
//
var pose = frameData.pose;
var poseObject = poseTarget !== null ? poseTarget : camera;
var stageParameters = device.stageParameters;
if ( pose.position !== null ) {
if ( stageParameters ) {
poseObject.position.fromArray( pose.position );
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
} else {
poseObject.position.set( 0, 0, 0 );
standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
}
if ( pose.orientation !== null ) {
poseObject.quaternion.fromArray( pose.orientation );
var pose = frameData.pose;
var poseObject = poseTarget !== null ? poseTarget : camera;
}
// We want to manipulate poseObject by its position and quaternion components since users may rely on them.
poseObject.matrix.copy( standingMatrix );
poseObject.matrix.decompose( poseObject.position, poseObject.quaternion, poseObject.scale );
var stageParameters = device.stageParameters;
if ( pose.orientation !== null ) {
if ( stageParameters ) {
tempQuaternion.fromArray( pose.orientation );
poseObject.quaternion.multiply( tempQuaternion );
standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
}
} else {
if ( pose.position !== null ) {
standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
tempQuaternion.setFromRotationMatrix( standingMatrix );
tempPosition.fromArray( pose.position );
tempPosition.applyQuaternion( tempQuaternion );
poseObject.position.add( tempPosition );
}
poseObject.position.applyMatrix4( standingMatrix );
poseObject.updateMatrixWorld();
if ( device.isPresenting === false ) return camera;
......@@ -25435,7 +25448,7 @@ function ParametricBufferGeometry( func, slices, stacks ) {
// vertex
p0 = func( u, v, p0 );
func( u, v, p0 );
vertices.push( p0.x, p0.y, p0.z );
// normal
......@@ -25444,24 +25457,24 @@ function ParametricBufferGeometry( func, slices, stacks ) {
if ( u - EPS >= 0 ) {
p1 = func( u - EPS, v, p1 );
func( u - EPS, v, p1 );
pu.subVectors( p0, p1 );
} else {
p1 = func( u + EPS, v, p1 );
func( u + EPS, v, p1 );
pu.subVectors( p1, p0 );
}
if ( v - EPS >= 0 ) {
p1 = func( u, v - EPS, p1 );
func( u, v - EPS, p1 );
pv.subVectors( p0, p1 );
} else {
p1 = func( u, v + EPS, p1 );
func( u, v + EPS, p1 );
pv.subVectors( p1, p0 );
}
......@@ -28142,7 +28155,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
}
scope.addGroup( start, verticesArray.length / 3 - start, options.material !== undefined ? options.material : 0 );
scope.addGroup( start, verticesArray.length / 3 - start, 0 );
}
......@@ -28166,7 +28179,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
}
scope.addGroup( start, verticesArray.length / 3 - start, options.extrudeMaterial !== undefined ? options.extrudeMaterial : 1 );
scope.addGroup( start, verticesArray.length / 3 - start, 1 );
}
......@@ -42117,9 +42130,9 @@ Object.assign( Raycaster.prototype, {
},
intersectObject: function ( object, recursive ) {
intersectObject: function ( object, recursive, optionalTarget ) {
var intersects = [];
var intersects = optionalTarget || [];
intersectObject( object, this, intersects, recursive );
......@@ -42129,9 +42142,9 @@ Object.assign( Raycaster.prototype, {
},
intersectObjects: function ( objects, recursive ) {
intersectObjects: function ( objects, recursive, optionalTarget ) {
var intersects = [];
var intersects = optionalTarget || [];
if ( Array.isArray( objects ) === false ) {
......@@ -44725,6 +44738,58 @@ Object.assign( Ray.prototype, {
} );
Object.assign( Triangle.prototype, {
area: function () {
console.warn( 'THREE.Triangle: .area() has been renamed to .getArea().' );
return this.getArea();
},
barycoordFromPoint: function ( point, target ) {
console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );
return this.getBarycoord( point, target );
},
midpoint: function ( target ) {
console.warn( 'THREE.Triangle: .midpoint() has been renamed to .getMidpoint().' );
return this.getMidpoint( target );
},
normal: function ( target ) {
console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );
return this.getNormal( target );
},
plane: function ( target ) {
console.warn( 'THREE.Triangle: .plane() has been renamed to .getPlane().' );
return this.getPlane( target );
}
} );
Object.assign( Triangle, {
barycoordFromPoint: function ( point, a, b, c, target ) {
console.warn( 'THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().' );
return Triangle.getBarycoord( point, a, b, c, target );
},
normal: function ( a, b, c, target ) {
console.warn( 'THREE.Triangle: .normal() has been renamed to .getNormal().' );
return Triangle.getNormal( a, b, c, target );
}
} );
Object.assign( Shape.prototype, {
extractAllPoints: function ( divisions ) {
......
{
"name": "three",
"version": "0.90.0",
"version": "0.91.0",
"description": "JavaScript 3D library",
"main": "build/three.js",
"repository": "mrdoob/three.js",
......
export var REVISION = '91dev';
export var REVISION = '91';
export var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
export var CullFaceNone = 0;
export var CullFaceBack = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册