Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/mrdoob/three.js into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
aardgoose committed Jul 5, 2023
2 parents 8d0edcd + a887bd5 commit 318076a
Show file tree
Hide file tree
Showing 19 changed files with 196 additions and 37 deletions.
45 changes: 42 additions & 3 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
'use strict';

const REVISION = '154';
const REVISION = '155dev';

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 };
Expand Down Expand Up @@ -20306,6 +20306,18 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;

let toneMapping = NoToneMapping;

if ( material.toneMapped ) {

if ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {

toneMapping = renderer.toneMapping;

}

}

const parameters = {

isWebGL2: IS_WEBGL2,
Expand Down Expand Up @@ -20466,7 +20478,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
shadowMapType: renderer.shadowMap.type,

toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,
toneMapping: toneMapping,
useLegacyLights: renderer.useLegacyLights,

premultipliedAlpha: material.premultipliedAlpha,
Expand Down Expand Up @@ -29490,7 +29502,18 @@ class WebGLRenderer {
const morphTargets = !! geometry.morphAttributes.position;
const morphNormals = !! geometry.morphAttributes.normal;
const morphColors = !! geometry.morphAttributes.color;
const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;

let toneMapping = NoToneMapping;

if ( material.toneMapped ) {

if ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {

toneMapping = _this.toneMapping;

}

}

const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
Expand Down Expand Up @@ -32754,6 +32777,21 @@ class CompressedArrayTexture extends CompressedTexture {

}

class CompressedCubeTexture extends CompressedTexture {

constructor( images, format, type ) {

super( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );

this.isCompressedCubeTexture = true;
this.isCubeTexture = true;

this.image = images;

}

}

class CanvasTexture extends Texture {

constructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
Expand Down Expand Up @@ -51303,6 +51341,7 @@ exports.Color = Color;
exports.ColorKeyframeTrack = ColorKeyframeTrack;
exports.ColorManagement = ColorManagement;
exports.CompressedArrayTexture = CompressedArrayTexture;
exports.CompressedCubeTexture = CompressedCubeTexture;
exports.CompressedTexture = CompressedTexture;
exports.CompressedTextureLoader = CompressedTextureLoader;
exports.ConeGeometry = ConeGeometry;
Expand Down
45 changes: 42 additions & 3 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
})(this, (function (exports) { 'use strict';

const REVISION = '154';
const REVISION = '155dev';

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 };
Expand Down Expand Up @@ -20311,6 +20311,18 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;

let toneMapping = NoToneMapping;

if ( material.toneMapped ) {

if ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {

toneMapping = renderer.toneMapping;

}

}

const parameters = {

isWebGL2: IS_WEBGL2,
Expand Down Expand Up @@ -20471,7 +20483,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
shadowMapType: renderer.shadowMap.type,

toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,
toneMapping: toneMapping,
useLegacyLights: renderer.useLegacyLights,

premultipliedAlpha: material.premultipliedAlpha,
Expand Down Expand Up @@ -29495,7 +29507,18 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
const morphTargets = !! geometry.morphAttributes.position;
const morphNormals = !! geometry.morphAttributes.normal;
const morphColors = !! geometry.morphAttributes.color;
const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;

let toneMapping = NoToneMapping;

if ( material.toneMapped ) {

if ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {

toneMapping = _this.toneMapping;

}

}

const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
Expand Down Expand Up @@ -32759,6 +32782,21 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated

}

class CompressedCubeTexture extends CompressedTexture {

constructor( images, format, type ) {

super( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );

this.isCompressedCubeTexture = true;
this.isCubeTexture = true;

this.image = images;

}

}

class CanvasTexture extends Texture {

constructor( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
Expand Down Expand Up @@ -51308,6 +51346,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
exports.ColorKeyframeTrack = ColorKeyframeTrack;
exports.ColorManagement = ColorManagement;
exports.CompressedArrayTexture = CompressedArrayTexture;
exports.CompressedCubeTexture = CompressedCubeTexture;
exports.CompressedTexture = CompressedTexture;
exports.CompressedTextureLoader = CompressedTextureLoader;
exports.ConeGeometry = ConeGeometry;
Expand Down
2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

46 changes: 42 additions & 4 deletions build/three.module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/three.module.min.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import {
CompressedTexture,
CompressedArrayTexture,
CompressedCubeTexture,
Data3DTexture,
DataTexture,
FileLoader,
Expand Down Expand Up @@ -261,10 +262,7 @@ class KTX2Loader extends Loader {

if ( container.faceCount === 6 ) {

texture = new CompressedTexture();
texture.image = faces;
texture.format = format;
texture.type = UnsignedByteType;
texture = new CompressedCubeTexture( faces, format, UnsignedByteType );

} else {

Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/postprocessing/OutputPass.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
ShaderMaterial,
RawShaderMaterial,
UniformsUtils,
NoToneMapping,
LinearToneMapping,
Expand All @@ -25,7 +25,7 @@ class OutputPass extends Pass {

this.uniforms = UniformsUtils.clone( shader.uniforms );

this.material = new ShaderMaterial( {
this.material = new RawShaderMaterial( {
uniforms: this.uniforms,
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader
Expand Down
2 changes: 2 additions & 0 deletions examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ class WebGPUTextureUtils {

textureData.version = texture.version;

if ( texture.onUpdate ) texture.onUpdate( texture );

}

async copyTextureToBuffer( texture, x, y, width, height ) {
Expand Down
15 changes: 14 additions & 1 deletion examples/jsm/shaders/OutputShader.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
ShaderChunk
} from 'three';

const OutputShader = {

uniforms: {
Expand All @@ -8,6 +12,13 @@ const OutputShader = {
},

vertexShader: /* glsl */`
precision highp float;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
attribute vec3 position;
attribute vec2 uv;
varying vec2 vUv;
Expand All @@ -19,10 +30,12 @@ const OutputShader = {
}`,

fragmentShader: /* glsl */`
precision highp float;
uniform sampler2D tDiffuse;
#include <tonemapping_pars_fragment>
` + ShaderChunk[ 'tonemapping_pars_fragment' ] + ShaderChunk[ 'colorspace_pars_fragment' ] + `
varying vec2 vUv;
Expand Down
Binary file modified examples/screenshots/webgl_postprocessing_3dlut.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/screenshots/webgl_shaders_ocean.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion examples/webaudio_sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@

controls.movementSpeed = 70;
controls.lookSpeed = 0.05;
controls.noFly = true;
controls.lookVertical = false;

//
Expand Down
16 changes: 3 additions & 13 deletions examples/webgl_postprocessing_3dlut.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@
import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
import { LUTPass } from 'three/addons/postprocessing/LUTPass.js';
import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js';
import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js';
import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js';
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';

const params = {
Expand Down Expand Up @@ -125,22 +124,13 @@
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.useLegacyLights = false;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1;
container.appendChild( renderer.domElement );

const target = new THREE.WebGLRenderTarget( {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBAFormat,
colorSpace: THREE.SRGBColorSpace
} );

composer = new EffectComposer( renderer, target );
composer = new EffectComposer( renderer );
composer.setPixelRatio( window.devicePixelRatio );
composer.setSize( window.innerWidth, window.innerHeight );
composer.addPass( new RenderPass( scene, camera ) );
composer.addPass( new ShaderPass( GammaCorrectionShader ) );
composer.addPass( new OutputPass( THREE.ACESFilmicToneMapping ) );

lutPass = new LUTPass();
composer.addPass( lutPass );
Expand Down
1 change: 0 additions & 1 deletion examples/webgl_shadowmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@

controls.lookSpeed = 0.0125;
controls.movementSpeed = 500;
controls.noFly = false;
controls.lookVertical = true;

controls.lookAt( scene.position );
Expand Down
1 change: 0 additions & 1 deletion examples/webgl_shadowmap_performance.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@

controls.lookSpeed = 0.0125;
controls.movementSpeed = 500;
controls.noFly = false;
controls.lookVertical = true;

controls.lookAt( scene.position );
Expand Down
1 change: 1 addition & 0 deletions src/Three.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export { DataArrayTexture } from './textures/DataArrayTexture.js';
export { Data3DTexture } from './textures/Data3DTexture.js';
export { CompressedTexture } from './textures/CompressedTexture.js';
export { CompressedArrayTexture } from './textures/CompressedArrayTexture.js';
export { CompressedCubeTexture } from './textures/CompressedCubeTexture.js';
export { CubeTexture } from './textures/CubeTexture.js';
export { CanvasTexture } from './textures/CanvasTexture.js';
export { DepthTexture } from './textures/DepthTexture.js';
Expand Down
13 changes: 12 additions & 1 deletion src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,18 @@ class WebGLRenderer {
const morphTargets = !! geometry.morphAttributes.position;
const morphNormals = !! geometry.morphAttributes.normal;
const morphColors = !! geometry.morphAttributes.color;
const toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;

let toneMapping = NoToneMapping;

if ( material.toneMapped ) {

if ( _currentRenderTarget === null || _currentRenderTarget.isXRRenderTarget === true ) {

toneMapping = _this.toneMapping;

}

}

const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
Expand Down
14 changes: 13 additions & 1 deletion src/renderers/webgl/WebGLPrograms.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;

let toneMapping = NoToneMapping;

if ( material.toneMapped ) {

if ( currentRenderTarget === null || currentRenderTarget.isXRRenderTarget === true ) {

toneMapping = renderer.toneMapping;

}

}

const parameters = {

isWebGL2: IS_WEBGL2,
Expand Down Expand Up @@ -320,7 +332,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
shadowMapType: renderer.shadowMap.type,

toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,
toneMapping: toneMapping,
useLegacyLights: renderer.useLegacyLights,

premultipliedAlpha: material.premultipliedAlpha,
Expand Down
19 changes: 19 additions & 0 deletions src/textures/CompressedCubeTexture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { CubeReflectionMapping } from '../constants.js';
import { CompressedTexture } from './CompressedTexture.js';

class CompressedCubeTexture extends CompressedTexture {

constructor( images, format, type ) {

super( undefined, images[ 0 ].width, images[ 0 ].height, format, type, CubeReflectionMapping );

this.isCompressedCubeTexture = true;
this.isCubeTexture = true;

this.image = images;

}

}

export { CompressedCubeTexture };

0 comments on commit 318076a

Please sign in to comment.