Skip to content

Commit

Permalink
r133 (bis)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Oct 4, 2021
1 parent 48be61a commit d9af995
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 83 deletions.
56 changes: 21 additions & 35 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -12503,7 +12503,6 @@

getExtension('OES_texture_float_linear');
getExtension('EXT_color_buffer_half_float');
getExtension('EXT_multisampled_render_to_texture');
},
get: function (name) {
const extension = getExtension(name);
Expand Down Expand Up @@ -17624,8 +17623,6 @@
let xrFrame = null;
let depthStyle = null;
let clearStyle = null;
const msaartcSupported = renderer.extensions.has('EXT_multisampled_render_to_texture');
let msaaExt = null;
const controllers = [];
const inputSourcesMap = new Map(); //

Expand Down Expand Up @@ -17824,9 +17821,7 @@
layers: [glProjLayer]
});

if (isMultisample && msaartcSupported) {
msaaExt = renderer.extensions.get('EXT_multisampled_render_to_texture');
} else if (isMultisample) {
if (isMultisample) {
glMultisampledFramebuffer = gl.createFramebuffer();
glColorRenderbuffer = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, glColorRenderbuffer);
Expand Down Expand Up @@ -18055,20 +18050,11 @@
const glSubImage = glBinding.getViewSubImage(glProjLayer, view);
state.bindXRFramebuffer(glFramebuffer);

if (isMultisample && msaartcSupported) {
if (glSubImage.depthStencilTexture !== undefined) {
msaaExt.framebufferTexture2DMultisampleEXT(gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, glSubImage.depthStencilTexture, 0, 4);
}

msaaExt.framebufferTexture2DMultisampleEXT(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, glSubImage.colorTexture, 0, 4);
} else {
if (glSubImage.depthStencilTexture !== undefined) {
gl.framebufferTexture2D(gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, glSubImage.depthStencilTexture, 0);
}

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

gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, glSubImage.colorTexture, 0);
viewport = glSubImage.viewport;
}

Expand All @@ -18086,7 +18072,7 @@
}
}

if (isMultisample && !msaartcSupported) {
if (isMultisample) {
state.bindXRFramebuffer(glMultisampledFramebuffer);
if (clearStyle !== null) gl.clear(clearStyle);
}
Expand All @@ -18103,7 +18089,7 @@

if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);

if (isMultisample && !msaartcSupported) {
if (isMultisample) {
const width = glProjLayer.textureWidth;
const height = glProjLayer.textureHeight;
state.bindFramebuffer(gl.READ_FRAMEBUFFER, glMultisampledFramebuffer);
Expand Down Expand Up @@ -19170,7 +19156,7 @@
if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)

const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0;
const program = setProgram(camera, scene, material, object);
const program = setProgram(camera, scene, geometry, material, object);
state.setMaterial(material, frontFaceCW); //

let index = geometry.index;
Expand All @@ -19190,10 +19176,6 @@
rangeFactor = 2;
}

if (geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined) {
morphtargets.update(object, geometry, material, program);
}

bindingStates.setup(object, material, program, geometry, index);
let attribute;
let renderer = bufferRenderer;
Expand Down Expand Up @@ -19553,7 +19535,7 @@
material.onBeforeRender(_this, scene, camera, geometry, object, group);

if (object.isImmediateRenderObject) {
const program = setProgram(camera, scene, material, object);
const program = setProgram(camera, scene, geometry, material, object);
state.setMaterial(material);
bindingStates.reset();
renderObjectImmediate(object, program);
Expand Down Expand Up @@ -19671,19 +19653,19 @@
materialProperties.vertexTangents = parameters.vertexTangents;
}

