|
@@ -319,19 +319,27 @@ var _Math = {
|
|
|
|
|
|
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
|
|
|
|
|
|
- var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16).toUpperCase(); }
|
|
|
+ var lut = [];
|
|
|
+
|
|
|
+ for ( var i = 0; i < 256; i ++ ) {
|
|
|
+
|
|
|
+ lut[ i ] = ( i < 16 ? '0' : '' ) + ( i ).toString( 16 ).toUpperCase();
|
|
|
|
|
|
- return function () {
|
|
|
- var d0 = Math.random()*0xffffffff|0;
|
|
|
- var d1 = Math.random()*0xffffffff|0;
|
|
|
- var d2 = Math.random()*0xffffffff|0;
|
|
|
- var d3 = Math.random()*0xffffffff|0;
|
|
|
- return lut[d0&0xff]+lut[d0>>8&0xff]+lut[d0>>16&0xff]+lut[d0>>24&0xff]+'-'+
|
|
|
- lut[d1&0xff]+lut[d1>>8&0xff]+'-'+lut[d1>>16&0x0f|0x40]+lut[d1>>24&0xff]+'-'+
|
|
|
- lut[d2&0x3f|0x80]+lut[d2>>8&0xff]+'-'+lut[d2>>16&0xff]+lut[d2>>24&0xff]+
|
|
|
- lut[d3&0xff]+lut[d3>>8&0xff]+lut[d3>>16&0xff]+lut[d3>>24&0xff];
|
|
|
}
|
|
|
|
|
|
+ return function () {
|
|
|
+
|
|
|
+ var d0 = Math.random() * 0xffffffff | 0;
|
|
|
+ var d1 = Math.random() * 0xffffffff | 0;
|
|
|
+ var d2 = Math.random() * 0xffffffff | 0;
|
|
|
+ var d3 = Math.random() * 0xffffffff | 0;
|
|
|
+ return lut[ d0 & 0xff ] + lut[ d0 >> 8 & 0xff ] + lut[ d0 >> 16 & 0xff ] + lut[ d0 >> 24 & 0xff ] + '-' +
|
|
|
+ lut[ d1 & 0xff ] + lut[ d1 >> 8 & 0xff ] + '-' + lut[ d1 >> 16 & 0x0f | 0x40 ] + lut[ d1 >> 24 & 0xff ] + '-' +
|
|
|
+ lut[ d2 & 0x3f | 0x80 ] + lut[ d2 >> 8 & 0xff ] + '-' + lut[ d2 >> 16 & 0xff ] + lut[ d2 >> 24 & 0xff ] +
|
|
|
+ lut[ d3 & 0xff ] + lut[ d3 >> 8 & 0xff ] + lut[ d3 >> 16 & 0xff ] + lut[ d3 >> 24 & 0xff ];
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
} )(),
|
|
|
|
|
|
clamp: function ( value, min, max ) {
|
|
@@ -18429,6 +18437,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
|
|
|
function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, infoMemory ) {
|
|
|
|
|
|
var _isWebGL2 = ( typeof WebGL2RenderingContext !== 'undefined' && _gl instanceof window.WebGL2RenderingContext );
|
|
|
+ var _videoTextures = {};
|
|
|
|
|
|
//
|
|
|
|
|
@@ -18523,8 +18532,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
deallocateTexture( texture );
|
|
|
|
|
|
- infoMemory.textures --;
|
|
|
+ if ( texture.isVideoTexture ) {
|
|
|
+
|
|
|
+ delete _videoTextures[ texture.id ];
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ infoMemory.textures --;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -18826,6 +18840,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
textureProperties.__webglTexture = _gl.createTexture();
|
|
|
|
|
|
+ if ( texture.isVideoTexture ) {
|
|
|
+
|
|
|
+ _videoTextures[ texture.id ] = texture;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
infoMemory.textures ++;
|
|
|
|
|
|
}
|
|
@@ -19207,11 +19227,22 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function updateVideoTextures() {
|
|
|
+
|
|
|
+ for ( var id in _videoTextures ) {
|
|
|
+
|
|
|
+ _videoTextures[ id ].update();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
this.setTexture2D = setTexture2D;
|
|
|
this.setTextureCube = setTextureCube;
|
|
|
this.setTextureCubeDynamic = setTextureCubeDynamic;
|
|
|
this.setupRenderTarget = setupRenderTarget;
|
|
|
this.updateRenderTargetMipmap = updateRenderTargetMipmap;
|
|
|
+ this.updateVideoTextures = updateVideoTextures;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -19904,13 +19935,16 @@ function WebGLState( gl, extensions, utils ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- function setMaterial( material ) {
|
|
|
+ function setMaterial( material, frontFaceCW ) {
|
|
|
|
|
|
material.side === DoubleSide
|
|
|
? disable( gl.CULL_FACE )
|
|
|
: enable( gl.CULL_FACE );
|
|
|
|
|
|
- setFlipSided( material.side === BackSide );
|
|
|
+ var flipSided = ( material.side === BackSide );
|
|
|
+ if ( frontFaceCW ) flipSided = ! flipSided;
|
|
|
+
|
|
|
+ setFlipSided( flipSided );
|
|
|
|
|
|
material.transparent === true
|
|
|
? setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha )
|
|
@@ -20668,17 +20702,7 @@ function WebVRManager( renderer ) {
|
|
|
//
|
|
|
|
|
|
var pose = frameData.pose;
|
|
|
- var poseObject;
|
|
|
-
|
|
|
- if ( poseTarget !== null ) {
|
|
|
-
|
|
|
- poseObject = poseTarget;
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- poseObject = camera;
|
|
|
-
|
|
|
- }
|
|
|
+ var poseObject = poseTarget !== null ? poseTarget : camera;
|
|
|
|
|
|
if ( pose.position !== null ) {
|
|
|
|
|
@@ -20714,7 +20738,7 @@ function WebVRManager( renderer ) {
|
|
|
cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
|
|
|
cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
|
|
|
|
|
|
- var parent = camera.parent;
|
|
|
+ var parent = poseObject.parent;
|
|
|
|
|
|
if ( parent !== null ) {
|
|
|
|
|
@@ -21162,7 +21186,8 @@ function WebGLRenderer( parameters ) {
|
|
|
_stencil = parameters.stencil !== undefined ? parameters.stencil : true,
|
|
|
_antialias = parameters.antialias !== undefined ? parameters.antialias : false,
|
|
|
_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,
|
|
|
- _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false;
|
|
|
+ _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,
|
|
|
+ _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default';
|
|
|
|
|
|
var lightsArray = [];
|
|
|
var shadowsArray = [];
|
|
@@ -21308,9 +21333,15 @@ function WebGLRenderer( parameters ) {
|
|
|
stencil: _stencil,
|
|
|
antialias: _antialias,
|
|
|
premultipliedAlpha: _premultipliedAlpha,
|
|
|
- preserveDrawingBuffer: _preserveDrawingBuffer
|
|
|
+ preserveDrawingBuffer: _preserveDrawingBuffer,
|
|
|
+ powerPreference: _powerPreference
|
|
|
};
|
|
|
|
|
|
+ // event listeners must be registered before WebGL context is created, see #12753
|
|
|
+
|
|
|
+ _canvas.addEventListener( 'webglcontextlost', onContextLost, false );
|
|
|
+ _canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );
|
|
|
+
|
|
|
_gl = _context || _canvas.getContext( 'webgl', contextAttributes ) || _canvas.getContext( 'experimental-webgl', contextAttributes );
|
|
|
|
|
|
if ( _gl === null ) {
|
|
@@ -21339,9 +21370,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _canvas.addEventListener( 'webglcontextlost', onContextLost, false );
|
|
|
- _canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );
|
|
|
-
|
|
|
} catch ( error ) {
|
|
|
|
|
|
console.error( 'THREE.WebGLRenderer: ' + error );
|
|
@@ -21785,7 +21813,9 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
this.renderBufferDirect = function ( camera, fog, geometry, material, object, group ) {
|
|
|
|
|
|
- state.setMaterial( material );
|
|
|
+ var frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );
|
|
|
+
|
|
|
+ state.setMaterial( material, frontFaceCW );
|
|
|
|
|
|
var program = setProgram( camera, fog, material, object );
|
|
|
var geometryProgram = geometry.id + '_' + program.id + '_' + ( material.wireframe === true );
|
|
@@ -22233,6 +22263,10 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
//
|
|
|
|
|
|
+ textures.updateVideoTextures();
|
|
|
+
|
|
|
+ //
|
|
|
+
|
|
|
if ( _clippingEnabled ) _clipping.beginShadows();
|
|
|
|
|
|
shadowMap.render( shadowsArray, scene, camera );
|
|
@@ -22530,7 +22564,9 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
if ( object.isImmediateRenderObject ) {
|
|
|
|
|
|
- state.setMaterial( material );
|
|
|
+ var frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );
|
|
|
+
|
|
|
+ state.setMaterial( material, frontFaceCW );
|
|
|
|
|
|
var program = setProgram( camera, scene.fog, material, object );
|
|
|
|
|
@@ -25013,7 +25049,9 @@ function Group() {
|
|
|
|
|
|
Group.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
|
|
|
|
|
- constructor: Group
|
|
|
+ constructor: Group,
|
|
|
+
|
|
|
+ isGroup: true
|
|
|
|
|
|
} );
|
|
|
|
|
@@ -25026,29 +25064,29 @@ function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, forma
|
|
|
Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
|
|
|
|
|
|
this.generateMipmaps = false;
|
|
|
+ this.needsUpdate = true;
|
|
|
|
|
|
- var scope = this;
|
|
|
+}
|
|
|
|
|
|
- function update() {
|
|
|
+VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
|
|
|
|
|
|
- var video = scope.image;
|
|
|
+ constructor: VideoTexture,
|
|
|
|
|
|
- if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
|
|
|
+ isVideoTexture: true,
|
|
|
|
|
|
- scope.needsUpdate = true;
|
|
|
+ update: function () {
|
|
|
|
|
|
- }
|
|
|
+ var video = this.image;
|
|
|
|
|
|
- requestAnimationFrame( update );
|
|
|
+ if ( video.readyState >= video.HAVE_CURRENT_DATA ) {
|
|
|
|
|
|
- }
|
|
|
+ this.needsUpdate = true;
|
|
|
|
|
|
- requestAnimationFrame( update );
|
|
|
+ }
|
|
|
|
|
|
-}
|
|
|
+ }
|
|
|
|
|
|
-VideoTexture.prototype = Object.create( Texture.prototype );
|
|
|
-VideoTexture.prototype.constructor = VideoTexture;
|
|
|
+} );
|
|
|
|
|
|
/**
|
|
|
* @author alteredq / http://alteredqualia.com/
|
|
@@ -28197,7 +28235,7 @@ ExtrudeBufferGeometry.prototype.addShape = function ( shape, options ) {
|
|
|
|
|
|
this.setIndex( indicesArray );
|
|
|
this.addAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );
|
|
|
- this.addAttribute( 'uv', new Float32BufferAttribute( options.arrays.uv, 2 ) );
|
|
|
+ this.addAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -44803,7 +44841,7 @@ Object.assign( WebVRManager.prototype, {
|
|
|
Object.defineProperties( WebVRManager.prototype, {
|
|
|
|
|
|
standing: {
|
|
|
- set: function ( value ) {
|
|
|
+ set: function ( /* value */ ) {
|
|
|
|
|
|
console.warn( 'THREE.WebVRManager: .standing has been removed.' );
|
|
|
|