Skip to content

Commit

Permalink
Merge pull request mrdoob#1 from mrdoob/dev
Browse files Browse the repository at this point in the history
fetch downstream
  • Loading branch information
0X-JonMichaelGalindo authored Jun 30, 2021
2 parents f439e98 + e8877df commit d4f68bd
Show file tree
Hide file tree
Showing 34 changed files with 774 additions and 553 deletions.
98 changes: 80 additions & 18 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
}(this, (function (exports) { 'use strict';

const REVISION = '130dev';
const REVISION = '130';
const MOUSE = {
LEFT: 0,
MIDDLE: 1,
Expand Down Expand Up @@ -11652,7 +11652,7 @@
const length = objectInfluences === undefined ? 0 : objectInfluences.length;
let influences = influencesList[geometry.id];

if (influences === undefined) {
if (influences === undefined || influences.length !== length) {
// initialise list
influences = [];

Expand Down Expand Up @@ -16421,6 +16421,9 @@
let referenceSpace = null;
let referenceSpaceType = 'local-floor';
let pose = null;
let glBinding = null;
let glFramebuffer = null;
let glProjLayer = null;
const controllers = [];
const inputSourcesMap = new Map(); //

Expand Down Expand Up @@ -16546,18 +16549,40 @@
await gl.makeXRCompatible();
}

const layerInit = {
antialias: attributes.antialias,
alpha: attributes.alpha,
depth: attributes.depth,
stencil: attributes.stencil,
framebufferScaleFactor: framebufferScaleFactor
}; // eslint-disable-next-line no-undef
if (session.renderState.layers === undefined) {
const layerInit = {
antialias: attributes.antialias,
alpha: attributes.alpha,
depth: attributes.depth,
stencil: attributes.stencil,
framebufferScaleFactor: framebufferScaleFactor
}; // eslint-disable-next-line no-undef

const baseLayer = new XRWebGLLayer(session, gl, layerInit);
session.updateRenderState({
baseLayer: baseLayer
});
} else {
let depthFormat = 0;

if (attributes.depth) {
depthFormat = attributes.stencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;
}

const projectionlayerInit = {
colorFormat: attributes.alpha ? gl.RGBA : gl.RGB,
depthFormat: depthFormat,
scaleFactor: framebufferScaleFactor
}; // eslint-disable-next-line no-undef

glBinding = new XRWebGLBinding(session, gl);
glProjLayer = glBinding.createProjectionLayer(projectionlayerInit);
glFramebuffer = gl.createFramebuffer();
session.updateRenderState({
layers: [glProjLayer]
});
}

const baseLayer = new XRWebGLLayer(session, gl, layerInit);
session.updateRenderState({
baseLayer: baseLayer
});
referenceSpace = await session.requestReferenceSpace(referenceSpaceType);
animation.setContext(session);
animation.start();
Expand Down Expand Up @@ -16720,7 +16745,11 @@
if (pose !== null) {
const views = pose.views;
const baseLayer = session.renderState.baseLayer;
state.bindXRFramebuffer(baseLayer.framebuffer);

if (session.renderState.layers === undefined) {
state.bindXRFramebuffer(baseLayer.framebuffer);
}

let cameraVRNeedsUpdate = false; // check if it's necessary to rebuild cameraVR's camera list

if (views.length !== cameraVR.cameras.length) {
Expand All @@ -16730,7 +16759,24 @@

for (let i = 0; i < views.length; i++) {
const view = views[i];
const viewport = baseLayer.getViewport(view);
let viewport = null;

if (session.renderState.layers === undefined) {
viewport = baseLayer.getViewport(view);
} else {
const glSubImage = glBinding.getViewSubImage(glProjLayer, view);
gl.bindFramebuffer(gl.FRAMEBUFFER, glFramebuffer);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, glSubImage.colorTexture, 0);

if (glSubImage.depthStencilTexture !== undefined) {
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, glSubImage.depthStencilTexture, 0);
}

gl.bindFramebuffer(gl.FRAMEBUFFER, null);
state.bindXRFramebuffer(glFramebuffer);
viewport = glSubImage.viewport;
}

const camera = cameras[i];
camera.matrix.fromArray(view.transform.matrix);
camera.projectionMatrix.fromArray(view.projectionMatrix);
Expand Down Expand Up @@ -17963,10 +18009,10 @@
if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera); //

if (_currentRenderTarget !== null) {
// Generate mipmap if we're using any kind of mipmap filtering
textures.updateRenderTargetMipmap(_currentRenderTarget); // resolve multisample renderbuffers to a single-sample texture if necessary
// resolve multisample renderbuffers to a single-sample texture if necessary
textures.updateMultisampleRenderTarget(_currentRenderTarget); // Generate mipmap if we're using any kind of mipmap filtering

textures.updateMultisampleRenderTarget(_currentRenderTarget);
textures.updateRenderTargetMipmap(_currentRenderTarget);
} //


Expand Down Expand Up @@ -33544,6 +33590,22 @@
this.type = 'AxesHelper';
}

setColors(xAxisColor, yAxisColor, zAxisColor) {
const color = new Color();
const array = this.geometry.attributes.color.array;
color.set(xAxisColor);
color.toArray(array, 0);
color.toArray(array, 3);
color.set(yAxisColor);
color.toArray(array, 6);
color.toArray(array, 9);
color.set(zAxisColor);
color.toArray(array, 12);
color.toArray(array, 15);
this.geometry.attributes.color.needsUpdate = true;
return this;
}

dispose() {
this.geometry.dispose();
this.material.dispose();
Expand Down
2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

129 changes: 110 additions & 19 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright 2010-2021 Three.js Authors
* SPDX-License-Identifier: MIT
*/
const REVISION = '130dev';
const REVISION = '130';
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
const CullFaceNone = 0;
Expand Down Expand Up @@ -15235,7 +15235,7 @@ function WebGLMorphtargets( gl ) {

let influences = influencesList[ geometry.id ];

if ( influences === undefined ) {
if ( influences === undefined || influences.length !== length ) {

// initialise list

Expand Down Expand Up @@ -22187,13 +22187,15 @@ class WebXRManager extends EventDispatcher {
const state = renderer.state;

let session = null;

let framebufferScaleFactor = 1.0;

let referenceSpace = null;
let referenceSpaceType = 'local-floor';

let pose = null;
let glBinding = null;
let glFramebuffer = null;
let glProjLayer = null;

const controllers = [];
const inputSourcesMap = new Map();
Expand Down Expand Up @@ -22370,18 +22372,47 @@ class WebXRManager extends EventDispatcher {

}

const layerInit = {
antialias: attributes.antialias,
alpha: attributes.alpha,
depth: attributes.depth,
stencil: attributes.stencil,
framebufferScaleFactor: framebufferScaleFactor
};
if ( session.renderState.layers === undefined ) {

const layerInit = {
antialias: attributes.antialias,
alpha: attributes.alpha,
depth: attributes.depth,
stencil: attributes.stencil,
framebufferScaleFactor: framebufferScaleFactor
};

// eslint-disable-next-line no-undef
const baseLayer = new XRWebGLLayer( session, gl, layerInit );

session.updateRenderState( { baseLayer: baseLayer } );

} else {

let depthFormat = 0;

if ( attributes.depth ) {

depthFormat = attributes.stencil ? 34041 : 6402;

}

const projectionlayerInit = {
colorFormat: attributes.alpha ? 6408 : 6407,
depthFormat: depthFormat,
scaleFactor: framebufferScaleFactor
};

// eslint-disable-next-line no-undef
glBinding = new XRWebGLBinding( session, gl );

// eslint-disable-next-line no-undef
const baseLayer = new XRWebGLLayer( session, gl, layerInit );
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );

session.updateRenderState( { baseLayer: baseLayer } );
glFramebuffer = gl.createFramebuffer();

session.updateRenderState( { layers: [ glProjLayer ] } );

}

referenceSpace = await session.requestReferenceSpace( referenceSpaceType );

Expand Down Expand Up @@ -22600,9 +22631,14 @@ class WebXRManager extends EventDispatcher {
if ( pose !== null ) {

const views = pose.views;

const baseLayer = session.renderState.baseLayer;

state.bindXRFramebuffer( baseLayer.framebuffer );
if ( session.renderState.layers === undefined ) {

state.bindXRFramebuffer( baseLayer.framebuffer );

}

let cameraVRNeedsUpdate = false;

Expand All @@ -22611,18 +22647,50 @@ class WebXRManager extends EventDispatcher {
if ( views.length !== cameraVR.cameras.length ) {

cameraVR.cameras.length = 0;

cameraVRNeedsUpdate = true;


}

for ( let i = 0; i < views.length; i ++ ) {

const view = views[ i ];
const viewport = baseLayer.getViewport( view );

let viewport = null;

if ( session.renderState.layers === undefined ) {

viewport = baseLayer.getViewport( view );

} else {

const glSubImage = glBinding.getViewSubImage( glProjLayer, view );

gl.bindFramebuffer( 36160, glFramebuffer );

gl.framebufferTexture2D( 36160, 36064, 3553, glSubImage.colorTexture, 0 );

if ( glSubImage.depthStencilTexture !== undefined ) {

gl.framebufferTexture2D( 36160, 36096, 3553, glSubImage.depthStencilTexture, 0 );

}

gl.bindFramebuffer( 36160, null );

state.bindXRFramebuffer( glFramebuffer );

viewport = glSubImage.viewport;

}

const camera = cameras[ i ];

camera.matrix.fromArray( view.transform.matrix );

camera.projectionMatrix.fromArray( view.projectionMatrix );

camera.viewport.set( viewport.x, viewport.y, viewport.width, viewport.height );

if ( i === 0 ) {
Expand Down Expand Up @@ -24395,14 +24463,14 @@ function WebGLRenderer( parameters = {} ) {

if ( _currentRenderTarget !== null ) {

// Generate mipmap if we're using any kind of mipmap filtering

textures.updateRenderTargetMipmap( _currentRenderTarget );

// resolve multisample renderbuffers to a single-sample texture if necessary

textures.updateMultisampleRenderTarget( _currentRenderTarget );

// Generate mipmap if we're using any kind of mipmap filtering

textures.updateRenderTargetMipmap( _currentRenderTarget );

}

//
Expand Down Expand Up @@ -46491,6 +46559,29 @@ class AxesHelper extends LineSegments {

}

setColors( xAxisColor, yAxisColor, zAxisColor ) {

const color = new Color();
const array = this.geometry.attributes.color.array;

color.set( xAxisColor );
color.toArray( array, 0 );
color.toArray( array, 3 );

color.set( yAxisColor );
color.toArray( array, 6 );
color.toArray( array, 9 );

color.set( zAxisColor );
color.toArray( array, 12 );
color.toArray( array, 15 );

this.geometry.attributes.color.needsUpdate = true;

return this;

}

dispose() {

this.geometry.dispose();
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/core/Uniform.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h2>Uniform types</h2>
</tr>
<tr>
<td>mat4</td>
<td>[page:Matrix3 THREE.Matrix4]</td>
<td>[page:Matrix4 THREE.Matrix4]</td>
</tr>
<tr>
<td>mat4</td>
Expand Down
12 changes: 6 additions & 6 deletions docs/api/en/math/Matrix4.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ <h3>[method:this makeScale]( [param:Float x], [param:Float y], [param:Float z] )

<h3>[method:this makeShear]( [param:Float xy], [param:Float xz], [param:Float yx], [param:Float yz], [param:Float zx], [param:Float zy] )</h3>
<p>
[page:Float x] - the amount to shear X by Y.<br />
[page:Float x] - the amount to shear X by Z.<br />
[page:Float x] - the amount to shear Y by X.<br />
[page:Float x] - the amount to shear Y by Z.<br />
[page:Float y] - the amount to shear Z by X.<br />
[page:Float z] - the amount to shear Z by Y.<br /><br />
[page:Float xy] - the amount to shear X by Y.<br />
[page:Float xz] - the amount to shear X by Z.<br />
[page:Float yx] - the amount to shear Y by X.<br />
[page:Float yz] - the amount to shear Y by Z.<br />
[page:Float zx] - the amount to shear Z by X.<br />
[page:Float zy] - the amount to shear Z by Y.<br /><br />

Sets this matrix as a shear transform:
<code>
Expand Down
Loading

0 comments on commit d4f68bd

Please sign in to comment.