|
@@ -5589,13 +5589,23 @@
|
|
|
|
|
|
},
|
|
|
|
|
|
- setPosition: function ( v ) {
|
|
|
+ setPosition: function ( x, y, z ) {
|
|
|
|
|
|
var te = this.elements;
|
|
|
|
|
|
- te[ 12 ] = v.x;
|
|
|
- te[ 13 ] = v.y;
|
|
|
- te[ 14 ] = v.z;
|
|
|
+ if ( x.isVector3 ) {
|
|
|
+
|
|
|
+ te[ 12 ] = x.x;
|
|
|
+ te[ 13 ] = x.y;
|
|
|
+ te[ 14 ] = x.z;
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ te[ 12 ] = x;
|
|
|
+ te[ 13 ] = y;
|
|
|
+ te[ 14 ] = z;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return this;
|
|
|
|
|
@@ -8586,6 +8596,38 @@
|
|
|
|
|
|
},
|
|
|
|
|
|
+ attach: function () {
|
|
|
+
|
|
|
+ // adds object as a child of this, while maintaining the object's world transform
|
|
|
+
|
|
|
+ var m = new Matrix4();
|
|
|
+
|
|
|
+ return function attach( object ) {
|
|
|
+
|
|
|
+ this.updateWorldMatrix( true, false );
|
|
|
+
|
|
|
+ m.getInverse( this.matrixWorld );
|
|
|
+
|
|
|
+ if ( object.parent !== null ) {
|
|
|
+
|
|
|
+ object.parent.updateWorldMatrix( true, false );
|
|
|
+
|
|
|
+ m.multiply( object.parent.matrixWorld );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ object.applyMatrix( m );
|
|
|
+
|
|
|
+ object.updateWorldMatrix( false, false );
|
|
|
+
|
|
|
+ this.add( object );
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ }(),
|
|
|
+
|
|
|
getObjectById: function ( id ) {
|
|
|
|
|
|
return this.getObjectByProperty( 'id', id );
|
|
@@ -9267,7 +9309,7 @@
|
|
|
|
|
|
if ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = [];
|
|
|
|
|
|
- for ( var i = 0, j = 0; i < positions.length; i += 3, j += 2 ) {
|
|
|
+ for ( var i = 0; i < positions.length; i += 3 ) {
|
|
|
|
|
|
scope.vertices.push( new Vector3().fromArray( positions, i ) );
|
|
|
|
|
@@ -10786,6 +10828,17 @@
|
|
|
|
|
|
return new this.constructor( this.array, this.itemSize ).copy( this );
|
|
|
|
|
|
+ },
|
|
|
+
|
|
|
+ toJSON: function () {
|
|
|
+
|
|
|
+ return {
|
|
|
+ itemSize: this.itemSize,
|
|
|
+ type: this.array.constructor.name,
|
|
|
+ array: Array.prototype.slice.call( this.array ),
|
|
|
+ normalized: this.normalized
|
|
|
+ };
|
|
|
+
|
|
|
}
|
|
|
|
|
|
} );
|
|
@@ -12224,12 +12277,7 @@
|
|
|
|
|
|
var attribute = attributes[ key ];
|
|
|
|
|
|
- var attributeData = {
|
|
|
- itemSize: attribute.itemSize,
|
|
|
- type: attribute.array.constructor.name,
|
|
|
- array: Array.prototype.slice.call( attribute.array ),
|
|
|
- normalized: attribute.normalized
|
|
|
- };
|
|
|
+ var attributeData = attribute.toJSON();
|
|
|
|
|
|
if ( attribute.name !== '' ) attributeData.name = attribute.name;
|
|
|
|
|
@@ -12250,12 +12298,7 @@
|
|
|
|
|
|
var attribute = attributeArray[ i ];
|
|
|
|
|
|
- var attributeData = {
|
|
|
- itemSize: attribute.itemSize,
|
|
|
- type: attribute.array.constructor.name,
|
|
|
- array: Array.prototype.slice.call( attribute.array ),
|
|
|
- normalized: attribute.normalized
|
|
|
- };
|
|
|
+ var attributeData = attribute.toJSON();
|
|
|
|
|
|
if ( attribute.name !== '' ) attributeData.name = attribute.name;
|
|
|
|
|
@@ -16116,7 +16159,7 @@
|
|
|
|
|
|
// Single scalar
|
|
|
|
|
|
- function setValue1f( gl, v ) {
|
|
|
+ function setValueV1f( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
|
|
@@ -16128,21 +16171,9 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValue1i( gl, v ) {
|
|
|
-
|
|
|
- var cache = this.cache;
|
|
|
-
|
|
|
- if ( cache[ 0 ] === v ) return;
|
|
|
-
|
|
|
- gl.uniform1i( this.addr, v );
|
|
|
-
|
|
|
- cache[ 0 ] = v;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
// Single float vector (from flat array or THREE.VectorN)
|
|
|
|
|
|
- function setValue2fv( gl, v ) {
|
|
|
+ function setValueV2f( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
|
|
@@ -16169,7 +16200,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValue3fv( gl, v ) {
|
|
|
+ function setValueV3f( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
|
|
@@ -16209,7 +16240,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValue4fv( gl, v ) {
|
|
|
+ function setValueV4f( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
|
|
@@ -16240,7 +16271,7 @@
|
|
|
|
|
|
// Single matrix (from flat array or MatrixN)
|
|
|
|
|
|
- function setValue2fm( gl, v ) {
|
|
|
+ function setValueM2( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
var elements = v.elements;
|
|
@@ -16267,7 +16298,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValue3fm( gl, v ) {
|
|
|
+ function setValueM3( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
var elements = v.elements;
|
|
@@ -16294,7 +16325,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValue4fm( gl, v ) {
|
|
|
+ function setValueM4( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
var elements = v.elements;
|
|
@@ -16389,7 +16420,19 @@
|
|
|
|
|
|
// Integer / Boolean vectors or arrays thereof (always flat arrays)
|
|
|
|
|
|
- function setValue2iv( gl, v ) {
|
|
|
+ function setValueV1i( gl, v ) {
|
|
|
+
|
|
|
+ var cache = this.cache;
|
|
|
+
|
|
|
+ if ( cache[ 0 ] === v ) return;
|
|
|
+
|
|
|
+ gl.uniform1i( this.addr, v );
|
|
|
+
|
|
|
+ cache[ 0 ] = v;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function setValueV2i( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
|
|
@@ -16401,7 +16444,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValue3iv( gl, v ) {
|
|
|
+ function setValueV3i( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
|
|
@@ -16413,7 +16456,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValue4iv( gl, v ) {
|
|
|
+ function setValueV4i( gl, v ) {
|
|
|
|
|
|
var cache = this.cache;
|
|
|
|
|
@@ -16431,151 +16474,123 @@
|
|
|
|
|
|
switch ( type ) {
|
|
|
|
|
|
- case 0x1406: return setValue1f; // FLOAT
|
|
|
- case 0x8b50: return setValue2fv; // _VEC2
|
|
|
- case 0x8b51: return setValue3fv; // _VEC3
|
|
|
- case 0x8b52: return setValue4fv; // _VEC4
|
|
|
+ case 0x1406: return setValueV1f; // FLOAT
|
|
|
+ case 0x8b50: return setValueV2f; // _VEC2
|
|
|
+ case 0x8b51: return setValueV3f; // _VEC3
|
|
|
+ case 0x8b52: return setValueV4f; // _VEC4
|
|
|
|
|
|
- case 0x8b5a: return setValue2fm; // _MAT2
|
|
|
- case 0x8b5b: return setValue3fm; // _MAT3
|
|
|
- case 0x8b5c: return setValue4fm; // _MAT4
|
|
|
+ case 0x8b5a: return setValueM2; // _MAT2
|
|
|
+ case 0x8b5b: return setValueM3; // _MAT3
|
|
|
+ case 0x8b5c: return setValueM4; // _MAT4
|
|
|
|
|
|
case 0x8b5e: case 0x8d66: return setValueT1; // SAMPLER_2D, SAMPLER_EXTERNAL_OES
|
|
|
case 0x8b5f: return setValueT3D1; // SAMPLER_3D
|
|
|
case 0x8b60: return setValueT6; // SAMPLER_CUBE
|
|
|
case 0x8DC1: return setValueT2DArray1; // SAMPLER_2D_ARRAY
|
|
|
|
|
|
- case 0x1404: case 0x8b56: return setValue1i; // INT, BOOL
|
|
|
- case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2
|
|
|
- case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3
|
|
|
- case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4
|
|
|
+ case 0x1404: case 0x8b56: return setValueV1i; // INT, BOOL
|
|
|
+ case 0x8b53: case 0x8b57: return setValueV2i; // _VEC2
|
|
|
+ case 0x8b54: case 0x8b58: return setValueV3i; // _VEC3
|
|
|
+ case 0x8b55: case 0x8b59: return setValueV4i; // _VEC4
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// Array of scalars
|
|
|
+ function setValueV1fArray( gl, v ) {
|
|
|
|
|
|
- function setValue1fv( gl, v ) {
|
|
|
+ gl.uniform1fv( this.addr, v );
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
+ }
|
|
|
|
|
|
- if ( arraysEqual( cache, v ) ) return;
|
|
|
+ // Integer / Boolean vectors or arrays thereof (always flat arrays)
|
|
|
+ function setValueV1iArray( gl, v ) {
|
|
|
|
|
|
- gl.uniform1fv( this.addr, v );
|
|
|
+ gl.uniform1iv( this.addr, v );
|
|
|
|
|
|
- copyArray( cache, v );
|
|
|
+ }
|
|
|
+
|
|
|
+ function setValueV2iArray( gl, v ) {
|
|
|
+
|
|
|
+ gl.uniform2iv( this.addr, v );
|
|
|
|
|
|
}
|
|
|
- function setValue1iv( gl, v ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
+ function setValueV3iArray( gl, v ) {
|
|
|
|
|
|
- if ( arraysEqual( cache, v ) ) return;
|
|
|
+ gl.uniform3iv( this.addr, v );
|
|
|
|
|
|
- gl.uniform1iv( this.addr, v );
|
|
|
+ }
|
|
|
|
|
|
- copyArray( cache, v );
|
|
|
+ function setValueV4iArray( gl, v ) {
|
|
|
+
|
|
|
+ gl.uniform4iv( this.addr, v );
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// Array of vectors (flat or from THREE classes)
|
|
|
|
|
|
- function setValueV2a( gl, v ) {
|
|
|
+ function setValueV2fArray( gl, v ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var data = flatten( v, this.size, 2 );
|
|
|
|
|
|
- if ( arraysEqual( cache, data ) ) return;
|
|
|
-
|
|
|
gl.uniform2fv( this.addr, data );
|
|
|
|
|
|
- this.updateCache( data );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- function setValueV3a( gl, v ) {
|
|
|
+ function setValueV3fArray( gl, v ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var data = flatten( v, this.size, 3 );
|
|
|
|
|
|
- if ( arraysEqual( cache, data ) ) return;
|
|
|
-
|
|
|
gl.uniform3fv( this.addr, data );
|
|
|
|
|
|
- this.updateCache( data );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- function setValueV4a( gl, v ) {
|
|
|
+ function setValueV4fArray( gl, v ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var data = flatten( v, this.size, 4 );
|
|
|
|
|
|
- if ( arraysEqual( cache, data ) ) return;
|
|
|
-
|
|
|
gl.uniform4fv( this.addr, data );
|
|
|
|
|
|
- this.updateCache( data );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// Array of matrices (flat or from THREE clases)
|
|
|
|
|
|
- function setValueM2a( gl, v ) {
|
|
|
+ function setValueM2Array( gl, v ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var data = flatten( v, this.size, 4 );
|
|
|
|
|
|
- if ( arraysEqual( cache, data ) ) return;
|
|
|
-
|
|
|
gl.uniformMatrix2fv( this.addr, false, data );
|
|
|
|
|
|
- this.updateCache( data );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- function setValueM3a( gl, v ) {
|
|
|
+ function setValueM3Array( gl, v ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var data = flatten( v, this.size, 9 );
|
|
|
|
|
|
- if ( arraysEqual( cache, data ) ) return;
|
|
|
-
|
|
|
gl.uniformMatrix3fv( this.addr, false, data );
|
|
|
|
|
|
- this.updateCache( data );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- function setValueM4a( gl, v ) {
|
|
|
+ function setValueM4Array( gl, v ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var data = flatten( v, this.size, 16 );
|
|
|
|
|
|
- if ( arraysEqual( cache, data ) ) return;
|
|
|
-
|
|
|
gl.uniformMatrix4fv( this.addr, false, data );
|
|
|
|
|
|
- this.updateCache( data );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
// Array of textures (2D / Cube)
|
|
|
|
|
|
- function setValueT1a( gl, v, textures ) {
|
|
|
+ function setValueT1Array( gl, v, textures ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var n = v.length;
|
|
|
|
|
|
var units = allocTexUnits( textures, n );
|
|
|
|
|
|
- if ( arraysEqual( cache, units ) === false ) {
|
|
|
-
|
|
|
- gl.uniform1iv( this.addr, units );
|
|
|
- copyArray( cache, units );
|
|
|
-
|
|
|
- }
|
|
|
+ gl.uniform1iv( this.addr, units );
|
|
|
|
|
|
for ( var i = 0; i !== n; ++ i ) {
|
|
|
|
|
@@ -16585,19 +16600,13 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setValueT6a( gl, v, textures ) {
|
|
|
+ function setValueT6Array( gl, v, textures ) {
|
|
|
|
|
|
- var cache = this.cache;
|
|
|
var n = v.length;
|
|
|
|
|
|
var units = allocTexUnits( textures, n );
|
|
|
|
|
|
- if ( arraysEqual( cache, units ) === false ) {
|
|
|
-
|
|
|
- gl.uniform1iv( this.addr, units );
|
|
|
- copyArray( cache, units );
|
|
|
-
|
|
|
- }
|
|
|
+ gl.uniform1iv( this.addr, units );
|
|
|
|
|
|
for ( var i = 0; i !== n; ++ i ) {
|
|
|
|
|
@@ -16613,22 +16622,22 @@
|
|
|
|
|
|
switch ( type ) {
|
|
|
|
|
|
- case 0x1406: return setValue1fv; // FLOAT
|
|
|
- case 0x8b50: return setValueV2a; // _VEC2
|
|
|
- case 0x8b51: return setValueV3a; // _VEC3
|
|
|
- case 0x8b52: return setValueV4a; // _VEC4
|
|
|
+ case 0x1406: return setValueV1fArray; // FLOAT
|
|
|
+ case 0x8b50: return setValueV2fArray; // _VEC2
|
|
|
+ case 0x8b51: return setValueV3fArray; // _VEC3
|
|
|
+ case 0x8b52: return setValueV4fArray; // _VEC4
|
|
|
|
|
|
- case 0x8b5a: return setValueM2a; // _MAT2
|
|
|
- case 0x8b5b: return setValueM3a; // _MAT3
|
|
|
- case 0x8b5c: return setValueM4a; // _MAT4
|
|
|
+ case 0x8b5a: return setValueM2Array; // _MAT2
|
|
|
+ case 0x8b5b: return setValueM3Array; // _MAT3
|
|
|
+ case 0x8b5c: return setValueM4Array; // _MAT4
|
|
|
|
|
|
- case 0x8b5e: return setValueT1a; // SAMPLER_2D
|
|
|
- case 0x8b60: return setValueT6a; // SAMPLER_CUBE
|
|
|
+ case 0x8b5e: return setValueT1Array; // SAMPLER_2D
|
|
|
+ case 0x8b60: return setValueT6Array; // SAMPLER_CUBE
|
|
|
|
|
|
- case 0x1404: case 0x8b56: return setValue1iv; // INT, BOOL
|
|
|
- case 0x8b53: case 0x8b57: return setValue2iv; // _VEC2
|
|
|
- case 0x8b54: case 0x8b58: return setValue3iv; // _VEC3
|
|
|
- case 0x8b55: case 0x8b59: return setValue4iv; // _VEC4
|
|
|
+ case 0x1404: case 0x8b56: return setValueV1iArray; // INT, BOOL
|
|
|
+ case 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2
|
|
|
+ case 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3
|
|
|
+ case 0x8b55: case 0x8b59: return setValueV4iArray; // _VEC4
|
|
|
|
|
|
}
|
|
|
|
|
@@ -22109,6 +22118,8 @@
|
|
|
|
|
|
var buttonId = gamepad.id === 'Daydream Controller' ? 0 : 1;
|
|
|
|
|
|
+ if ( triggers[ i ] === undefined ) triggers[ i ] = false;
|
|
|
+
|
|
|
if ( triggers[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
|
|
|
|
|
|
triggers[ i ] = gamepad.buttons[ buttonId ].pressed;
|
|
@@ -22691,7 +22702,8 @@
|
|
|
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
|
|
|
_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,
|
|
|
_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,
|
|
|
- _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default';
|
|
|
+ _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default',
|
|
|
+ _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false;
|
|
|
|
|
|
var currentRenderList = null;
|
|
|
var currentRenderState = null;
|
|
@@ -22823,7 +22835,8 @@
|
|
|
antialias: _antialias,
|
|
|
premultipliedAlpha: _premultipliedAlpha,
|
|
|
preserveDrawingBuffer: _preserveDrawingBuffer,
|
|
|
- powerPreference: _powerPreference
|
|
|
+ powerPreference: _powerPreference,
|
|
|
+ failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
|
|
|
};
|
|
|
|
|
|
// event listeners must be registered before WebGL context is created, see #12753
|
|
@@ -22932,7 +22945,7 @@
|
|
|
|
|
|
// vr
|
|
|
|
|
|
- var vr = ( typeof navigator !== 'undefined' && 'xr' in navigator ) ? new WebXRManager( _this ) : new WebVRManager( _this );
|
|
|
+ var vr = ( typeof navigator !== 'undefined' && 'xr' in navigator && 'requestDevice' in navigator.xr ) ? new WebXRManager( _this ) : new WebVRManager( _this );
|
|
|
|
|
|
this.vr = vr;
|
|
|
|
|
@@ -25110,7 +25123,7 @@
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer ) {
|
|
|
+ this.readRenderTargetPixels = function ( renderTarget, x, y, width, height, buffer, activeCubeFaceIndex ) {
|
|
|
|
|
|
if ( ! ( renderTarget && renderTarget.isWebGLRenderTarget ) ) {
|
|
|
|
|
@@ -25121,6 +25134,12 @@
|
|
|
|
|
|
var framebuffer = properties.get( renderTarget ).__webglFramebuffer;
|
|
|
|
|
|
+ if ( renderTarget.isWebGLRenderTargetCube && activeCubeFaceIndex !== undefined ) {
|
|
|
+
|
|
|
+ framebuffer = framebuffer[ activeCubeFaceIndex ];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
if ( framebuffer ) {
|
|
|
|
|
|
var restore = false;
|
|
@@ -30333,7 +30352,7 @@
|
|
|
thetaStart = thetaStart !== undefined ? thetaStart : 0;
|
|
|
thetaLength = thetaLength !== undefined ? thetaLength : Math.PI;
|
|
|
|
|
|
- var thetaEnd = thetaStart + thetaLength;
|
|
|
+ var thetaEnd = Math.min( thetaStart + thetaLength, Math.PI );
|
|
|
|
|
|
var ix, iy;
|
|
|
|
|
@@ -30360,7 +30379,17 @@
|
|
|
|
|
|
// special case for the poles
|
|
|
|
|
|
- var uOffset = ( iy == 0 ) ? 0.5 / widthSegments : ( ( iy == heightSegments ) ? - 0.5 / widthSegments : 0 );
|
|
|
+ var uOffset = 0;
|
|
|
+
|
|
|
+ if ( iy == 0 && thetaStart == 0 ) {
|
|
|
+
|
|
|
+ uOffset = 0.5 / widthSegments;
|
|
|
+
|
|
|
+ } else if ( iy == heightSegments && thetaEnd == Math.PI ) {
|
|
|
+
|
|
|
+ uOffset = - 0.5 / widthSegments;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
for ( ix = 0; ix <= widthSegments; ix ++ ) {
|
|
|
|
|
@@ -38051,6 +38080,107 @@
|
|
|
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * @author benaadams / https://twitter.com/ben_a_adams
|
|
|
+ */
|
|
|
+
|
|
|
+ function InstancedBufferGeometry() {
|
|
|
+
|
|
|
+ BufferGeometry.call( this );
|
|
|
+
|
|
|
+ this.type = 'InstancedBufferGeometry';
|
|
|
+ this.maxInstancedCount = undefined;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), {
|
|
|
+
|
|
|
+ constructor: InstancedBufferGeometry,
|
|
|
+
|
|
|
+ isInstancedBufferGeometry: true,
|
|
|
+
|
|
|
+ copy: function ( source ) {
|
|
|
+
|
|
|
+ BufferGeometry.prototype.copy.call( this, source );
|
|
|
+
|
|
|
+ this.maxInstancedCount = source.maxInstancedCount;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ clone: function () {
|
|
|
+
|
|
|
+ return new this.constructor().copy( this );
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ toJSON: function () {
|
|
|
+
|
|
|
+ var data = BufferGeometry.prototype.toJSON.call( this );
|
|
|
+
|
|
|
+ data.maxInstancedCount = this.maxInstancedCount;
|
|
|
+
|
|
|
+ data.isInstancedBufferGeometry = true;
|
|
|
+
|
|
|
+ return data;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } );
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @author benaadams / https://twitter.com/ben_a_adams
|
|
|
+ */
|
|
|
+
|
|
|
+ function InstancedBufferAttribute( array, itemSize, normalized, meshPerAttribute ) {
|
|
|
+
|
|
|
+ if ( typeof ( normalized ) === 'number' ) {
|
|
|
+
|
|
|
+ meshPerAttribute = normalized;
|
|
|
+
|
|
|
+ normalized = false;
|
|
|
+
|
|
|
+ console.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ BufferAttribute.call( this, array, itemSize, normalized );
|
|
|
+
|
|
|
+ this.meshPerAttribute = meshPerAttribute || 1;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribute.prototype ), {
|
|
|
+
|
|
|
+ constructor: InstancedBufferAttribute,
|
|
|
+
|
|
|
+ isInstancedBufferAttribute: true,
|
|
|
+
|
|
|
+ copy: function ( source ) {
|
|
|
+
|
|
|
+ BufferAttribute.prototype.copy.call( this, source );
|
|
|
+
|
|
|
+ this.meshPerAttribute = source.meshPerAttribute;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ toJSON: function () {
|
|
|
+
|
|
|
+ var data = BufferAttribute.prototype.toJSON.call( this );
|
|
|
+
|
|
|
+ data.meshPerAttribute = this.meshPerAttribute;
|
|
|
+
|
|
|
+ data.isInstancedBufferAttribute = true;
|
|
|
+
|
|
|
+ return data;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } );
|
|
|
+
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
*/
|
|
@@ -38079,7 +38209,7 @@
|
|
|
|
|
|
parse: function ( json ) {
|
|
|
|
|
|
- var geometry = new BufferGeometry();
|
|
|
+ var geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();
|
|
|
|
|
|
var index = json.data.index;
|
|
|
|
|
@@ -38096,8 +38226,8 @@
|
|
|
|
|
|
var attribute = attributes[ key ];
|
|
|
var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array );
|
|
|
-
|
|
|
- var bufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );
|
|
|
+ var bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;
|
|
|
+ var bufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );
|
|
|
if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
|
|
|
geometry.addAttribute( key, bufferAttribute );
|
|
|
|
|
@@ -38565,6 +38695,7 @@
|
|
|
break;
|
|
|
|
|
|
case 'BufferGeometry':
|
|
|
+ case 'InstancedBufferGeometry':
|
|
|
|
|
|
geometry = bufferGeometryLoader.parse( data );
|
|
|
|
|
@@ -44199,43 +44330,6 @@
|
|
|
|
|
|
};
|
|
|
|
|
|
- /**
|
|
|
- * @author benaadams / https://twitter.com/ben_a_adams
|
|
|
- */
|
|
|
-
|
|
|
- function InstancedBufferGeometry() {
|
|
|
-
|
|
|
- BufferGeometry.call( this );
|
|
|
-
|
|
|
- this.type = 'InstancedBufferGeometry';
|
|
|
- this.maxInstancedCount = undefined;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- InstancedBufferGeometry.prototype = Object.assign( Object.create( BufferGeometry.prototype ), {
|
|
|
-
|
|
|
- constructor: InstancedBufferGeometry,
|
|
|
-
|
|
|
- isInstancedBufferGeometry: true,
|
|
|
-
|
|
|
- copy: function ( source ) {
|
|
|
-
|
|
|
- BufferGeometry.prototype.copy.call( this, source );
|
|
|
-
|
|
|
- this.maxInstancedCount = source.maxInstancedCount;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- clone: function () {
|
|
|
-
|
|
|
- return new this.constructor().copy( this );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } );
|
|
|
-
|
|
|
/**
|
|
|
* @author benaadams / https://twitter.com/ben_a_adams
|
|
|
*/
|
|
@@ -44266,46 +44360,6 @@
|
|
|
|
|
|
} );
|
|
|
|
|
|
- /**
|
|
|
- * @author benaadams / https://twitter.com/ben_a_adams
|
|
|
- */
|
|
|
-
|
|
|
- function InstancedBufferAttribute( array, itemSize, normalized, meshPerAttribute ) {
|
|
|
-
|
|
|
- if ( typeof ( normalized ) === 'number' ) {
|
|
|
-
|
|
|
- meshPerAttribute = normalized;
|
|
|
-
|
|
|
- normalized = false;
|
|
|
-
|
|
|
- console.error( 'THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.' );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- BufferAttribute.call( this, array, itemSize, normalized );
|
|
|
-
|
|
|
- this.meshPerAttribute = meshPerAttribute || 1;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- InstancedBufferAttribute.prototype = Object.assign( Object.create( BufferAttribute.prototype ), {
|
|
|
-
|
|
|
- constructor: InstancedBufferAttribute,
|
|
|
-
|
|
|
- isInstancedBufferAttribute: true,
|
|
|
-
|
|
|
- copy: function ( source ) {
|
|
|
-
|
|
|
- BufferAttribute.prototype.copy.call( this, source );
|
|
|
-
|
|
|
- this.meshPerAttribute = source.meshPerAttribute;
|
|
|
-
|
|
|
- return this;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- } );
|
|
|
-
|
|
|
/**
|
|
|
* @author mrdoob / http://mrdoob.com/
|
|
|
* @author bhouston / http://clara.io/
|
|
@@ -48573,34 +48627,6 @@
|
|
|
|
|
|
//
|
|
|
|
|
|
- function Projector() {
|
|
|
-
|
|
|
- console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );
|
|
|
-
|
|
|
- this.projectVector = function ( vector, camera ) {
|
|
|
-
|
|
|
- console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );
|
|
|
- vector.project( camera );
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- this.unprojectVector = function ( vector, camera ) {
|
|
|
-
|
|
|
- console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );
|
|
|
- vector.unproject( camera );
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- this.pickingRay = function () {
|
|
|
-
|
|
|
- console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //
|
|
|
-
|
|
|
function CanvasRenderer() {
|
|
|
|
|
|
console.error( 'THREE.CanvasRenderer has been removed' );
|
|
@@ -49056,7 +49082,6 @@
|
|
|
exports.XHRLoader = XHRLoader;
|
|
|
exports.BinaryTextureLoader = BinaryTextureLoader;
|
|
|
exports.GeometryUtils = GeometryUtils;
|
|
|
- exports.Projector = Projector;
|
|
|
exports.CanvasRenderer = CanvasRenderer;
|
|
|
exports.JSONLoader = JSONLoader;
|
|
|
exports.SceneUtils = SceneUtils;
|