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,
|
DynamicDrawUsage,
|
||||||
InstancedBufferAttribute,
|
InstancedBufferAttribute,
|
||||||
InstancedMesh,
|
InstancedMesh,
|
||||||
|
LinearFilter,
|
||||||
MeshBasicMaterial,
|
MeshBasicMaterial,
|
||||||
PlaneGeometry,
|
PlaneGeometry,
|
||||||
SRGBColorSpace,
|
SRGBColorSpace,
|
||||||
@@ -147,15 +148,20 @@ export function patchMoverShader(shader, uniforms, { point = false } = {}) {
|
|||||||
return shader;
|
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). */
|
/** The atlas as a three texture (a canvas at once, a URL once loaded). */
|
||||||
function atlasTexture(atlas, onLoad) {
|
function atlasTexture(atlas, onLoad) {
|
||||||
if (atlas.canvas) {
|
if (atlas.canvas) return cesiumSampling(new CanvasTexture(atlas.canvas));
|
||||||
const texture = new CanvasTexture(atlas.canvas);
|
const texture = cesiumSampling(new Texture());
|
||||||
texture.colorSpace = SRGBColorSpace;
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
const texture = new Texture();
|
|
||||||
texture.colorSpace = SRGBColorSpace;
|
|
||||||
const image = new Image();
|
const image = new Image();
|
||||||
image.crossOrigin = 'anonymous';
|
image.crossOrigin = 'anonymous';
|
||||||
image.onload = () => {
|
image.onload = () => {
|
||||||
|
|||||||
Reference in new issue
Block a user