Skip to content

Commit

Permalink
refactor(View): Deprecate WebGL 1.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Desplandis committed Sep 13, 2023
1 parent a881ac8 commit a56415f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/Core/Deprecated/Undeprecator.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ export const deprecatedFeature2MeshOptions = (options) => {
}
};

export const deprecatedC3DEngineWebGLOptions = (options) => {
if (options.isWebGL2 === false) {
console.warn('WebGL1 support (isWebGL2=false) is deprecated and will be removed in iTowns 2.43. This follows its deprecation by three.js. If you are impacted by this change, please discuss in the following issue: https://github.com/iTowns/itowns/issues/2152.');
}
};

export default {};
6 changes: 0 additions & 6 deletions src/Core/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ class View extends THREE.EventDispatcher {
* var view = itowns.View('EPSG:4326', viewerDiv, { camera: { type: itowns.CAMERA_TYPE.ORTHOGRAPHIC } });
* var customControls = itowns.THREE.OrbitControls(view.camera.camera3D, viewerDiv);
*
* @example <caption><b>Enable WebGl 1.0 instead of WebGl 2.0.</b></caption>
* var viewerDiv = document.getElementById('viewerDiv');
* const extent = new Extent('EPSG:3946', 1837816.94334, 1847692.32501, 5170036.4587, 5178412.82698);
* var view = new itowns.View('EPSG:4326', viewerDiv, { renderer: { isWebGL2: false } });
*
* @param {string} crs - The default CRS of Three.js coordinates. Should be a cartesian CRS.
* @param {HTMLElement} viewerDiv - Where to instanciate the Three.js scene in the DOM
* @param {Object=} options - Optional properties.
Expand All @@ -145,7 +140,6 @@ class View extends THREE.EventDispatcher {
* a default one will be constructed. In this case, if options.renderer is an object, it will be used to
* configure the renderer (see {@link c3DEngine}. If not present, a new &lt;canvas> will be created and
* added to viewerDiv (mutually exclusive with mainLoop)
* @param {boolean} [options.renderer.isWebGL2=true] - enable webgl 2.0 for THREE.js.
* @param {?Scene} [options.scene3D] - [THREE.Scene](https://threejs.org/docs/#api/en/scenes/Scene) instance to use, otherwise a default one will be constructed
* @param {?Color} options.diffuse - [THREE.Color](https://threejs.org/docs/?q=color#api/en/math/Color) Diffuse color terrain material.
* This color is applied to terrain if there isn't color layer on terrain extent (by example on pole).
Expand Down
3 changes: 3 additions & 0 deletions src/Renderer/c3DEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ import Capabilities from 'Core/System/Capabilities';
import { unpack1K } from 'Renderer/LayeredMaterial';
import WEBGL from 'ThreeExtended/capabilities/WebGL';
import Label2DRenderer from 'Renderer/Label2DRenderer';
import { deprecatedC3DEngineWebGLOptions } from 'Core/Deprecated/Undeprecator';

const depthRGBA = new THREE.Vector4();
class c3DEngine {
constructor(rendererOrDiv, options = {}) {
deprecatedC3DEngineWebGLOptions(options);

const NOIE = !Capabilities.isInternetExplorer();
// pick sensible default options
if (options.antialias === undefined) {
Expand Down

0 comments on commit a56415f

Please sign in to comment.