diff --git a/.github/workflows/build.workflow.yml b/.github/workflows/build.workflow.yml index 534435a..6b5c695 100644 --- a/.github/workflows/build.workflow.yml +++ b/.github/workflows/build.workflow.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 16 - name: Install depedencies from NPM run: npm install diff --git a/.github/workflows/lint.workflow.yml b/.github/workflows/lint.workflow.yml index 08eeb82..5afb53d 100644 --- a/.github/workflows/lint.workflow.yml +++ b/.github/workflows/lint.workflow.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 16 - name: Install depedencies from NPM run: npm install diff --git a/source/examples/transition.ts b/source/examples/transition.ts index 4ccfca4..37a74f2 100644 --- a/source/examples/transition.ts +++ b/source/examples/transition.ts @@ -1,6 +1,6 @@ // @ts-nocheck -import {WebGLRenderer, Scene, Color, TextureLoader, Mesh, SphereGeometry, MeshBasicMaterial, PerspectiveCamera, MOUSE, AmbientLight, Raycaster, Vector2, LinearSRGBColorSpace, ColorManagement} from 'three'; +import {WebGLRenderer, Scene, Color, TextureLoader, Mesh, SphereGeometry, MeshBasicMaterial, PerspectiveCamera, MOUSE, AmbientLight, Raycaster, Vector2, LinearSRGBColorSpace, ColorManagement, REVISION} from 'three'; import {MapControls} from 'three/examples/jsm/controls/MapControls.js'; import {UnitsUtils, BingMapsProvider, MapView} from '../Main'; @@ -32,6 +32,9 @@ function createWorldScene(): any var loader = new TextureLoader(); loader.load('2k_earth_daymap.jpg', function(texture) { + if(parseInt(REVISION) >= 152) { + texture.colorSpace = 'srgb' + } var sphere = new Mesh(new SphereGeometry(UnitsUtils.EARTH_RADIUS, 256, 256), new MeshBasicMaterial({map: texture})); scene.add(sphere); }); diff --git a/source/lod/LODRaycast.ts b/source/lod/LODRaycast.ts index c63108f..dd2c79d 100644 --- a/source/lod/LODRaycast.ts +++ b/source/lod/LODRaycast.ts @@ -66,7 +66,8 @@ export class LODRaycast implements LODControl let myIntersects = []; this.raycaster.intersectObjects(view.children, true, myIntersects); - if (myIntersects.length > 0) { + if (myIntersects.length > 0) + { // Only use first intersection with the terrain intersects.push(myIntersects[0]); } diff --git a/source/nodes/MapNode.ts b/source/nodes/MapNode.ts index 541527d..8682b4f 100644 --- a/source/nodes/MapNode.ts +++ b/source/nodes/MapNode.ts @@ -1,4 +1,4 @@ -import {LinearFilter, Material, Mesh, Texture, Vector3, BufferGeometry, Object3D, RGBAFormat} from 'three'; +import {LinearFilter, Material, Mesh, Texture, Vector3, BufferGeometry, Object3D, RGBAFormat, REVISION} from 'three'; import {MapView} from '../MapView'; import {TextureUtils} from '../utils/TextureUtils'; @@ -286,6 +286,10 @@ export abstract class MapNode extends Mesh } const texture = new Texture(image); + if (parseInt(REVISION) >= 152) + { + texture.colorSpace = 'srgb'; + } texture.generateMipmaps = false; texture.format = RGBAFormat; texture.magFilter = LinearFilter; diff --git a/source/nodes/MapSphereNode.ts b/source/nodes/MapSphereNode.ts index ccaa86f..6fd21db 100644 --- a/source/nodes/MapSphereNode.ts +++ b/source/nodes/MapSphereNode.ts @@ -1,4 +1,4 @@ -import {Matrix4, BufferGeometry, Quaternion, Vector3, Raycaster, Intersection, ShaderMaterial, TextureLoader, Texture, Vector4} from 'three'; +import {Matrix4, BufferGeometry, Quaternion, Vector3, Raycaster, Intersection, ShaderMaterial, TextureLoader, Texture, Vector4, REVISION} from 'three'; import {MapNode, QuadTreePosition} from './MapNode'; import {MapSphereNodeGeometry} from '../geometries/MapSphereNodeGeometry'; import {UnitsUtils} from '../utils/UnitsUtils'; @@ -67,6 +67,12 @@ export class MapSphereNode extends MapNode vec4 color = texture2D(uTexture, vec2(x, y)); gl_FragColor = color; + ${ + parseInt(REVISION) < 152 ? '' : ` + #include + #include ${parseInt(REVISION) >= 154 ? '' : ''} + ` +} } `; @@ -127,7 +133,13 @@ export class MapSphereNode extends MapNode public async applyTexture(image: HTMLImageElement): Promise { const textureLoader = new TextureLoader(); - const texture = textureLoader.load(image.src, function() {}); + const texture = textureLoader.load(image.src, function() + { + if (parseInt(REVISION) >= 152) + { + texture.colorSpace = 'srgb'; + } + }); // @ts-ignore this.material.uniforms.uTexture.value = texture; // @ts-ignore