|
@@ -2066,6 +2066,8 @@ Object.defineProperties( Quaternion.prototype, {
|
|
|
|
|
|
Object.assign( Quaternion.prototype, {
|
|
|
|
|
|
+ isQuaternion: true,
|
|
|
+
|
|
|
set: function ( x, y, z, w ) {
|
|
|
|
|
|
this._x = x;
|
|
@@ -6152,6 +6154,10 @@ var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 =
|
|
|
|
|
|
var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n";
|
|
|
|
|
|
+var background_frag = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n}\n";
|
|
|
+
|
|
|
+var background_vert = "varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = vec4( position, 1.0 );\n\tgl_Position.z = 1.0;\n}\n";
|
|
|
+
|
|
|
var cube_frag = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n";
|
|
|
|
|
|
var cube_vert = "varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}\n";
|
|
@@ -6299,6 +6305,8 @@ var ShaderChunk = {
|
|
|
uv2_vertex: uv2_vertex,
|
|
|
worldpos_vertex: worldpos_vertex,
|
|
|
|
|
|
+ background_frag: background_frag,
|
|
|
+ background_vert: background_vert,
|
|
|
cube_frag: cube_frag,
|
|
|
cube_vert: cube_vert,
|
|
|
depth_frag: depth_frag,
|
|
@@ -7379,6 +7387,16 @@ var ShaderLib = {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ background: {
|
|
|
+
|
|
|
+ uniforms: {
|
|
|
+ t2D: { value: null },
|
|
|
+ },
|
|
|
+
|
|
|
+ vertexShader: ShaderChunk.background_vert,
|
|
|
+ fragmentShader: ShaderChunk.background_frag
|
|
|
+
|
|
|
+ },
|
|
|
/* -------------------------------------------------------------------------
|
|
|
// Cube map shader
|
|
|
------------------------------------------------------------------------- */
|
|
@@ -7665,6 +7683,64 @@ function WebGLAttributes( gl ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @author mrdoob / http://mrdoob.com/
|
|
|
+ * @author alteredq / http://alteredqualia.com/
|
|
|
+ */
|
|
|
+
|
|
|
+function Face3( a, b, c, normal, color, materialIndex ) {
|
|
|
+
|
|
|
+ this.a = a;
|
|
|
+ this.b = b;
|
|
|
+ this.c = c;
|
|
|
+
|
|
|
+ this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3();
|
|
|
+ this.vertexNormals = Array.isArray( normal ) ? normal : [];
|
|
|
+
|
|
|
+ this.color = ( color && color.isColor ) ? color : new Color();
|
|
|
+ this.vertexColors = Array.isArray( color ) ? color : [];
|
|
|
+
|
|
|
+ this.materialIndex = materialIndex !== undefined ? materialIndex : 0;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+Object.assign( Face3.prototype, {
|
|
|
+
|
|
|
+ clone: function () {
|
|
|
+
|
|
|
+ return new this.constructor().copy( this );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ copy: function ( source ) {
|
|
|
+
|
|
|
+ this.a = source.a;
|
|
|
+ this.b = source.b;
|
|
|
+ this.c = source.c;
|
|
|
+
|
|
|
+ this.normal.copy( source.normal );
|
|
|
+ this.color.copy( source.color );
|
|
|
+
|
|
|
+ this.materialIndex = source.materialIndex;
|
|
|
+
|
|
|
+ for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) {
|
|
|
+
|
|
|
+ this.vertexNormals[ i ] = source.vertexNormals[ i ].clone();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) {
|
|
|
+
|
|
|
+ this.vertexColors[ i ] = source.vertexColors[ i ].clone();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+} );
|
|
|
+
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
* @author WestLangley / http://github.com/WestLangley
|
|
@@ -8932,277 +9008,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
|
|
|
|
|
|
} );
|
|
|
|
|
|
-/**
|
|
|
- * @author mrdoob / http://mrdoob.com/
|
|
|
- * @author mikael emtinger / http://gomo.se/
|
|
|
- * @author WestLangley / http://github.com/WestLangley
|
|
|
-*/
|
|
|
-
|
|
|
-function Camera() {
|
|
|
-
|
|
|
- Object3D.call( this );
|
|
|
-
|
|
|
- this.type = 'Camera';
|
|
|
-
|
|
|
- this.matrixWorldInverse = new Matrix4();
|
|
|
-
|
|
|
- this.projectionMatrix = new Matrix4();
|
|
|
- this.projectionMatrixInverse = new Matrix4();
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-Camera.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
-
|
|
|
- constructor: Camera,
|
|
|
-
|
|
|
- isCamera: true,
|
|
|
-
|
|
|
- copy: function ( source, recursive ) {
|
|
|
-
|
|
|
- Object3D.prototype.copy.call( this, source, recursive );
|
|
|
-
|
|
|
- this.matrixWorldInverse.copy( source.matrixWorldInverse );
|
|
|
-
|
|
|
- this.projectionMatrix.copy( source.projectionMatrix );
|
|
|
- this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- getWorldDirection: function ( target ) {
|
|
|
-
|
|
|
- if ( target === undefined ) {
|
|
|
-
|
|
|
- console.warn( 'THREE.Camera: .getWorldDirection() target is now required' );
|
|
|
- target = new Vector3();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- this.updateMatrixWorld( true );
|
|
|
-
|
|
|
- var e = this.matrixWorld.elements;
|
|
|
-
|
|
|
- return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- updateMatrixWorld: function ( force ) {
|
|
|
-
|
|
|
- Object3D.prototype.updateMatrixWorld.call( this, force );
|
|
|
-
|
|
|
- this.matrixWorldInverse.getInverse( this.matrixWorld );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- clone: function () {
|
|
|
-
|
|
|
- return new this.constructor().copy( this );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-} );
|
|
|
-
|
|
|
-/**
|
|
|
- * @author alteredq / http://alteredqualia.com/
|
|
|
- * @author arose / http://github.com/arose
|
|
|
- */
|
|
|
-
|
|
|
-function OrthographicCamera( left, right, top, bottom, near, far ) {
|
|
|
-
|
|
|
- Camera.call( this );
|
|
|
-
|
|
|
- this.type = 'OrthographicCamera';
|
|
|
-
|
|
|
- this.zoom = 1;
|
|
|
- this.view = null;
|
|
|
-
|
|
|
- this.left = left;
|
|
|
- this.right = right;
|
|
|
- this.top = top;
|
|
|
- this.bottom = bottom;
|
|
|
-
|
|
|
- this.near = ( near !== undefined ) ? near : 0.1;
|
|
|
- this.far = ( far !== undefined ) ? far : 2000;
|
|
|
-
|
|
|
- this.updateProjectionMatrix();
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), {
|
|
|
-
|
|
|
- constructor: OrthographicCamera,
|
|
|
-
|
|
|
- isOrthographicCamera: true,
|
|
|
-
|
|
|
- copy: function ( source, recursive ) {
|
|
|
-
|
|
|
- Camera.prototype.copy.call( this, source, recursive );
|
|
|
-
|
|
|
- this.left = source.left;
|
|
|
- this.right = source.right;
|
|
|
- this.top = source.top;
|
|
|
- this.bottom = source.bottom;
|
|
|
- this.near = source.near;
|
|
|
- this.far = source.far;
|
|
|
-
|
|
|
- this.zoom = source.zoom;
|
|
|
- this.view = source.view === null ? null : Object.assign( {}, source.view );
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) {
|
|
|
-
|
|
|
- if ( this.view === null ) {
|
|
|
-
|
|
|
- this.view = {
|
|
|
- enabled: true,
|
|
|
- fullWidth: 1,
|
|
|
- fullHeight: 1,
|
|
|
- offsetX: 0,
|
|
|
- offsetY: 0,
|
|
|
- width: 1,
|
|
|
- height: 1
|
|
|
- };
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- this.view.enabled = true;
|
|
|
- this.view.fullWidth = fullWidth;
|
|
|
- this.view.fullHeight = fullHeight;
|
|
|
- this.view.offsetX = x;
|
|
|
- this.view.offsetY = y;
|
|
|
- this.view.width = width;
|
|
|
- this.view.height = height;
|
|
|
-
|
|
|
- this.updateProjectionMatrix();
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- clearViewOffset: function () {
|
|
|
-
|
|
|
- if ( this.view !== null ) {
|
|
|
-
|
|
|
- this.view.enabled = false;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- this.updateProjectionMatrix();
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- updateProjectionMatrix: function () {
|
|
|
-
|
|
|
- var dx = ( this.right - this.left ) / ( 2 * this.zoom );
|
|
|
- var dy = ( this.top - this.bottom ) / ( 2 * this.zoom );
|
|
|
- var cx = ( this.right + this.left ) / 2;
|
|
|
- var cy = ( this.top + this.bottom ) / 2;
|
|
|
-
|
|
|
- var left = cx - dx;
|
|
|
- var right = cx + dx;
|
|
|
- var top = cy + dy;
|
|
|
- var bottom = cy - dy;
|
|
|
-
|
|
|
- if ( this.view !== null && this.view.enabled ) {
|
|
|
-
|
|
|
- var zoomW = this.zoom / ( this.view.width / this.view.fullWidth );
|
|
|
- var zoomH = this.zoom / ( this.view.height / this.view.fullHeight );
|
|
|
- var scaleW = ( this.right - this.left ) / this.view.width;
|
|
|
- var scaleH = ( this.top - this.bottom ) / this.view.height;
|
|
|
-
|
|
|
- left += scaleW * ( this.view.offsetX / zoomW );
|
|
|
- right = left + scaleW * ( this.view.width / zoomW );
|
|
|
- top -= scaleH * ( this.view.offsetY / zoomH );
|
|
|
- bottom = top - scaleH * ( this.view.height / zoomH );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far );
|
|
|
-
|
|
|
- this.projectionMatrixInverse.getInverse( this.projectionMatrix );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- toJSON: function ( meta ) {
|
|
|
-
|
|
|
- var data = Object3D.prototype.toJSON.call( this, meta );
|
|
|
-
|
|
|
- data.object.zoom = this.zoom;
|
|
|
- data.object.left = this.left;
|
|
|
- data.object.right = this.right;
|
|
|
- data.object.top = this.top;
|
|
|
- data.object.bottom = this.bottom;
|
|
|
- data.object.near = this.near;
|
|
|
- data.object.far = this.far;
|
|
|
-
|
|
|
- if ( this.view !== null ) data.object.view = Object.assign( {}, this.view );
|
|
|
-
|
|
|
- return data;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-} );
|
|
|
-
|
|
|
-/**
|
|
|
- * @author mrdoob / http://mrdoob.com/
|
|
|
- * @author alteredq / http://alteredqualia.com/
|
|
|
- */
|
|
|
-
|
|
|
-function Face3( a, b, c, normal, color, materialIndex ) {
|
|
|
-
|
|
|
- this.a = a;
|
|
|
- this.b = b;
|
|
|
- this.c = c;
|
|
|
-
|
|
|
- this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3();
|
|
|
- this.vertexNormals = Array.isArray( normal ) ? normal : [];
|
|
|
-
|
|
|
- this.color = ( color && color.isColor ) ? color : new Color();
|
|
|
- this.vertexColors = Array.isArray( color ) ? color : [];
|
|
|
-
|
|
|
- this.materialIndex = materialIndex !== undefined ? materialIndex : 0;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-Object.assign( Face3.prototype, {
|
|
|
-
|
|
|
- clone: function () {
|
|
|
-
|
|
|
- return new this.constructor().copy( this );
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- copy: function ( source ) {
|
|
|
-
|
|
|
- this.a = source.a;
|
|
|
- this.b = source.b;
|
|
|
- this.c = source.c;
|
|
|
-
|
|
|
- this.normal.copy( source.normal );
|
|
|
- this.color.copy( source.color );
|
|
|
-
|
|
|
- this.materialIndex = source.materialIndex;
|
|
|
-
|
|
|
- for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) {
|
|
|
-
|
|
|
- this.vertexNormals[ i ] = source.vertexNormals[ i ].clone();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) {
|
|
|
-
|
|
|
- this.vertexColors[ i ] = source.vertexColors[ i ].clone();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-} );
|
|
|
-
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
* @author kile / http://kile.stravaganza.org/
|
|
@@ -12978,6 +12783,9 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
|
|
|
data.envMap = this.envMap.toJSON( meta ).uuid;
|
|
|
data.reflectivity = this.reflectivity; // Scale behind envMap
|
|
|
|
|
|
+ if ( this.combine !== undefined ) data.combine = this.combine;
|
|
|
+ if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if ( this.gradientMap && this.gradientMap.isTexture ) {
|
|
@@ -13143,120 +12951,6 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
|
|
|
|
|
|
} );
|
|
|
|
|
|
-/**
|
|
|
- * @author mrdoob / http://mrdoob.com/
|
|
|
- * @author alteredq / http://alteredqualia.com/
|
|
|
- *
|
|
|
- * parameters = {
|
|
|
- * color: <hex>,
|
|
|
- * opacity: <float>,
|
|
|
- * map: new THREE.Texture( <Image> ),
|
|
|
- *
|
|
|
- * lightMap: new THREE.Texture( <Image> ),
|
|
|
- * lightMapIntensity: <float>
|
|
|
- *
|
|
|
- * aoMap: new THREE.Texture( <Image> ),
|
|
|
- * aoMapIntensity: <float>
|
|
|
- *
|
|
|
- * specularMap: new THREE.Texture( <Image> ),
|
|
|
- *
|
|
|
- * alphaMap: new THREE.Texture( <Image> ),
|
|
|
- *
|
|
|
- * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
|
|
|
- * combine: THREE.Multiply,
|
|
|
- * reflectivity: <float>,
|
|
|
- * refractionRatio: <float>,
|
|
|
- *
|
|
|
- * depthTest: <bool>,
|
|
|
- * depthWrite: <bool>,
|
|
|
- *
|
|
|
- * wireframe: <boolean>,
|
|
|
- * wireframeLinewidth: <float>,
|
|
|
- *
|
|
|
- * skinning: <bool>,
|
|
|
- * morphTargets: <bool>
|
|
|
- * }
|
|
|
- */
|
|
|
-
|
|
|
-function MeshBasicMaterial( parameters ) {
|
|
|
-
|
|
|
- Material.call( this );
|
|
|
-
|
|
|
- this.type = 'MeshBasicMaterial';
|
|
|
-
|
|
|
- this.color = new Color( 0xffffff ); // emissive
|
|
|
-
|
|
|
- this.map = null;
|
|
|
-
|
|
|
- this.lightMap = null;
|
|
|
- this.lightMapIntensity = 1.0;
|
|
|
-
|
|
|
- this.aoMap = null;
|
|
|
- this.aoMapIntensity = 1.0;
|
|
|
-
|
|
|
- this.specularMap = null;
|
|
|
-
|
|
|
- this.alphaMap = null;
|
|
|
-
|
|
|
- this.envMap = null;
|
|
|
- this.combine = MultiplyOperation;
|
|
|
- this.reflectivity = 1;
|
|
|
- this.refractionRatio = 0.98;
|
|
|
-
|
|
|
- this.wireframe = false;
|
|
|
- this.wireframeLinewidth = 1;
|
|
|
- this.wireframeLinecap = 'round';
|
|
|
- this.wireframeLinejoin = 'round';
|
|
|
-
|
|
|
- this.skinning = false;
|
|
|
- this.morphTargets = false;
|
|
|
-
|
|
|
- this.lights = false;
|
|
|
-
|
|
|
- this.setValues( parameters );
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-MeshBasicMaterial.prototype = Object.create( Material.prototype );
|
|
|
-MeshBasicMaterial.prototype.constructor = MeshBasicMaterial;
|
|
|
-
|
|
|
-MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
|
|
|
-
|
|
|
-MeshBasicMaterial.prototype.copy = function ( source ) {
|
|
|
-
|
|
|
- Material.prototype.copy.call( this, source );
|
|
|
-
|
|
|
- this.color.copy( source.color );
|
|
|
-
|
|
|
- this.map = source.map;
|
|
|
-
|
|
|
- this.lightMap = source.lightMap;
|
|
|
- this.lightMapIntensity = source.lightMapIntensity;
|
|
|
-
|
|
|
- this.aoMap = source.aoMap;
|
|
|
- this.aoMapIntensity = source.aoMapIntensity;
|
|
|
-
|
|
|
- this.specularMap = source.specularMap;
|
|
|
-
|
|
|
- this.alphaMap = source.alphaMap;
|
|
|
-
|
|
|
- this.envMap = source.envMap;
|
|
|
- this.combine = source.combine;
|
|
|
- this.reflectivity = source.reflectivity;
|
|
|
- this.refractionRatio = source.refractionRatio;
|
|
|
-
|
|
|
- this.wireframe = source.wireframe;
|
|
|
- this.wireframeLinewidth = source.wireframeLinewidth;
|
|
|
- this.wireframeLinecap = source.wireframeLinecap;
|
|
|
- this.wireframeLinejoin = source.wireframeLinejoin;
|
|
|
-
|
|
|
- this.skinning = source.skinning;
|
|
|
- this.morphTargets = source.morphTargets;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
-};
|
|
|
-
|
|
|
/**
|
|
|
* @author alteredq / http://alteredqualia.com/
|
|
|
*
|
|
@@ -14329,6 +14023,120 @@ Object.assign( Triangle.prototype, {
|
|
|
|
|
|
} );
|
|
|
|
|
|
+/**
|
|
|
+ * @author mrdoob / http://mrdoob.com/
|
|
|
+ * @author alteredq / http://alteredqualia.com/
|
|
|
+ *
|
|
|
+ * parameters = {
|
|
|
+ * color: <hex>,
|
|
|
+ * opacity: <float>,
|
|
|
+ * map: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * lightMap: new THREE.Texture( <Image> ),
|
|
|
+ * lightMapIntensity: <float>
|
|
|
+ *
|
|
|
+ * aoMap: new THREE.Texture( <Image> ),
|
|
|
+ * aoMapIntensity: <float>
|
|
|
+ *
|
|
|
+ * specularMap: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * alphaMap: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
|
|
|
+ * combine: THREE.Multiply,
|
|
|
+ * reflectivity: <float>,
|
|
|
+ * refractionRatio: <float>,
|
|
|
+ *
|
|
|
+ * depthTest: <bool>,
|
|
|
+ * depthWrite: <bool>,
|
|
|
+ *
|
|
|
+ * wireframe: <boolean>,
|
|
|
+ * wireframeLinewidth: <float>,
|
|
|
+ *
|
|
|
+ * skinning: <bool>,
|
|
|
+ * morphTargets: <bool>
|
|
|
+ * }
|
|
|
+ */
|
|
|
+
|
|
|
+function MeshBasicMaterial( parameters ) {
|
|
|
+
|
|
|
+ Material.call( this );
|
|
|
+
|
|
|
+ this.type = 'MeshBasicMaterial';
|
|
|
+
|
|
|
+ this.color = new Color( 0xffffff ); // emissive
|
|
|
+
|
|
|
+ this.map = null;
|
|
|
+
|
|
|
+ this.lightMap = null;
|
|
|
+ this.lightMapIntensity = 1.0;
|
|
|
+
|
|
|
+ this.aoMap = null;
|
|
|
+ this.aoMapIntensity = 1.0;
|
|
|
+
|
|
|
+ this.specularMap = null;
|
|
|
+
|
|
|
+ this.alphaMap = null;
|
|
|
+
|
|
|
+ this.envMap = null;
|
|
|
+ this.combine = MultiplyOperation;
|
|
|
+ this.reflectivity = 1;
|
|
|
+ this.refractionRatio = 0.98;
|
|
|
+
|
|
|
+ this.wireframe = false;
|
|
|
+ this.wireframeLinewidth = 1;
|
|
|
+ this.wireframeLinecap = 'round';
|
|
|
+ this.wireframeLinejoin = 'round';
|
|
|
+
|
|
|
+ this.skinning = false;
|
|
|
+ this.morphTargets = false;
|
|
|
+
|
|
|
+ this.lights = false;
|
|
|
+
|
|
|
+ this.setValues( parameters );
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+MeshBasicMaterial.prototype = Object.create( Material.prototype );
|
|
|
+MeshBasicMaterial.prototype.constructor = MeshBasicMaterial;
|
|
|
+
|
|
|
+MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
|
|
|
+
|
|
|
+MeshBasicMaterial.prototype.copy = function ( source ) {
|
|
|
+
|
|
|
+ Material.prototype.copy.call( this, source );
|
|
|
+
|
|
|
+ this.color.copy( source.color );
|
|
|
+
|
|
|
+ this.map = source.map;
|
|
|
+
|
|
|
+ this.lightMap = source.lightMap;
|
|
|
+ this.lightMapIntensity = source.lightMapIntensity;
|
|
|
+
|
|
|
+ this.aoMap = source.aoMap;
|
|
|
+ this.aoMapIntensity = source.aoMapIntensity;
|
|
|
+
|
|
|
+ this.specularMap = source.specularMap;
|
|
|
+
|
|
|
+ this.alphaMap = source.alphaMap;
|
|
|
+
|
|
|
+ this.envMap = source.envMap;
|
|
|
+ this.combine = source.combine;
|
|
|
+ this.reflectivity = source.reflectivity;
|
|
|
+ this.refractionRatio = source.refractionRatio;
|
|
|
+
|
|
|
+ this.wireframe = source.wireframe;
|
|
|
+ this.wireframeLinewidth = source.wireframeLinewidth;
|
|
|
+ this.wireframeLinecap = source.wireframeLinecap;
|
|
|
+ this.wireframeLinejoin = source.wireframeLinejoin;
|
|
|
+
|
|
|
+ this.skinning = source.skinning;
|
|
|
+ this.morphTargets = source.morphTargets;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
* @author alteredq / http://alteredqualia.com/
|
|
@@ -14786,7 +14594,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
|
|
|
var clearColor = new Color( 0x000000 );
|
|
|
var clearAlpha = 0;
|
|
|
|
|
|
- var planeCamera, planeMesh;
|
|
|
+ var planeMesh;
|
|
|
var boxMesh;
|
|
|
|
|
|
function render( renderList, scene, camera, forceClear ) {
|
|
@@ -14817,7 +14625,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
|
|
|
boxMesh = new Mesh(
|
|
|
new BoxBufferGeometry( 1, 1, 1 ),
|
|
|
new ShaderMaterial( {
|
|
|
- uniforms: ShaderLib.cube.uniforms,
|
|
|
+ uniforms: UniformsUtils.clone( ShaderLib.cube.uniforms ),
|
|
|
vertexShader: ShaderLib.cube.vertexShader,
|
|
|
fragmentShader: ShaderLib.cube.fragmentShader,
|
|
|
side: BackSide,
|
|
@@ -14846,24 +14654,30 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
|
|
|
|
|
|
} else if ( background && background.isTexture ) {
|
|
|
|
|
|
- if ( planeCamera === undefined ) {
|
|
|
-
|
|
|
- planeCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
|
|
|
+ if ( planeMesh === undefined ) {
|
|
|
|
|
|
planeMesh = new Mesh(
|
|
|
new PlaneBufferGeometry( 2, 2 ),
|
|
|
- new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } )
|
|
|
+ new ShaderMaterial( {
|
|
|
+ uniforms: UniformsUtils.clone( ShaderLib.background.uniforms ),
|
|
|
+ vertexShader: ShaderLib.background.vertexShader,
|
|
|
+ fragmentShader: ShaderLib.background.fragmentShader,
|
|
|
+ side: FrontSide,
|
|
|
+ depthTest: true,
|
|
|
+ depthWrite: false,
|
|
|
+ fog: false
|
|
|
+ } )
|
|
|
);
|
|
|
|
|
|
+ planeMesh.geometry.removeAttribute( 'normal' );
|
|
|
+
|
|
|
objects.update( planeMesh );
|
|
|
|
|
|
}
|
|
|
|
|
|
- planeMesh.material.map = background;
|
|
|
+ planeMesh.material.uniforms.t2D.value = background;
|
|
|
|
|
|
- // TODO Push this to renderList
|
|
|
-
|
|
|
- renderer.renderBufferDirect( planeCamera, null, planeMesh.geometry, planeMesh.material, planeMesh, null );
|
|
|
+ renderList.push( planeMesh, planeMesh.geometry, planeMesh.material, 0, null );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -15820,14 +15634,22 @@ Object.defineProperty( CubeTexture.prototype, 'images', {
|
|
|
* @author Artur Trzesiok
|
|
|
*/
|
|
|
|
|
|
-function Texture3D( data, width, height, depth, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
|
|
|
+function Texture3D( data, width, height, depth ) {
|
|
|
|
|
|
- Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
|
|
|
+ // We're going to add .setXXX() methods for setting properties later.
|
|
|
+ // Users can still set in Texture3D directly.
|
|
|
+ //
|
|
|
+ // var texture = new THREE.Texture3D( data, width, height, depth );
|
|
|
+ // texture.anisotropy = 16;
|
|
|
+ //
|
|
|
+ // See #14839
|
|
|
+
|
|
|
+ Texture.call( this, null );
|
|
|
|
|
|
this.image = { data: data, width: width, height: height, depth: depth };
|
|
|
|
|
|
- this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
|
|
|
- this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
|
|
|
+ this.magFilter = NearestFilter;
|
|
|
+ this.minFilter = NearestFilter;
|
|
|
|
|
|
this.generateMipmaps = false;
|
|
|
this.flipY = false;
|
|
@@ -21107,6 +20929,77 @@ Group.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
} );
|
|
|
|
|
|
+/**
|
|
|
+ * @author mrdoob / http://mrdoob.com/
|
|
|
+ * @author mikael emtinger / http://gomo.se/
|
|
|
+ * @author WestLangley / http://github.com/WestLangley
|
|
|
+*/
|
|
|
+
|
|
|
+function Camera() {
|
|
|
+
|
|
|
+ Object3D.call( this );
|
|
|
+
|
|
|
+ this.type = 'Camera';
|
|
|
+
|
|
|
+ this.matrixWorldInverse = new Matrix4();
|
|
|
+
|
|
|
+ this.projectionMatrix = new Matrix4();
|
|
|
+ this.projectionMatrixInverse = new Matrix4();
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+Camera.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
+
|
|
|
+ constructor: Camera,
|
|
|
+
|
|
|
+ isCamera: true,
|
|
|
+
|
|
|
+ copy: function ( source, recursive ) {
|
|
|
+
|
|
|
+ Object3D.prototype.copy.call( this, source, recursive );
|
|
|
+
|
|
|
+ this.matrixWorldInverse.copy( source.matrixWorldInverse );
|
|
|
+
|
|
|
+ this.projectionMatrix.copy( source.projectionMatrix );
|
|
|
+ this.projectionMatrixInverse.copy( source.projectionMatrixInverse );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ getWorldDirection: function ( target ) {
|
|
|
+
|
|
|
+ if ( target === undefined ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.Camera: .getWorldDirection() target is now required' );
|
|
|
+ target = new Vector3();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.updateMatrixWorld( true );
|
|
|
+
|
|
|
+ var e = this.matrixWorld.elements;
|
|
|
+
|
|
|
+ return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ updateMatrixWorld: function ( force ) {
|
|
|
+
|
|
|
+ Object3D.prototype.updateMatrixWorld.call( this, force );
|
|
|
+
|
|
|
+ this.matrixWorldInverse.getInverse( this.matrixWorld );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ clone: function () {
|
|
|
+
|
|
|
+ return new this.constructor().copy( this );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+} );
|
|
|
+
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
* @author greggman / http://games.greggman.com/
|
|
@@ -31880,7 +31773,7 @@ MeshMatcapMaterial.prototype.copy = function ( source ) {
|
|
|
|
|
|
this.color.copy( source.color );
|
|
|
|
|
|
- this.matcap = source.map;
|
|
|
+ this.matcap = source.matcap;
|
|
|
|
|
|
this.map = source.map;
|
|
|
|
|
@@ -35195,6 +35088,148 @@ PointLight.prototype = Object.assign( Object.create( Light.prototype ), {
|
|
|
|
|
|
} );
|
|
|
|
|
|
+/**
|
|
|
+ * @author alteredq / http://alteredqualia.com/
|
|
|
+ * @author arose / http://github.com/arose
|
|
|
+ */
|
|
|
+
|
|
|
+function OrthographicCamera( left, right, top, bottom, near, far ) {
|
|
|
+
|
|
|
+ Camera.call( this );
|
|
|
+
|
|
|
+ this.type = 'OrthographicCamera';
|
|
|
+
|
|
|
+ this.zoom = 1;
|
|
|
+ this.view = null;
|
|
|
+
|
|
|
+ this.left = left;
|
|
|
+ this.right = right;
|
|
|
+ this.top = top;
|
|
|
+ this.bottom = bottom;
|
|
|
+
|
|
|
+ this.near = ( near !== undefined ) ? near : 0.1;
|
|
|
+ this.far = ( far !== undefined ) ? far : 2000;
|
|
|
+
|
|
|
+ this.updateProjectionMatrix();
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), {
|
|
|
+
|
|
|
+ constructor: OrthographicCamera,
|
|
|
+
|
|
|
+ isOrthographicCamera: true,
|
|
|
+
|
|
|
+ copy: function ( source, recursive ) {
|
|
|
+
|
|
|
+ Camera.prototype.copy.call( this, source, recursive );
|
|
|
+
|
|
|
+ this.left = source.left;
|
|
|
+ this.right = source.right;
|
|
|
+ this.top = source.top;
|
|
|
+ this.bottom = source.bottom;
|
|
|
+ this.near = source.near;
|
|
|
+ this.far = source.far;
|
|
|
+
|
|
|
+ this.zoom = source.zoom;
|
|
|
+ this.view = source.view === null ? null : Object.assign( {}, source.view );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) {
|
|
|
+
|
|
|
+ if ( this.view === null ) {
|
|
|
+
|
|
|
+ this.view = {
|
|
|
+ enabled: true,
|
|
|
+ fullWidth: 1,
|
|
|
+ fullHeight: 1,
|
|
|
+ offsetX: 0,
|
|
|
+ offsetY: 0,
|
|
|
+ width: 1,
|
|
|
+ height: 1
|
|
|
+ };
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.view.enabled = true;
|
|
|
+ this.view.fullWidth = fullWidth;
|
|
|
+ this.view.fullHeight = fullHeight;
|
|
|
+ this.view.offsetX = x;
|
|
|
+ this.view.offsetY = y;
|
|
|
+ this.view.width = width;
|
|
|
+ this.view.height = height;
|
|
|
+
|
|
|
+ this.updateProjectionMatrix();
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ clearViewOffset: function () {
|
|
|
+
|
|
|
+ if ( this.view !== null ) {
|
|
|
+
|
|
|
+ this.view.enabled = false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.updateProjectionMatrix();
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ updateProjectionMatrix: function () {
|
|
|
+
|
|
|
+ var dx = ( this.right - this.left ) / ( 2 * this.zoom );
|
|
|
+ var dy = ( this.top - this.bottom ) / ( 2 * this.zoom );
|
|
|
+ var cx = ( this.right + this.left ) / 2;
|
|
|
+ var cy = ( this.top + this.bottom ) / 2;
|
|
|
+
|
|
|
+ var left = cx - dx;
|
|
|
+ var right = cx + dx;
|
|
|
+ var top = cy + dy;
|
|
|
+ var bottom = cy - dy;
|
|
|
+
|
|
|
+ if ( this.view !== null && this.view.enabled ) {
|
|
|
+
|
|
|
+ var zoomW = this.zoom / ( this.view.width / this.view.fullWidth );
|
|
|
+ var zoomH = this.zoom / ( this.view.height / this.view.fullHeight );
|
|
|
+ var scaleW = ( this.right - this.left ) / this.view.width;
|
|
|
+ var scaleH = ( this.top - this.bottom ) / this.view.height;
|
|
|
+
|
|
|
+ left += scaleW * ( this.view.offsetX / zoomW );
|
|
|
+ right = left + scaleW * ( this.view.width / zoomW );
|
|
|
+ top -= scaleH * ( this.view.offsetY / zoomH );
|
|
|
+ bottom = top - scaleH * ( this.view.height / zoomH );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far );
|
|
|
+
|
|
|
+ this.projectionMatrixInverse.getInverse( this.projectionMatrix );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ toJSON: function ( meta ) {
|
|
|
+
|
|
|
+ var data = Object3D.prototype.toJSON.call( this, meta );
|
|
|
+
|
|
|
+ data.object.zoom = this.zoom;
|
|
|
+ data.object.left = this.left;
|
|
|
+ data.object.right = this.right;
|
|
|
+ data.object.top = this.top;
|
|
|
+ data.object.bottom = this.bottom;
|
|
|
+ data.object.near = this.near;
|
|
|
+ data.object.far = this.far;
|
|
|
+
|
|
|
+ if ( this.view !== null ) data.object.view = Object.assign( {}, this.view );
|
|
|
+
|
|
|
+ return data;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+} );
|
|
|
+
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
*/
|
|
@@ -37127,6 +37162,7 @@ Object.assign( MaterialLoader.prototype, {
|
|
|
if ( json.fog !== undefined ) material.fog = json.fog;
|
|
|
if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
|
|
|
if ( json.blending !== undefined ) material.blending = json.blending;
|
|
|
+ if ( json.combine !== undefined ) material.combine = json.combine;
|
|
|
if ( json.side !== undefined ) material.side = json.side;
|
|
|
if ( json.opacity !== undefined ) material.opacity = json.opacity;
|
|
|
if ( json.transparent !== undefined ) material.transparent = json.transparent;
|
|
@@ -37260,6 +37296,7 @@ Object.assign( MaterialLoader.prototype, {
|
|
|
if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
|
|
|
|
|
|
if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
|
|
|
+ if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
|
|
|
|
|
|
if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
|
|
|
|