|
@@ -6152,6 +6152,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 +6303,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 +7385,16 @@ var ShaderLib = {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ background: {
|
|
|
+
|
|
|
+ uniforms: {
|
|
|
+ t2D: { value: null },
|
|
|
+ },
|
|
|
+
|
|
|
+ vertexShader: ShaderChunk.background_vert,
|
|
|
+ fragmentShader: ShaderChunk.background_frag
|
|
|
+
|
|
|
+ },
|
|
|
/* -------------------------------------------------------------------------
|
|
|
// Cube map shader
|
|
|
------------------------------------------------------------------------- */
|
|
@@ -7665,6 +7681,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 +9006,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/
|
|
@@ -13143,120 +12946,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 +14018,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 +14589,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 ) {
|
|
@@ -14846,24 +14649,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: 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 );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -21107,6 +20916,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/
|
|
@@ -22499,13 +22379,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.clearTarget = function ( renderTarget, color, depth, stencil ) {
|
|
|
-
|
|
|
- this.setRenderTarget( renderTarget );
|
|
|
- this.clear( color, depth, stencil );
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
//
|
|
|
|
|
|
this.dispose = function () {
|
|
@@ -35202,6 +35075,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/
|
|
|
*/
|
|
@@ -47002,6 +47017,14 @@ Object.defineProperties( ShaderMaterial.prototype, {
|
|
|
|
|
|
Object.assign( WebGLRenderer.prototype, {
|
|
|
|
|
|
+ clearTarget: function ( renderTarget, color, depth, stencil ) {
|
|
|
+
|
|
|
+ console.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' );
|
|
|
+ this.setRenderTarget( renderTarget );
|
|
|
+ this.clear( color, depth, stencil );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
animate: function ( callback ) {
|
|
|
|
|
|
console.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' );
|