mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 18:52:18 +00:00
Complete phase 3 W1 acceptance and close T16 findings
Fix Navara model display tint, overlay ordering, follow gestures and resource cleanup. Reduce repeated aircraft work and correct fixture enrichment responses. Strengthen dev/preview QA, preserve failure history and document verified W1 results. Validation: 7171 ordinary tests pass, one Windows-only skip; 15 allocation probes; 37 W1 acceptance steps; contracts, shell, four performance gates; 18 identical Cesium baseline PNGs. Known pre-existing CCTV and live-source limits are recorded.
This commit is contained in:
1 parent
766c786093
commit
0600964249
59 files changed
+2334
-701
No files matched your search
@@ -0,0 +1,73 @@
|
||||
// Models use the scene's depth, but their lit display colour is resolved after
|
||||
// the view's HDR effects. This keeps MSAA from spreading HDR tint into edges.
|
||||
import { InstancedMesh } from 'three';
|
||||
import { OVERLAY_DEPTH_FRAGMENT } from '../overlayDepth.js';
|
||||
|
||||
// three's pinned ACESFilmicToneMapping, with the view's public exposure.
|
||||
const ACES = `
|
||||
uniform float uGevModelExposure;
|
||||
vec3 gevModelAces(vec3 color) {
|
||||
const mat3 inputMatrix = mat3(0.59719,0.076,0.0284, 0.35458,0.90834,0.13383, 0.04823,0.01566,0.83777);
|
||||
const mat3 outputMatrix = mat3(1.60475,-0.10208,-0.00327, -0.53108,1.10813,-0.07276, -0.07367,-0.00605,1.07602);
|
||||
color = inputMatrix * (color * uGevModelExposure / 0.6);
|
||||
color = (color * (color + 0.0245786) - 0.000090537) /
|
||||
(color * (0.983729 * color + 0.432951) + 0.238081);
|
||||
return clamp(outputMatrix * color, 0.0, 1.0);
|
||||
}
|
||||
`;
|
||||
|
||||
export function createModelTint(mesh, uniforms, overlayUniforms) {
|
||||
const material = mesh.material.clone();
|
||||
material.depthTest = false;
|
||||
material.depthWrite = false;
|
||||
material.toneMapped = false;
|
||||
const lit = material.isMeshBasicMaterial
|
||||
? 'gl_FragColor.rgb'
|
||||
: 'gevModelAces(gl_FragColor.rgb)';
|
||||
material.onBeforeCompile = (shader) => {
|
||||
Object.assign(shader.uniforms, uniforms, overlayUniforms, {
|
||||
uGevDepthMode: { value: 1 },
|
||||
});
|
||||
shader.vertexShader = shader.vertexShader
|
||||
.replace(
|
||||
'void main() {',
|
||||
'attribute vec4 gevColor;\nvarying vec4 vGevColor;\nvarying float vGevDepthFree;\nvoid main() {',
|
||||
)
|
||||
.replace(
|
||||
'#include <begin_vertex>',
|
||||
'#include <begin_vertex>\nvGevColor = gevColor;\nvGevDepthFree = 0.0;',
|
||||
);
|
||||
shader.fragmentShader = shader.fragmentShader
|
||||
.replace(
|
||||
'void main() {',
|
||||
`uniform float uGevBlend;\nuniform float uGevAmbient;\nvarying vec4 vGevColor;\n${ACES}\n${OVERLAY_DEPTH_FRAGMENT}\nvoid main() {`,
|
||||
)
|
||||
.replace(
|
||||
'#include <logdepthbuf_fragment>',
|
||||
'#include <logdepthbuf_fragment>\nif (gevOverlayHidden()) discard;',
|
||||
)
|
||||
.replace(
|
||||
'#include <map_fragment>',
|
||||
'#include <map_fragment>\ndiffuseColor.a *= vGevColor.a;',
|
||||
)
|
||||
.replace(
|
||||
'#include <emissivemap_fragment>',
|
||||
'#include <emissivemap_fragment>\ntotalEmissiveRadiance += diffuseColor.rgb * uGevAmbient;',
|
||||
)
|
||||
.replace(
|
||||
'#include <opaque_fragment>',
|
||||
`#include <opaque_fragment>\nvec3 gevLitSrgb = sRGBTransferOETF(vec4(${lit}, 1.0)).rgb;\ngl_FragColor.rgb = sRGBTransferEOTF(vec4(mix(gevLitSrgb, vGevColor.rgb, uGevBlend), 1.0)).rgb;`,
|
||||
);
|
||||
};
|
||||
material.customProgramCacheKey = () => 'gev-model-lit-display-color';
|
||||
const tint = new InstancedMesh(
|
||||
mesh.geometry,
|
||||
material,
|
||||
mesh.instanceMatrix.count,
|
||||
);
|
||||
tint.userData.gevModelTint = true;
|
||||
tint.instanceMatrix = mesh.instanceMatrix;
|
||||
tint.frustumCulled = false;
|
||||
tint.renderOrder = mesh.renderOrder;
|
||||
return tint;
|
||||
}
|
||||
Reference in new issue
Block a user