|
@@ -11915,7 +11915,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
|
|
|
|
|
|
var index = this.index;
|
|
|
var attributes = this.attributes;
|
|
|
- var groups = this.groups;
|
|
|
|
|
|
if ( attributes.position ) {
|
|
|
|
|
@@ -11951,46 +11950,31 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
|
|
|
|
|
|
var indices = index.array;
|
|
|
|
|
|
- if ( groups.length === 0 ) {
|
|
|
-
|
|
|
- this.addGroup( 0, indices.length );
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- for ( var j = 0, jl = groups.length; j < jl; ++ j ) {
|
|
|
-
|
|
|
- var group = groups[ j ];
|
|
|
-
|
|
|
- var start = group.start;
|
|
|
- var count = group.count;
|
|
|
+ for ( var i = 0, il = index.count; i < il; i += 3 ) {
|
|
|
|
|
|
- for ( var i = start, il = start + count; i < il; i += 3 ) {
|
|
|
+ vA = indices[ i + 0 ] * 3;
|
|
|
+ vB = indices[ i + 1 ] * 3;
|
|
|
+ vC = indices[ i + 2 ] * 3;
|
|
|
|
|
|
- vA = indices[ i + 0 ] * 3;
|
|
|
- vB = indices[ i + 1 ] * 3;
|
|
|
- vC = indices[ i + 2 ] * 3;
|
|
|
+ pA.fromArray( positions, vA );
|
|
|
+ pB.fromArray( positions, vB );
|
|
|
+ pC.fromArray( positions, vC );
|
|
|
|
|
|
- pA.fromArray( positions, vA );
|
|
|
- pB.fromArray( positions, vB );
|
|
|
- pC.fromArray( positions, vC );
|
|
|
-
|
|
|
- cb.subVectors( pC, pB );
|
|
|
- ab.subVectors( pA, pB );
|
|
|
- cb.cross( ab );
|
|
|
-
|
|
|
- normals[ vA ] += cb.x;
|
|
|
- normals[ vA + 1 ] += cb.y;
|
|
|
- normals[ vA + 2 ] += cb.z;
|
|
|
+ cb.subVectors( pC, pB );
|
|
|
+ ab.subVectors( pA, pB );
|
|
|
+ cb.cross( ab );
|
|
|
|
|
|
- normals[ vB ] += cb.x;
|
|
|
- normals[ vB + 1 ] += cb.y;
|
|
|
- normals[ vB + 2 ] += cb.z;
|
|
|
+ normals[ vA ] += cb.x;
|
|
|
+ normals[ vA + 1 ] += cb.y;
|
|
|
+ normals[ vA + 2 ] += cb.z;
|
|
|
|
|
|
- normals[ vC ] += cb.x;
|
|
|
- normals[ vC + 1 ] += cb.y;
|
|
|
- normals[ vC + 2 ] += cb.z;
|
|
|
+ normals[ vB ] += cb.x;
|
|
|
+ normals[ vB + 1 ] += cb.y;
|
|
|
+ normals[ vB + 2 ] += cb.z;
|
|
|
|
|
|
- }
|
|
|
+ normals[ vC ] += cb.x;
|
|
|
+ normals[ vC + 1 ] += cb.y;
|
|
|
+ normals[ vC + 2 ] += cb.z;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -21528,21 +21512,9 @@ function WebVRManager( renderer ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- this.submitFrame = function ( scene, camera ) {
|
|
|
+ this.submitFrame = function () {
|
|
|
|
|
|
- if ( isPresenting() ) {
|
|
|
-
|
|
|
- device.submitFrame();
|
|
|
-
|
|
|
- if ( device.capabilities.hasExternalDisplay ) {
|
|
|
-
|
|
|
- scope.enabled = false;
|
|
|
- renderer.render( scene, camera );
|
|
|
- scope.enabled = true;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ if ( isPresenting() ) device.submitFrame();
|
|
|
|
|
|
};
|
|
|
|
|
@@ -21963,7 +21935,6 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
// frustum
|
|
|
|
|
|
- _camera = null,
|
|
|
_frustum = new Frustum(),
|
|
|
|
|
|
// clipping
|
|
@@ -22848,7 +22819,6 @@ function WebGLRenderer( parameters ) {
|
|
|
_currentGeometryProgram.wireframe = false;
|
|
|
_currentMaterialId = - 1;
|
|
|
_currentCamera = null;
|
|
|
- _camera = camera;
|
|
|
|
|
|
// update scene graph
|
|
|
|
|
@@ -22930,7 +22900,12 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
+ // opaque pass (front-to-back order)
|
|
|
+
|
|
|
if ( opaqueObjects.length ) renderObjects( opaqueObjects, scene, camera );
|
|
|
+
|
|
|
+ // transparent pass (back-to-front order)
|
|
|
+
|
|
|
if ( transparentObjects.length ) renderObjects( transparentObjects, scene, camera );
|
|
|
|
|
|
}
|
|
@@ -22955,7 +22930,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
if ( vr.enabled ) {
|
|
|
|
|
|
- vr.submitFrame( scene, _camera );
|
|
|
+ vr.submitFrame();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -23167,6 +23142,8 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ currentRenderState.setupLights( camera2 );
|
|
|
+
|
|
|
renderObject( object, scene, camera2, geometry, material, group );
|
|
|
|
|
|
}
|
|
@@ -23492,7 +23469,7 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( refreshProgram || camera !== _currentCamera ) {
|
|
|
+ if ( refreshProgram || _currentCamera !== camera ) {
|
|
|
|
|
|
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
|
|
|
@@ -23503,11 +23480,9 @@ function WebGLRenderer( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // Avoid unneeded uniform updates per ArrayCamera's sub-camera
|
|
|
-
|
|
|
- if ( _currentCamera !== ( _currentArrayCamera || camera ) ) {
|
|
|
+ if ( _currentCamera !== camera ) {
|
|
|
|
|
|
- _currentCamera = ( _currentArrayCamera || camera );
|
|
|
+ _currentCamera = camera;
|
|
|
|
|
|
// lighting uniforms depend on the camera so enforce an update
|
|
|
// now, in case this material supports lights - or later, when
|