- Fixed brightness on tv when change video
This commit is contained in:
Kum1ta
2024-08-24 17:06:13 +02:00
parent 347711eb39
commit 1291a6add8
19 changed files with 289 additions and 54 deletions

View File

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* Screen.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: marvin <marvin@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 23:13:53 by edbernar #+# #+# */
/* Updated: 2024/08/24 11:39:09 by marvin ### ########.fr */
/* Updated: 2024/08/24 16:56:57 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,12 +15,18 @@ import * as THREE from 'three'
const loader = new GLTFLoader();
let light = {
point: 1,
};
class Screen
{
screen = null;
tv = null;
pointLightIntensity = 1;
screenMaterial = null;
canvasVideo = null;
interval = null;
constructor(scene)
{
@ -34,17 +40,17 @@ class Screen
this.tv = tv;
tv.position.set(0, 0.99, 2);
tv.material = new THREE.MeshPhysicalMaterial({color: 0xaaaaaa});
tv.material.roughness = 10;
tv.material.metalness = 1;
tv.material.roughness = 1;
tv.material.metalness = 1.05;
tv.scale.set(0.05, 0.05, 0.05);
tv.castShadow = true;
tv.receiveShadow = true;
scene.add(tv);
this.showVideo('/modeles/pong.mp4');
}, undefined, function ( error ) {
console.error( error );
throw Error("Can't open file 'tv.glb'");
} );
this.#showVideo('/modeles/pong.mp4')
}
#createScreen(scene)
@ -54,7 +60,8 @@ class Screen
const vertices = positionAttribute.array;
const material = new THREE.MeshStandardMaterial({color: 0xbbbbbb});
const mesh = new THREE.Mesh(geometry, material);
const pointLight = new THREE.PointLight( 0xffffff, 10 * this.pointLightIntensity, 0, 2);
// const pointLight = new THREE.PointLight( 0xffffff, 10 * light.point, 0, 2);
const pointLight = new THREE.SpotLight(0xffffff, 10 * light.point, 0, Math.PI / 1.6);
for (let i = 0; i < vertices.length; i += 3)
{
@ -74,17 +81,27 @@ class Screen
pointLight.castShadow = true;
pointLight.shadow.mapSize.width = 2048;
pointLight.shadow.mapSize.height = 2048;
console.log(pointLight.shadow)
const targetObject = new THREE.Object3D();
targetObject.position.set(0, 1.2, 0);
pointLight.target = targetObject;
pointLight.target.updateMatrixWorld();
scene.add(pointLight);
setInterval(() => {
const intensity = Math.random() * 2 + 10;
pointLight.intensity = intensity * this.pointLightIntensity > 13 * this.pointLightIntensity ? 13 * this.pointLightIntensity : intensity * this.pointLightIntensity;
pointLight.intensity = intensity * light.point > 13 * light.point ? 13 * light.point : intensity * light.point;
}, 100);
return (mesh);
}
#showVideo(path)
changeVideo(path)
{
this.#disposeVideo();
this.showVideo(path);
}
showVideo(path)
{
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d', { willReadFrequently: true });
@ -92,9 +109,12 @@ class Screen
const texture = new THREE.CanvasTexture(canvas);
const material = new THREE.MeshBasicMaterial({ map: texture,color: 0xffffff, transparent: true, opacity: 1 });
canvas.video = video;
canvas.context = context;
canvas.width = 534;
canvas.height = 360;
video.src = path + '?t=' + new Date().getTime();
this.canvasVideo = canvas;
video.src = path;
video.loop = true;
video.muted = true;
video.crossOrigin = 'anonymous';
@ -107,37 +127,70 @@ class Screen
}).catch(err => console.error("Error playing video: ", err));
});
function addNoiseOnImage(context)
{
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
const data = imageData.data;
for (let i = 0; i < data.length; i += 4)
{
const r = data[i];
const g = data[i + 1];
const b = data[i + 2];
const brightness = (3 * r + 4 * g + b) >>> 3;
const noise = Math.random() * 128 - 32;
data[i] = data[i + 1] = data[i + 2] = brightness + noise;
}
context.putImageData(imageData, 0, 0);
}
// function addNoiseOnImage(context)
// {
// const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
// const data = imageData.data;
// for (let i = 0; i < data.length; i += 4)
// {
// const r = data[i];
// const g = data[i + 1];
// const b = data[i + 2];
// const brightness = (3 * r + 4 * g + b) >>> 3;
// const noise = Math.random() * 128 - 32;
// data[i] = data[i + 1] = data[i + 2] = brightness + noise;
// }
// context.putImageData(imageData, 0, 0);
// }
function updateCanvas()
{
if (!video.paused && !video.ended)
if (canvas.video != null || canvas.video == undefined)
{
context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(video, 0, 0, canvas.width, canvas.height);
addNoiseOnImage(context);
texture.needsUpdate = true;
if (canvas.video && !canvas.video.paused && !canvas.video.ended)
{
context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(canvas.video, 0, 0, canvas.width, canvas.height);
// addNoiseOnImage(context);
texture.needsUpdate = true;
}
requestAnimationFrame(updateCanvas);
}
requestAnimationFrame(updateCanvas);
}
texture.offset.set(0.02, 0);
texture.offset.set(0.05, 0);
this.screen.material = material;
video.load();
canvas.video.load();
}
#disposeVideo()
{
if (this.canvasVideo)
{
const canvas = this.canvasVideo;
const video = canvas.video;
const texture = this.screen.material.map;
if (video)
{
video.pause();
video.src = '';
video.removeAttribute('src');
video.load();
}
if (texture)
texture.dispose();
canvas.video = null;
canvas.context = null;
if (this.screen)
{
this.screen.material.map = null;
this.screen.material.dispose();
}
this.canvasVideo = null;
}
}
};
export { Screen };
export { Screen, light };

View File

@ -3,19 +3,20 @@
/* ::: :::::::: */
/* home3D.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: marvin <marvin@student.42.fr> +#+ +:+ +#+ */
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/22 17:19:17 by edbernar #+# #+# */
/* Updated: 2024/08/24 11:41:18 by marvin ### ########.fr */
/* Updated: 2024/08/24 16:47:41 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
import * as THREE from 'three'
import { Screen } from './Screen.js'
import { Screen, light } from './Screen.js'
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';
import { BokehPass } from 'three/examples/jsm/postprocessing/BokehPass.js';
import Stats from 'stats.js';
const scene = new THREE.Scene();
const renderer = new THREE.WebGLRenderer({antialias: true});
@ -24,6 +25,10 @@ const ambiantLight = new THREE.AmbientLight(0xffffff, 35);
const screen = new Screen(scene);
const cube = createCube();
const stats = new Stats();
stats.showPanel(0); // 0: fps, 1: ms, 2: mémoire
document.body.appendChild(stats.dom);
renderer.toneMapping = THREE.LinearToneMapping;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
@ -41,7 +46,7 @@ composer.addPass(new RenderPass(scene, camera));
const dofPass = new BokehPass(scene, camera, {
focus: 10.0,
aperture: 0.020,
aperture: 0.02,
maxblur: 0.01,
});
composer.addPass(dofPass);
@ -102,18 +107,23 @@ function fadeInOut()
let interval = null;
isInFade = true;
interval = setInterval(() => {
screen.pointLightIntensity -= 0.2;
light.point -= 0.2;
screen.screen.material.opacity -= 0.05;
if (screen.screen.material.opacity <= 0)
{
clearInterval(interval);
setTimeout(() => {
interval = setInterval(() => {
screen.pointLightIntensity += 0.2;
light.point += 0.2;
screen.screen.material.opacity += 0.05;
if (screen.screen.material.opacity >= 1)
{
clearInterval(interval);
interval = setInterval(() => {
light.point += 0.2;
if (light.point >= 1)
clearInterval(interval);
}, 10);
isInFade = false;
}
}, 20);
@ -132,6 +142,15 @@ function createCube()
scene.add(mesh);
}
const raycaster = new THREE.Raycaster();
const mouse = new THREE.Vector2();
document.addEventListener( 'mousemove', (event) => {
event.preventDefault();
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
});
function home3D()
{
@ -151,11 +170,57 @@ function createPlane()
scene.add(mesh);
}
const video = {
pong: '/modeles/pong.mp4',
login: '/modeles/notLogin.webm'
}
let actualVideo = -1;
if (Math.random() % 100 > 0.97)
video.pong = './modeles/easteregg.webm'
setTimeout(() => {
screen.changeVideo(video.pong);
actualVideo = 0;
}, 100);
function loop()
{
stats.begin()
raycaster.setFromCamera( mouse, camera );
const intersects = raycaster.intersectObjects( scene.children, false );
if (!screen.canvasVideo)
{
composer.render();
stats.end();
return ;
}
if (intersects.length === 0)
{
if (actualVideo != 0)
{
console.log("change 1");
screen.changeVideo(video.pong);
actualVideo = 0;
}
}
else if (intersects[0].object == screen.screen)
{
if (actualVideo != 1)
{
console.log("change 2");
screen.changeVideo(video.login);
actualVideo = 1;
}
}
else if (actualVideo != 0)
{
console.log("change 3");
screen.changeVideo(video.pong);
actualVideo = 0;
}
composer.render();
// renderer.render(scene, camera);
stats.end();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,38 +1,44 @@
{
"hash": "44aef43e",
"configHash": "da99a08f",
"hash": "86ff4072",
"configHash": "2420ea4a",
"lockfileHash": "7685a2f8",
"browserHash": "e0102bd3",
"browserHash": "21e1352c",
"optimized": {
"three": {
"src": "../../three/build/three.module.js",
"file": "three.js",
"fileHash": "b1c96f0f",
"fileHash": "5eb4d8ca",
"needsInterop": false
},
"three/addons/loaders/GLTFLoader.js": {
"src": "../../three/examples/jsm/loaders/GLTFLoader.js",
"file": "three_addons_loaders_GLTFLoader__js.js",
"fileHash": "cfe30105",
"fileHash": "9ac44446",
"needsInterop": false
},
"three/examples/jsm/postprocessing/BokehPass.js": {
"src": "../../three/examples/jsm/postprocessing/BokehPass.js",
"file": "three_examples_jsm_postprocessing_BokehPass__js.js",
"fileHash": "99b44bd7",
"fileHash": "b415e63e",
"needsInterop": false
},
"three/examples/jsm/postprocessing/EffectComposer.js": {
"src": "../../three/examples/jsm/postprocessing/EffectComposer.js",
"file": "three_examples_jsm_postprocessing_EffectComposer__js.js",
"fileHash": "113be6c6",
"fileHash": "3aeb7bbb",
"needsInterop": false
},
"three/examples/jsm/postprocessing/RenderPass.js": {
"src": "../../three/examples/jsm/postprocessing/RenderPass.js",
"file": "three_examples_jsm_postprocessing_RenderPass__js.js",
"fileHash": "9b0442c1",
"fileHash": "670c2198",
"needsInterop": false
},
"stats.js": {
"src": "../../stats.js/build/stats.min.js",
"file": "stats__js.js",
"fileHash": "243d1a1e",
"needsInterop": true
}
},
"chunks": {
@ -41,6 +47,9 @@
},
"chunk-IS2ZBFBB": {
"file": "chunk-IS2ZBFBB.js"
},
"chunk-BUSYA2B4": {
"file": "chunk-BUSYA2B4.js"
}
}
}

View File

@ -0,0 +1,9 @@
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
export {
__commonJS
};
//# sourceMappingURL=chunk-BUSYA2B4.js.map

View File

@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

View File

@ -0,0 +1,80 @@
import {
__commonJS
} from "./chunk-BUSYA2B4.js";
// node_modules/stats.js/build/stats.min.js
var require_stats_min = __commonJS({
"node_modules/stats.js/build/stats.min.js"(exports, module) {
(function(f, e) {
"object" === typeof exports && "undefined" !== typeof module ? module.exports = e() : "function" === typeof define && define.amd ? define(e) : f.Stats = e();
})(exports, function() {
var f = function() {
function e(a2) {
c.appendChild(a2.dom);
return a2;
}
function u(a2) {
for (var d = 0; d < c.children.length; d++) c.children[d].style.display = d === a2 ? "block" : "none";
l = a2;
}
var l = 0, c = document.createElement("div");
c.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000";
c.addEventListener("click", function(a2) {
a2.preventDefault();
u(++l % c.children.length);
}, false);
var k = (performance || Date).now(), g = k, a = 0, r = e(new f.Panel("FPS", "#0ff", "#002")), h = e(new f.Panel("MS", "#0f0", "#020"));
if (self.performance && self.performance.memory) var t = e(new f.Panel("MB", "#f08", "#201"));
u(0);
return { REVISION: 16, dom: c, addPanel: e, showPanel: u, begin: function() {
k = (performance || Date).now();
}, end: function() {
a++;
var c2 = (performance || Date).now();
h.update(c2 - k, 200);
if (c2 > g + 1e3 && (r.update(1e3 * a / (c2 - g), 100), g = c2, a = 0, t)) {
var d = performance.memory;
t.update(d.usedJSHeapSize / 1048576, d.jsHeapSizeLimit / 1048576);
}
return c2;
}, update: function() {
k = this.end();
}, domElement: c, setMode: u };
};
f.Panel = function(e, f2, l) {
var c = Infinity, k = 0, g = Math.round, a = g(window.devicePixelRatio || 1), r = 80 * a, h = 48 * a, t = 3 * a, v = 2 * a, d = 3 * a, m = 15 * a, n = 74 * a, p = 30 * a, q = document.createElement("canvas");
q.width = r;
q.height = h;
q.style.cssText = "width:80px;height:48px";
var b = q.getContext("2d");
b.font = "bold " + 9 * a + "px Helvetica,Arial,sans-serif";
b.textBaseline = "top";
b.fillStyle = l;
b.fillRect(0, 0, r, h);
b.fillStyle = f2;
b.fillText(e, t, v);
b.fillRect(d, m, n, p);
b.fillStyle = l;
b.globalAlpha = 0.9;
b.fillRect(d, m, n, p);
return { dom: q, update: function(h2, w) {
c = Math.min(c, h2);
k = Math.max(k, h2);
b.fillStyle = l;
b.globalAlpha = 1;
b.fillRect(0, 0, r, m);
b.fillStyle = f2;
b.fillText(g(h2) + " " + e + " (" + g(c) + "-" + g(k) + ")", t, v);
b.drawImage(q, d + a, m, n - a, p, d, m, n - a, p);
b.fillRect(d + n - a, m, a, p);
b.fillStyle = l;
b.globalAlpha = 0.9;
b.fillRect(d + n - a, m, a, g((1 - h2 / w) * p));
} };
};
return f;
});
}
});
export default require_stats_min();
//# sourceMappingURL=stats__js.js.map

View File

@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../stats.js/build/stats.min.js"],
"sourcesContent": ["// stats.js - http://github.com/mrdoob/stats.js\n(function(f,e){\"object\"===typeof exports&&\"undefined\"!==typeof module?module.exports=e():\"function\"===typeof define&&define.amd?define(e):f.Stats=e()})(this,function(){var f=function(){function e(a){c.appendChild(a.dom);return a}function u(a){for(var d=0;d<c.children.length;d++)c.children[d].style.display=d===a?\"block\":\"none\";l=a}var l=0,c=document.createElement(\"div\");c.style.cssText=\"position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000\";c.addEventListener(\"click\",function(a){a.preventDefault();\nu(++l%c.children.length)},!1);var k=(performance||Date).now(),g=k,a=0,r=e(new f.Panel(\"FPS\",\"#0ff\",\"#002\")),h=e(new f.Panel(\"MS\",\"#0f0\",\"#020\"));if(self.performance&&self.performance.memory)var t=e(new f.Panel(\"MB\",\"#f08\",\"#201\"));u(0);return{REVISION:16,dom:c,addPanel:e,showPanel:u,begin:function(){k=(performance||Date).now()},end:function(){a++;var c=(performance||Date).now();h.update(c-k,200);if(c>g+1E3&&(r.update(1E3*a/(c-g),100),g=c,a=0,t)){var d=performance.memory;t.update(d.usedJSHeapSize/\n1048576,d.jsHeapSizeLimit/1048576)}return c},update:function(){k=this.end()},domElement:c,setMode:u}};f.Panel=function(e,f,l){var c=Infinity,k=0,g=Math.round,a=g(window.devicePixelRatio||1),r=80*a,h=48*a,t=3*a,v=2*a,d=3*a,m=15*a,n=74*a,p=30*a,q=document.createElement(\"canvas\");q.width=r;q.height=h;q.style.cssText=\"width:80px;height:48px\";var b=q.getContext(\"2d\");b.font=\"bold \"+9*a+\"px Helvetica,Arial,sans-serif\";b.textBaseline=\"top\";b.fillStyle=l;b.fillRect(0,0,r,h);b.fillStyle=f;b.fillText(e,t,v);\nb.fillRect(d,m,n,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d,m,n,p);return{dom:q,update:function(h,w){c=Math.min(c,h);k=Math.max(k,h);b.fillStyle=l;b.globalAlpha=1;b.fillRect(0,0,r,m);b.fillStyle=f;b.fillText(g(h)+\" \"+e+\" (\"+g(c)+\"-\"+g(k)+\")\",t,v);b.drawImage(q,d+a,m,n-a,p,d,m,n-a,p);b.fillRect(d+n-a,m,a,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d+n-a,m,a,g((1-h/w)*p))}}};return f});\n"],
"mappings": ";;;;;AAAA;AAAA;AACA,KAAC,SAAS,GAAE,GAAE;AAAC,mBAAW,OAAO,WAAS,gBAAc,OAAO,SAAO,OAAO,UAAQ,EAAE,IAAE,eA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AAAE,YAAE,UAAU,GAAE,IAAE,GAAE,GAAE,IAAE,GAAE,GAAE,GAAE,GAAE,IAAE,GAAE,CAAC;AAAE,YAAE,SAAS,IAAE,IAAE,GAAE,GAAE,GAAE,CAAC;AAAE,YAAE,YAAU;AAAE,YAAE,cAAY;AAAG,YAAE,SAAS,IAAE,IAAE,GAAE,GAAE,GAAE,GAAG,IAAEA,KAAE,KAAG,CAAC,CAAC;AAAA,QAAC,EAAC;AAAA,MAAC;AAAE,aAAO;AAAA,IAAC,CAAC;AAAA;AAAA;",
"names": ["a", "c", "f", "h"]
}

View File

@ -418,6 +418,7 @@ import {
ZeroStencilOp,
createCanvasElement
} from "./chunk-IS2ZBFBB.js";
import "./chunk-BUSYA2B4.js";
export {
ACESFilmicToneMapping,
AddEquation,

View File

@ -66,6 +66,7 @@ import {
Vector3,
VectorKeyframeTrack
} from "./chunk-IS2ZBFBB.js";
import "./chunk-BUSYA2B4.js";
// node_modules/three/examples/jsm/utils/BufferGeometryUtils.js
function toTrianglesDrawMode(geometry, drawMode) {

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,7 @@ import {
UniformsUtils,
WebGLRenderTarget
} from "./chunk-IS2ZBFBB.js";
import "./chunk-BUSYA2B4.js";
// node_modules/three/examples/jsm/shaders/BokehShader.js
var BokehShader = {

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,7 @@ import {
Vector2,
WebGLRenderTarget
} from "./chunk-IS2ZBFBB.js";
import "./chunk-BUSYA2B4.js";
// node_modules/three/examples/jsm/shaders/CopyShader.js
var CopyShader = {

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,7 @@ import {
import {
Color
} from "./chunk-IS2ZBFBB.js";
import "./chunk-BUSYA2B4.js";
// node_modules/three/examples/jsm/postprocessing/RenderPass.js
var RenderPass = class extends Pass {

View File

@ -2,6 +2,6 @@
"version": 3,
"sources": ["../../three/examples/jsm/postprocessing/RenderPass.js"],
"sourcesContent": ["import {\n\tColor\n} from 'three';\nimport { Pass } from './Pass.js';\n\nclass RenderPass extends Pass {\n\n\tconstructor( scene, camera, overrideMaterial = null, clearColor = null, clearAlpha = null ) {\n\n\t\tsuper();\n\n\t\tthis.scene = scene;\n\t\tthis.camera = camera;\n\n\t\tthis.overrideMaterial = overrideMaterial;\n\n\t\tthis.clearColor = clearColor;\n\t\tthis.clearAlpha = clearAlpha;\n\n\t\tthis.clear = true;\n\t\tthis.clearDepth = false;\n\t\tthis.needsSwap = false;\n\t\tthis._oldClearColor = new Color();\n\n\t}\n\n\trender( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {\n\n\t\tconst oldAutoClear = renderer.autoClear;\n\t\trenderer.autoClear = false;\n\n\t\tlet oldClearAlpha, oldOverrideMaterial;\n\n\t\tif ( this.overrideMaterial !== null ) {\n\n\t\t\toldOverrideMaterial = this.scene.overrideMaterial;\n\n\t\t\tthis.scene.overrideMaterial = this.overrideMaterial;\n\n\t\t}\n\n\t\tif ( this.clearColor !== null ) {\n\n\t\t\trenderer.getClearColor( this._oldClearColor );\n\t\t\trenderer.setClearColor( this.clearColor, renderer.getClearAlpha() );\n\n\t\t}\n\n\t\tif ( this.clearAlpha !== null ) {\n\n\t\t\toldClearAlpha = renderer.getClearAlpha();\n\t\t\trenderer.setClearAlpha( this.clearAlpha );\n\n\t\t}\n\n\t\tif ( this.clearDepth == true ) {\n\n\t\t\trenderer.clearDepth();\n\n\t\t}\n\n\t\trenderer.setRenderTarget( this.renderToScreen ? null : readBuffer );\n\n\t\tif ( this.clear === true ) {\n\n\t\t\t// TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600\n\t\t\trenderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\n\t\t}\n\n\t\trenderer.render( this.scene, this.camera );\n\n\t\t// restore\n\n\t\tif ( this.clearColor !== null ) {\n\n\t\t\trenderer.setClearColor( this._oldClearColor );\n\n\t\t}\n\n\t\tif ( this.clearAlpha !== null ) {\n\n\t\t\trenderer.setClearAlpha( oldClearAlpha );\n\n\t\t}\n\n\t\tif ( this.overrideMaterial !== null ) {\n\n\t\t\tthis.scene.overrideMaterial = oldOverrideMaterial;\n\n\t\t}\n\n\t\trenderer.autoClear = oldAutoClear;\n\n\t}\n\n}\n\nexport { RenderPass };\n"],
"mappings": ";;;;;;;;AAKA,IAAM,aAAN,cAAyB,KAAK;AAAA,EAE7B,YAAa,OAAO,QAAQ,mBAAmB,MAAM,aAAa,MAAM,aAAa,MAAO;AAE3F,UAAM;AAEN,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,SAAK,mBAAmB;AAExB,SAAK,aAAa;AAClB,SAAK,aAAa;AAElB,SAAK,QAAQ;AACb,SAAK,aAAa;AAClB,SAAK,YAAY;AACjB,SAAK,iBAAiB,IAAI,MAAM;AAAA,EAEjC;AAAA,EAEA,OAAQ,UAAU,aAAa,YAA0C;AAExE,UAAM,eAAe,SAAS;AAC9B,aAAS,YAAY;AAErB,QAAI,eAAe;AAEnB,QAAK,KAAK,qBAAqB,MAAO;AAErC,4BAAsB,KAAK,MAAM;AAEjC,WAAK,MAAM,mBAAmB,KAAK;AAAA,IAEpC;AAEA,QAAK,KAAK,eAAe,MAAO;AAE/B,eAAS,cAAe,KAAK,cAAe;AAC5C,eAAS,cAAe,KAAK,YAAY,SAAS,cAAc,CAAE;AAAA,IAEnE;AAEA,QAAK,KAAK,eAAe,MAAO;AAE/B,sBAAgB,SAAS,cAAc;AACvC,eAAS,cAAe,KAAK,UAAW;AAAA,IAEzC;AAEA,QAAK,KAAK,cAAc,MAAO;AAE9B,eAAS,WAAW;AAAA,IAErB;AAEA,aAAS,gBAAiB,KAAK,iBAAiB,OAAO,UAAW;AAElE,QAAK,KAAK,UAAU,MAAO;AAG1B,eAAS,MAAO,SAAS,gBAAgB,SAAS,gBAAgB,SAAS,gBAAiB;AAAA,IAE7F;AAEA,aAAS,OAAQ,KAAK,OAAO,KAAK,MAAO;AAIzC,QAAK,KAAK,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