退役(零视觉影响:NEXT_PUBLIC_HERO_SCENE 从未在任何 .env* 设置): - 删 hero-scene.tsx(694行)/caption/单测/文案真源/CC0 机柜/海报帧 - R26 删除、R22 登记归零、e2e heroSceneMask 移除(无命中的假安全网) - R22 自证改可注入(夹具不再依赖生产条目) 落库(flag NEXT_PUBLIC_HERO_FIELD 样期默认关 ⇒ 基线零影响): - hero-field.tsx 三拍:噪声→增长→判断;bloom 半分辨率;DPR≤1.5 - 降级统一看结论帧(reduced-motion 定格 T_HOLD=40500 非 0) - 文案真源含承诺词正则守卫(禁帮助/赋能/提升/%/倍) - 海报帧 capture 脚本与资产同批入库(1920x864/26.9KB,可复现) - eslint 忽略 demo/**/vendor/**(vendored three 不可被 lint-staged --fix 改写) 守卫重建:R26 指向 hero-field(43260ms/3 拍合规);R22 登记 HeroField 条目 验证:tsc 0 / eslint 0 error / jest 162 套件 1906 例 / check:grammar 26+26 / check:a11y 0 违规 / 默认构建首页 DOM 冒烟 E 案不变
139 lines
2.2 KiB
JavaScript
139 lines
2.2 KiB
JavaScript
import { ShaderPass } from './ShaderPass.js';
|
|
|
|
const LUTShader = {
|
|
|
|
name: 'LUTShader',
|
|
|
|
uniforms: {
|
|
|
|
lut: { value: null },
|
|
lutSize: { value: 0 },
|
|
|
|
tDiffuse: { value: null },
|
|
intensity: { value: 1.0 },
|
|
},
|
|
|
|
vertexShader: /* glsl */`
|
|
|
|
varying vec2 vUv;
|
|
|
|
void main() {
|
|
|
|
vUv = uv;
|
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
fragmentShader: /* glsl */`
|
|
|
|
uniform float lutSize;
|
|
uniform sampler3D lut;
|
|
|
|
varying vec2 vUv;
|
|
uniform float intensity;
|
|
uniform sampler2D tDiffuse;
|
|
void main() {
|
|
|
|
vec4 val = texture2D( tDiffuse, vUv );
|
|
vec4 lutVal;
|
|
|
|
// pull the sample in by half a pixel so the sample begins
|
|
// at the center of the edge pixels.
|
|
float pixelWidth = 1.0 / lutSize;
|
|
float halfPixelWidth = 0.5 / lutSize;
|
|
vec3 uvw = vec3( halfPixelWidth ) + val.rgb * ( 1.0 - pixelWidth );
|
|
|
|
|
|
lutVal = vec4( texture( lut, uvw ).rgb, val.a );
|
|
|
|
gl_FragColor = vec4( mix( val, lutVal, intensity ) );
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
};
|
|
|
|
/**
|
|
* Pass for color grading via lookup tables.
|
|
*
|
|
* ```js
|
|
* const lutPass = new LUTPass( { lut: lut.texture3D } );
|
|
* composer.addPass( lutPass );
|
|
* ```
|
|
*
|
|
* @augments ShaderPass
|
|
* @three_import import { LUTPass } from 'three/addons/postprocessing/LUTPass.js';
|
|
*/
|
|
class LUTPass extends ShaderPass {
|
|
|
|
/**
|
|
* Constructs a LUT pass.
|
|
*
|
|
* @param {{lut:Data3DTexture,intensity:number}} [options={}] - The pass options.
|
|
*/
|
|
constructor( options = {} ) {
|
|
|
|
super( LUTShader );
|
|
|
|
/**
|
|
* The LUT as a 3D texture.
|
|
*
|
|
* @type {?Data3DTexture}
|
|
* @default null
|
|
*/
|
|
this.lut = options.lut || null;
|
|
|
|
/**
|
|
* The intensity.
|
|
*
|
|
* @type {?number}
|
|
* @default 1
|
|
*/
|
|
this.intensity = 'intensity' in options ? options.intensity : 1;
|
|
|
|
}
|
|
|
|
set lut( v ) {
|
|
|
|
const material = this.material;
|
|
|
|
if ( v !== this.lut ) {
|
|
|
|
material.uniforms.lut.value = null;
|
|
|
|
if ( v ) {
|
|
|
|
material.uniforms.lutSize.value = v.image.width;
|
|
material.uniforms.lut.value = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
get lut() {
|
|
|
|
return this.material.uniforms.lut.value;
|
|
|
|
}
|
|
|
|
set intensity( v ) {
|
|
|
|
this.material.uniforms.intensity.value = v;
|
|
|
|
}
|
|
|
|
get intensity() {
|
|
|
|
return this.material.uniforms.intensity.value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export { LUTPass };
|