mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(navara): separate always-visible shader programs
This commit is contained in:
1 parent
8328aab779
commit
0df0fb8261
2 files changed
+29
-1
No files matched your search
@@ -309,7 +309,7 @@ export function createMoverMesh(
|
||||
alwaysVisible: depthTest === 'always',
|
||||
});
|
||||
material.customProgramCacheKey = () =>
|
||||
`gev-mover-${kind}${encodedAtlas ? '-encoded-atlas' : ''}`;
|
||||
`gev-mover-${kind}${encodedAtlas ? '-encoded-atlas' : ''}${depthTest === 'always' ? '-always-visible' : ''}`;
|
||||
const mesh = new InstancedMesh(geometry, material, capacity);
|
||||
mesh.userData.gevStaticSprite =
|
||||
kind === 'sprite' &&
|
||||
|
||||
@@ -29,6 +29,34 @@ const basicShader = () => ({
|
||||
fragmentShader: ShaderLib.basic.fragmentShader,
|
||||
});
|
||||
|
||||
test('depth-tested and always-visible movers cannot reuse incompatible shader programs', () => {
|
||||
for (const kind of ['point', 'sprite']) {
|
||||
const movers = ['normal', 'always', { disableWithinM: 2000 }].map(
|
||||
(depthTest) => {
|
||||
const options = normalizeMoverSetOptions({
|
||||
...spriteOptions,
|
||||
kind,
|
||||
depthTest,
|
||||
point: { sizePx: 8 },
|
||||
});
|
||||
return createMoverMesh(options, createMoverStore(options));
|
||||
},
|
||||
);
|
||||
const keys = movers.map((m) => m.mesh.material.customProgramCacheKey());
|
||||
assert.notEqual(
|
||||
keys[0],
|
||||
keys[1],
|
||||
`${kind}: different depth GLSL requires different programs`,
|
||||
);
|
||||
assert.equal(
|
||||
keys[0],
|
||||
keys[2],
|
||||
`${kind}: distance escape is a uniform, not another program`,
|
||||
);
|
||||
for (const mover of movers) mover.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
test('point translucency applies to fill and outline and defaults to no fade', () => {
|
||||
const options = normalizeMoverSetOptions({
|
||||
id: 'stations',
|
||||
|
||||
Reference in new issue
Block a user