Site :
- Fix tele screen
This commit is contained in:
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* Screen.js :+: :+: :+: */
|
/* Screen.js :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: marvin <marvin@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/22 23:13:53 by edbernar #+# #+# */
|
/* Created: 2024/08/22 23:13:53 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/24 02:36:42 by edbernar ### ########.fr */
|
/* Updated: 2024/08/24 11:39:09 by marvin ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ class Screen
|
|||||||
vertices[i + 2] = height;
|
vertices[i + 2] = height;
|
||||||
}
|
}
|
||||||
positionAttribute.needsUpdate = true;
|
positionAttribute.needsUpdate = true;
|
||||||
mesh.scale.set(0.4, 0.4);
|
mesh.scale.set(0.41, 0.42);
|
||||||
mesh.position.set(-0.155, 1.2, 1.15);
|
mesh.position.set(-0.155, 1.2, 1.15);
|
||||||
mesh.rotation.x = Math.PI + 0.05;
|
mesh.rotation.x = Math.PI + 0.05;
|
||||||
mesh.rotation.z = Math.PI;
|
mesh.rotation.z = Math.PI;
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* home3D.js :+: :+: :+: */
|
/* home3D.js :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: marvin <marvin@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/22 17:19:17 by edbernar #+# #+# */
|
/* Created: 2024/08/22 17:19:17 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/24 02:46:49 by edbernar ### ########.fr */
|
/* Updated: 2024/08/24 11:41:18 by marvin ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ import { BokehPass } from 'three/examples/jsm/postprocessing/BokehPass.js';
|
|||||||
const scene = new THREE.Scene();
|
const scene = new THREE.Scene();
|
||||||
const renderer = new THREE.WebGLRenderer({antialias: true});
|
const renderer = new THREE.WebGLRenderer({antialias: true});
|
||||||
const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight);
|
const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight);
|
||||||
const ambiantLight = new THREE.AmbientLight(0xffffff, 3);
|
const ambiantLight = new THREE.AmbientLight(0xffffff, 35);
|
||||||
const screen = new Screen(scene);
|
const screen = new Screen(scene);
|
||||||
const cube = createCube();
|
const cube = createCube();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="left-side"></div>
|
<div class="left-side"></div>
|
||||||
<div class="right-side">
|
<div class="right-side">
|
||||||
<h1>Acces to a new WORLD</h1>
|
<h1>Access to a new WORLD</h1>
|
||||||
<form>
|
<form>
|
||||||
<label for="email">Email</label>
|
<label for="email">Email</label>
|
||||||
<input type="email" id="email" name="email" placeholder="Email">
|
<input type="email" id="email" name="email" placeholder="Email">
|
||||||
@ -51,7 +51,6 @@
|
|||||||
<p>Or</p>
|
<p>Or</p>
|
||||||
<span></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" class="login-42-btn">Log with <span>42</span></button>
|
<button type="button" class="login-42-btn">Log with <span>42</span></button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,229 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* createConnectDiv.js :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: madegryc <madegryc@student.42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2024/08/07 18:14:53 by edbernar #+# #+# */
|
|
||||||
/* Updated: 2024/08/13 17:19:04 by madegryc ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
import { userMeInfo, waitForLogin } from "../typeResponse/typeLogin.js";
|
|
||||||
import { createNotification as CN } from "../notification/main.js";
|
|
||||||
import { sendRequest } from "../websocket.js";
|
|
||||||
import { showLoginDiv, showMenu } from "./main.js";
|
|
||||||
|
|
||||||
/*
|
|
||||||
Todo (Eddy) :
|
|
||||||
- ajouter un message de confirmation de création de compte et un message d'erreur
|
|
||||||
- une fleche pour revenir en arriere
|
|
||||||
- remettre sur l'ecran de login quand le compte est créé
|
|
||||||
- ajouter l'envoi d'un mail de confirmation
|
|
||||||
- Empecher les requetes de connexion si un champ est vide
|
|
||||||
- Ajouter un message d'erreur si le mail est invalide
|
|
||||||
- Connexion par 42
|
|
||||||
*/
|
|
||||||
|
|
||||||
let url42 = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-d9d6d46bd0be36dc13718981df4bfcf37e574ea364a07fcb5c39658be0f5706c&redirect_uri=http%3A%2F%2F127.0.0.1%3A5500%2Fsite%2F&response_type=code";
|
|
||||||
|
|
||||||
function createConnectDiv(divLogin)
|
|
||||||
{
|
|
||||||
const form = document.createElement("form");
|
|
||||||
const divConnect = document.createElement("div");
|
|
||||||
const inputLogin = document.createElement("input");
|
|
||||||
const inputPass = document.createElement("input");
|
|
||||||
const buttonLogin = createButton(inputLogin, inputPass);
|
|
||||||
const buttonConnect42 = document.createElement("button");
|
|
||||||
|
|
||||||
const mailText = document.createElement("p");
|
|
||||||
const passText = document.createElement("p");
|
|
||||||
const MainText = document.createElement("h1");
|
|
||||||
const newPlayerText = document.createElement("p");
|
|
||||||
const createAccText = document.createElement("p");
|
|
||||||
const newAccDiv = document.createElement("div");
|
|
||||||
const divCenter = document.createElement("div");
|
|
||||||
const orText = document.createElement("p");
|
|
||||||
|
|
||||||
addGlobalBg();
|
|
||||||
MainText.innerText = "Access to a new WORLD";
|
|
||||||
MainText.setAttribute("id", "mainText");
|
|
||||||
mailText.innerText = "Email";
|
|
||||||
passText.innerText = "Password";
|
|
||||||
newPlayerText.innerText = "New Player ?";
|
|
||||||
newPlayerText.setAttribute("id", "newPlayerText")
|
|
||||||
createAccText.innerText = "Create an account";
|
|
||||||
createAccText.setAttribute("id", "createAccText")
|
|
||||||
createAccText.addEventListener("mousedown", () => {
|
|
||||||
createButtonNewAcc(divConnect, divLogin);
|
|
||||||
});
|
|
||||||
newAccDiv.setAttribute("id", "newAccDiv");
|
|
||||||
divConnect.setAttribute("id", "connectDiv");
|
|
||||||
inputLogin.setAttribute("type", "text");
|
|
||||||
inputLogin.setAttribute("id", "inputLogin");
|
|
||||||
inputLogin.setAttribute("placeholder", "login");
|
|
||||||
inputLogin.setAttribute("autocomplete", "username");
|
|
||||||
inputPass.setAttribute("type", "password");
|
|
||||||
inputPass.setAttribute("id", "inputPassword");
|
|
||||||
inputPass.setAttribute("autocomplete", "current-password");
|
|
||||||
inputPass.setAttribute("placeholder", "password");
|
|
||||||
buttonLogin.innerHTML = "Login";
|
|
||||||
buttonLogin.setAttribute("id", "styleButton");
|
|
||||||
orText.innerText = "▬▬▬▬▬▬▬▬ ㅤ Or ㅤ ▬▬▬▬▬▬▬▬";
|
|
||||||
orText.setAttribute("id", "orText");
|
|
||||||
buttonConnect42.innerHTML = "Log with 42";
|
|
||||||
buttonConnect42.setAttribute("id", "styleButton42")
|
|
||||||
divConnect.appendChild(MainText);
|
|
||||||
form.appendChild(mailText);
|
|
||||||
form.appendChild(inputLogin);
|
|
||||||
form.appendChild(passText);
|
|
||||||
form.appendChild(inputPass);
|
|
||||||
form.appendChild(buttonLogin);
|
|
||||||
newAccDiv.appendChild(newPlayerText);
|
|
||||||
newAccDiv.appendChild(createAccText);
|
|
||||||
form.appendChild(newAccDiv);
|
|
||||||
form.appendChild(orText);
|
|
||||||
form.appendChild(buttonConnect42);
|
|
||||||
divCenter.appendChild(form);
|
|
||||||
divCenter.setAttribute("id", "divCenter");
|
|
||||||
divConnect.appendChild(divCenter);
|
|
||||||
form.addEventListener('submit', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
buttonLogin.click();
|
|
||||||
});
|
|
||||||
buttonConnect42.addEventListener('click', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
window.location.replace(url42);
|
|
||||||
});
|
|
||||||
return (divConnect);
|
|
||||||
}
|
|
||||||
|
|
||||||
function addGlobalBg()
|
|
||||||
{
|
|
||||||
const globalBg = document.createElement("div");
|
|
||||||
|
|
||||||
globalBg.setAttribute("id", "globalBg");
|
|
||||||
document.body.appendChild(globalBg);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function hashPassword(password)
|
|
||||||
{
|
|
||||||
const encoder = new TextEncoder();
|
|
||||||
const data = encoder.encode(password);
|
|
||||||
const hash = await crypto.subtle.digest('SHA-256', data);
|
|
||||||
const hashArray = Array.from(new Uint8Array(hash));
|
|
||||||
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
||||||
|
|
||||||
return (hashHex);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createButton(inputLogin, inputPass)
|
|
||||||
{
|
|
||||||
const loginButton = document.getElementById('loginButton');
|
|
||||||
const pLoginButton = loginButton.getElementsByTagName('p')[0];
|
|
||||||
const button = document.createElement("button");
|
|
||||||
let usernameNode = null;
|
|
||||||
let hashedPass = null;
|
|
||||||
|
|
||||||
button.addEventListener('click', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
hashPassword(inputPass.value).then((hash) => {
|
|
||||||
hashedPass = hash;
|
|
||||||
sendRequest("login", {type: "byPass", mail: inputLogin.value, password: hashedPass});
|
|
||||||
waitForLogin().then((token) => {
|
|
||||||
usernameNode = document.createTextNode(userMeInfo.username);
|
|
||||||
loginButton.replaceChild(usernameNode, pLoginButton);
|
|
||||||
CN.new("Connected successfully", "Welcome " + userMeInfo.username, CN.defaultIcon.success);
|
|
||||||
document.getElementById("loginDiv").remove();
|
|
||||||
document.getElementById("globalBg").remove();
|
|
||||||
document.cookie = "token={" + token + "}; path=/; Secure; SameSite=Strict; max-age=3600";
|
|
||||||
document.getElementById('loginButton').removeEventListener('click', showLoginDiv);
|
|
||||||
document.getElementById('loginButton').addEventListener('click', showMenu);
|
|
||||||
});
|
|
||||||
}).catch((err) => {
|
|
||||||
CN.new("Error", "An error occured while trying to connect", CN.defaultIcon.error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return (button);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createButtonNewAcc(divConnect, divLogin)
|
|
||||||
{
|
|
||||||
const newDiv = document.createElement("div");
|
|
||||||
const inputUsername = document.createElement("input");
|
|
||||||
const inputMail = document.createElement("input");
|
|
||||||
const inputPass = document.createElement("input");
|
|
||||||
const inputPass2 = document.createElement("input");
|
|
||||||
const buttonCreate = document.createElement("button");
|
|
||||||
const form = document.createElement("form");
|
|
||||||
|
|
||||||
newDiv.setAttribute("id", "connectDiv");
|
|
||||||
inputUsername.setAttribute("type", "text");
|
|
||||||
inputUsername.setAttribute("placeholder", "username");
|
|
||||||
inputUsername.setAttribute("autocomplete", "username");
|
|
||||||
inputMail.setAttribute("type", "text");
|
|
||||||
inputMail.setAttribute("placeholder", "mail");
|
|
||||||
inputMail.setAttribute("autocomplete", "email");
|
|
||||||
inputPass.setAttribute("type", "password");
|
|
||||||
inputPass.setAttribute("placeholder", "password");
|
|
||||||
inputPass.setAttribute("autocomplete", "new-password");
|
|
||||||
inputPass2.setAttribute("type", "password");
|
|
||||||
inputPass2.setAttribute("placeholder", "confirm password");
|
|
||||||
inputPass2.setAttribute("autocomplete", "new-password");
|
|
||||||
buttonCreate.innerHTML = "Create";
|
|
||||||
form.appendChild(inputMail);
|
|
||||||
form.appendChild(inputUsername);
|
|
||||||
form.appendChild(inputPass);
|
|
||||||
form.appendChild(inputPass2);
|
|
||||||
form.appendChild(buttonCreate);
|
|
||||||
newDiv.appendChild(form);
|
|
||||||
buttonCreate.addEventListener('click', createNewAccount);
|
|
||||||
form.addEventListener('submit', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
buttonCreate.click();
|
|
||||||
});
|
|
||||||
divConnect.remove();
|
|
||||||
divLogin.appendChild(newDiv);
|
|
||||||
}
|
|
||||||
|
|
||||||
function createNewAccount(e)
|
|
||||||
{
|
|
||||||
const inputMail = document.getElementsByTagName("input")[0];
|
|
||||||
const inputUsername = document.getElementsByTagName("input")[1];
|
|
||||||
const inputPass = document.getElementsByTagName("input")[2];
|
|
||||||
const inputPass2 = document.getElementsByTagName("input")[3];
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
if (inputMail.value.indexOf('@') === -1 || inputMail.value.indexOf('.') === -1)
|
|
||||||
{
|
|
||||||
console.log(inputMail.value);
|
|
||||||
CN.new("Error", "Invalid mail", CN.defaultIcon.error);
|
|
||||||
}
|
|
||||||
else if (inputUsername.value.length < 3)
|
|
||||||
CN.new("Error", "Username must be at least 3 characters long", CN.defaultIcon.error);
|
|
||||||
else if (inputUsername.value.length > 20)
|
|
||||||
CN.new("Error", "Username must be at most 20 characters long", CN.defaultIcon.error);
|
|
||||||
else if (inputUsername.value.search(' ') !== -1)
|
|
||||||
CN.new("Error", "Username must not contain spaces", CN.defaultIcon.error);
|
|
||||||
else if (inputUsername.value.search(/[^a-zA-Z0-9]/) !== -1)
|
|
||||||
CN.new("Error", "Username must contain only letters and numbers", CN.defaultIcon.error);
|
|
||||||
else if (inputPass.value.length < 8)
|
|
||||||
CN.new("Error", "Password must be at least 8 characters long", CN.defaultIcon.error);
|
|
||||||
else if (inputPass.value !== inputPass2.value)
|
|
||||||
CN.new("Error", "Passwords do not match", CN.defaultIcon.error);
|
|
||||||
else if (inputPass.value.search(/[a-z]/) === -1 || inputPass.value.search(/[A-Z]/) === -1 || inputPass.value.search(/[0-9]/) === -1)
|
|
||||||
CN.new("Error", "Password must contain at least one lowercase letter, one uppercase letter and one number", CN.defaultIcon.error);
|
|
||||||
else if (inputPass.value.search(inputUsername.value) !== -1)
|
|
||||||
CN.new("Error", "Password must not contain the username", CN.defaultIcon.error);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hashPassword(inputPass.value).then((hash) => {
|
|
||||||
sendRequest("create_account", {username: inputUsername.value, mail: inputMail.value, password: hash});
|
|
||||||
}).catch((err) => {
|
|
||||||
CN.new("Error", "An error occured while trying to create a new account", CN.defaultIcon.error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export { createConnectDiv };
|
|
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* main.js :+: :+: :+: */
|
/* main.js :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: marvin <marvin@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/30 13:50:35 by edbernar #+# #+# */
|
/* Created: 2024/07/30 13:50:35 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/23 23:36:33 by edbernar ### ########.fr */
|
/* Updated: 2024/08/24 11:57:47 by marvin ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
68
site/interface/site/node_modules/.vite/deps/_metadata.json
generated
vendored
68
site/interface/site/node_modules/.vite/deps/_metadata.json
generated
vendored
@ -1,77 +1,41 @@
|
|||||||
{
|
{
|
||||||
"hash": "86ff4072",
|
"hash": "44aef43e",
|
||||||
"configHash": "2420ea4a",
|
"configHash": "da99a08f",
|
||||||
"lockfileHash": "7685a2f8",
|
"lockfileHash": "7685a2f8",
|
||||||
"browserHash": "aad3db38",
|
"browserHash": "e0102bd3",
|
||||||
"optimized": {
|
"optimized": {
|
||||||
"three": {
|
"three": {
|
||||||
"src": "../../three/build/three.module.js",
|
"src": "../../three/build/three.module.js",
|
||||||
"file": "three.js",
|
"file": "three.js",
|
||||||
"fileHash": "f6b8584f",
|
"fileHash": "b1c96f0f",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"three/addons/loaders/GLTFLoader.js": {
|
"three/addons/loaders/GLTFLoader.js": {
|
||||||
"src": "../../three/examples/jsm/loaders/GLTFLoader.js",
|
"src": "../../three/examples/jsm/loaders/GLTFLoader.js",
|
||||||
"file": "three_addons_loaders_GLTFLoader__js.js",
|
"file": "three_addons_loaders_GLTFLoader__js.js",
|
||||||
"fileHash": "35494c7f",
|
"fileHash": "cfe30105",
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"three/examples/jsm/postprocessing/EffectComposer.js": {
|
|
||||||
"src": "../../three/examples/jsm/postprocessing/EffectComposer.js",
|
|
||||||
"file": "three_examples_jsm_postprocessing_EffectComposer__js.js",
|
|
||||||
"fileHash": "7753c0a1",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"three/examples/jsm/postprocessing/RenderPass.js": {
|
|
||||||
"src": "../../three/examples/jsm/postprocessing/RenderPass.js",
|
|
||||||
"file": "three_examples_jsm_postprocessing_RenderPass__js.js",
|
|
||||||
"fileHash": "1a306bae",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"three/examples/jsm/postprocessing/ShaderPass.js": {
|
|
||||||
"src": "../../three/examples/jsm/postprocessing/ShaderPass.js",
|
|
||||||
"file": "three_examples_jsm_postprocessing_ShaderPass__js.js",
|
|
||||||
"fileHash": "22bec74b",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"three/examples/jsm/postprocessing/UnrealBloomPass.js": {
|
|
||||||
"src": "../../three/examples/jsm/postprocessing/UnrealBloomPass.js",
|
|
||||||
"file": "three_examples_jsm_postprocessing_UnrealBloomPass__js.js",
|
|
||||||
"fileHash": "7a96d06c",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"three/examples/jsm/shaders/HorizontalBlurShader.js": {
|
|
||||||
"src": "../../three/examples/jsm/shaders/HorizontalBlurShader.js",
|
|
||||||
"file": "three_examples_jsm_shaders_HorizontalBlurShader__js.js",
|
|
||||||
"fileHash": "d8a23bdf",
|
|
||||||
"needsInterop": false
|
|
||||||
},
|
|
||||||
"three/examples/jsm/shaders/VerticalBlurShader.js": {
|
|
||||||
"src": "../../three/examples/jsm/shaders/VerticalBlurShader.js",
|
|
||||||
"file": "three_examples_jsm_shaders_VerticalBlurShader__js.js",
|
|
||||||
"fileHash": "fdb8cde0",
|
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"three/examples/jsm/postprocessing/BokehPass.js": {
|
"three/examples/jsm/postprocessing/BokehPass.js": {
|
||||||
"src": "../../three/examples/jsm/postprocessing/BokehPass.js",
|
"src": "../../three/examples/jsm/postprocessing/BokehPass.js",
|
||||||
"file": "three_examples_jsm_postprocessing_BokehPass__js.js",
|
"file": "three_examples_jsm_postprocessing_BokehPass__js.js",
|
||||||
"fileHash": "915505f2",
|
"fileHash": "99b44bd7",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
},
|
},
|
||||||
"three/examples/jsm/postprocessing/SSAOPass.js": {
|
"three/examples/jsm/postprocessing/EffectComposer.js": {
|
||||||
"src": "../../three/examples/jsm/postprocessing/SSAOPass.js",
|
"src": "../../three/examples/jsm/postprocessing/EffectComposer.js",
|
||||||
"file": "three_examples_jsm_postprocessing_SSAOPass__js.js",
|
"file": "three_examples_jsm_postprocessing_EffectComposer__js.js",
|
||||||
"fileHash": "3f06867f",
|
"fileHash": "113be6c6",
|
||||||
|
"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",
|
||||||
"needsInterop": false
|
"needsInterop": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chunks": {
|
"chunks": {
|
||||||
"chunk-D6CDVL7U": {
|
|
||||||
"file": "chunk-D6CDVL7U.js"
|
|
||||||
},
|
|
||||||
"chunk-OLTXGRDG": {
|
|
||||||
"file": "chunk-OLTXGRDG.js"
|
|
||||||
},
|
|
||||||
"chunk-JHQAMVLY": {
|
"chunk-JHQAMVLY": {
|
||||||
"file": "chunk-JHQAMVLY.js"
|
"file": "chunk-JHQAMVLY.js"
|
||||||
},
|
},
|
||||||
|
53
site/interface/site/node_modules/.vite/deps/chunk-D6CDVL7U.js
generated
vendored
53
site/interface/site/node_modules/.vite/deps/chunk-D6CDVL7U.js
generated
vendored
@ -1,53 +0,0 @@
|
|||||||
import {
|
|
||||||
FullScreenQuad,
|
|
||||||
Pass
|
|
||||||
} from "./chunk-JHQAMVLY.js";
|
|
||||||
import {
|
|
||||||
ShaderMaterial,
|
|
||||||
UniformsUtils
|
|
||||||
} from "./chunk-IS2ZBFBB.js";
|
|
||||||
|
|
||||||
// node_modules/three/examples/jsm/postprocessing/ShaderPass.js
|
|
||||||
var ShaderPass = class extends Pass {
|
|
||||||
constructor(shader, textureID) {
|
|
||||||
super();
|
|
||||||
this.textureID = textureID !== void 0 ? textureID : "tDiffuse";
|
|
||||||
if (shader instanceof ShaderMaterial) {
|
|
||||||
this.uniforms = shader.uniforms;
|
|
||||||
this.material = shader;
|
|
||||||
} else if (shader) {
|
|
||||||
this.uniforms = UniformsUtils.clone(shader.uniforms);
|
|
||||||
this.material = new ShaderMaterial({
|
|
||||||
name: shader.name !== void 0 ? shader.name : "unspecified",
|
|
||||||
defines: Object.assign({}, shader.defines),
|
|
||||||
uniforms: this.uniforms,
|
|
||||||
vertexShader: shader.vertexShader,
|
|
||||||
fragmentShader: shader.fragmentShader
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.fsQuad = new FullScreenQuad(this.material);
|
|
||||||
}
|
|
||||||
render(renderer, writeBuffer, readBuffer) {
|
|
||||||
if (this.uniforms[this.textureID]) {
|
|
||||||
this.uniforms[this.textureID].value = readBuffer.texture;
|
|
||||||
}
|
|
||||||
this.fsQuad.material = this.material;
|
|
||||||
if (this.renderToScreen) {
|
|
||||||
renderer.setRenderTarget(null);
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
} else {
|
|
||||||
renderer.setRenderTarget(writeBuffer);
|
|
||||||
if (this.clear) renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dispose() {
|
|
||||||
this.material.dispose();
|
|
||||||
this.fsQuad.dispose();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
ShaderPass
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=chunk-D6CDVL7U.js.map
|
|
7
site/interface/site/node_modules/.vite/deps/chunk-D6CDVL7U.js.map
generated
vendored
7
site/interface/site/node_modules/.vite/deps/chunk-D6CDVL7U.js.map
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../three/examples/jsm/postprocessing/ShaderPass.js"],
|
|
||||||
"sourcesContent": ["import {\n\tShaderMaterial,\n\tUniformsUtils\n} from 'three';\nimport { Pass, FullScreenQuad } from './Pass.js';\n\nclass ShaderPass extends Pass {\n\n\tconstructor( shader, textureID ) {\n\n\t\tsuper();\n\n\t\tthis.textureID = ( textureID !== undefined ) ? textureID : 'tDiffuse';\n\n\t\tif ( shader instanceof ShaderMaterial ) {\n\n\t\t\tthis.uniforms = shader.uniforms;\n\n\t\t\tthis.material = shader;\n\n\t\t} else if ( shader ) {\n\n\t\t\tthis.uniforms = UniformsUtils.clone( shader.uniforms );\n\n\t\t\tthis.material = new ShaderMaterial( {\n\n\t\t\t\tname: ( shader.name !== undefined ) ? shader.name : 'unspecified',\n\t\t\t\tdefines: Object.assign( {}, shader.defines ),\n\t\t\t\tuniforms: this.uniforms,\n\t\t\t\tvertexShader: shader.vertexShader,\n\t\t\t\tfragmentShader: shader.fragmentShader\n\n\t\t\t} );\n\n\t\t}\n\n\t\tthis.fsQuad = new FullScreenQuad( this.material );\n\n\t}\n\n\trender( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {\n\n\t\tif ( this.uniforms[ this.textureID ] ) {\n\n\t\t\tthis.uniforms[ this.textureID ].value = readBuffer.texture;\n\n\t\t}\n\n\t\tthis.fsQuad.material = this.material;\n\n\t\tif ( this.renderToScreen ) {\n\n\t\t\trenderer.setRenderTarget( null );\n\t\t\tthis.fsQuad.render( renderer );\n\n\t\t} else {\n\n\t\t\trenderer.setRenderTarget( writeBuffer );\n\t\t\t// TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600\n\t\t\tif ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );\n\t\t\tthis.fsQuad.render( renderer );\n\n\t\t}\n\n\t}\n\n\tdispose() {\n\n\t\tthis.material.dispose();\n\n\t\tthis.fsQuad.dispose();\n\n\t}\n\n}\n\nexport { ShaderPass };\n"],
|
|
||||||
"mappings": ";;;;;;;;;;AAMA,IAAM,aAAN,cAAyB,KAAK;AAAA,EAE7B,YAAa,QAAQ,WAAY;AAEhC,UAAM;AAEN,SAAK,YAAc,cAAc,SAAc,YAAY;AAE3D,QAAK,kBAAkB,gBAAiB;AAEvC,WAAK,WAAW,OAAO;AAEvB,WAAK,WAAW;AAAA,IAEjB,WAAY,QAAS;AAEpB,WAAK,WAAW,cAAc,MAAO,OAAO,QAAS;AAErD,WAAK,WAAW,IAAI,eAAgB;AAAA,QAEnC,MAAQ,OAAO,SAAS,SAAc,OAAO,OAAO;AAAA,QACpD,SAAS,OAAO,OAAQ,CAAC,GAAG,OAAO,OAAQ;AAAA,QAC3C,UAAU,KAAK;AAAA,QACf,cAAc,OAAO;AAAA,QACrB,gBAAgB,OAAO;AAAA,MAExB,CAAE;AAAA,IAEH;AAEA,SAAK,SAAS,IAAI,eAAgB,KAAK,QAAS;AAAA,EAEjD;AAAA,EAEA,OAAQ,UAAU,aAAa,YAA0C;AAExE,QAAK,KAAK,SAAU,KAAK,SAAU,GAAI;AAEtC,WAAK,SAAU,KAAK,SAAU,EAAE,QAAQ,WAAW;AAAA,IAEpD;AAEA,SAAK,OAAO,WAAW,KAAK;AAE5B,QAAK,KAAK,gBAAiB;AAE1B,eAAS,gBAAiB,IAAK;AAC/B,WAAK,OAAO,OAAQ,QAAS;AAAA,IAE9B,OAAO;AAEN,eAAS,gBAAiB,WAAY;AAEtC,UAAK,KAAK,MAAQ,UAAS,MAAO,SAAS,gBAAgB,SAAS,gBAAgB,SAAS,gBAAiB;AAC9G,WAAK,OAAO,OAAQ,QAAS;AAAA,IAE9B;AAAA,EAED;AAAA,EAEA,UAAU;AAET,SAAK,SAAS,QAAQ;AAEtB,SAAK,OAAO,QAAQ;AAAA,EAErB;AAED;",
|
|
||||||
"names": []
|
|
||||||
}
|
|
44
site/interface/site/node_modules/.vite/deps/chunk-OLTXGRDG.js
generated
vendored
44
site/interface/site/node_modules/.vite/deps/chunk-OLTXGRDG.js
generated
vendored
@ -1,44 +0,0 @@
|
|||||||
// node_modules/three/examples/jsm/shaders/CopyShader.js
|
|
||||||
var CopyShader = {
|
|
||||||
name: "CopyShader",
|
|
||||||
uniforms: {
|
|
||||||
"tDiffuse": { value: null },
|
|
||||||
"opacity": { value: 1 }
|
|
||||||
},
|
|
||||||
vertexShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vUv = uv;
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
|
|
||||||
}`
|
|
||||||
),
|
|
||||||
fragmentShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
uniform float opacity;
|
|
||||||
|
|
||||||
uniform sampler2D tDiffuse;
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec4 texel = texture2D( tDiffuse, vUv );
|
|
||||||
gl_FragColor = opacity * texel;
|
|
||||||
|
|
||||||
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
CopyShader
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=chunk-OLTXGRDG.js.map
|
|
7
site/interface/site/node_modules/.vite/deps/chunk-OLTXGRDG.js.map
generated
vendored
7
site/interface/site/node_modules/.vite/deps/chunk-OLTXGRDG.js.map
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../three/examples/jsm/shaders/CopyShader.js"],
|
|
||||||
"sourcesContent": ["/**\n * Full-screen textured quad shader\n */\n\nconst CopyShader = {\n\n\tname: 'CopyShader',\n\n\tuniforms: {\n\n\t\t'tDiffuse': { value: null },\n\t\t'opacity': { value: 1.0 }\n\n\t},\n\n\tvertexShader: /* glsl */`\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n\tfragmentShader: /* glsl */`\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}`\n\n};\n\nexport { CopyShader };\n"],
|
|
||||||
"mappings": ";AAIA,IAAM,aAAa;AAAA,EAElB,MAAM;AAAA,EAEN,UAAU;AAAA,IAET,YAAY,EAAE,OAAO,KAAK;AAAA,IAC1B,WAAW,EAAE,OAAO,EAAI;AAAA,EAEzB;AAAA,EAEA;AAAA;AAAA,IAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWxB;AAAA;AAAA,IAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgB3B;",
|
|
||||||
"names": []
|
|
||||||
}
|
|
@ -1,20 +1,97 @@
|
|||||||
import {
|
import {
|
||||||
ShaderPass
|
FullScreenQuad,
|
||||||
} from "./chunk-D6CDVL7U.js";
|
|
||||||
import {
|
|
||||||
CopyShader
|
|
||||||
} from "./chunk-OLTXGRDG.js";
|
|
||||||
import {
|
|
||||||
Pass
|
Pass
|
||||||
} from "./chunk-JHQAMVLY.js";
|
} from "./chunk-JHQAMVLY.js";
|
||||||
import {
|
import {
|
||||||
Clock,
|
Clock,
|
||||||
HalfFloatType,
|
HalfFloatType,
|
||||||
NoBlending,
|
NoBlending,
|
||||||
|
ShaderMaterial,
|
||||||
|
UniformsUtils,
|
||||||
Vector2,
|
Vector2,
|
||||||
WebGLRenderTarget
|
WebGLRenderTarget
|
||||||
} from "./chunk-IS2ZBFBB.js";
|
} from "./chunk-IS2ZBFBB.js";
|
||||||
|
|
||||||
|
// node_modules/three/examples/jsm/shaders/CopyShader.js
|
||||||
|
var CopyShader = {
|
||||||
|
name: "CopyShader",
|
||||||
|
uniforms: {
|
||||||
|
"tDiffuse": { value: null },
|
||||||
|
"opacity": { value: 1 }
|
||||||
|
},
|
||||||
|
vertexShader: (
|
||||||
|
/* glsl */
|
||||||
|
`
|
||||||
|
|
||||||
|
varying vec2 vUv;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
vUv = uv;
|
||||||
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||||||
|
|
||||||
|
}`
|
||||||
|
),
|
||||||
|
fragmentShader: (
|
||||||
|
/* glsl */
|
||||||
|
`
|
||||||
|
|
||||||
|
uniform float opacity;
|
||||||
|
|
||||||
|
uniform sampler2D tDiffuse;
|
||||||
|
|
||||||
|
varying vec2 vUv;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
vec4 texel = texture2D( tDiffuse, vUv );
|
||||||
|
gl_FragColor = opacity * texel;
|
||||||
|
|
||||||
|
|
||||||
|
}`
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
// node_modules/three/examples/jsm/postprocessing/ShaderPass.js
|
||||||
|
var ShaderPass = class extends Pass {
|
||||||
|
constructor(shader, textureID) {
|
||||||
|
super();
|
||||||
|
this.textureID = textureID !== void 0 ? textureID : "tDiffuse";
|
||||||
|
if (shader instanceof ShaderMaterial) {
|
||||||
|
this.uniforms = shader.uniforms;
|
||||||
|
this.material = shader;
|
||||||
|
} else if (shader) {
|
||||||
|
this.uniforms = UniformsUtils.clone(shader.uniforms);
|
||||||
|
this.material = new ShaderMaterial({
|
||||||
|
name: shader.name !== void 0 ? shader.name : "unspecified",
|
||||||
|
defines: Object.assign({}, shader.defines),
|
||||||
|
uniforms: this.uniforms,
|
||||||
|
vertexShader: shader.vertexShader,
|
||||||
|
fragmentShader: shader.fragmentShader
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.fsQuad = new FullScreenQuad(this.material);
|
||||||
|
}
|
||||||
|
render(renderer, writeBuffer, readBuffer) {
|
||||||
|
if (this.uniforms[this.textureID]) {
|
||||||
|
this.uniforms[this.textureID].value = readBuffer.texture;
|
||||||
|
}
|
||||||
|
this.fsQuad.material = this.material;
|
||||||
|
if (this.renderToScreen) {
|
||||||
|
renderer.setRenderTarget(null);
|
||||||
|
this.fsQuad.render(renderer);
|
||||||
|
} else {
|
||||||
|
renderer.setRenderTarget(writeBuffer);
|
||||||
|
if (this.clear) renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
|
||||||
|
this.fsQuad.render(renderer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispose() {
|
||||||
|
this.material.dispose();
|
||||||
|
this.fsQuad.dispose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// node_modules/three/examples/jsm/postprocessing/MaskPass.js
|
// node_modules/three/examples/jsm/postprocessing/MaskPass.js
|
||||||
var MaskPass = class extends Pass {
|
var MaskPass = class extends Pass {
|
||||||
constructor(scene, camera) {
|
constructor(scene, camera) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,938 +0,0 @@
|
|||||||
import {
|
|
||||||
CopyShader
|
|
||||||
} from "./chunk-OLTXGRDG.js";
|
|
||||||
import {
|
|
||||||
FullScreenQuad,
|
|
||||||
Pass
|
|
||||||
} from "./chunk-JHQAMVLY.js";
|
|
||||||
import {
|
|
||||||
AddEquation,
|
|
||||||
Color,
|
|
||||||
CustomBlending,
|
|
||||||
DataTexture,
|
|
||||||
DepthStencilFormat,
|
|
||||||
DepthTexture,
|
|
||||||
DstAlphaFactor,
|
|
||||||
DstColorFactor,
|
|
||||||
FloatType,
|
|
||||||
HalfFloatType,
|
|
||||||
MathUtils,
|
|
||||||
Matrix4,
|
|
||||||
MeshNormalMaterial,
|
|
||||||
NearestFilter,
|
|
||||||
NoBlending,
|
|
||||||
RedFormat,
|
|
||||||
RepeatWrapping,
|
|
||||||
ShaderMaterial,
|
|
||||||
UniformsUtils,
|
|
||||||
UnsignedInt248Type,
|
|
||||||
Vector2,
|
|
||||||
Vector3,
|
|
||||||
WebGLRenderTarget,
|
|
||||||
ZeroFactor
|
|
||||||
} from "./chunk-IS2ZBFBB.js";
|
|
||||||
|
|
||||||
// node_modules/three/examples/jsm/math/SimplexNoise.js
|
|
||||||
var SimplexNoise = class {
|
|
||||||
constructor(r = Math) {
|
|
||||||
this.grad3 = [
|
|
||||||
[1, 1, 0],
|
|
||||||
[-1, 1, 0],
|
|
||||||
[1, -1, 0],
|
|
||||||
[-1, -1, 0],
|
|
||||||
[1, 0, 1],
|
|
||||||
[-1, 0, 1],
|
|
||||||
[1, 0, -1],
|
|
||||||
[-1, 0, -1],
|
|
||||||
[0, 1, 1],
|
|
||||||
[0, -1, 1],
|
|
||||||
[0, 1, -1],
|
|
||||||
[0, -1, -1]
|
|
||||||
];
|
|
||||||
this.grad4 = [
|
|
||||||
[0, 1, 1, 1],
|
|
||||||
[0, 1, 1, -1],
|
|
||||||
[0, 1, -1, 1],
|
|
||||||
[0, 1, -1, -1],
|
|
||||||
[0, -1, 1, 1],
|
|
||||||
[0, -1, 1, -1],
|
|
||||||
[0, -1, -1, 1],
|
|
||||||
[0, -1, -1, -1],
|
|
||||||
[1, 0, 1, 1],
|
|
||||||
[1, 0, 1, -1],
|
|
||||||
[1, 0, -1, 1],
|
|
||||||
[1, 0, -1, -1],
|
|
||||||
[-1, 0, 1, 1],
|
|
||||||
[-1, 0, 1, -1],
|
|
||||||
[-1, 0, -1, 1],
|
|
||||||
[-1, 0, -1, -1],
|
|
||||||
[1, 1, 0, 1],
|
|
||||||
[1, 1, 0, -1],
|
|
||||||
[1, -1, 0, 1],
|
|
||||||
[1, -1, 0, -1],
|
|
||||||
[-1, 1, 0, 1],
|
|
||||||
[-1, 1, 0, -1],
|
|
||||||
[-1, -1, 0, 1],
|
|
||||||
[-1, -1, 0, -1],
|
|
||||||
[1, 1, 1, 0],
|
|
||||||
[1, 1, -1, 0],
|
|
||||||
[1, -1, 1, 0],
|
|
||||||
[1, -1, -1, 0],
|
|
||||||
[-1, 1, 1, 0],
|
|
||||||
[-1, 1, -1, 0],
|
|
||||||
[-1, -1, 1, 0],
|
|
||||||
[-1, -1, -1, 0]
|
|
||||||
];
|
|
||||||
this.p = [];
|
|
||||||
for (let i = 0; i < 256; i++) {
|
|
||||||
this.p[i] = Math.floor(r.random() * 256);
|
|
||||||
}
|
|
||||||
this.perm = [];
|
|
||||||
for (let i = 0; i < 512; i++) {
|
|
||||||
this.perm[i] = this.p[i & 255];
|
|
||||||
}
|
|
||||||
this.simplex = [
|
|
||||||
[0, 1, 2, 3],
|
|
||||||
[0, 1, 3, 2],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 2, 3, 1],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[1, 2, 3, 0],
|
|
||||||
[0, 2, 1, 3],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 3, 1, 2],
|
|
||||||
[0, 3, 2, 1],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[1, 3, 2, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[1, 2, 0, 3],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[1, 3, 0, 2],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[2, 3, 0, 1],
|
|
||||||
[2, 3, 1, 0],
|
|
||||||
[1, 0, 2, 3],
|
|
||||||
[1, 0, 3, 2],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[2, 0, 3, 1],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[2, 1, 3, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[2, 0, 1, 3],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[3, 0, 1, 2],
|
|
||||||
[3, 0, 2, 1],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[3, 1, 2, 0],
|
|
||||||
[2, 1, 0, 3],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[3, 1, 0, 2],
|
|
||||||
[0, 0, 0, 0],
|
|
||||||
[3, 2, 0, 1],
|
|
||||||
[3, 2, 1, 0]
|
|
||||||
];
|
|
||||||
}
|
|
||||||
dot(g, x, y) {
|
|
||||||
return g[0] * x + g[1] * y;
|
|
||||||
}
|
|
||||||
dot3(g, x, y, z) {
|
|
||||||
return g[0] * x + g[1] * y + g[2] * z;
|
|
||||||
}
|
|
||||||
dot4(g, x, y, z, w) {
|
|
||||||
return g[0] * x + g[1] * y + g[2] * z + g[3] * w;
|
|
||||||
}
|
|
||||||
noise(xin, yin) {
|
|
||||||
let n0;
|
|
||||||
let n1;
|
|
||||||
let n2;
|
|
||||||
const F2 = 0.5 * (Math.sqrt(3) - 1);
|
|
||||||
const s = (xin + yin) * F2;
|
|
||||||
const i = Math.floor(xin + s);
|
|
||||||
const j = Math.floor(yin + s);
|
|
||||||
const G2 = (3 - Math.sqrt(3)) / 6;
|
|
||||||
const t = (i + j) * G2;
|
|
||||||
const X0 = i - t;
|
|
||||||
const Y0 = j - t;
|
|
||||||
const x0 = xin - X0;
|
|
||||||
const y0 = yin - Y0;
|
|
||||||
let i1;
|
|
||||||
let j1;
|
|
||||||
if (x0 > y0) {
|
|
||||||
i1 = 1;
|
|
||||||
j1 = 0;
|
|
||||||
} else {
|
|
||||||
i1 = 0;
|
|
||||||
j1 = 1;
|
|
||||||
}
|
|
||||||
const x1 = x0 - i1 + G2;
|
|
||||||
const y1 = y0 - j1 + G2;
|
|
||||||
const x2 = x0 - 1 + 2 * G2;
|
|
||||||
const y2 = y0 - 1 + 2 * G2;
|
|
||||||
const ii = i & 255;
|
|
||||||
const jj = j & 255;
|
|
||||||
const gi0 = this.perm[ii + this.perm[jj]] % 12;
|
|
||||||
const gi1 = this.perm[ii + i1 + this.perm[jj + j1]] % 12;
|
|
||||||
const gi2 = this.perm[ii + 1 + this.perm[jj + 1]] % 12;
|
|
||||||
let t0 = 0.5 - x0 * x0 - y0 * y0;
|
|
||||||
if (t0 < 0) n0 = 0;
|
|
||||||
else {
|
|
||||||
t0 *= t0;
|
|
||||||
n0 = t0 * t0 * this.dot(this.grad3[gi0], x0, y0);
|
|
||||||
}
|
|
||||||
let t1 = 0.5 - x1 * x1 - y1 * y1;
|
|
||||||
if (t1 < 0) n1 = 0;
|
|
||||||
else {
|
|
||||||
t1 *= t1;
|
|
||||||
n1 = t1 * t1 * this.dot(this.grad3[gi1], x1, y1);
|
|
||||||
}
|
|
||||||
let t2 = 0.5 - x2 * x2 - y2 * y2;
|
|
||||||
if (t2 < 0) n2 = 0;
|
|
||||||
else {
|
|
||||||
t2 *= t2;
|
|
||||||
n2 = t2 * t2 * this.dot(this.grad3[gi2], x2, y2);
|
|
||||||
}
|
|
||||||
return 70 * (n0 + n1 + n2);
|
|
||||||
}
|
|
||||||
// 3D simplex noise
|
|
||||||
noise3d(xin, yin, zin) {
|
|
||||||
let n0;
|
|
||||||
let n1;
|
|
||||||
let n2;
|
|
||||||
let n3;
|
|
||||||
const F3 = 1 / 3;
|
|
||||||
const s = (xin + yin + zin) * F3;
|
|
||||||
const i = Math.floor(xin + s);
|
|
||||||
const j = Math.floor(yin + s);
|
|
||||||
const k = Math.floor(zin + s);
|
|
||||||
const G3 = 1 / 6;
|
|
||||||
const t = (i + j + k) * G3;
|
|
||||||
const X0 = i - t;
|
|
||||||
const Y0 = j - t;
|
|
||||||
const Z0 = k - t;
|
|
||||||
const x0 = xin - X0;
|
|
||||||
const y0 = yin - Y0;
|
|
||||||
const z0 = zin - Z0;
|
|
||||||
let i1;
|
|
||||||
let j1;
|
|
||||||
let k1;
|
|
||||||
let i2;
|
|
||||||
let j2;
|
|
||||||
let k2;
|
|
||||||
if (x0 >= y0) {
|
|
||||||
if (y0 >= z0) {
|
|
||||||
i1 = 1;
|
|
||||||
j1 = 0;
|
|
||||||
k1 = 0;
|
|
||||||
i2 = 1;
|
|
||||||
j2 = 1;
|
|
||||||
k2 = 0;
|
|
||||||
} else if (x0 >= z0) {
|
|
||||||
i1 = 1;
|
|
||||||
j1 = 0;
|
|
||||||
k1 = 0;
|
|
||||||
i2 = 1;
|
|
||||||
j2 = 0;
|
|
||||||
k2 = 1;
|
|
||||||
} else {
|
|
||||||
i1 = 0;
|
|
||||||
j1 = 0;
|
|
||||||
k1 = 1;
|
|
||||||
i2 = 1;
|
|
||||||
j2 = 0;
|
|
||||||
k2 = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (y0 < z0) {
|
|
||||||
i1 = 0;
|
|
||||||
j1 = 0;
|
|
||||||
k1 = 1;
|
|
||||||
i2 = 0;
|
|
||||||
j2 = 1;
|
|
||||||
k2 = 1;
|
|
||||||
} else if (x0 < z0) {
|
|
||||||
i1 = 0;
|
|
||||||
j1 = 1;
|
|
||||||
k1 = 0;
|
|
||||||
i2 = 0;
|
|
||||||
j2 = 1;
|
|
||||||
k2 = 1;
|
|
||||||
} else {
|
|
||||||
i1 = 0;
|
|
||||||
j1 = 1;
|
|
||||||
k1 = 0;
|
|
||||||
i2 = 1;
|
|
||||||
j2 = 1;
|
|
||||||
k2 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const x1 = x0 - i1 + G3;
|
|
||||||
const y1 = y0 - j1 + G3;
|
|
||||||
const z1 = z0 - k1 + G3;
|
|
||||||
const x2 = x0 - i2 + 2 * G3;
|
|
||||||
const y2 = y0 - j2 + 2 * G3;
|
|
||||||
const z2 = z0 - k2 + 2 * G3;
|
|
||||||
const x3 = x0 - 1 + 3 * G3;
|
|
||||||
const y3 = y0 - 1 + 3 * G3;
|
|
||||||
const z3 = z0 - 1 + 3 * G3;
|
|
||||||
const ii = i & 255;
|
|
||||||
const jj = j & 255;
|
|
||||||
const kk = k & 255;
|
|
||||||
const gi0 = this.perm[ii + this.perm[jj + this.perm[kk]]] % 12;
|
|
||||||
const gi1 = this.perm[ii + i1 + this.perm[jj + j1 + this.perm[kk + k1]]] % 12;
|
|
||||||
const gi2 = this.perm[ii + i2 + this.perm[jj + j2 + this.perm[kk + k2]]] % 12;
|
|
||||||
const gi3 = this.perm[ii + 1 + this.perm[jj + 1 + this.perm[kk + 1]]] % 12;
|
|
||||||
let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0;
|
|
||||||
if (t0 < 0) n0 = 0;
|
|
||||||
else {
|
|
||||||
t0 *= t0;
|
|
||||||
n0 = t0 * t0 * this.dot3(this.grad3[gi0], x0, y0, z0);
|
|
||||||
}
|
|
||||||
let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1;
|
|
||||||
if (t1 < 0) n1 = 0;
|
|
||||||
else {
|
|
||||||
t1 *= t1;
|
|
||||||
n1 = t1 * t1 * this.dot3(this.grad3[gi1], x1, y1, z1);
|
|
||||||
}
|
|
||||||
let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2;
|
|
||||||
if (t2 < 0) n2 = 0;
|
|
||||||
else {
|
|
||||||
t2 *= t2;
|
|
||||||
n2 = t2 * t2 * this.dot3(this.grad3[gi2], x2, y2, z2);
|
|
||||||
}
|
|
||||||
let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3;
|
|
||||||
if (t3 < 0) n3 = 0;
|
|
||||||
else {
|
|
||||||
t3 *= t3;
|
|
||||||
n3 = t3 * t3 * this.dot3(this.grad3[gi3], x3, y3, z3);
|
|
||||||
}
|
|
||||||
return 32 * (n0 + n1 + n2 + n3);
|
|
||||||
}
|
|
||||||
// 4D simplex noise
|
|
||||||
noise4d(x, y, z, w) {
|
|
||||||
const grad4 = this.grad4;
|
|
||||||
const simplex = this.simplex;
|
|
||||||
const perm = this.perm;
|
|
||||||
const F4 = (Math.sqrt(5) - 1) / 4;
|
|
||||||
const G4 = (5 - Math.sqrt(5)) / 20;
|
|
||||||
let n0;
|
|
||||||
let n1;
|
|
||||||
let n2;
|
|
||||||
let n3;
|
|
||||||
let n4;
|
|
||||||
const s = (x + y + z + w) * F4;
|
|
||||||
const i = Math.floor(x + s);
|
|
||||||
const j = Math.floor(y + s);
|
|
||||||
const k = Math.floor(z + s);
|
|
||||||
const l = Math.floor(w + s);
|
|
||||||
const t = (i + j + k + l) * G4;
|
|
||||||
const X0 = i - t;
|
|
||||||
const Y0 = j - t;
|
|
||||||
const Z0 = k - t;
|
|
||||||
const W0 = l - t;
|
|
||||||
const x0 = x - X0;
|
|
||||||
const y0 = y - Y0;
|
|
||||||
const z0 = z - Z0;
|
|
||||||
const w0 = w - W0;
|
|
||||||
const c1 = x0 > y0 ? 32 : 0;
|
|
||||||
const c2 = x0 > z0 ? 16 : 0;
|
|
||||||
const c3 = y0 > z0 ? 8 : 0;
|
|
||||||
const c4 = x0 > w0 ? 4 : 0;
|
|
||||||
const c5 = y0 > w0 ? 2 : 0;
|
|
||||||
const c6 = z0 > w0 ? 1 : 0;
|
|
||||||
const c = c1 + c2 + c3 + c4 + c5 + c6;
|
|
||||||
const i1 = simplex[c][0] >= 3 ? 1 : 0;
|
|
||||||
const j1 = simplex[c][1] >= 3 ? 1 : 0;
|
|
||||||
const k1 = simplex[c][2] >= 3 ? 1 : 0;
|
|
||||||
const l1 = simplex[c][3] >= 3 ? 1 : 0;
|
|
||||||
const i2 = simplex[c][0] >= 2 ? 1 : 0;
|
|
||||||
const j2 = simplex[c][1] >= 2 ? 1 : 0;
|
|
||||||
const k2 = simplex[c][2] >= 2 ? 1 : 0;
|
|
||||||
const l2 = simplex[c][3] >= 2 ? 1 : 0;
|
|
||||||
const i3 = simplex[c][0] >= 1 ? 1 : 0;
|
|
||||||
const j3 = simplex[c][1] >= 1 ? 1 : 0;
|
|
||||||
const k3 = simplex[c][2] >= 1 ? 1 : 0;
|
|
||||||
const l3 = simplex[c][3] >= 1 ? 1 : 0;
|
|
||||||
const x1 = x0 - i1 + G4;
|
|
||||||
const y1 = y0 - j1 + G4;
|
|
||||||
const z1 = z0 - k1 + G4;
|
|
||||||
const w1 = w0 - l1 + G4;
|
|
||||||
const x2 = x0 - i2 + 2 * G4;
|
|
||||||
const y2 = y0 - j2 + 2 * G4;
|
|
||||||
const z2 = z0 - k2 + 2 * G4;
|
|
||||||
const w2 = w0 - l2 + 2 * G4;
|
|
||||||
const x3 = x0 - i3 + 3 * G4;
|
|
||||||
const y3 = y0 - j3 + 3 * G4;
|
|
||||||
const z3 = z0 - k3 + 3 * G4;
|
|
||||||
const w3 = w0 - l3 + 3 * G4;
|
|
||||||
const x4 = x0 - 1 + 4 * G4;
|
|
||||||
const y4 = y0 - 1 + 4 * G4;
|
|
||||||
const z4 = z0 - 1 + 4 * G4;
|
|
||||||
const w4 = w0 - 1 + 4 * G4;
|
|
||||||
const ii = i & 255;
|
|
||||||
const jj = j & 255;
|
|
||||||
const kk = k & 255;
|
|
||||||
const ll = l & 255;
|
|
||||||
const gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32;
|
|
||||||
const gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32;
|
|
||||||
const gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32;
|
|
||||||
const gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32;
|
|
||||||
const gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32;
|
|
||||||
let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
|
|
||||||
if (t0 < 0) n0 = 0;
|
|
||||||
else {
|
|
||||||
t0 *= t0;
|
|
||||||
n0 = t0 * t0 * this.dot4(grad4[gi0], x0, y0, z0, w0);
|
|
||||||
}
|
|
||||||
let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
|
|
||||||
if (t1 < 0) n1 = 0;
|
|
||||||
else {
|
|
||||||
t1 *= t1;
|
|
||||||
n1 = t1 * t1 * this.dot4(grad4[gi1], x1, y1, z1, w1);
|
|
||||||
}
|
|
||||||
let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
|
|
||||||
if (t2 < 0) n2 = 0;
|
|
||||||
else {
|
|
||||||
t2 *= t2;
|
|
||||||
n2 = t2 * t2 * this.dot4(grad4[gi2], x2, y2, z2, w2);
|
|
||||||
}
|
|
||||||
let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
|
|
||||||
if (t3 < 0) n3 = 0;
|
|
||||||
else {
|
|
||||||
t3 *= t3;
|
|
||||||
n3 = t3 * t3 * this.dot4(grad4[gi3], x3, y3, z3, w3);
|
|
||||||
}
|
|
||||||
let t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
|
|
||||||
if (t4 < 0) n4 = 0;
|
|
||||||
else {
|
|
||||||
t4 *= t4;
|
|
||||||
n4 = t4 * t4 * this.dot4(grad4[gi4], x4, y4, z4, w4);
|
|
||||||
}
|
|
||||||
return 27 * (n0 + n1 + n2 + n3 + n4);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// node_modules/three/examples/jsm/shaders/SSAOShader.js
|
|
||||||
var SSAOShader = {
|
|
||||||
name: "SSAOShader",
|
|
||||||
defines: {
|
|
||||||
"PERSPECTIVE_CAMERA": 1,
|
|
||||||
"KERNEL_SIZE": 32
|
|
||||||
},
|
|
||||||
uniforms: {
|
|
||||||
"tNormal": { value: null },
|
|
||||||
"tDepth": { value: null },
|
|
||||||
"tNoise": { value: null },
|
|
||||||
"kernel": { value: null },
|
|
||||||
"cameraNear": { value: null },
|
|
||||||
"cameraFar": { value: null },
|
|
||||||
"resolution": { value: new Vector2() },
|
|
||||||
"cameraProjectionMatrix": { value: new Matrix4() },
|
|
||||||
"cameraInverseProjectionMatrix": { value: new Matrix4() },
|
|
||||||
"kernelRadius": { value: 8 },
|
|
||||||
"minDistance": { value: 5e-3 },
|
|
||||||
"maxDistance": { value: 0.05 }
|
|
||||||
},
|
|
||||||
vertexShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vUv = uv;
|
|
||||||
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
|
|
||||||
}`
|
|
||||||
),
|
|
||||||
fragmentShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
uniform highp sampler2D tNormal;
|
|
||||||
uniform highp sampler2D tDepth;
|
|
||||||
uniform sampler2D tNoise;
|
|
||||||
|
|
||||||
uniform vec3 kernel[ KERNEL_SIZE ];
|
|
||||||
|
|
||||||
uniform vec2 resolution;
|
|
||||||
|
|
||||||
uniform float cameraNear;
|
|
||||||
uniform float cameraFar;
|
|
||||||
uniform mat4 cameraProjectionMatrix;
|
|
||||||
uniform mat4 cameraInverseProjectionMatrix;
|
|
||||||
|
|
||||||
uniform float kernelRadius;
|
|
||||||
uniform float minDistance; // avoid artifacts caused by neighbour fragments with minimal depth difference
|
|
||||||
uniform float maxDistance; // avoid the influence of fragments which are too far away
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
#include <packing>
|
|
||||||
|
|
||||||
float getDepth( const in vec2 screenPosition ) {
|
|
||||||
|
|
||||||
return texture2D( tDepth, screenPosition ).x;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
float getLinearDepth( const in vec2 screenPosition ) {
|
|
||||||
|
|
||||||
#if PERSPECTIVE_CAMERA == 1
|
|
||||||
|
|
||||||
float fragCoordZ = texture2D( tDepth, screenPosition ).x;
|
|
||||||
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
|
|
||||||
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return texture2D( tDepth, screenPosition ).x;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
float getViewZ( const in float depth ) {
|
|
||||||
|
|
||||||
#if PERSPECTIVE_CAMERA == 1
|
|
||||||
|
|
||||||
return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {
|
|
||||||
|
|
||||||
float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];
|
|
||||||
|
|
||||||
vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );
|
|
||||||
|
|
||||||
clipPosition *= clipW; // unprojection.
|
|
||||||
|
|
||||||
return ( cameraInverseProjectionMatrix * clipPosition ).xyz;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 getViewNormal( const in vec2 screenPosition ) {
|
|
||||||
|
|
||||||
return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
float depth = getDepth( vUv );
|
|
||||||
|
|
||||||
if ( depth == 1.0 ) {
|
|
||||||
|
|
||||||
gl_FragColor = vec4( 1.0 ); // don't influence background
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
float viewZ = getViewZ( depth );
|
|
||||||
|
|
||||||
vec3 viewPosition = getViewPosition( vUv, depth, viewZ );
|
|
||||||
vec3 viewNormal = getViewNormal( vUv );
|
|
||||||
|
|
||||||
vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );
|
|
||||||
vec3 random = vec3( texture2D( tNoise, vUv * noiseScale ).r );
|
|
||||||
|
|
||||||
// compute matrix used to reorient a kernel vector
|
|
||||||
|
|
||||||
vec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );
|
|
||||||
vec3 bitangent = cross( viewNormal, tangent );
|
|
||||||
mat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );
|
|
||||||
|
|
||||||
float occlusion = 0.0;
|
|
||||||
|
|
||||||
for ( int i = 0; i < KERNEL_SIZE; i ++ ) {
|
|
||||||
|
|
||||||
vec3 sampleVector = kernelMatrix * kernel[ i ]; // reorient sample vector in view space
|
|
||||||
vec3 samplePoint = viewPosition + ( sampleVector * kernelRadius ); // calculate sample point
|
|
||||||
|
|
||||||
vec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 ); // project point and calculate NDC
|
|
||||||
samplePointNDC /= samplePointNDC.w;
|
|
||||||
|
|
||||||
vec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5; // compute uv coordinates
|
|
||||||
|
|
||||||
float realDepth = getLinearDepth( samplePointUv ); // get linear depth from depth texture
|
|
||||||
float sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar ); // compute linear depth of the sample view Z value
|
|
||||||
float delta = sampleDepth - realDepth;
|
|
||||||
|
|
||||||
if ( delta > minDistance && delta < maxDistance ) { // if fragment is before sample point, increase occlusion
|
|
||||||
|
|
||||||
occlusion += 1.0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
occlusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );
|
|
||||||
|
|
||||||
gl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
};
|
|
||||||
var SSAODepthShader = {
|
|
||||||
name: "SSAODepthShader",
|
|
||||||
defines: {
|
|
||||||
"PERSPECTIVE_CAMERA": 1
|
|
||||||
},
|
|
||||||
uniforms: {
|
|
||||||
"tDepth": { value: null },
|
|
||||||
"cameraNear": { value: null },
|
|
||||||
"cameraFar": { value: null }
|
|
||||||
},
|
|
||||||
vertexShader: `varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vUv = uv;
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
|
|
||||||
}`,
|
|
||||||
fragmentShader: `uniform sampler2D tDepth;
|
|
||||||
|
|
||||||
uniform float cameraNear;
|
|
||||||
uniform float cameraFar;
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
#include <packing>
|
|
||||||
|
|
||||||
float getLinearDepth( const in vec2 screenPosition ) {
|
|
||||||
|
|
||||||
#if PERSPECTIVE_CAMERA == 1
|
|
||||||
|
|
||||||
float fragCoordZ = texture2D( tDepth, screenPosition ).x;
|
|
||||||
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
|
|
||||||
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return texture2D( tDepth, screenPosition ).x;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
float depth = getLinearDepth( vUv );
|
|
||||||
gl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );
|
|
||||||
|
|
||||||
}`
|
|
||||||
};
|
|
||||||
var SSAOBlurShader = {
|
|
||||||
name: "SSAOBlurShader",
|
|
||||||
uniforms: {
|
|
||||||
"tDiffuse": { value: null },
|
|
||||||
"resolution": { value: new Vector2() }
|
|
||||||
},
|
|
||||||
vertexShader: `varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vUv = uv;
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
|
|
||||||
}`,
|
|
||||||
fragmentShader: `uniform sampler2D tDiffuse;
|
|
||||||
|
|
||||||
uniform vec2 resolution;
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec2 texelSize = ( 1.0 / resolution );
|
|
||||||
float result = 0.0;
|
|
||||||
|
|
||||||
for ( int i = - 2; i <= 2; i ++ ) {
|
|
||||||
|
|
||||||
for ( int j = - 2; j <= 2; j ++ ) {
|
|
||||||
|
|
||||||
vec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;
|
|
||||||
result += texture2D( tDiffuse, vUv + offset ).r;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
gl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );
|
|
||||||
|
|
||||||
}`
|
|
||||||
};
|
|
||||||
|
|
||||||
// node_modules/three/examples/jsm/postprocessing/SSAOPass.js
|
|
||||||
var SSAOPass = class _SSAOPass extends Pass {
|
|
||||||
constructor(scene, camera, width, height, kernelSize = 32) {
|
|
||||||
super();
|
|
||||||
this.width = width !== void 0 ? width : 512;
|
|
||||||
this.height = height !== void 0 ? height : 512;
|
|
||||||
this.clear = true;
|
|
||||||
this.needsSwap = false;
|
|
||||||
this.camera = camera;
|
|
||||||
this.scene = scene;
|
|
||||||
this.kernelRadius = 8;
|
|
||||||
this.kernel = [];
|
|
||||||
this.noiseTexture = null;
|
|
||||||
this.output = 0;
|
|
||||||
this.minDistance = 5e-3;
|
|
||||||
this.maxDistance = 0.1;
|
|
||||||
this._visibilityCache = /* @__PURE__ */ new Map();
|
|
||||||
this.generateSampleKernel(kernelSize);
|
|
||||||
this.generateRandomKernelRotations();
|
|
||||||
const depthTexture = new DepthTexture();
|
|
||||||
depthTexture.format = DepthStencilFormat;
|
|
||||||
depthTexture.type = UnsignedInt248Type;
|
|
||||||
this.normalRenderTarget = new WebGLRenderTarget(this.width, this.height, {
|
|
||||||
minFilter: NearestFilter,
|
|
||||||
magFilter: NearestFilter,
|
|
||||||
type: HalfFloatType,
|
|
||||||
depthTexture
|
|
||||||
});
|
|
||||||
this.ssaoRenderTarget = new WebGLRenderTarget(this.width, this.height, { type: HalfFloatType });
|
|
||||||
this.blurRenderTarget = this.ssaoRenderTarget.clone();
|
|
||||||
this.ssaoMaterial = new ShaderMaterial({
|
|
||||||
defines: Object.assign({}, SSAOShader.defines),
|
|
||||||
uniforms: UniformsUtils.clone(SSAOShader.uniforms),
|
|
||||||
vertexShader: SSAOShader.vertexShader,
|
|
||||||
fragmentShader: SSAOShader.fragmentShader,
|
|
||||||
blending: NoBlending
|
|
||||||
});
|
|
||||||
this.ssaoMaterial.defines["KERNEL_SIZE"] = kernelSize;
|
|
||||||
this.ssaoMaterial.uniforms["tNormal"].value = this.normalRenderTarget.texture;
|
|
||||||
this.ssaoMaterial.uniforms["tDepth"].value = this.normalRenderTarget.depthTexture;
|
|
||||||
this.ssaoMaterial.uniforms["tNoise"].value = this.noiseTexture;
|
|
||||||
this.ssaoMaterial.uniforms["kernel"].value = this.kernel;
|
|
||||||
this.ssaoMaterial.uniforms["cameraNear"].value = this.camera.near;
|
|
||||||
this.ssaoMaterial.uniforms["cameraFar"].value = this.camera.far;
|
|
||||||
this.ssaoMaterial.uniforms["resolution"].value.set(this.width, this.height);
|
|
||||||
this.ssaoMaterial.uniforms["cameraProjectionMatrix"].value.copy(this.camera.projectionMatrix);
|
|
||||||
this.ssaoMaterial.uniforms["cameraInverseProjectionMatrix"].value.copy(this.camera.projectionMatrixInverse);
|
|
||||||
this.normalMaterial = new MeshNormalMaterial();
|
|
||||||
this.normalMaterial.blending = NoBlending;
|
|
||||||
this.blurMaterial = new ShaderMaterial({
|
|
||||||
defines: Object.assign({}, SSAOBlurShader.defines),
|
|
||||||
uniforms: UniformsUtils.clone(SSAOBlurShader.uniforms),
|
|
||||||
vertexShader: SSAOBlurShader.vertexShader,
|
|
||||||
fragmentShader: SSAOBlurShader.fragmentShader
|
|
||||||
});
|
|
||||||
this.blurMaterial.uniforms["tDiffuse"].value = this.ssaoRenderTarget.texture;
|
|
||||||
this.blurMaterial.uniforms["resolution"].value.set(this.width, this.height);
|
|
||||||
this.depthRenderMaterial = new ShaderMaterial({
|
|
||||||
defines: Object.assign({}, SSAODepthShader.defines),
|
|
||||||
uniforms: UniformsUtils.clone(SSAODepthShader.uniforms),
|
|
||||||
vertexShader: SSAODepthShader.vertexShader,
|
|
||||||
fragmentShader: SSAODepthShader.fragmentShader,
|
|
||||||
blending: NoBlending
|
|
||||||
});
|
|
||||||
this.depthRenderMaterial.uniforms["tDepth"].value = this.normalRenderTarget.depthTexture;
|
|
||||||
this.depthRenderMaterial.uniforms["cameraNear"].value = this.camera.near;
|
|
||||||
this.depthRenderMaterial.uniforms["cameraFar"].value = this.camera.far;
|
|
||||||
this.copyMaterial = new ShaderMaterial({
|
|
||||||
uniforms: UniformsUtils.clone(CopyShader.uniforms),
|
|
||||||
vertexShader: CopyShader.vertexShader,
|
|
||||||
fragmentShader: CopyShader.fragmentShader,
|
|
||||||
transparent: true,
|
|
||||||
depthTest: false,
|
|
||||||
depthWrite: false,
|
|
||||||
blendSrc: DstColorFactor,
|
|
||||||
blendDst: ZeroFactor,
|
|
||||||
blendEquation: AddEquation,
|
|
||||||
blendSrcAlpha: DstAlphaFactor,
|
|
||||||
blendDstAlpha: ZeroFactor,
|
|
||||||
blendEquationAlpha: AddEquation
|
|
||||||
});
|
|
||||||
this.fsQuad = new FullScreenQuad(null);
|
|
||||||
this.originalClearColor = new Color();
|
|
||||||
}
|
|
||||||
dispose() {
|
|
||||||
this.normalRenderTarget.dispose();
|
|
||||||
this.ssaoRenderTarget.dispose();
|
|
||||||
this.blurRenderTarget.dispose();
|
|
||||||
this.normalMaterial.dispose();
|
|
||||||
this.blurMaterial.dispose();
|
|
||||||
this.copyMaterial.dispose();
|
|
||||||
this.depthRenderMaterial.dispose();
|
|
||||||
this.fsQuad.dispose();
|
|
||||||
}
|
|
||||||
render(renderer, writeBuffer, readBuffer) {
|
|
||||||
this.overrideVisibility();
|
|
||||||
this.renderOverride(renderer, this.normalMaterial, this.normalRenderTarget, 7829503, 1);
|
|
||||||
this.restoreVisibility();
|
|
||||||
this.ssaoMaterial.uniforms["kernelRadius"].value = this.kernelRadius;
|
|
||||||
this.ssaoMaterial.uniforms["minDistance"].value = this.minDistance;
|
|
||||||
this.ssaoMaterial.uniforms["maxDistance"].value = this.maxDistance;
|
|
||||||
this.renderPass(renderer, this.ssaoMaterial, this.ssaoRenderTarget);
|
|
||||||
this.renderPass(renderer, this.blurMaterial, this.blurRenderTarget);
|
|
||||||
switch (this.output) {
|
|
||||||
case _SSAOPass.OUTPUT.SSAO:
|
|
||||||
this.copyMaterial.uniforms["tDiffuse"].value = this.ssaoRenderTarget.texture;
|
|
||||||
this.copyMaterial.blending = NoBlending;
|
|
||||||
this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer);
|
|
||||||
break;
|
|
||||||
case _SSAOPass.OUTPUT.Blur:
|
|
||||||
this.copyMaterial.uniforms["tDiffuse"].value = this.blurRenderTarget.texture;
|
|
||||||
this.copyMaterial.blending = NoBlending;
|
|
||||||
this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer);
|
|
||||||
break;
|
|
||||||
case _SSAOPass.OUTPUT.Depth:
|
|
||||||
this.renderPass(renderer, this.depthRenderMaterial, this.renderToScreen ? null : readBuffer);
|
|
||||||
break;
|
|
||||||
case _SSAOPass.OUTPUT.Normal:
|
|
||||||
this.copyMaterial.uniforms["tDiffuse"].value = this.normalRenderTarget.texture;
|
|
||||||
this.copyMaterial.blending = NoBlending;
|
|
||||||
this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer);
|
|
||||||
break;
|
|
||||||
case _SSAOPass.OUTPUT.Default:
|
|
||||||
this.copyMaterial.uniforms["tDiffuse"].value = this.blurRenderTarget.texture;
|
|
||||||
this.copyMaterial.blending = CustomBlending;
|
|
||||||
this.renderPass(renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.warn("THREE.SSAOPass: Unknown output type.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
renderPass(renderer, passMaterial, renderTarget, clearColor, clearAlpha) {
|
|
||||||
renderer.getClearColor(this.originalClearColor);
|
|
||||||
const originalClearAlpha = renderer.getClearAlpha();
|
|
||||||
const originalAutoClear = renderer.autoClear;
|
|
||||||
renderer.setRenderTarget(renderTarget);
|
|
||||||
renderer.autoClear = false;
|
|
||||||
if (clearColor !== void 0 && clearColor !== null) {
|
|
||||||
renderer.setClearColor(clearColor);
|
|
||||||
renderer.setClearAlpha(clearAlpha || 0);
|
|
||||||
renderer.clear();
|
|
||||||
}
|
|
||||||
this.fsQuad.material = passMaterial;
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
renderer.autoClear = originalAutoClear;
|
|
||||||
renderer.setClearColor(this.originalClearColor);
|
|
||||||
renderer.setClearAlpha(originalClearAlpha);
|
|
||||||
}
|
|
||||||
renderOverride(renderer, overrideMaterial, renderTarget, clearColor, clearAlpha) {
|
|
||||||
renderer.getClearColor(this.originalClearColor);
|
|
||||||
const originalClearAlpha = renderer.getClearAlpha();
|
|
||||||
const originalAutoClear = renderer.autoClear;
|
|
||||||
renderer.setRenderTarget(renderTarget);
|
|
||||||
renderer.autoClear = false;
|
|
||||||
clearColor = overrideMaterial.clearColor || clearColor;
|
|
||||||
clearAlpha = overrideMaterial.clearAlpha || clearAlpha;
|
|
||||||
if (clearColor !== void 0 && clearColor !== null) {
|
|
||||||
renderer.setClearColor(clearColor);
|
|
||||||
renderer.setClearAlpha(clearAlpha || 0);
|
|
||||||
renderer.clear();
|
|
||||||
}
|
|
||||||
this.scene.overrideMaterial = overrideMaterial;
|
|
||||||
renderer.render(this.scene, this.camera);
|
|
||||||
this.scene.overrideMaterial = null;
|
|
||||||
renderer.autoClear = originalAutoClear;
|
|
||||||
renderer.setClearColor(this.originalClearColor);
|
|
||||||
renderer.setClearAlpha(originalClearAlpha);
|
|
||||||
}
|
|
||||||
setSize(width, height) {
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
this.ssaoRenderTarget.setSize(width, height);
|
|
||||||
this.normalRenderTarget.setSize(width, height);
|
|
||||||
this.blurRenderTarget.setSize(width, height);
|
|
||||||
this.ssaoMaterial.uniforms["resolution"].value.set(width, height);
|
|
||||||
this.ssaoMaterial.uniforms["cameraProjectionMatrix"].value.copy(this.camera.projectionMatrix);
|
|
||||||
this.ssaoMaterial.uniforms["cameraInverseProjectionMatrix"].value.copy(this.camera.projectionMatrixInverse);
|
|
||||||
this.blurMaterial.uniforms["resolution"].value.set(width, height);
|
|
||||||
}
|
|
||||||
generateSampleKernel(kernelSize) {
|
|
||||||
const kernel = this.kernel;
|
|
||||||
for (let i = 0; i < kernelSize; i++) {
|
|
||||||
const sample = new Vector3();
|
|
||||||
sample.x = Math.random() * 2 - 1;
|
|
||||||
sample.y = Math.random() * 2 - 1;
|
|
||||||
sample.z = Math.random();
|
|
||||||
sample.normalize();
|
|
||||||
let scale = i / kernelSize;
|
|
||||||
scale = MathUtils.lerp(0.1, 1, scale * scale);
|
|
||||||
sample.multiplyScalar(scale);
|
|
||||||
kernel.push(sample);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
generateRandomKernelRotations() {
|
|
||||||
const width = 4, height = 4;
|
|
||||||
const simplex = new SimplexNoise();
|
|
||||||
const size = width * height;
|
|
||||||
const data = new Float32Array(size);
|
|
||||||
for (let i = 0; i < size; i++) {
|
|
||||||
const x = Math.random() * 2 - 1;
|
|
||||||
const y = Math.random() * 2 - 1;
|
|
||||||
const z = 0;
|
|
||||||
data[i] = simplex.noise3d(x, y, z);
|
|
||||||
}
|
|
||||||
this.noiseTexture = new DataTexture(data, width, height, RedFormat, FloatType);
|
|
||||||
this.noiseTexture.wrapS = RepeatWrapping;
|
|
||||||
this.noiseTexture.wrapT = RepeatWrapping;
|
|
||||||
this.noiseTexture.needsUpdate = true;
|
|
||||||
}
|
|
||||||
overrideVisibility() {
|
|
||||||
const scene = this.scene;
|
|
||||||
const cache = this._visibilityCache;
|
|
||||||
scene.traverse(function(object) {
|
|
||||||
cache.set(object, object.visible);
|
|
||||||
if (object.isPoints || object.isLine) object.visible = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
restoreVisibility() {
|
|
||||||
const scene = this.scene;
|
|
||||||
const cache = this._visibilityCache;
|
|
||||||
scene.traverse(function(object) {
|
|
||||||
const visible = cache.get(object);
|
|
||||||
object.visible = visible;
|
|
||||||
});
|
|
||||||
cache.clear();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
SSAOPass.OUTPUT = {
|
|
||||||
"Default": 0,
|
|
||||||
"SSAO": 1,
|
|
||||||
"Blur": 2,
|
|
||||||
"Depth": 3,
|
|
||||||
"Normal": 4
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
SSAOPass
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=three_examples_jsm_postprocessing_SSAOPass__js.js.map
|
|
File diff suppressed because one or more lines are too long
@ -1,9 +0,0 @@
|
|||||||
import {
|
|
||||||
ShaderPass
|
|
||||||
} from "./chunk-D6CDVL7U.js";
|
|
||||||
import "./chunk-JHQAMVLY.js";
|
|
||||||
import "./chunk-IS2ZBFBB.js";
|
|
||||||
export {
|
|
||||||
ShaderPass
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=three_examples_jsm_postprocessing_ShaderPass__js.js.map
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": [],
|
|
||||||
"sourcesContent": [],
|
|
||||||
"mappings": "",
|
|
||||||
"names": []
|
|
||||||
}
|
|
@ -1,331 +0,0 @@
|
|||||||
import {
|
|
||||||
CopyShader
|
|
||||||
} from "./chunk-OLTXGRDG.js";
|
|
||||||
import {
|
|
||||||
FullScreenQuad,
|
|
||||||
Pass
|
|
||||||
} from "./chunk-JHQAMVLY.js";
|
|
||||||
import {
|
|
||||||
AdditiveBlending,
|
|
||||||
Color,
|
|
||||||
HalfFloatType,
|
|
||||||
MeshBasicMaterial,
|
|
||||||
ShaderMaterial,
|
|
||||||
UniformsUtils,
|
|
||||||
Vector2,
|
|
||||||
Vector3,
|
|
||||||
WebGLRenderTarget
|
|
||||||
} from "./chunk-IS2ZBFBB.js";
|
|
||||||
|
|
||||||
// node_modules/three/examples/jsm/shaders/LuminosityHighPassShader.js
|
|
||||||
var LuminosityHighPassShader = {
|
|
||||||
name: "LuminosityHighPassShader",
|
|
||||||
shaderID: "luminosityHighPass",
|
|
||||||
uniforms: {
|
|
||||||
"tDiffuse": { value: null },
|
|
||||||
"luminosityThreshold": { value: 1 },
|
|
||||||
"smoothWidth": { value: 1 },
|
|
||||||
"defaultColor": { value: new Color(0) },
|
|
||||||
"defaultOpacity": { value: 0 }
|
|
||||||
},
|
|
||||||
vertexShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vUv = uv;
|
|
||||||
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
|
|
||||||
}`
|
|
||||||
),
|
|
||||||
fragmentShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
uniform sampler2D tDiffuse;
|
|
||||||
uniform vec3 defaultColor;
|
|
||||||
uniform float defaultOpacity;
|
|
||||||
uniform float luminosityThreshold;
|
|
||||||
uniform float smoothWidth;
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec4 texel = texture2D( tDiffuse, vUv );
|
|
||||||
|
|
||||||
float v = luminance( texel.xyz );
|
|
||||||
|
|
||||||
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
|
|
||||||
|
|
||||||
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
|
|
||||||
|
|
||||||
gl_FragColor = mix( outputColor, texel, alpha );
|
|
||||||
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
// node_modules/three/examples/jsm/postprocessing/UnrealBloomPass.js
|
|
||||||
var UnrealBloomPass = class _UnrealBloomPass extends Pass {
|
|
||||||
constructor(resolution, strength, radius, threshold) {
|
|
||||||
super();
|
|
||||||
this.strength = strength !== void 0 ? strength : 1;
|
|
||||||
this.radius = radius;
|
|
||||||
this.threshold = threshold;
|
|
||||||
this.resolution = resolution !== void 0 ? new Vector2(resolution.x, resolution.y) : new Vector2(256, 256);
|
|
||||||
this.clearColor = new Color(0, 0, 0);
|
|
||||||
this.renderTargetsHorizontal = [];
|
|
||||||
this.renderTargetsVertical = [];
|
|
||||||
this.nMips = 5;
|
|
||||||
let resx = Math.round(this.resolution.x / 2);
|
|
||||||
let resy = Math.round(this.resolution.y / 2);
|
|
||||||
this.renderTargetBright = new WebGLRenderTarget(resx, resy, { type: HalfFloatType });
|
|
||||||
this.renderTargetBright.texture.name = "UnrealBloomPass.bright";
|
|
||||||
this.renderTargetBright.texture.generateMipmaps = false;
|
|
||||||
for (let i = 0; i < this.nMips; i++) {
|
|
||||||
const renderTargetHorizontal = new WebGLRenderTarget(resx, resy, { type: HalfFloatType });
|
|
||||||
renderTargetHorizontal.texture.name = "UnrealBloomPass.h" + i;
|
|
||||||
renderTargetHorizontal.texture.generateMipmaps = false;
|
|
||||||
this.renderTargetsHorizontal.push(renderTargetHorizontal);
|
|
||||||
const renderTargetVertical = new WebGLRenderTarget(resx, resy, { type: HalfFloatType });
|
|
||||||
renderTargetVertical.texture.name = "UnrealBloomPass.v" + i;
|
|
||||||
renderTargetVertical.texture.generateMipmaps = false;
|
|
||||||
this.renderTargetsVertical.push(renderTargetVertical);
|
|
||||||
resx = Math.round(resx / 2);
|
|
||||||
resy = Math.round(resy / 2);
|
|
||||||
}
|
|
||||||
const highPassShader = LuminosityHighPassShader;
|
|
||||||
this.highPassUniforms = UniformsUtils.clone(highPassShader.uniforms);
|
|
||||||
this.highPassUniforms["luminosityThreshold"].value = threshold;
|
|
||||||
this.highPassUniforms["smoothWidth"].value = 0.01;
|
|
||||||
this.materialHighPassFilter = new ShaderMaterial({
|
|
||||||
uniforms: this.highPassUniforms,
|
|
||||||
vertexShader: highPassShader.vertexShader,
|
|
||||||
fragmentShader: highPassShader.fragmentShader
|
|
||||||
});
|
|
||||||
this.separableBlurMaterials = [];
|
|
||||||
const kernelSizeArray = [3, 5, 7, 9, 11];
|
|
||||||
resx = Math.round(this.resolution.x / 2);
|
|
||||||
resy = Math.round(this.resolution.y / 2);
|
|
||||||
for (let i = 0; i < this.nMips; i++) {
|
|
||||||
this.separableBlurMaterials.push(this.getSeperableBlurMaterial(kernelSizeArray[i]));
|
|
||||||
this.separableBlurMaterials[i].uniforms["invSize"].value = new Vector2(1 / resx, 1 / resy);
|
|
||||||
resx = Math.round(resx / 2);
|
|
||||||
resy = Math.round(resy / 2);
|
|
||||||
}
|
|
||||||
this.compositeMaterial = this.getCompositeMaterial(this.nMips);
|
|
||||||
this.compositeMaterial.uniforms["blurTexture1"].value = this.renderTargetsVertical[0].texture;
|
|
||||||
this.compositeMaterial.uniforms["blurTexture2"].value = this.renderTargetsVertical[1].texture;
|
|
||||||
this.compositeMaterial.uniforms["blurTexture3"].value = this.renderTargetsVertical[2].texture;
|
|
||||||
this.compositeMaterial.uniforms["blurTexture4"].value = this.renderTargetsVertical[3].texture;
|
|
||||||
this.compositeMaterial.uniforms["blurTexture5"].value = this.renderTargetsVertical[4].texture;
|
|
||||||
this.compositeMaterial.uniforms["bloomStrength"].value = strength;
|
|
||||||
this.compositeMaterial.uniforms["bloomRadius"].value = 0.1;
|
|
||||||
const bloomFactors = [1, 0.8, 0.6, 0.4, 0.2];
|
|
||||||
this.compositeMaterial.uniforms["bloomFactors"].value = bloomFactors;
|
|
||||||
this.bloomTintColors = [new Vector3(1, 1, 1), new Vector3(1, 1, 1), new Vector3(1, 1, 1), new Vector3(1, 1, 1), new Vector3(1, 1, 1)];
|
|
||||||
this.compositeMaterial.uniforms["bloomTintColors"].value = this.bloomTintColors;
|
|
||||||
const copyShader = CopyShader;
|
|
||||||
this.copyUniforms = UniformsUtils.clone(copyShader.uniforms);
|
|
||||||
this.blendMaterial = new ShaderMaterial({
|
|
||||||
uniforms: this.copyUniforms,
|
|
||||||
vertexShader: copyShader.vertexShader,
|
|
||||||
fragmentShader: copyShader.fragmentShader,
|
|
||||||
blending: AdditiveBlending,
|
|
||||||
depthTest: false,
|
|
||||||
depthWrite: false,
|
|
||||||
transparent: true
|
|
||||||
});
|
|
||||||
this.enabled = true;
|
|
||||||
this.needsSwap = false;
|
|
||||||
this._oldClearColor = new Color();
|
|
||||||
this.oldClearAlpha = 1;
|
|
||||||
this.basic = new MeshBasicMaterial();
|
|
||||||
this.fsQuad = new FullScreenQuad(null);
|
|
||||||
}
|
|
||||||
dispose() {
|
|
||||||
for (let i = 0; i < this.renderTargetsHorizontal.length; i++) {
|
|
||||||
this.renderTargetsHorizontal[i].dispose();
|
|
||||||
}
|
|
||||||
for (let i = 0; i < this.renderTargetsVertical.length; i++) {
|
|
||||||
this.renderTargetsVertical[i].dispose();
|
|
||||||
}
|
|
||||||
this.renderTargetBright.dispose();
|
|
||||||
for (let i = 0; i < this.separableBlurMaterials.length; i++) {
|
|
||||||
this.separableBlurMaterials[i].dispose();
|
|
||||||
}
|
|
||||||
this.compositeMaterial.dispose();
|
|
||||||
this.blendMaterial.dispose();
|
|
||||||
this.basic.dispose();
|
|
||||||
this.fsQuad.dispose();
|
|
||||||
}
|
|
||||||
setSize(width, height) {
|
|
||||||
let resx = Math.round(width / 2);
|
|
||||||
let resy = Math.round(height / 2);
|
|
||||||
this.renderTargetBright.setSize(resx, resy);
|
|
||||||
for (let i = 0; i < this.nMips; i++) {
|
|
||||||
this.renderTargetsHorizontal[i].setSize(resx, resy);
|
|
||||||
this.renderTargetsVertical[i].setSize(resx, resy);
|
|
||||||
this.separableBlurMaterials[i].uniforms["invSize"].value = new Vector2(1 / resx, 1 / resy);
|
|
||||||
resx = Math.round(resx / 2);
|
|
||||||
resy = Math.round(resy / 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {
|
|
||||||
renderer.getClearColor(this._oldClearColor);
|
|
||||||
this.oldClearAlpha = renderer.getClearAlpha();
|
|
||||||
const oldAutoClear = renderer.autoClear;
|
|
||||||
renderer.autoClear = false;
|
|
||||||
renderer.setClearColor(this.clearColor, 0);
|
|
||||||
if (maskActive) renderer.state.buffers.stencil.setTest(false);
|
|
||||||
if (this.renderToScreen) {
|
|
||||||
this.fsQuad.material = this.basic;
|
|
||||||
this.basic.map = readBuffer.texture;
|
|
||||||
renderer.setRenderTarget(null);
|
|
||||||
renderer.clear();
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
}
|
|
||||||
this.highPassUniforms["tDiffuse"].value = readBuffer.texture;
|
|
||||||
this.highPassUniforms["luminosityThreshold"].value = this.threshold;
|
|
||||||
this.fsQuad.material = this.materialHighPassFilter;
|
|
||||||
renderer.setRenderTarget(this.renderTargetBright);
|
|
||||||
renderer.clear();
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
let inputRenderTarget = this.renderTargetBright;
|
|
||||||
for (let i = 0; i < this.nMips; i++) {
|
|
||||||
this.fsQuad.material = this.separableBlurMaterials[i];
|
|
||||||
this.separableBlurMaterials[i].uniforms["colorTexture"].value = inputRenderTarget.texture;
|
|
||||||
this.separableBlurMaterials[i].uniforms["direction"].value = _UnrealBloomPass.BlurDirectionX;
|
|
||||||
renderer.setRenderTarget(this.renderTargetsHorizontal[i]);
|
|
||||||
renderer.clear();
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
this.separableBlurMaterials[i].uniforms["colorTexture"].value = this.renderTargetsHorizontal[i].texture;
|
|
||||||
this.separableBlurMaterials[i].uniforms["direction"].value = _UnrealBloomPass.BlurDirectionY;
|
|
||||||
renderer.setRenderTarget(this.renderTargetsVertical[i]);
|
|
||||||
renderer.clear();
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
inputRenderTarget = this.renderTargetsVertical[i];
|
|
||||||
}
|
|
||||||
this.fsQuad.material = this.compositeMaterial;
|
|
||||||
this.compositeMaterial.uniforms["bloomStrength"].value = this.strength;
|
|
||||||
this.compositeMaterial.uniforms["bloomRadius"].value = this.radius;
|
|
||||||
this.compositeMaterial.uniforms["bloomTintColors"].value = this.bloomTintColors;
|
|
||||||
renderer.setRenderTarget(this.renderTargetsHorizontal[0]);
|
|
||||||
renderer.clear();
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
this.fsQuad.material = this.blendMaterial;
|
|
||||||
this.copyUniforms["tDiffuse"].value = this.renderTargetsHorizontal[0].texture;
|
|
||||||
if (maskActive) renderer.state.buffers.stencil.setTest(true);
|
|
||||||
if (this.renderToScreen) {
|
|
||||||
renderer.setRenderTarget(null);
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
} else {
|
|
||||||
renderer.setRenderTarget(readBuffer);
|
|
||||||
this.fsQuad.render(renderer);
|
|
||||||
}
|
|
||||||
renderer.setClearColor(this._oldClearColor, this.oldClearAlpha);
|
|
||||||
renderer.autoClear = oldAutoClear;
|
|
||||||
}
|
|
||||||
getSeperableBlurMaterial(kernelRadius) {
|
|
||||||
const coefficients = [];
|
|
||||||
for (let i = 0; i < kernelRadius; i++) {
|
|
||||||
coefficients.push(0.39894 * Math.exp(-0.5 * i * i / (kernelRadius * kernelRadius)) / kernelRadius);
|
|
||||||
}
|
|
||||||
return new ShaderMaterial({
|
|
||||||
defines: {
|
|
||||||
"KERNEL_RADIUS": kernelRadius
|
|
||||||
},
|
|
||||||
uniforms: {
|
|
||||||
"colorTexture": { value: null },
|
|
||||||
"invSize": { value: new Vector2(0.5, 0.5) },
|
|
||||||
// inverse texture size
|
|
||||||
"direction": { value: new Vector2(0.5, 0.5) },
|
|
||||||
"gaussianCoefficients": { value: coefficients }
|
|
||||||
// precomputed Gaussian coefficients
|
|
||||||
},
|
|
||||||
vertexShader: `varying vec2 vUv;
|
|
||||||
void main() {
|
|
||||||
vUv = uv;
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
}`,
|
|
||||||
fragmentShader: `#include <common>
|
|
||||||
varying vec2 vUv;
|
|
||||||
uniform sampler2D colorTexture;
|
|
||||||
uniform vec2 invSize;
|
|
||||||
uniform vec2 direction;
|
|
||||||
uniform float gaussianCoefficients[KERNEL_RADIUS];
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
float weightSum = gaussianCoefficients[0];
|
|
||||||
vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
|
|
||||||
for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
|
|
||||||
float x = float(i);
|
|
||||||
float w = gaussianCoefficients[i];
|
|
||||||
vec2 uvOffset = direction * invSize * x;
|
|
||||||
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
|
|
||||||
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
|
|
||||||
diffuseSum += (sample1 + sample2) * w;
|
|
||||||
weightSum += 2.0 * w;
|
|
||||||
}
|
|
||||||
gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
|
|
||||||
}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getCompositeMaterial(nMips) {
|
|
||||||
return new ShaderMaterial({
|
|
||||||
defines: {
|
|
||||||
"NUM_MIPS": nMips
|
|
||||||
},
|
|
||||||
uniforms: {
|
|
||||||
"blurTexture1": { value: null },
|
|
||||||
"blurTexture2": { value: null },
|
|
||||||
"blurTexture3": { value: null },
|
|
||||||
"blurTexture4": { value: null },
|
|
||||||
"blurTexture5": { value: null },
|
|
||||||
"bloomStrength": { value: 1 },
|
|
||||||
"bloomFactors": { value: null },
|
|
||||||
"bloomTintColors": { value: null },
|
|
||||||
"bloomRadius": { value: 0 }
|
|
||||||
},
|
|
||||||
vertexShader: `varying vec2 vUv;
|
|
||||||
void main() {
|
|
||||||
vUv = uv;
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
}`,
|
|
||||||
fragmentShader: `varying vec2 vUv;
|
|
||||||
uniform sampler2D blurTexture1;
|
|
||||||
uniform sampler2D blurTexture2;
|
|
||||||
uniform sampler2D blurTexture3;
|
|
||||||
uniform sampler2D blurTexture4;
|
|
||||||
uniform sampler2D blurTexture5;
|
|
||||||
uniform float bloomStrength;
|
|
||||||
uniform float bloomRadius;
|
|
||||||
uniform float bloomFactors[NUM_MIPS];
|
|
||||||
uniform vec3 bloomTintColors[NUM_MIPS];
|
|
||||||
|
|
||||||
float lerpBloomFactor(const in float factor) {
|
|
||||||
float mirrorFactor = 1.2 - factor;
|
|
||||||
return mix(factor, mirrorFactor, bloomRadius);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
|
|
||||||
lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
|
|
||||||
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
|
|
||||||
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
|
|
||||||
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
|
|
||||||
}`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
UnrealBloomPass.BlurDirectionX = new Vector2(1, 0);
|
|
||||||
UnrealBloomPass.BlurDirectionY = new Vector2(0, 1);
|
|
||||||
export {
|
|
||||||
UnrealBloomPass
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=three_examples_jsm_postprocessing_UnrealBloomPass__js.js.map
|
|
File diff suppressed because one or more lines are too long
@ -1,52 +0,0 @@
|
|||||||
// node_modules/three/examples/jsm/shaders/HorizontalBlurShader.js
|
|
||||||
var HorizontalBlurShader = {
|
|
||||||
name: "HorizontalBlurShader",
|
|
||||||
uniforms: {
|
|
||||||
"tDiffuse": { value: null },
|
|
||||||
"h": { value: 1 / 512 }
|
|
||||||
},
|
|
||||||
vertexShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vUv = uv;
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
|
|
||||||
}`
|
|
||||||
),
|
|
||||||
fragmentShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
uniform sampler2D tDiffuse;
|
|
||||||
uniform float h;
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec4 sum = vec4( 0.0 );
|
|
||||||
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
|
|
||||||
|
|
||||||
gl_FragColor = sum;
|
|
||||||
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
HorizontalBlurShader
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=three_examples_jsm_shaders_HorizontalBlurShader__js.js.map
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../three/examples/jsm/shaders/HorizontalBlurShader.js"],
|
|
||||||
"sourcesContent": ["/**\n * Two pass Gaussian blur filter (horizontal and vertical blur shaders)\n * - see http://www.cake23.de/traveling-wavefronts-lit-up.html\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n */\n\nconst HorizontalBlurShader = {\n\n\tname: 'HorizontalBlurShader',\n\n\tuniforms: {\n\n\t\t'tDiffuse': { value: null },\n\t\t'h': { value: 1.0 / 512.0 }\n\n\t},\n\n\tvertexShader: /* glsl */`\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n\tfragmentShader: /* glsl */`\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}`\n\n};\n\nexport { HorizontalBlurShader };\n"],
|
|
||||||
"mappings": ";AASA,IAAM,uBAAuB;AAAA,EAE5B,MAAM;AAAA,EAEN,UAAU;AAAA,IAET,YAAY,EAAE,OAAO,KAAK;AAAA,IAC1B,KAAK,EAAE,OAAO,IAAM,IAAM;AAAA,EAE3B;AAAA,EAEA;AAAA;AAAA,IAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWxB;AAAA;AAAA,IAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyB3B;",
|
|
||||||
"names": []
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
// node_modules/three/examples/jsm/shaders/VerticalBlurShader.js
|
|
||||||
var VerticalBlurShader = {
|
|
||||||
name: "VerticalBlurShader",
|
|
||||||
uniforms: {
|
|
||||||
"tDiffuse": { value: null },
|
|
||||||
"v": { value: 1 / 512 }
|
|
||||||
},
|
|
||||||
vertexShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vUv = uv;
|
|
||||||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
||||||
|
|
||||||
}`
|
|
||||||
),
|
|
||||||
fragmentShader: (
|
|
||||||
/* glsl */
|
|
||||||
`
|
|
||||||
|
|
||||||
uniform sampler2D tDiffuse;
|
|
||||||
uniform float v;
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
|
|
||||||
vec4 sum = vec4( 0.0 );
|
|
||||||
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
|
|
||||||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
|
|
||||||
|
|
||||||
gl_FragColor = sum;
|
|
||||||
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
};
|
|
||||||
export {
|
|
||||||
VerticalBlurShader
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=three_examples_jsm_shaders_VerticalBlurShader__js.js.map
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"sources": ["../../three/examples/jsm/shaders/VerticalBlurShader.js"],
|
|
||||||
"sourcesContent": ["/**\n * Two pass Gaussian blur filter (horizontal and vertical blur shaders)\n * - see http://www.cake23.de/traveling-wavefronts-lit-up.html\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n */\n\nconst VerticalBlurShader = {\n\n\tname: 'VerticalBlurShader',\n\n\tuniforms: {\n\n\t\t'tDiffuse': { value: null },\n\t\t'v': { value: 1.0 / 512.0 }\n\n\t},\n\n\tvertexShader: /* glsl */`\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}`,\n\n\tfragmentShader: /* glsl */`\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}`\n\n};\n\nexport { VerticalBlurShader };\n"],
|
|
||||||
"mappings": ";AASA,IAAM,qBAAqB;AAAA,EAE1B,MAAM;AAAA,EAEN,UAAU;AAAA,IAET,YAAY,EAAE,OAAO,KAAK;AAAA,IAC1B,KAAK,EAAE,OAAO,IAAM,IAAM;AAAA,EAE3B;AAAA,EAEA;AAAA;AAAA,IAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWxB;AAAA;AAAA,IAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyB3B;",
|
|
||||||
"names": []
|
|
||||||
}
|
|
@ -3,10 +3,10 @@
|
|||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* home.css :+: :+: :+: */
|
/* home.css :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: marvin <marvin@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/07 12:00:55 by edbernar #+# #+# */
|
/* Created: 2024/08/07 12:00:55 by edbernar #+# #+# */
|
||||||
/* Updated: 2024/08/24 02:10:59 by edbernar ### ########.fr */
|
/* Updated: 2024/08/24 11:26:27 by marvin ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -59,7 +59,6 @@ body {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
padding-inline: 50px;
|
padding-inline: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #020202;
|
|
||||||
gap: 2rem;
|
gap: 2rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
Reference in New Issue
Block a user