function setProgram(camera, scene, material, object) {
function setProgram(camera, scene, geometry, material, object) {
if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...

textures.resetTextureUnits();
const fog = scene.fog;
const environment = material.isMeshStandardMaterial ? scene.environment : null;
const encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);
const vertexAlphas = material.vertexColors === true && !!object.geometry && !!object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4;
const vertexTangents = !!material.normalMap && !!object.geometry && !!object.geometry.attributes.tangent;
const morphTargets = !!object.geometry && !!object.geometry.morphAttributes.position;
const morphNormals = !!object.geometry && !!object.geometry.morphAttributes.normal;
const morphTargetsCount = !!object.geometry && !!object.geometry.morphAttributes.position ? object.geometry.morphAttributes.position.length : 0;
const vertexAlphas = material.vertexColors === true && !!geometry && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;
const vertexTangents = !!material.normalMap && !!geometry && !!geometry.attributes.tangent;
const morphTargets = !!geometry && !!geometry.morphAttributes.position;
const morphNormals = !!geometry && !!geometry.morphAttributes.normal;
const morphTargetsCount = !!geometry && !!geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0;
const materialProperties = properties.get(material);
const lights = currentRenderState.state.lights;

Expand Down Expand Up @@ -19793,9 +19775,9 @@
if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) {
p_uniforms.setValue(_gl, 'viewMatrix', camera.matrixWorldInverse);
}
} // skinning uniforms must be set even if material didn't change
// auto-setting of texture unit for bone texture must go before other textures
// otherwise textures used for skinning can take over texture units reserved for other material textures
} // skinning and morph target uniforms must be set even if material didn't change
// auto-setting of texture unit for bone and morph texture must go before other textures
// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures


if (object.isSkinnedMesh) {
Expand All @@ -19814,6 +19796,10 @@
}
}

if (!!geometry && (geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined)) {
morphtargets.update(object, geometry, material, program);
}

if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {
materialProperties.receiveShadow = object.receiveShadow;
p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow);
Expand Down
2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

70 changes: 25 additions & 45 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -16194,7 +16194,6 @@ function WebGLExtensions( gl ) {

getExtension( 'OES_texture_float_linear' );
getExtension( 'EXT_color_buffer_half_float' );
getExtension( 'EXT_multisampled_render_to_texture' );

},

