Merge pull request #8023 from fredj/typedefs.js

Module type changes for ol.webgl
This commit is contained in:
Frédéric Junod
2018-03-23 13:37:16 +01:00
committed by GitHub
16 changed files with 116 additions and 112 deletions

View File

@@ -12,7 +12,7 @@ import Event from '../events/Event.js';
* @param {ol.render.VectorContext=} opt_vectorContext Vector context. * @param {ol.render.VectorContext=} opt_vectorContext Vector context.
* @param {module:ol/PluggableMap~FrameState=} opt_frameState Frame state. * @param {module:ol/PluggableMap~FrameState=} opt_frameState Frame state.
* @param {?CanvasRenderingContext2D=} opt_context Context. * @param {?CanvasRenderingContext2D=} opt_context Context.
* @param {?ol.webgl.Context=} opt_glContext WebGL Context. * @param {?module:ol/webgl/Context~WebGLContext=} opt_glContext WebGL Context.
*/ */
const RenderEvent = function( const RenderEvent = function(
type, opt_vectorContext, opt_frameState, opt_context, type, opt_vectorContext, opt_frameState, opt_context,
@@ -45,7 +45,7 @@ const RenderEvent = function(
/** /**
* WebGL context. Only available when a WebGL renderer is used, null * WebGL context. Only available when a WebGL renderer is used, null
* otherwise. * otherwise.
* @type {ol.webgl.Context|null|undefined} * @type {module:ol/webgl/Context~WebGLContext|null|undefined}
* @api * @api
*/ */
this.glContext = opt_glContext; this.glContext = opt_glContext;

View File

@@ -181,7 +181,7 @@ WebGLCircleReplay.prototype.finish = function(context) {
WebGLCircleReplay.prototype.getDeleteResourcesFunction = function(context) { WebGLCircleReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may // We only delete our stuff here. The shaders and the program may
// be used by other CircleReplay instances (for other layers). And // be used by other CircleReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context // they will be deleted when disposing of the module:ol/webgl/Context~WebGLContext
// object. // object.
const verticesBuffer = this.verticesBuffer; const verticesBuffer = this.verticesBuffer;
const indicesBuffer = this.indicesBuffer; const indicesBuffer = this.indicesBuffer;
@@ -311,7 +311,7 @@ WebGLCircleReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, contex
/** /**
* @private * @private
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object} skippedFeaturesHash Ids of features to skip. * @param {Object} skippedFeaturesHash Ids of features to skip.
*/ */
WebGLCircleReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) { WebGLCircleReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {

View File

@@ -11,7 +11,7 @@ import WebGLReplayGroup from '../webgl/ReplayGroup.js';
/** /**
* @constructor * @constructor
* @extends {ol.render.VectorContext} * @extends {ol.render.VectorContext}
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {module:ol/coordinate~Coordinate} center Center. * @param {module:ol/coordinate~Coordinate} center Center.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.

View File

@@ -549,7 +549,7 @@ WebGLLineStringReplay.prototype.drawReplay = function(gl, context, skippedFeatur
/** /**
* @private * @private
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object} skippedFeaturesHash Ids of features to skip. * @param {Object} skippedFeaturesHash Ids of features to skip.
*/ */
WebGLLineStringReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) { WebGLLineStringReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {

View File

@@ -20,6 +20,22 @@ import RBush from '../../structs/RBush.js';
import {FLOAT} from '../../webgl.js'; import {FLOAT} from '../../webgl.js';
import WebGLBuffer from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/**
* @typedef {Object} PolygonVertex
* @property {number} x
* @property {number} y
* @property {number} i
* @property {boolean} [reflex]
*/
/**
* @typedef {Object} PolygonSegment
* @property {module:ol/render/webgl/PolygonReplay~PolygonVertex} p0
* @property {module:ol/render/webgl/PolygonReplay~PolygonVertex} p1
*/
/** /**
* @constructor * @constructor
* @extends {ol.render.webgl.Replay} * @extends {ol.render.webgl.Replay}
@@ -144,11 +160,11 @@ WebGLPolygonReplay.prototype.processFlatCoordinates_ = function(
0, flatCoordinates.length, stride); 0, flatCoordinates.length, stride);
let i, ii; let i, ii;
let n = this.vertices.length / 2; let n = this.vertices.length / 2;
/** @type {ol.WebglPolygonVertex} */ /** @type {module:ol/render/webgl/PolygonReplay~PolygonVertex} */
let start; let start;
/** @type {ol.WebglPolygonVertex} */ /** @type {module:ol/render/webgl/PolygonReplay~PolygonVertex} */
let p0; let p0;
/** @type {ol.WebglPolygonVertex} */ /** @type {module:ol/render/webgl/PolygonReplay~PolygonVertex} */
let p1; let p1;
const extents = []; const extents = [];
const segments = []; const segments = [];
@@ -260,11 +276,11 @@ WebGLPolygonReplay.prototype.bridgeHole_ = function(hole, holeMaxX,
} }
const p1 = seg.p1; const p1 = seg.p1;
/** @type {ol.WebglPolygonVertex} */ /** @type {module:ol/render/webgl/PolygonReplay~PolygonVertex} */
const p2 = {x: listMaxX, y: p1.y, i: -1}; const p2 = {x: listMaxX, y: p1.y, i: -1};
let minDist = Infinity; let minDist = Infinity;
let i, ii, bestPoint; let i, ii, bestPoint;
/** @type {ol.WebglPolygonVertex} */ /** @type {module:ol/render/webgl/PolygonReplay~PolygonVertex} */
let p5; let p5;
const intersectingSegments = this.getIntersections_({p0: p1, p1: p2}, rtree, true); const intersectingSegments = this.getIntersections_({p0: p1, p1: p2}, rtree, true);
@@ -586,13 +602,13 @@ WebGLPolygonReplay.prototype.splitPolygon_ = function(list, rtree) {
* @param {number} x X coordinate. * @param {number} x X coordinate.
* @param {number} y Y coordinate. * @param {number} y Y coordinate.
* @param {number} i Index. * @param {number} i Index.
* @return {ol.WebglPolygonVertex} List item. * @return {module:ol/render/webgl/PolygonReplay~PolygonVertex} List item.
*/ */
WebGLPolygonReplay.prototype.createPoint_ = function(x, y, i) { WebGLPolygonReplay.prototype.createPoint_ = function(x, y, i) {
let numVertices = this.vertices.length; let numVertices = this.vertices.length;
this.vertices[numVertices++] = x; this.vertices[numVertices++] = x;
this.vertices[numVertices++] = y; this.vertices[numVertices++] = y;
/** @type {ol.WebglPolygonVertex} */ /** @type {module:ol/render/webgl/PolygonReplay~PolygonVertex} */
const p = { const p = {
x: x, x: x,
y: y, y: y,
@@ -605,11 +621,11 @@ WebGLPolygonReplay.prototype.createPoint_ = function(x, y, i) {
/** /**
* @private * @private
* @param {ol.WebglPolygonVertex} p0 First point of segment. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p0 First point of segment.
* @param {ol.WebglPolygonVertex} p1 Second point of segment. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p1 Second point of segment.
* @param {ol.structs.LinkedList} list Polygon ring. * @param {ol.structs.LinkedList} list Polygon ring.
* @param {ol.structs.RBush=} opt_rtree Insert the segment into the R-Tree. * @param {ol.structs.RBush=} opt_rtree Insert the segment into the R-Tree.
* @return {ol.WebglPolygonSegment} segment. * @return {module:ol/render/webgl/PolygonReplay~PolygonSegment} segment.
*/ */
WebGLPolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt_rtree) { WebGLPolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt_rtree) {
const seg = { const seg = {
@@ -627,8 +643,8 @@ WebGLPolygonReplay.prototype.insertItem_ = function(p0, p1, list, opt_rtree) {
/** /**
* @private * @private
* @param {ol.WebglPolygonSegment} s0 Segment before the remove candidate. * @param {module:ol/render/webgl/PolygonReplay~PolygonSegment} s0 Segment before the remove candidate.
* @param {ol.WebglPolygonSegment} s1 Remove candidate segment. * @param {module:ol/render/webgl/PolygonReplay~PolygonSegment} s1 Remove candidate segment.
* @param {ol.structs.LinkedList} list Polygon ring. * @param {ol.structs.LinkedList} list Polygon ring.
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
*/ */
@@ -645,12 +661,12 @@ WebGLPolygonReplay.prototype.removeItem_ = function(s0, s1, list, rtree) {
/** /**
* @private * @private
* @param {ol.WebglPolygonVertex} p0 First point. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p0 First point.
* @param {ol.WebglPolygonVertex} p1 Second point. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p1 Second point.
* @param {ol.WebglPolygonVertex} p2 Third point. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p2 Third point.
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
* @param {boolean=} opt_reflex Only include reflex points. * @param {boolean=} opt_reflex Only include reflex points.
* @return {Array.<ol.WebglPolygonVertex>} Points in the triangle. * @return {Array.<module:ol/render/webgl/PolygonReplay~PolygonVertex>} Points in the triangle.
*/ */
WebGLPolygonReplay.prototype.getPointsInTriangle_ = function(p0, p1, p2, rtree, opt_reflex) { WebGLPolygonReplay.prototype.getPointsInTriangle_ = function(p0, p1, p2, rtree, opt_reflex) {
const result = []; const result = [];
@@ -675,10 +691,10 @@ WebGLPolygonReplay.prototype.getPointsInTriangle_ = function(p0, p1, p2, rtree,
/** /**
* @private * @private
* @param {ol.WebglPolygonSegment} segment Segment. * @param {module:ol/render/webgl/PolygonReplay~PolygonSegment} segment Segment.
* @param {ol.structs.RBush} rtree R-Tree of the polygon. * @param {ol.structs.RBush} rtree R-Tree of the polygon.
* @param {boolean=} opt_touch Touching segments should be considered an intersection. * @param {boolean=} opt_touch Touching segments should be considered an intersection.
* @return {Array.<ol.WebglPolygonSegment>} Intersecting segments. * @return {Array.<module:ol/render/webgl/PolygonReplay~PolygonSegment>} Intersecting segments.
*/ */
WebGLPolygonReplay.prototype.getIntersections_ = function(segment, rtree, opt_touch) { WebGLPolygonReplay.prototype.getIntersections_ = function(segment, rtree, opt_touch) {
const p0 = segment.p0; const p0 = segment.p0;
@@ -702,10 +718,10 @@ WebGLPolygonReplay.prototype.getIntersections_ = function(segment, rtree, opt_to
* @see http://paulbourke.net/geometry/pointlineplane/ * @see http://paulbourke.net/geometry/pointlineplane/
* *
* @private * @private
* @param {ol.WebglPolygonVertex} p0 First point. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p0 First point.
* @param {ol.WebglPolygonVertex} p1 Second point. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p1 Second point.
* @param {ol.WebglPolygonVertex} p2 Third point. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p2 Third point.
* @param {ol.WebglPolygonVertex} p3 Fourth point. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p3 Fourth point.
* @param {boolean=} opt_touch Touching segments should be considered an intersection. * @param {boolean=} opt_touch Touching segments should be considered an intersection.
* @return {Array.<number>|undefined} Intersection coordinates. * @return {Array.<number>|undefined} Intersection coordinates.
*/ */
@@ -726,11 +742,11 @@ WebGLPolygonReplay.prototype.calculateIntersection_ = function(p0, p1, p2, p3, o
/** /**
* @private * @private
* @param {ol.WebglPolygonVertex} p0 Point before the start of the diagonal. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p0 Point before the start of the diagonal.
* @param {ol.WebglPolygonVertex} p1 Start point of the diagonal. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p1 Start point of the diagonal.
* @param {ol.WebglPolygonVertex} p2 Ear candidate. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p2 Ear candidate.
* @param {ol.WebglPolygonVertex} p3 End point of the diagonal. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p3 End point of the diagonal.
* @param {ol.WebglPolygonVertex} p4 Point after the end of the diagonal. * @param {module:ol/render/webgl/PolygonReplay~PolygonVertex} p4 Point after the end of the diagonal.
* @return {boolean} Diagonal is inside the polygon. * @return {boolean} Diagonal is inside the polygon.
*/ */
WebGLPolygonReplay.prototype.diagonalIsInside_ = function(p0, p1, p2, p3, p4) { WebGLPolygonReplay.prototype.diagonalIsInside_ = function(p0, p1, p2, p3, p4) {
@@ -986,7 +1002,7 @@ WebGLPolygonReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, conte
/** /**
* @private * @private
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object} skippedFeaturesHash Ids of features to skip. * @param {Object} skippedFeaturesHash Ids of features to skip.
*/ */
WebGLPolygonReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) { WebGLPolygonReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {

View File

@@ -81,7 +81,7 @@ const WebGLReplay = function(tolerance, maxExtent) {
/** /**
* @protected * @protected
* @type {?ol.webgl.Buffer} * @type {?module:ol/webgl/Buffer~WebGLBuffer}
*/ */
this.indicesBuffer = null; this.indicesBuffer = null;
@@ -107,7 +107,7 @@ const WebGLReplay = function(tolerance, maxExtent) {
/** /**
* @protected * @protected
* @type {?ol.webgl.Buffer} * @type {?module:ol/webgl/Buffer~WebGLBuffer}
*/ */
this.verticesBuffer = null; this.verticesBuffer = null;
@@ -125,7 +125,7 @@ inherits(WebGLReplay, VectorContext);
/** /**
* @abstract * @abstract
* @param {ol.webgl.Context} context WebGL context. * @param {module:ol/webgl/Context~WebGLContext} context WebGL context.
* @return {function()} Delete resources function. * @return {function()} Delete resources function.
*/ */
WebGLReplay.prototype.getDeleteResourcesFunction = function(context) {}; WebGLReplay.prototype.getDeleteResourcesFunction = function(context) {};
@@ -133,7 +133,7 @@ WebGLReplay.prototype.getDeleteResourcesFunction = function(context) {};
/** /**
* @abstract * @abstract
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
*/ */
WebGLReplay.prototype.finish = function(context) {}; WebGLReplay.prototype.finish = function(context) {};
@@ -142,7 +142,7 @@ WebGLReplay.prototype.finish = function(context) {};
* @abstract * @abstract
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {module:ol/size~Size} size Size. * @param {module:ol/size~Size} size Size.
* @param {number} pixelRatio Pixel ratio. * @param {number} pixelRatio Pixel ratio.
* @return {ol.render.webgl.circlereplay.defaultshader.Locations| * @return {ol.render.webgl.circlereplay.defaultshader.Locations|
@@ -169,7 +169,7 @@ WebGLReplay.prototype.shutDownProgram = function(gl, locations) {};
* @abstract * @abstract
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
* @param {boolean} hitDetection Hit detection mode. * @param {boolean} hitDetection Hit detection mode.
@@ -181,7 +181,7 @@ WebGLReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hi
* @abstract * @abstract
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
* @param {function((module:ol/Feature~Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback. * @param {function((module:ol/Feature~Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback.
@@ -196,7 +196,7 @@ WebGLReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, ski
/** /**
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
* @param {function((module:ol/Feature~Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback. * @param {function((module:ol/Feature~Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback.
@@ -223,7 +223,7 @@ WebGLReplay.prototype.drawHitDetectionReplay = function(gl, context, skippedFeat
/** /**
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
* @param {function((module:ol/Feature~Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback. * @param {function((module:ol/Feature~Feature|ol.render.Feature)): T|undefined} featureCallback Feature callback.
@@ -245,7 +245,7 @@ WebGLReplay.prototype.drawHitDetectionReplayAll = function(gl, context, skippedF
/** /**
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {module:ol/coordinate~Coordinate} center Center. * @param {module:ol/coordinate~Coordinate} center Center.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.
@@ -353,7 +353,7 @@ WebGLReplay.prototype.replay = function(context,
/** /**
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {number} start Start index. * @param {number} start Start index.
* @param {number} end End index. * @param {number} end End index.
*/ */

View File

@@ -81,7 +81,7 @@ WebGLReplayGroup.prototype.addDeclutter = function(style, group) {};
/** /**
* @param {ol.webgl.Context} context WebGL context. * @param {module:ol/webgl/Context~WebGLContext} context WebGL context.
* @return {function()} Delete resources function. * @return {function()} Delete resources function.
*/ */
WebGLReplayGroup.prototype.getDeleteResourcesFunction = function(context) { WebGLReplayGroup.prototype.getDeleteResourcesFunction = function(context) {
@@ -106,7 +106,7 @@ WebGLReplayGroup.prototype.getDeleteResourcesFunction = function(context) {
/** /**
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
*/ */
WebGLReplayGroup.prototype.finish = function(context) { WebGLReplayGroup.prototype.finish = function(context) {
let zKey; let zKey;
@@ -151,7 +151,7 @@ WebGLReplayGroup.prototype.isEmpty = function() {
/** /**
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {module:ol/coordinate~Coordinate} center Center. * @param {module:ol/coordinate~Coordinate} center Center.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.
@@ -186,7 +186,7 @@ WebGLReplayGroup.prototype.replay = function(context,
/** /**
* @private * @private
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {module:ol/coordinate~Coordinate} center Center. * @param {module:ol/coordinate~Coordinate} center Center.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.
@@ -232,7 +232,7 @@ WebGLReplayGroup.prototype.replayHitDetection_ = function(context,
/** /**
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {module:ol/coordinate~Coordinate} center Center. * @param {module:ol/coordinate~Coordinate} center Center.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.
@@ -287,7 +287,7 @@ WebGLReplayGroup.prototype.forEachFeatureAtCoordinate = function(
/** /**
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate. * @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {module:ol/coordinate~Coordinate} center Center. * @param {module:ol/coordinate~Coordinate} center Center.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.

View File

@@ -14,6 +14,14 @@ import WebGLTextureReplay from '../webgl/TextureReplay.js';
import AtlasManager from '../../style/AtlasManager.js'; import AtlasManager from '../../style/AtlasManager.js';
import WebGLBuffer from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/**
* @typedef {Object} GlyphAtlas
* @property {module:ol/style/AtlasManager~AtlasManager} atlas
* @property {Object.<string, number>} width
* @property {number} height
*/
/** /**
* @constructor * @constructor
* @extends {ol.render.webgl.TextureReplay} * @extends {ol.render.webgl.TextureReplay}
@@ -100,13 +108,13 @@ const WebGLTextReplay = function(tolerance, maxExtent) {
/** /**
* @private * @private
* @type {Object.<string, ol.WebglGlyphAtlas>} * @type {Object.<string, module:ol/render/webgl/TextReplay~GlyphAtlas>}
*/ */
this.atlases_ = {}; this.atlases_ = {};
/** /**
* @private * @private
* @type {ol.WebglGlyphAtlas|undefined} * @type {module:ol/render/webgl/TextReplay~GlyphAtlas|undefined}
*/ */
this.currAtlas_ = undefined; this.currAtlas_ = undefined;
@@ -397,7 +405,7 @@ WebGLTextReplay.prototype.setTextStyle = function(textStyle) {
/** /**
* @private * @private
* @param {Object} state Font attributes. * @param {Object} state Font attributes.
* @return {ol.WebglGlyphAtlas} Glyph atlas. * @return {module:ol/render/webgl/TextReplay~GlyphAtlas} Glyph atlas.
*/ */
WebGLTextReplay.prototype.getAtlas_ = function(state) { WebGLTextReplay.prototype.getAtlas_ = function(state) {
let params = []; let params = [];

View File

@@ -362,7 +362,7 @@ WebGLTextureReplay.prototype.drawReplay = function(gl, context, skippedFeaturesH
* *
* @protected * @protected
* @param {WebGLRenderingContext} gl gl. * @param {WebGLRenderingContext} gl gl.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
* @param {Array.<WebGLTexture>} textures Textures. * @param {Array.<WebGLTexture>} textures Textures.

View File

@@ -34,7 +34,7 @@ const WebGLLayerRenderer = function(mapRenderer, layer) {
/** /**
* @private * @private
* @type {ol.webgl.Buffer} * @type {module:ol/webgl/Buffer~WebGLBuffer}
*/ */
this.arrayBuffer_ = new WebGLBuffer([ this.arrayBuffer_ = new WebGLBuffer([
-1, -1, 0, 0, -1, -1, 0, 0,
@@ -139,7 +139,7 @@ WebGLLayerRenderer.prototype.bindFramebuffer = function(frameState, framebufferD
/** /**
* @param {module:ol/PluggableMap~FrameState} frameState Frame state. * @param {module:ol/PluggableMap~FrameState} frameState Frame state.
* @param {module:ol/layer/Layer~State} layerState Layer state. * @param {module:ol/layer/Layer~State} layerState Layer state.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
*/ */
WebGLLayerRenderer.prototype.composeFrame = function(frameState, layerState, context) { WebGLLayerRenderer.prototype.composeFrame = function(frameState, layerState, context) {
@@ -183,7 +183,7 @@ WebGLLayerRenderer.prototype.composeFrame = function(frameState, layerState, con
/** /**
* @param {ol.render.EventType} type Event type. * @param {ol.render.EventType} type Event type.
* @param {ol.webgl.Context} context WebGL context. * @param {module:ol/webgl/Context~WebGLContext} context WebGL context.
* @param {module:ol/PluggableMap~FrameState} frameState Frame state. * @param {module:ol/PluggableMap~FrameState} frameState Frame state.
* @private * @private
*/ */
@@ -245,7 +245,7 @@ WebGLLayerRenderer.prototype.handleWebGLContextLost = function() {
* @abstract * @abstract
* @param {module:ol/PluggableMap~FrameState} frameState Frame state. * @param {module:ol/PluggableMap~FrameState} frameState Frame state.
* @param {module:ol/layer/Layer~State} layerState Layer state. * @param {module:ol/layer/Layer~State} layerState Layer state.
* @param {ol.webgl.Context} context Context. * @param {module:ol/webgl/Context~WebGLContext} context Context.
* @return {boolean} whether composeFrame should be called. * @return {boolean} whether composeFrame should be called.
*/ */
WebGLLayerRenderer.prototype.prepareFrame = function(frameState, layerState, context) {}; WebGLLayerRenderer.prototype.prepareFrame = function(frameState, layerState, context) {};

View File

@@ -25,6 +25,14 @@ import WebGLContext from '../../webgl/Context.js';
import ContextEventType from '../../webgl/ContextEventType.js'; import ContextEventType from '../../webgl/ContextEventType.js';
/**
* @typedef {Object} TextureCacheEntry
* @property {number} magFilter
* @property {number} minFilter
* @property {WebGLTexture} texture
*/
/** /**
* Texture cache high water mark. * Texture cache high water mark.
* @type {number} * @type {number}
@@ -92,7 +100,7 @@ const WebGLMapRenderer = function(container, map) {
/** /**
* @private * @private
* @type {ol.webgl.Context} * @type {module:ol/webgl/Context~WebGLContext}
*/ */
this.context_ = new WebGLContext(this.canvas_, this.gl_); this.context_ = new WebGLContext(this.canvas_, this.gl_);
@@ -103,7 +111,7 @@ const WebGLMapRenderer = function(container, map) {
/** /**
* @private * @private
* @type {ol.structs.LRUCache.<ol.WebglTextureCacheEntry|null>} * @type {ol.structs.LRUCache.<module:ol/renderer/webgl/Map~TextureCacheEntry|null>}
*/ */
this.textureCache_ = new LRUCache(); this.textureCache_ = new LRUCache();
@@ -295,7 +303,7 @@ WebGLMapRenderer.prototype.disposeInternal = function() {
if (!gl.isContextLost()) { if (!gl.isContextLost()) {
this.textureCache_.forEach( this.textureCache_.forEach(
/** /**
* @param {?ol.WebglTextureCacheEntry} textureCacheEntry * @param {?module:ol/renderer/webgl/Map~TextureCacheEntry} textureCacheEntry
* Texture cache entry. * Texture cache entry.
*/ */
function(textureCacheEntry) { function(textureCacheEntry) {
@@ -335,7 +343,7 @@ WebGLMapRenderer.prototype.expireCache_ = function(map, frameState) {
/** /**
* @return {ol.webgl.Context} The context. * @return {module:ol/webgl/Context~WebGLContext} The context.
*/ */
WebGLMapRenderer.prototype.getContext = function() { WebGLMapRenderer.prototype.getContext = function() {
return this.context_; return this.context_;

View File

@@ -39,13 +39,13 @@ const WebGLTileLayerRenderer = function(mapRenderer, tileLayer) {
/** /**
* @private * @private
* @type {ol.webgl.Fragment} * @type {module:ol/webgl/Fragment~WebGLFragment}
*/ */
this.fragmentShader_ = fragment; this.fragmentShader_ = fragment;
/** /**
* @private * @private
* @type {ol.webgl.Vertex} * @type {module:ol/webgl/Vertex~WebGLVertex}
*/ */
this.vertexShader_ = vertex; this.vertexShader_ = vertex;
@@ -57,7 +57,7 @@ const WebGLTileLayerRenderer = function(mapRenderer, tileLayer) {
/** /**
* @private * @private
* @type {ol.webgl.Buffer} * @type {module:ol/webgl/Buffer~WebGLBuffer}
*/ */
this.renderArrayBuffer_ = new WebGLBuffer([ this.renderArrayBuffer_ = new WebGLBuffer([
0, 0, 0, 1, 0, 0, 0, 1,

View File

@@ -301,42 +301,6 @@ ol.StyleRenderFunction;
ol.StyleImageOptions; ol.StyleImageOptions;
/**
* @typedef {{buf: ol.webgl.Buffer,
* buffer: WebGLBuffer}}
*/
ol.WebglBufferCacheEntry;
/**
* @typedef {{atlas: ol.style.AtlasManager,
* width: Object.<string, number>,
* height: number}}
*/
ol.WebglGlyphAtlas;
/**
* @typedef {{p0: ol.WebglPolygonVertex,
* p1: ol.WebglPolygonVertex}}
*/
ol.WebglPolygonSegment;
/**
* @typedef {{x: number,
* y: number,
* i: number,
* reflex: (boolean|undefined)}}
*/
ol.WebglPolygonVertex;
/**
* @typedef {{magFilter: number, minFilter: number, texture: WebGLTexture}}
*/
ol.WebglTextureCacheEntry;
/** /**
* Number of features; bounds/extent. * Number of features; bounds/extent.
* @typedef {{numberOfFeatures: number, * @typedef {{numberOfFeatures: number,

View File

@@ -9,6 +9,14 @@ import {clear} from '../obj.js';
import {ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, TEXTURE_2D, TEXTURE_WRAP_S, TEXTURE_WRAP_T} from '../webgl.js'; import {ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, TEXTURE_2D, TEXTURE_WRAP_S, TEXTURE_WRAP_T} from '../webgl.js';
import ContextEventType from '../webgl/ContextEventType.js'; import ContextEventType from '../webgl/ContextEventType.js';
/**
* @typedef {Object} BufferCacheEntry
* @property {module:ol/webgl/Buffer~WebGLBuffer} buf
* @property {WebGLBuffer} buffer
*/
/** /**
* @classdesc * @classdesc
* A WebGL context for accessing low-level WebGL capabilities. * A WebGL context for accessing low-level WebGL capabilities.
@@ -34,7 +42,7 @@ const WebGLContext = function(canvas, gl) {
/** /**
* @private * @private
* @type {!Object.<string, ol.WebglBufferCacheEntry>} * @type {!Object.<string, module:ol/webgl/Context~BufferCacheEntry>}
*/ */
this.bufferCache_ = {}; this.bufferCache_ = {};
@@ -99,7 +107,7 @@ inherits(WebGLContext, Disposable);
* the WebGL buffer, bind it, populate it, and add an entry to * the WebGL buffer, bind it, populate it, and add an entry to
* the cache. * the cache.
* @param {number} target Target. * @param {number} target Target.
* @param {ol.webgl.Buffer} buf Buffer. * @param {module:ol/webgl/Buffer~WebGLBuffer} buf Buffer.
*/ */
WebGLContext.prototype.bindBuffer = function(target, buf) { WebGLContext.prototype.bindBuffer = function(target, buf) {
const gl = this.getGL(); const gl = this.getGL();
@@ -128,7 +136,7 @@ WebGLContext.prototype.bindBuffer = function(target, buf) {
/** /**
* @param {ol.webgl.Buffer} buf Buffer. * @param {module:ol/webgl/Buffer~WebGLBuffer} buf Buffer.
*/ */
WebGLContext.prototype.deleteBuffer = function(buf) { WebGLContext.prototype.deleteBuffer = function(buf) {
const gl = this.getGL(); const gl = this.getGL();
@@ -198,7 +206,7 @@ WebGLContext.prototype.getHitDetectionFramebuffer = function() {
/** /**
* Get shader from the cache if it's in the cache. Otherwise, create * Get shader from the cache if it's in the cache. Otherwise, create
* the WebGL shader, compile it, and add entry to cache. * the WebGL shader, compile it, and add entry to cache.
* @param {ol.webgl.Shader} shaderObject Shader object. * @param {module:ol/webgl/Shader~WebGLShader} shaderObject Shader object.
* @return {WebGLShader} Shader. * @return {WebGLShader} Shader.
*/ */
WebGLContext.prototype.getShader = function(shaderObject) { WebGLContext.prototype.getShader = function(shaderObject) {
@@ -220,8 +228,8 @@ WebGLContext.prototype.getShader = function(shaderObject) {
* Get the program from the cache if it's in the cache. Otherwise create * Get the program from the cache if it's in the cache. Otherwise create
* the WebGL program, attach the shaders to it, and add an entry to the * the WebGL program, attach the shaders to it, and add an entry to the
* cache. * cache.
* @param {ol.webgl.Fragment} fragmentShaderObject Fragment shader. * @param {module:ol/webgl/Fragment~WebGLFragment} fragmentShaderObject Fragment shader.
* @param {ol.webgl.Vertex} vertexShaderObject Vertex shader. * @param {module:ol/webgl/Vertex~WebGLVertex} vertexShaderObject Vertex shader.
* @return {WebGLProgram} Program. * @return {WebGLProgram} Program.
*/ */
WebGLContext.prototype.getProgram = function(fragmentShaderObject, vertexShaderObject) { WebGLContext.prototype.getProgram = function(fragmentShaderObject, vertexShaderObject) {

View File

@@ -7,7 +7,7 @@ import WebGLShader from '../webgl/Shader.js';
/** /**
* @constructor * @constructor
* @extends {ol.webgl.Shader} * @extends {module:ol/webgl/Shader~WebGLShader}
* @param {string} source Source. * @param {string} source Source.
* @struct * @struct
*/ */

View File

@@ -7,7 +7,7 @@ import WebGLShader from '../webgl/Shader.js';
/** /**
* @constructor * @constructor
* @extends {ol.webgl.Shader} * @extends {module:ol/webgl/Shader~WebGLShader}
* @param {string} source Source. * @param {string} source Source.
* @struct * @struct
*/ */