/
astroceti
/
Singularity
Обзор
Документация
Войти
/
astroceti
/
Singularity
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
master
src/Experience/State.js
59 строк
2 KB
MisterPrada
Add Background Intensity
31 окт 2025, 18:13
31 окт 2025, 18:13
17828f5
Код
Авторство
О чём код?
import * as THREE from 'three/webgpu' import Experience from './Experience.js' import Sizes from "./Utils/Sizes.js" import { color, uniform } from 'three/tsl' export default class State { experience = Experience.getInstance() sizes = this.experience.sizes renderer = this.experience.renderer.instance postprocessing = true; //floatType = this.renderer.capabilities.isWebGL2 ? THREE.FloatType : THREE.HalfFloatType; uniforms = { resolution: uniform( new THREE.Vector2( this.sizes.width_DPR, this.sizes.height_DPR ) ), mainScene: { environment: { topColor: uniform( color( 0x0487e2 ) ), bottomColor: uniform( color( 0x0066ff ) ), //fogColor: uniform( new THREE.Color( 0x0487e2 ) ), fogColor: uniform( color( 0x000000 ) ), fogNear: uniform( 0 ), fogFar: uniform( 47.83 ), backgroundIntensity: 2 }, bloomPass: { strength: uniform( 0.217 ), radius: uniform( 0.0 ), threshold: uniform( 0 ), } } } constructor() { this.experience = Experience.getInstance() this.renderer = this.experience.renderer.instance this.canvas = this.experience.canvas this.sizes = this.experience.sizes this.setLayers() } setLayers() { this.layersConst = { BLOOM_SCENE: 1, DEFAULT: 0, } this.bloomLayer = new THREE.Layers(); this.bloomLayer.set( this.layersConst.BLOOM_SCENE ); } resize() { this.uniforms.resolution.value.set( this.sizes.width_DPR, this.sizes.height_DPR ) } }