Expand Down Expand Up @@ -23665,8 +23664,6 @@ class WebXRManager extends EventDispatcher {
let xrFrame = null;
let depthStyle = null;
let clearStyle = null;
const msaartcSupported = renderer.extensions.has( 'EXT_multisampled_render_to_texture' );
let msaaExt = null;

const controllers = [];
const inputSourcesMap = new Map();
Expand Down Expand Up @@ -23936,11 +23933,7 @@ class WebXRManager extends EventDispatcher {

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

if ( isMultisample && msaartcSupported ) {

msaaExt = renderer.extensions.get( 'EXT_multisampled_render_to_texture' );

} else if ( isMultisample ) {
if ( isMultisample ) {

glMultisampledFramebuffer = gl.createFramebuffer();
glColorRenderbuffer = gl.createRenderbuffer();
Expand Down Expand Up @@ -24261,28 +24254,14 @@ class WebXRManager extends EventDispatcher {

state.bindXRFramebuffer( glFramebuffer );

if ( isMultisample && msaartcSupported ) {

if ( glSubImage.depthStencilTexture !== undefined ) {

msaaExt.framebufferTexture2DMultisampleEXT( 36160, depthStyle, 3553, glSubImage.depthStencilTexture, 0, 4 );

}

msaaExt.framebufferTexture2DMultisampleEXT( 36160, 36064, 3553, glSubImage.colorTexture, 0, 4 );

} else {

if ( glSubImage.depthStencilTexture !== undefined ) {

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

}
if ( glSubImage.depthStencilTexture !== undefined ) {

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

}

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

viewport = glSubImage.viewport;

}
Expand All @@ -24307,7 +24286,7 @@ class WebXRManager extends EventDispatcher {

}

if ( isMultisample && ! msaartcSupported ) {
if ( isMultisample ) {

state.bindXRFramebuffer( glMultisampledFramebuffer );

Expand All @@ -24332,7 +24311,7 @@ class WebXRManager extends EventDispatcher {

if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );

if ( isMultisample && ! msaartcSupported ) {
if ( isMultisample ) {

const width = glProjLayer.textureWidth;
const height = glProjLayer.textureHeight;
Expand Down Expand Up @@ -25840,7 +25819,7 @@ function WebGLRenderer( parameters = {} ) {

const frontFaceCW = ( object.isMesh && object.matrixWorld.determinant() < 0 );

const program = setProgram( camera, scene, material, object );
const program = setProgram( camera, scene, geometry, material, object );

state.setMaterial( material, frontFaceCW );

Expand Down Expand Up @@ -25872,12 +25851,6 @@ function WebGLRenderer( parameters = {} ) {

}

if ( geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined ) {

morphtargets.update( object, geometry, material, program );

}

bindingStates.setup( object, material, program, geometry, index );

let attribute;
Expand Down Expand Up @@ -26442,7 +26415,7 @@ function WebGLRenderer( parameters = {} ) {

if ( object.isImmediateRenderObject ) {

const program = setProgram( camera, scene, material, object );
const program = setProgram( camera, scene, geometry, material, object );

state.setMaterial( material );

Expand Down Expand Up @@ -26607,7 +26580,7 @@ function WebGLRenderer( parameters = {} ) {

}

function setProgram( camera, scene, material, object ) {
function setProgram( camera, scene, geometry, material, object ) {

if ( scene.isScene !== true ) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...

Expand All @@ -26617,11 +26590,11 @@ function WebGLRenderer( parameters = {} ) {
const environment = material.isMeshStandardMaterial ? scene.environment : null;
const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
const vertexAlphas = material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4;
const vertexTangents = !! material.normalMap && !! object.geometry && !! object.geometry.attributes.tangent;
const morphTargets = !! object.geometry && !! object.geometry.morphAttributes.position;
const morphNormals = !! object.geometry && !! object.geometry.morphAttributes.normal;
const morphTargetsCount = ( !! object.geometry && !! object.geometry.morphAttributes.position ) ? object.geometry.morphAttributes.position.length : 0;
const vertexAlphas = material.vertexColors === true && !! geometry && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
const vertexTangents = !! material.normalMap && !! geometry && !! geometry.attributes.tangent;
const morphTargets = !! geometry && !! geometry.morphAttributes.position;
const morphNormals = !! geometry && !! geometry.morphAttributes.normal;
const morphTargetsCount = ( !! geometry && !! geometry.morphAttributes.position ) ? geometry.morphAttributes.position.length : 0;

const materialProperties = properties.get( material );
const lights = currentRenderState.state.lights;
Expand Down Expand Up @@ -26819,9 +26792,9 @@ function WebGLRenderer( parameters = {} ) {

}

// skinning uniforms must be set even if material didn't change
// auto-setting of texture unit for bone texture must go before other textures
// otherwise textures used for skinning can take over texture units reserved for other material textures
// skinning and morph target uniforms must be set even if material didn't change
// auto-setting of texture unit for bone and morph texture must go before other textures
// otherwise textures used for skinning and morphing can take over texture units reserved for other material textures

if ( object.isSkinnedMesh ) {

Expand Down Expand Up @@ -26849,6 +26822,13 @@ function WebGLRenderer( parameters = {} ) {

}

if ( !! geometry && ( geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined ) ) {

morphtargets.update( object, geometry, material, program );

}


if ( refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow ) {

materialProperties.receiveShadow = object.receiveShadow;
Expand Down
2 changes: 1 addition & 1 deletion editor/sw.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// r133
// r133.1

const cacheName = 'threejs-editor';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "three",
"version": "0.133.0",
"version": "0.133.1",
"description": "JavaScript 3D library",
"main": "build/three.js",
"module": "build/three.module.js",
Expand Down

0 comments on commit d9af995

Please sign in to comment.