mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
Works now.
This commit is contained in:
parent
067920cee3
commit
efbedf3874
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
import { Globe } from '../../src/og/Globe.js';
|
||||
import { GlobusTerrain } from '../../src/og/terrain/GlobusTerrain.js';
|
||||
import { XYZ } from '../../src/og/layer/XYZ.js';
|
||||
|
||||
let osm = new XYZ("OSM", {
|
||||
@ -16,5 +17,6 @@ let osm = new XYZ("OSM", {
|
||||
let globe = new Globe({
|
||||
'name': "Earth",
|
||||
'target': "earth",
|
||||
'terrain': new GlobusTerrain(),
|
||||
'layers': [osm]
|
||||
});
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { EmptyTerrainProvider } from './terrainProvider/EmptyTerrainProvider.js';
|
||||
import { EmptyTerrain } from './terrain/EmptyTerrain.js';
|
||||
import { Handler } from './webgl/Handler.js';
|
||||
import { Planet } from './scene/Planet.js';
|
||||
import { Renderer } from './renderer/Renderer.js';
|
||||
@ -52,7 +52,7 @@ const PLANET_NAME_PREFIX = "globus_planet_";
|
||||
* @param {boolean} [options.skybox] - Render skybox. null - default.
|
||||
* @param {boolean} [options.atmosphere] - Render planet with atmosphere. False - default.
|
||||
* @param {string} [options.name] - Planet name. Default is unic identifier.
|
||||
* @param {og.terrainProvider.TerrainProvider} [options.terrain] - Terrain provider. Default no terrain - og.terrainProvider.EmptyTerrainProvider.
|
||||
* @param {og.terrain.Terrain} [options.terrain] - Terrain provider. Default no terrain - og.terrain.EmptyTerrain.
|
||||
* @param {Array.<og.control.BaseControl>} [options.controls] - Renderer controls array.
|
||||
* @param {Array.<og.layer.Layer>} [options.layers] - Planet layers.
|
||||
* @param {og.Extent} [options.viewExtent] - Viewable starting extent.
|
||||
@ -127,9 +127,9 @@ class Globe {
|
||||
|
||||
//Attach terrain provider
|
||||
if (options.terrain) {
|
||||
this.planet.setTerrainProvider(options.terrain);
|
||||
this.planet.setTerrain(options.terrain);
|
||||
} else {
|
||||
this.planet.setTerrainProvider(new EmptyTerrainProvider());
|
||||
this.planet.setTerrain(new EmptyTerrain());
|
||||
}
|
||||
|
||||
this.renderer.addRenderNode(this.planet);
|
||||
|
||||
@ -13,10 +13,10 @@ import { Vec3 } from '../math/Vec3.js';
|
||||
|
||||
/**
|
||||
* Returns Sun position in the geocentric coordinate system by the time.
|
||||
* @param {Number} jd - Julian date time.
|
||||
* @param {Number} jDate - Julian date time.
|
||||
* @returns {og.math.Vector3} - Sun geocentric coordinates.
|
||||
*/
|
||||
export function getSunPosition(jd) {
|
||||
export function getSunPosition(jDate) {
|
||||
//http://stjarnhimlen.se/comp/tutorial.html
|
||||
// a Mean distance, or semi-major axis
|
||||
// e Eccentricity
|
||||
@ -69,7 +69,7 @@ export function getSunPosition(jd) {
|
||||
// position (seen from the Sun) should be converted to a
|
||||
// corresponding geocentric position (seen from the Earth).
|
||||
|
||||
var d = jd - jd.J2000;
|
||||
var d = jDate - jd.J2000;
|
||||
|
||||
var w = 282.9404 + 4.70935E-5 * d; //longitude of perihelion
|
||||
var a = 1.000000; //mean distance, a.u.
|
||||
|
||||
@ -28,6 +28,7 @@ class LightSource {
|
||||
static set _staticCounter(n) {
|
||||
this._counter = n;
|
||||
}
|
||||
|
||||
constructor(name, params) {
|
||||
params = params || {};
|
||||
|
||||
|
||||
@ -427,7 +427,7 @@ Quat.prototype.setFromEulerAngles = function (pitch, yaw, roll) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
Quat.prototype.getEulerAngles = function () {
|
||||
var matrix = this.getMatrix4();
|
||||
var matrix = this.getMat4();
|
||||
return matrix.getEulerAngles();
|
||||
};
|
||||
|
||||
@ -482,7 +482,7 @@ Quat.prototype.setFromMatrix4 = function (m) {
|
||||
* @public
|
||||
* @returns {og.math.Matrix4}
|
||||
*/
|
||||
Quat.prototype.getMatrix4 = function () {
|
||||
Quat.prototype.getMat4 = function () {
|
||||
var m = new Mat4();
|
||||
var mx = m._m;
|
||||
var c = this.x, d = this.y, e = this.z, g = this.w, f = c + c, h = d + d, i = e + e, j = c * f, k = c * h;
|
||||
|
||||
@ -6,23 +6,12 @@
|
||||
|
||||
import * as quadTree from '../quadTree/quadTree.js';
|
||||
|
||||
let CURRENT_POWER = 0;
|
||||
export const TABLESIZE = 6;
|
||||
|
||||
export let textureCoordsTable = [];
|
||||
const centerIndexesTable = initIndexBodiesTable(TABLESIZE);
|
||||
const skirtsIndexesTable = initIndexesBodySkirts(TABLESIZE);
|
||||
|
||||
let centerIndexesTable = [];
|
||||
let skirtsIndexesTable = [];
|
||||
|
||||
export function initIndexesTables(powerOfTwo) {
|
||||
if (powerOfTwo > CURRENT_POWER) {
|
||||
CURRENT_POWER = powerOfTwo;
|
||||
centerIndexesTable = initIndexBodiesTable(powerOfTwo);
|
||||
textureCoordsTable = initTextureCoordsTable(powerOfTwo);
|
||||
skirtsIndexesTable = initIndexesBodySkirts(powerOfTwo);
|
||||
}
|
||||
centerIndexesTable[0] = [];
|
||||
textureCoordsTable[0] = [];
|
||||
};
|
||||
export const textureCoordsTable = initTextureCoordsTable(TABLESIZE);
|
||||
|
||||
export function createSegmentIndexes(size, sidesSizes) {
|
||||
if (size != 1) {
|
||||
@ -195,6 +184,7 @@ function initTextureCoordsTable(pow) {
|
||||
var d = Math.pow(2, i);
|
||||
table[d] = createTextureCoords(d);
|
||||
}
|
||||
table[0] = [];
|
||||
return table;
|
||||
};
|
||||
|
||||
@ -205,6 +195,7 @@ function initIndexBodiesTable(pow) {
|
||||
var t = table[d] = [];
|
||||
createCenterBodyIndexes(d + 1, t);
|
||||
}
|
||||
table[0] = [];
|
||||
return table;
|
||||
};
|
||||
|
||||
|
||||
@ -12,9 +12,9 @@ import { EPSG3857 } from '../proj/EPSG3857.js';
|
||||
import { Extent } from '../Extent.js';
|
||||
import { Layer } from '../layer/Layer.js';
|
||||
import { LonLat } from '../LonLat.js';
|
||||
import { textureCoordsTable } from './PlanetSegmentHelper.js';
|
||||
import { Ray } from '../math/Ray.js';
|
||||
import { Sphere } from '../bv/Sphere.js';
|
||||
import { textureCoordsTable } from './PlanetSegmentHelper.js';
|
||||
import { Vec3 } from '../math/Vec3.js';
|
||||
|
||||
var _RenderingSlice = function (p) {
|
||||
@ -86,7 +86,7 @@ const Segment = function (node, planet, tileZoom, extent) {
|
||||
* Vertices grid size.
|
||||
* @type {number}
|
||||
*/
|
||||
this.gridSize = planet.terrainProvider.gridSizeByZoom[tileZoom];
|
||||
this.gridSize = planet.terrain.gridSizeByZoom[tileZoom];
|
||||
|
||||
/**
|
||||
* Tile zoom index.
|
||||
@ -284,13 +284,10 @@ Segment.prototype.projectNative = function (lonlat) {
|
||||
return lonlat.forwardMercator();
|
||||
};
|
||||
|
||||
/**
|
||||
* Starts and load terrain provider to make terrain.
|
||||
*/
|
||||
Segment.prototype.loadTerrain = function () {
|
||||
if (this.tileZoom >= this.planet.terrainProvider.minZoom) {
|
||||
if (this.tileZoom >= this.planet.terrain.minZoom) {
|
||||
if (!this.terrainIsLoading && !this.terrainReady) {
|
||||
this.planet.terrainProvider.handleSegmentTerrain(this);
|
||||
this.planet.terrain.handleSegmentTerrain(this);
|
||||
}
|
||||
} else {
|
||||
this.terrainReady = true;
|
||||
@ -336,7 +333,7 @@ Segment.prototype._terrainWorkerCallback = function (data) {
|
||||
this.planet._normalMapCreator.queue(this);
|
||||
}
|
||||
|
||||
var tgs = this.planet.terrainProvider.gridSizeByZoom[this.tileZoom];
|
||||
var tgs = this.planet.terrain.gridSizeByZoom[this.tileZoom];
|
||||
this.createCoordsBuffers(this.terrainVertices, tgs);
|
||||
this.bsphere.setFromBounds(data.bounds);
|
||||
this.gridSize = tgs;
|
||||
@ -349,13 +346,13 @@ Segment.prototype._terrainWorkerCallback = function (data) {
|
||||
* Terrain is not obtained or not exists on the server.
|
||||
*/
|
||||
Segment.prototype.elevationsNotExists = function () {
|
||||
if (this.tileZoom <= this.planet.terrainProvider.maxZoom) {
|
||||
if (this.tileZoom <= this.planet.terrain.maxZoom) {
|
||||
if (this.ready && this.terrainIsLoading) {
|
||||
this.terrainIsLoading = false;
|
||||
this.terrainReady = true;
|
||||
this.terrainExists = false;
|
||||
this.node.appliedTerrainNodeId = this.node.nodeId;
|
||||
this.gridSize = this.planet.terrainProvider.gridSizeByZoom[this.tileZoom];
|
||||
this.gridSize = this.planet.terrain.gridSizeByZoom[this.tileZoom];
|
||||
|
||||
if (this.planet.lightEnabled && !this._inTheQueue) {
|
||||
this.planet._normalMapCreator.queue(this);
|
||||
@ -381,7 +378,7 @@ Segment.prototype._normalMapEdgeEqualize = function (side, i_a, vert) {
|
||||
|
||||
var nn = this.node.neighbors;
|
||||
var n = nn[side];
|
||||
var maxZ = this.planet.terrainProvider.maxZoom;
|
||||
var maxZ = this.planet.terrain.maxZoom;
|
||||
|
||||
if (this.tileZoom === maxZ) {
|
||||
if (!(nn[0] || nn[1] || nn[2] || nn[3])) {
|
||||
@ -525,9 +522,6 @@ Segment.prototype._normalMapEdgeEqualize = function (side, i_a, vert) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback that calls in terrain provider to complete the terrain.
|
||||
*/
|
||||
Segment.prototype.applyTerrain = function (elevations) {
|
||||
if (this.ready) {
|
||||
if (elevations.length) {
|
||||
@ -742,10 +736,10 @@ Segment.prototype.initializePlainSegment = function () {
|
||||
var n = this.node;
|
||||
n.sideSize[0] = n.sideSize[1] =
|
||||
n.sideSize[2] = n.sideSize[3] =
|
||||
this.gridSize = p.terrainProvider.gridSizeByZoom[this.tileZoom];
|
||||
this.gridSize = p.terrain.gridSizeByZoom[this.tileZoom];
|
||||
this.initialized = true;
|
||||
|
||||
if (this.tileZoom <= p.terrainProvider.maxZoom) {
|
||||
if (this.tileZoom <= p.terrain.maxZoom) {
|
||||
var nmc = this.planet._normalMapCreator;
|
||||
this.normalMapTexturePtr = p.renderer.handler.createEmptyTexture_l(nmc._width, nmc._height);
|
||||
}
|
||||
@ -761,7 +755,7 @@ Segment.prototype.createPlainSegment = function () {
|
||||
Segment.prototype.createPlainVertices = function (gridSize) {
|
||||
|
||||
var e = this._extent,
|
||||
fgs = this.planet.terrainProvider.fileGridSize;
|
||||
fgs = this.planet.terrain.fileGridSize;
|
||||
var lonSize = e.getWidth();
|
||||
var llStep = lonSize / Math.max(fgs, gridSize);
|
||||
var esw_lon = e.southWest.lon,
|
||||
|
||||
@ -107,7 +107,7 @@ Node.prototype.createBounds = function () {
|
||||
if (!seg.tileZoom) {
|
||||
seg.bsphere.radius = seg.planet.ellipsoid._a;
|
||||
seg.bsphere.center = new Vec3();
|
||||
} else if (seg.tileZoom < seg.planet.terrainProvider.minZoom) {
|
||||
} else if (seg.tileZoom < seg.planet.terrain.minZoom) {
|
||||
seg.createBoundsByExtent();
|
||||
} else {
|
||||
var pn = this;
|
||||
@ -310,7 +310,7 @@ Node.prototype.renderTree = function (maxZoom) {
|
||||
} else if (seg.tileZoom === maxZoom || !maxZoom && seg.acceptForRendering(cam)) {
|
||||
this.prepareForRendering(h, altVis, onlyTerrain);
|
||||
} else {
|
||||
if (seg.tileZoom < planet.terrainProvider.gridSizeByZoom.length - 1) {
|
||||
if (seg.tileZoom < planet.terrain.gridSizeByZoom.length - 1) {
|
||||
this.traverseNodes(maxZoom);
|
||||
} else {
|
||||
this.prepareForRendering(h, altVis, onlyTerrain);
|
||||
@ -454,7 +454,7 @@ Node.prototype.getCommonSide = function (node) {
|
||||
Node.prototype.whileNormalMapCreating = function () {
|
||||
|
||||
var seg = this.planetSegment;
|
||||
var maxZ = this.planet.terrainProvider.maxZoom;
|
||||
var maxZ = this.planet.terrain.maxZoom;
|
||||
|
||||
if (seg.tileZoom <= maxZ && !seg.terrainIsLoading && seg.terrainReady && !seg._inTheQueue) {
|
||||
seg.planet._normalMapCreator.queue(seg);
|
||||
@ -501,8 +501,8 @@ Node.prototype.whileTerrainLoading = function () {
|
||||
var n = this.nodes;
|
||||
|
||||
//Maybe better is to replace this code to the Segment module?
|
||||
if (seg.tileZoom >= this.planet.terrainProvider.minZoom &&
|
||||
seg.tileZoom < this.planet.terrainProvider.maxZoom &&
|
||||
if (seg.tileZoom >= this.planet.terrain.minZoom &&
|
||||
seg.tileZoom < this.planet.terrain.maxZoom &&
|
||||
n.length === 4 && n[0].planetSegment.terrainReady && n[1].planetSegment.terrainReady &&
|
||||
n[2].planetSegment.terrainReady && n[3].planetSegment.terrainReady
|
||||
) {
|
||||
@ -511,7 +511,7 @@ Node.prototype.whileTerrainLoading = function () {
|
||||
|
||||
seg.initializePlainSegment();
|
||||
|
||||
var fgs = this.planet.terrainProvider.fileGridSize;
|
||||
var fgs = this.planet.terrain.fileGridSize;
|
||||
var dg = Math.max(fgs / seg.gridSize, 1),
|
||||
gs = Math.max(fgs, seg.gridSize) + 1;
|
||||
var ind = 0,
|
||||
@ -627,7 +627,7 @@ Node.prototype.whileTerrainLoading = function () {
|
||||
var gridSize = pn.planetSegment.gridSize / dZ2;
|
||||
var tempVertices;
|
||||
|
||||
var fgs = this.planet.terrainProvider.fileGridSize,
|
||||
var fgs = this.planet.terrain.fileGridSize,
|
||||
fgsZ = fgs / dZ2;
|
||||
var tempNormalMapNormals;
|
||||
|
||||
@ -698,7 +698,7 @@ Node.prototype.whileTerrainLoading = function () {
|
||||
this.appliedTerrainNodeId = pn.nodeId;
|
||||
}
|
||||
|
||||
var maxZ = this.planet.terrainProvider.maxZoom;
|
||||
var maxZ = this.planet.terrain.maxZoom;
|
||||
|
||||
if (seg.tileZoom > maxZ) {
|
||||
if (pn.planetSegment.tileZoom >= maxZ) {
|
||||
|
||||
@ -315,6 +315,7 @@ class Renderer {
|
||||
'width': 640,
|
||||
'height': 480
|
||||
});
|
||||
this.pickingFramebuffer.init();
|
||||
|
||||
this.handler.addShaderProgram(new ShaderProgram("screenFrame", {
|
||||
uniforms: {
|
||||
@ -347,9 +348,13 @@ class Renderer {
|
||||
|
||||
if (this._drawBuffersExtension) {
|
||||
this.sceneFramebuffer = new MultiFramebuffer(this.handler, { size: 3 });
|
||||
this.sceneFramebuffer.init();
|
||||
|
||||
this._fnScreenFrame = this._multiframebufferScreenFrame;
|
||||
} else {
|
||||
this.sceneFramebuffer = new Framebuffer(this.handler);
|
||||
this.sceneFramebuffer.init();
|
||||
|
||||
this._fnScreenFrame = this._singleframebufferScreenFrame;
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import * as math from '../math.js';
|
||||
import * as mercator from '../mercator.js';
|
||||
import * as planetSegmentHelper from '../planetSegment/planetSegmentHelper.js';
|
||||
import * as quadTree from '../quadTree/quadTree.js';
|
||||
import { EPSG3857 } from '../proj/EPSG3857.js';
|
||||
import { Extent } from '../Extent.js';
|
||||
import { Framebuffer } from '../webgl/Framebuffer.js';
|
||||
import { GeoImageCreator } from '../utils/GeoImageCreator.js';
|
||||
@ -140,9 +141,9 @@ class Planet extends RenderNode {
|
||||
/**
|
||||
* Terrain provider.
|
||||
* @public
|
||||
* @type {og.terrainProvider.TerrainProvider}
|
||||
* @type {og.terrain.Terrain}
|
||||
*/
|
||||
this.terrainProvider = null;
|
||||
this.terrain = null;
|
||||
|
||||
/**
|
||||
* Camera is this.renderer.activeCamera pointer.
|
||||
@ -533,11 +534,11 @@ class Planet extends RenderNode {
|
||||
/**
|
||||
* Sets terrain provider
|
||||
* @public
|
||||
* @param {og.terrainProvider.TerrainProvider} terrain - Terrain provider.
|
||||
* @param {og.terrain.Terrain} terrain - Terrain provider.
|
||||
*/
|
||||
setTerrainProvider(terrain) {
|
||||
this.terrainProvider = terrain;
|
||||
this.terrainProvider._planet = this;
|
||||
setTerrain(terrain) {
|
||||
this.terrain = terrain;
|
||||
this.terrain._planet = this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -563,6 +564,7 @@ class Planet extends RenderNode {
|
||||
'width': 320,
|
||||
'height': 240
|
||||
});
|
||||
this._heightPickingFramebuffer.init();
|
||||
}
|
||||
}
|
||||
|
||||
@ -572,8 +574,7 @@ class Planet extends RenderNode {
|
||||
*/
|
||||
initialization() {
|
||||
//Initialization indexes table
|
||||
var TABLESIZE = 6;
|
||||
planetSegmentHelper.initIndexesTables(TABLESIZE);
|
||||
var TABLESIZE = planetSegmentHelper.TABLESIZE;
|
||||
|
||||
//Iniytialize indexes buffers cache. It takes ~120mb RAM!
|
||||
for (var i = 0; i <= TABLESIZE; i++) {
|
||||
@ -1232,7 +1233,7 @@ class Planet extends RenderNode {
|
||||
this._normalMapCreator.lock(this._memKey);
|
||||
|
||||
this._normalMapCreator.clear();
|
||||
this.terrainProvider.abortLoading();
|
||||
this.terrain.abortLoading();
|
||||
|
||||
var that = this;
|
||||
setTimeout(function () {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @module og/terrainProvider/EmptyTerrainProvider
|
||||
* @module og/terrainProvider/EmptyTerrain
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@ -8,7 +8,7 @@
|
||||
* Class represents terrain provider without elevation data.
|
||||
* @class
|
||||
*/
|
||||
class EmptyTerrainProvider {
|
||||
class EmptyTerrain {
|
||||
constructor() {
|
||||
/**
|
||||
* Provider name is "empty"
|
||||
@ -72,4 +72,4 @@ class EmptyTerrainProvider {
|
||||
abortLoading() { }
|
||||
};
|
||||
|
||||
export { EmptyTerrainProvider };
|
||||
export { EmptyTerrain };
|
||||
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* @module og/terrainProvider/GlobusTerrainProvider
|
||||
* @module og/terrainProvider/GlobusTerrain
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as quadTree from '../quadTree/quadTree.js';
|
||||
import { ajax } from '../ajax.js';
|
||||
import { EmptyTerrainProvider } from './EmptyTerrainProvider.js';
|
||||
import { EmptyTerrain } from './EmptyTerrain.js';
|
||||
import { EPSG3857 } from '../proj/EPSG3857.js';
|
||||
import { Events } from '../Events.js';
|
||||
import { QueueArray } from '../QueueArray.js';
|
||||
@ -42,7 +42,7 @@ const EVENT_NAMES = [
|
||||
* @fires og.terrainProvider.TerrainProvider#load
|
||||
* @fires og.terrainProvider.TerrainProvider#loadend
|
||||
*/
|
||||
class GlobusTerrainProvider extends EmptyTerrainProvider {
|
||||
class GlobusTerrain extends EmptyTerrain {
|
||||
constructor(name, options) {
|
||||
super();
|
||||
options = options || {};
|
||||
@ -321,4 +321,4 @@ class GlobusTerrainProvider extends EmptyTerrainProvider {
|
||||
}
|
||||
};
|
||||
|
||||
export { TerrainProvider };
|
||||
export { GlobusTerrain };
|
||||
@ -112,10 +112,12 @@ GeoImageCreator.prototype.remove = function (geoImage) {
|
||||
};
|
||||
|
||||
GeoImageCreator.prototype._initBuffers = function () {
|
||||
planetSegmentHelper.initIndexesTables(3);
|
||||
|
||||
this._framebuffer = new Framebuffer(this._handler, { width: 2, height: 2, useDepth: false });
|
||||
this._framebuffer.init();
|
||||
|
||||
this._framebufferMercProj = new Framebuffer(this._handler, { width: 2, height: 2, useDepth: false });
|
||||
this._framebufferMercProj.init();
|
||||
|
||||
var gs = this._gridSize;
|
||||
var gs1 = this._gridSize + 1;
|
||||
|
||||
@ -118,6 +118,8 @@ NormalMapCreator.prototype._init = function () {
|
||||
useDepth: false
|
||||
});
|
||||
|
||||
this._framebuffer.init();
|
||||
|
||||
this._normalMapVerticesTexture = this._handler.createEmptyTexture_l(this._width, this._height);
|
||||
|
||||
//create vertices hasharray for different grid size segments
|
||||
|
||||
@ -50,6 +50,10 @@ class SDFCreator {
|
||||
this._framebuffer0 = new Framebuffer(this._handler, { useDepth: false });
|
||||
this._framebuffer1 = new Framebuffer(this._handler, { useDepth: false });
|
||||
this._framebuffer2 = new Framebuffer(this._handler, { useDepth: false });
|
||||
|
||||
this._framebuffer0.init();
|
||||
this._framebuffer1.init();
|
||||
this._framebuffer2.init();
|
||||
}
|
||||
_initShaders() {
|
||||
var vfield = new ShaderProgram("vfield", {
|
||||
|
||||
@ -102,7 +102,7 @@ export function htmlColorToRgb(htmlColor) {
|
||||
* @param {Object} params - Template named object with subsrtings.
|
||||
* @returns {string} -
|
||||
*
|
||||
* @example <caption>Example from og.terrainProvider that replaces tile indexes in url:</caption>
|
||||
* @example <caption>Example from og.terrain that replaces tile indexes in url:</caption>
|
||||
* var substrings = {
|
||||
* "x": 12,
|
||||
* "y": 15,
|
||||
|
||||
@ -47,7 +47,7 @@ class TerrainWorker {
|
||||
'this_normalMapVertices': segment.normalMapVertices,
|
||||
'this_normalMapNormals': segment.normalMapNormals,
|
||||
'heightFactor': segment.planet._heightFactor,
|
||||
'gridSize': segment.planet.terrainProvider.gridSizeByZoom[segment.tileZoom]
|
||||
'gridSize': segment.planet.terrain.gridSizeByZoom[segment.tileZoom]
|
||||
}, [
|
||||
_elevations.buffer,
|
||||
segment.plainVertices.buffer,
|
||||
|
||||
@ -147,6 +147,7 @@ VectorTileCreator.prototype._initialize = function () {
|
||||
height: this._height,
|
||||
useDepth: false
|
||||
});
|
||||
this._framebuffer.init();
|
||||
};
|
||||
|
||||
VectorTileCreator.prototype.frame = function () {
|
||||
|
||||
@ -67,8 +67,6 @@ class Framebuffer {
|
||||
* @type {number}
|
||||
*/
|
||||
this.texture = options.texture || null;
|
||||
|
||||
this._initialize();
|
||||
}
|
||||
|
||||
destroy() {
|
||||
@ -88,7 +86,7 @@ class Framebuffer {
|
||||
* Framebuffer initialization.
|
||||
* @private
|
||||
*/
|
||||
_initialize() {
|
||||
init() {
|
||||
var gl = this.handler.gl;
|
||||
|
||||
this._fbo = gl.createFramebuffer();
|
||||
@ -134,7 +132,7 @@ class Framebuffer {
|
||||
}
|
||||
if (this._useDepth) {
|
||||
this.destroy();
|
||||
this._initialize();
|
||||
this.init();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -71,8 +71,6 @@ class MultiFramebuffer {
|
||||
* @type {boolean}
|
||||
*/
|
||||
this._active = false;
|
||||
|
||||
this._initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,9 +95,9 @@ class MultiFramebuffer {
|
||||
|
||||
/**
|
||||
* Framebuffer initialization.
|
||||
* @private
|
||||
* @virtual
|
||||
*/
|
||||
_initialize() {
|
||||
init() {
|
||||
var gl = this.handler.gl;
|
||||
var ext = this.handler.extensions.WEBGL_draw_buffers;
|
||||
|
||||
@ -148,7 +146,7 @@ class MultiFramebuffer {
|
||||
this._width = width;
|
||||
this._height = height;
|
||||
this.destroy();
|
||||
this._initialize();
|
||||
this.init();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user