mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
fix(globe): Navara sprite atlases are sampled as Cesium samples billboards
Linear, without mipmaps: Cesium's billboard atlas has none, and a mipmapped atlas greyed small glyphs Cesium draws at full colour (a 5 px aircraft at 15,000 km: 239 against Cesium's 255; now 255 on both). Task 10b colour parity.
This commit is contained in:
1 parent
1dd3220812
commit
20e9d4a0fa
1 file changed
+13
-7
@@ -12,6 +12,7 @@ import {
|
||||
DynamicDrawUsage,
|
||||
InstancedBufferAttribute,
|
||||
InstancedMesh,
|
||||
LinearFilter,
|
||||
MeshBasicMaterial,
|
||||
PlaneGeometry,
|
||||
SRGBColorSpace,
|
||||
@@ -147,15 +148,20 @@ export function patchMoverShader(shader, uniforms, { point = false } = {}) {
|
||||
return shader;
|
||||
}
|
||||
|
||||
// Sampled as Cesium samples its billboard atlas: linear, no mipmaps (a
|
||||
// mipmapped atlas greys small glyphs that Cesium draws at full colour).
|
||||
function cesiumSampling(texture) {
|
||||
texture.colorSpace = SRGBColorSpace;
|
||||
texture.generateMipmaps = false;
|
||||
texture.minFilter = LinearFilter;
|
||||
texture.magFilter = LinearFilter;
|
||||
return texture;
|
||||
}
|
||||
|
||||
/** The atlas as a three texture (a canvas at once, a URL once loaded). */
|
||||
function atlasTexture(atlas, onLoad) {
|
||||
if (atlas.canvas) {
|
||||
const texture = new CanvasTexture(atlas.canvas);
|
||||
texture.colorSpace = SRGBColorSpace;
|
||||
return texture;
|
||||
}
|
||||
const texture = new Texture();
|
||||
texture.colorSpace = SRGBColorSpace;
|
||||
if (atlas.canvas) return cesiumSampling(new CanvasTexture(atlas.canvas));
|
||||
const texture = cesiumSampling(new Texture());
|
||||
const image = new Image();
|
||||
image.crossOrigin = 'anonymous';
|
||||
image.onload = () => {
|
||||
|
||||
Reference in new issue
Block a user