Merge pull request #7787 from fredj/rename

More renaming
This commit is contained in:
Frédéric Junod
2018-02-08 12:24:57 +01:00
committed by GitHub
15 changed files with 73 additions and 75 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../webgl/cir
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
@@ -157,10 +157,10 @@ WebGLCircleReplay.prototype.drawCircle = function(circleGeometry, feature) {
**/ **/
WebGLCircleReplay.prototype.finish = function(context) { WebGLCircleReplay.prototype.finish = function(context) {
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new WebGLBuffer(this.vertices);
// create, bind, and populate the indices buffer // create, bind, and populate the indices buffer
this.indicesBuffer = new _ol_webgl_Buffer_(this.indices); this.indicesBuffer = new WebGLBuffer(this.indices);
this.startIndices.push(this.indices.length); this.startIndices.push(this.indices.length);
+3 -3
View File
@@ -3,7 +3,7 @@
*/ */
import {getUid, inherits} from '../../index.js'; import {getUid, inherits} from '../../index.js';
import WebGLTextureReplay from '../webgl/TextureReplay.js'; import WebGLTextureReplay from '../webgl/TextureReplay.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
@@ -80,12 +80,12 @@ WebGLImageReplay.prototype.finish = function(context) {
this.hitDetectionGroupIndices.push(this.indices.length); this.hitDetectionGroupIndices.push(this.indices.length);
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new WebGLBuffer(this.vertices);
const indices = this.indices; const indices = this.indices;
// create, bind, and populate the indices buffer // create, bind, and populate the indices buffer
this.indicesBuffer = new _ol_webgl_Buffer_(indices); this.indicesBuffer = new WebGLBuffer(indices);
// create textures // create textures
/** @type {Object.<string, WebGLTexture>} */ /** @type {Object.<string, WebGLTexture>} */
+3 -3
View File
@@ -14,7 +14,7 @@ import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_linestringreplay_defaultshader_ from '../webgl/linestringreplay/defaultshader.js'; import _ol_render_webgl_linestringreplay_defaultshader_ from '../webgl/linestringreplay/defaultshader.js';
import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../webgl/linestringreplay/defaultshader/Locations.js'; import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../webgl/linestringreplay/defaultshader/Locations.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
@@ -404,10 +404,10 @@ WebGLLineStringReplay.prototype.getCurrentIndex = function() {
**/ **/
WebGLLineStringReplay.prototype.finish = function(context) { WebGLLineStringReplay.prototype.finish = function(context) {
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new WebGLBuffer(this.vertices);
// create, bind, and populate the indices buffer // create, bind, and populate the indices buffer
this.indicesBuffer = new _ol_webgl_Buffer_(this.indices); this.indicesBuffer = new WebGLBuffer(this.indices);
this.startIndices.push(this.indices.length); this.startIndices.push(this.indices.length);
+3 -3
View File
@@ -18,7 +18,7 @@ import Stroke from '../../style/Stroke.js';
import LinkedList from '../../structs/LinkedList.js'; import LinkedList from '../../structs/LinkedList.js';
import RBush from '../../structs/RBush.js'; import RBush from '../../structs/RBush.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
@@ -834,10 +834,10 @@ WebGLPolygonReplay.prototype.drawPolygon = function(polygonGeometry, feature) {
**/ **/
WebGLPolygonReplay.prototype.finish = function(context) { WebGLPolygonReplay.prototype.finish = function(context) {
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new WebGLBuffer(this.vertices);
// create, bind, and populate the indices buffer // create, bind, and populate the indices buffer
this.indicesBuffer = new _ol_webgl_Buffer_(this.indices); this.indicesBuffer = new WebGLBuffer(this.indices);
this.startIndices.push(this.indices.length); this.startIndices.push(this.indices.length);
+3 -3
View File
@@ -10,7 +10,7 @@ import _ol_render_replay_ from '../replay.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import WebGLTextureReplay from '../webgl/TextureReplay.js'; import WebGLTextureReplay from '../webgl/TextureReplay.js';
import AtlasManager from '../../style/AtlasManager.js'; import AtlasManager from '../../style/AtlasManager.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
@@ -306,10 +306,10 @@ WebGLTextReplay.prototype.finish = function(context) {
this.hitDetectionGroupIndices = this.groupIndices; this.hitDetectionGroupIndices = this.groupIndices;
// create, bind, and populate the vertices buffer // create, bind, and populate the vertices buffer
this.verticesBuffer = new _ol_webgl_Buffer_(this.vertices); this.verticesBuffer = new WebGLBuffer(this.vertices);
// create, bind, and populate the indices buffer // create, bind, and populate the indices buffer
this.indicesBuffer = new _ol_webgl_Buffer_(this.indices); this.indicesBuffer = new WebGLBuffer(this.indices);
// create textures // create textures
/** @type {Object.<string, WebGLTexture>} */ /** @type {Object.<string, WebGLTexture>} */
+2 -2
View File
@@ -8,7 +8,7 @@ import _ol_render_webgl_texturereplay_defaultshader_ from '../webgl/texturerepla
import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js'; import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Context_ from '../../webgl/Context.js'; import WebGLContext from '../../webgl/Context.js';
/** /**
* @constructor * @constructor
@@ -257,7 +257,7 @@ WebGLTextureReplay.prototype.createTextures = function(textures, images, texture
if (uid in texturePerImage) { if (uid in texturePerImage) {
texture = texturePerImage[uid]; texture = texturePerImage[uid];
} else { } else {
texture = _ol_webgl_Context_.createTexture( texture = WebGLContext.createTexture(
gl, image, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE); gl, image, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE);
texturePerImage[uid] = texture; texturePerImage[uid] = texture;
} }
+2 -2
View File
@@ -12,7 +12,7 @@ import RendererType from '../Type.js';
import WebGLLayerRenderer from '../webgl/Layer.js'; import WebGLLayerRenderer from '../webgl/Layer.js';
import _ol_transform_ from '../../transform.js'; import _ol_transform_ from '../../transform.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Context_ from '../../webgl/Context.js'; import WebGLContext from '../../webgl/Context.js';
/** /**
* @constructor * @constructor
@@ -88,7 +88,7 @@ WebGLImageLayerRenderer.prototype.createTexture_ = function(image) {
const imageElement = image.getImage(); const imageElement = image.getImage();
const gl = this.mapRenderer.getGL(); const gl = this.mapRenderer.getGL();
return _ol_webgl_Context_.createTexture( return WebGLContext.createTexture(
gl, imageElement, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE); gl, imageElement, _ol_webgl_.CLAMP_TO_EDGE, _ol_webgl_.CLAMP_TO_EDGE);
}; };
+4 -4
View File
@@ -11,8 +11,8 @@ import _ol_renderer_webgl_defaultmapshader_Locations_ from '../webgl/defaultmaps
import _ol_transform_ from '../../transform.js'; import _ol_transform_ from '../../transform.js';
import {create, fromTransform} from '../../vec/mat4.js'; import {create, fromTransform} from '../../vec/mat4.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
import _ol_webgl_Context_ from '../../webgl/Context.js'; import WebGLContext from '../../webgl/Context.js';
/** /**
* @constructor * @constructor
@@ -35,7 +35,7 @@ const WebGLLayerRenderer = function(mapRenderer, layer) {
* @private * @private
* @type {ol.webgl.Buffer} * @type {ol.webgl.Buffer}
*/ */
this.arrayBuffer_ = new _ol_webgl_Buffer_([ this.arrayBuffer_ = new WebGLBuffer([
-1, -1, 0, 0, -1, -1, 0, 0,
1, -1, 1, 0, 1, -1, 1, 0,
-1, 1, 0, 1, -1, 1, 0, 1,
@@ -116,7 +116,7 @@ WebGLLayerRenderer.prototype.bindFramebuffer = function(frameState, framebufferD
/** @type {ol.PostRenderFunction} */ (postRenderFunction) /** @type {ol.PostRenderFunction} */ (postRenderFunction)
); );
const texture = _ol_webgl_Context_.createEmptyTexture( const texture = WebGLContext.createEmptyTexture(
gl, framebufferDimension, framebufferDimension); gl, framebufferDimension, framebufferDimension);
const framebuffer = gl.createFramebuffer(); const framebuffer = gl.createFramebuffer();
+2 -2
View File
@@ -18,7 +18,7 @@ import SourceState from '../../source/State.js';
import LRUCache from '../../structs/LRUCache.js'; import LRUCache from '../../structs/LRUCache.js';
import PriorityQueue from '../../structs/PriorityQueue.js'; import PriorityQueue from '../../structs/PriorityQueue.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Context_ from '../../webgl/Context.js'; import WebGLContext from '../../webgl/Context.js';
import ContextEventType from '../../webgl/ContextEventType.js'; import ContextEventType from '../../webgl/ContextEventType.js';
@@ -90,7 +90,7 @@ const WebGLMapRenderer = function(container, map) {
* @private * @private
* @type {ol.webgl.Context} * @type {ol.webgl.Context}
*/ */
this.context_ = new _ol_webgl_Context_(this.canvas_, this.gl_); this.context_ = new WebGLContext(this.canvas_, this.gl_);
listen(this.canvas_, ContextEventType.LOST, listen(this.canvas_, ContextEventType.LOST,
this.handleWebGLContextLost, this); this.handleWebGLContextLost, this);
+2 -2
View File
@@ -18,7 +18,7 @@ import _ol_renderer_webgl_tilelayershader_Locations_ from '../webgl/tilelayersha
import {toSize} from '../../size.js'; import {toSize} from '../../size.js';
import _ol_transform_ from '../../transform.js'; import _ol_transform_ from '../../transform.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import _ol_webgl_Buffer_ from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
/** /**
* @constructor * @constructor
@@ -53,7 +53,7 @@ const WebGLTileLayerRenderer = function(mapRenderer, tileLayer) {
* @private * @private
* @type {ol.webgl.Buffer} * @type {ol.webgl.Buffer}
*/ */
this.renderArrayBuffer_ = new _ol_webgl_Buffer_([ this.renderArrayBuffer_ = new WebGLBuffer([
0, 0, 0, 1, 0, 0, 0, 1,
1, 0, 1, 1, 1, 0, 1, 1,
0, 1, 0, 0, 0, 1, 0, 0,
+14 -16
View File
@@ -3,13 +3,22 @@
*/ */
import _ol_webgl_ from '../webgl.js'; import _ol_webgl_ from '../webgl.js';
/**
* @enum {number}
*/
const BufferUsage = {
STATIC_DRAW: _ol_webgl_.STATIC_DRAW,
STREAM_DRAW: _ol_webgl_.STREAM_DRAW,
DYNAMIC_DRAW: _ol_webgl_.DYNAMIC_DRAW
};
/** /**
* @constructor * @constructor
* @param {Array.<number>=} opt_arr Array. * @param {Array.<number>=} opt_arr Array.
* @param {number=} opt_usage Usage. * @param {number=} opt_usage Usage.
* @struct * @struct
*/ */
const _ol_webgl_Buffer_ = function(opt_arr, opt_usage) { const WebGLBuffer = function(opt_arr, opt_usage) {
/** /**
* @private * @private
@@ -21,8 +30,7 @@ const _ol_webgl_Buffer_ = function(opt_arr, opt_usage) {
* @private * @private
* @type {number} * @type {number}
*/ */
this.usage_ = opt_usage !== undefined ? this.usage_ = opt_usage !== undefined ? opt_usage : BufferUsage;
opt_usage : _ol_webgl_Buffer_.Usage_.STATIC_DRAW;
}; };
@@ -30,7 +38,7 @@ const _ol_webgl_Buffer_ = function(opt_arr, opt_usage) {
/** /**
* @return {Array.<number>} Array. * @return {Array.<number>} Array.
*/ */
_ol_webgl_Buffer_.prototype.getArray = function() { WebGLBuffer.prototype.getArray = function() {
return this.arr_; return this.arr_;
}; };
@@ -38,18 +46,8 @@ _ol_webgl_Buffer_.prototype.getArray = function() {
/** /**
* @return {number} Usage. * @return {number} Usage.
*/ */
_ol_webgl_Buffer_.prototype.getUsage = function() { WebGLBuffer.prototype.getUsage = function() {
return this.usage_; return this.usage_;
}; };
export default WebGLBuffer;
/**
* @enum {number}
* @private
*/
_ol_webgl_Buffer_.Usage_ = {
STATIC_DRAW: _ol_webgl_.STATIC_DRAW,
STREAM_DRAW: _ol_webgl_.STREAM_DRAW,
DYNAMIC_DRAW: _ol_webgl_.DYNAMIC_DRAW
};
export default _ol_webgl_Buffer_;
+21 -21
View File
@@ -18,7 +18,7 @@ import ContextEventType from '../webgl/ContextEventType.js';
* @param {HTMLCanvasElement} canvas Canvas. * @param {HTMLCanvasElement} canvas Canvas.
* @param {WebGLRenderingContext} gl GL. * @param {WebGLRenderingContext} gl GL.
*/ */
const _ol_webgl_Context_ = function(canvas, gl) { const WebGLContext = function(canvas, gl) {
/** /**
* @private * @private
@@ -91,7 +91,7 @@ const _ol_webgl_Context_ = function(canvas, gl) {
}; };
inherits(_ol_webgl_Context_, Disposable); inherits(WebGLContext, Disposable);
/** /**
@@ -101,7 +101,7 @@ inherits(_ol_webgl_Context_, Disposable);
* @param {number} target Target. * @param {number} target Target.
* @param {ol.webgl.Buffer} buf Buffer. * @param {ol.webgl.Buffer} buf Buffer.
*/ */
_ol_webgl_Context_.prototype.bindBuffer = function(target, buf) { WebGLContext.prototype.bindBuffer = function(target, buf) {
const gl = this.getGL(); const gl = this.getGL();
const arr = buf.getArray(); const arr = buf.getArray();
const bufferKey = String(getUid(buf)); const bufferKey = String(getUid(buf));
@@ -130,7 +130,7 @@ _ol_webgl_Context_.prototype.bindBuffer = function(target, buf) {
/** /**
* @param {ol.webgl.Buffer} buf Buffer. * @param {ol.webgl.Buffer} buf Buffer.
*/ */
_ol_webgl_Context_.prototype.deleteBuffer = function(buf) { WebGLContext.prototype.deleteBuffer = function(buf) {
const gl = this.getGL(); const gl = this.getGL();
const bufferKey = String(getUid(buf)); const bufferKey = String(getUid(buf));
const bufferCacheEntry = this.bufferCache_[bufferKey]; const bufferCacheEntry = this.bufferCache_[bufferKey];
@@ -144,7 +144,7 @@ _ol_webgl_Context_.prototype.deleteBuffer = function(buf) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
_ol_webgl_Context_.prototype.disposeInternal = function() { WebGLContext.prototype.disposeInternal = function() {
unlistenAll(this.canvas_); unlistenAll(this.canvas_);
const gl = this.getGL(); const gl = this.getGL();
if (!gl.isContextLost()) { if (!gl.isContextLost()) {
@@ -168,7 +168,7 @@ _ol_webgl_Context_.prototype.disposeInternal = function() {
/** /**
* @return {HTMLCanvasElement} Canvas. * @return {HTMLCanvasElement} Canvas.
*/ */
_ol_webgl_Context_.prototype.getCanvas = function() { WebGLContext.prototype.getCanvas = function() {
return this.canvas_; return this.canvas_;
}; };
@@ -178,7 +178,7 @@ _ol_webgl_Context_.prototype.getCanvas = function() {
* @return {WebGLRenderingContext} The rendering context. * @return {WebGLRenderingContext} The rendering context.
* @api * @api
*/ */
_ol_webgl_Context_.prototype.getGL = function() { WebGLContext.prototype.getGL = function() {
return this.gl_; return this.gl_;
}; };
@@ -187,7 +187,7 @@ _ol_webgl_Context_.prototype.getGL = function() {
* Get the frame buffer for hit detection. * Get the frame buffer for hit detection.
* @return {WebGLFramebuffer} The hit detection frame buffer. * @return {WebGLFramebuffer} The hit detection frame buffer.
*/ */
_ol_webgl_Context_.prototype.getHitDetectionFramebuffer = function() { WebGLContext.prototype.getHitDetectionFramebuffer = function() {
if (!this.hitDetectionFramebuffer_) { if (!this.hitDetectionFramebuffer_) {
this.initHitDetectionFramebuffer_(); this.initHitDetectionFramebuffer_();
} }
@@ -201,7 +201,7 @@ _ol_webgl_Context_.prototype.getHitDetectionFramebuffer = function() {
* @param {ol.webgl.Shader} shaderObject Shader object. * @param {ol.webgl.Shader} shaderObject Shader object.
* @return {WebGLShader} Shader. * @return {WebGLShader} Shader.
*/ */
_ol_webgl_Context_.prototype.getShader = function(shaderObject) { WebGLContext.prototype.getShader = function(shaderObject) {
const shaderKey = String(getUid(shaderObject)); const shaderKey = String(getUid(shaderObject));
if (shaderKey in this.shaderCache_) { if (shaderKey in this.shaderCache_) {
return this.shaderCache_[shaderKey]; return this.shaderCache_[shaderKey];
@@ -224,7 +224,7 @@ _ol_webgl_Context_.prototype.getShader = function(shaderObject) {
* @param {ol.webgl.Vertex} vertexShaderObject Vertex shader. * @param {ol.webgl.Vertex} vertexShaderObject Vertex shader.
* @return {WebGLProgram} Program. * @return {WebGLProgram} Program.
*/ */
_ol_webgl_Context_.prototype.getProgram = function( WebGLContext.prototype.getProgram = function(
fragmentShaderObject, vertexShaderObject) { fragmentShaderObject, vertexShaderObject) {
const programKey = const programKey =
getUid(fragmentShaderObject) + '/' + getUid(vertexShaderObject); getUid(fragmentShaderObject) + '/' + getUid(vertexShaderObject);
@@ -245,7 +245,7 @@ _ol_webgl_Context_.prototype.getProgram = function(
/** /**
* FIXME empy description for jsdoc * FIXME empy description for jsdoc
*/ */
_ol_webgl_Context_.prototype.handleWebGLContextLost = function() { WebGLContext.prototype.handleWebGLContextLost = function() {
clear(this.bufferCache_); clear(this.bufferCache_);
clear(this.shaderCache_); clear(this.shaderCache_);
clear(this.programCache_); clear(this.programCache_);
@@ -259,7 +259,7 @@ _ol_webgl_Context_.prototype.handleWebGLContextLost = function() {
/** /**
* FIXME empy description for jsdoc * FIXME empy description for jsdoc
*/ */
_ol_webgl_Context_.prototype.handleWebGLContextRestored = function() { WebGLContext.prototype.handleWebGLContextRestored = function() {
}; };
@@ -267,12 +267,12 @@ _ol_webgl_Context_.prototype.handleWebGLContextRestored = function() {
* Creates a 1x1 pixel framebuffer for the hit-detection. * Creates a 1x1 pixel framebuffer for the hit-detection.
* @private * @private
*/ */
_ol_webgl_Context_.prototype.initHitDetectionFramebuffer_ = function() { WebGLContext.prototype.initHitDetectionFramebuffer_ = function() {
const gl = this.gl_; const gl = this.gl_;
const framebuffer = gl.createFramebuffer(); const framebuffer = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
const texture = _ol_webgl_Context_.createEmptyTexture(gl, 1, 1); const texture = WebGLContext.createEmptyTexture(gl, 1, 1);
const renderbuffer = gl.createRenderbuffer(); const renderbuffer = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer); gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, 1, 1); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, 1, 1);
@@ -297,7 +297,7 @@ _ol_webgl_Context_.prototype.initHitDetectionFramebuffer_ = function() {
* @return {boolean} Changed. * @return {boolean} Changed.
* @api * @api
*/ */
_ol_webgl_Context_.prototype.useProgram = function(program) { WebGLContext.prototype.useProgram = function(program) {
if (program == this.currentProgram_) { if (program == this.currentProgram_) {
return false; return false;
} else { } else {
@@ -316,7 +316,7 @@ _ol_webgl_Context_.prototype.useProgram = function(program) {
* @return {WebGLTexture} The texture. * @return {WebGLTexture} The texture.
* @private * @private
*/ */
_ol_webgl_Context_.createTexture_ = function(gl, opt_wrapS, opt_wrapT) { WebGLContext.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
const texture = gl.createTexture(); const texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture); gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
@@ -343,9 +343,9 @@ _ol_webgl_Context_.createTexture_ = function(gl, opt_wrapS, opt_wrapT) {
* @param {number=} opt_wrapT wrapT. * @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture. * @return {WebGLTexture} The texture.
*/ */
_ol_webgl_Context_.createEmptyTexture = function( WebGLContext.createEmptyTexture = function(
gl, width, height, opt_wrapS, opt_wrapT) { gl, width, height, opt_wrapS, opt_wrapT) {
const texture = _ol_webgl_Context_.createTexture_(gl, opt_wrapS, opt_wrapT); const texture = WebGLContext.createTexture_(gl, opt_wrapS, opt_wrapT);
gl.texImage2D( gl.texImage2D(
gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE,
null); null);
@@ -361,11 +361,11 @@ _ol_webgl_Context_.createEmptyTexture = function(
* @param {number=} opt_wrapT wrapT. * @param {number=} opt_wrapT wrapT.
* @return {WebGLTexture} The texture. * @return {WebGLTexture} The texture.
*/ */
_ol_webgl_Context_.createTexture = function(gl, image, opt_wrapS, opt_wrapT) { WebGLContext.createTexture = function(gl, image, opt_wrapS, opt_wrapT) {
const texture = _ol_webgl_Context_.createTexture_(gl, opt_wrapS, opt_wrapT); const texture = WebGLContext.createTexture_(gl, opt_wrapS, opt_wrapT);
gl.texImage2D( gl.texImage2D(
gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
return texture; return texture;
}; };
export default _ol_webgl_Context_; export default WebGLContext;
+3 -3
View File
@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_webgl_ from '../webgl.js'; import _ol_webgl_ from '../webgl.js';
import _ol_webgl_Shader_ from '../webgl/Shader.js'; import WebGLShader from '../webgl/Shader.js';
/** /**
* @constructor * @constructor
@@ -12,10 +12,10 @@ import _ol_webgl_Shader_ from '../webgl/Shader.js';
* @struct * @struct
*/ */
const _ol_webgl_Fragment_ = function(source) { const _ol_webgl_Fragment_ = function(source) {
_ol_webgl_Shader_.call(this, source); WebGLShader.call(this, source);
}; };
inherits(_ol_webgl_Fragment_, _ol_webgl_Shader_); inherits(_ol_webgl_Fragment_, WebGLShader);
/** /**
+5 -5
View File
@@ -9,7 +9,7 @@ import {FALSE} from '../functions.js';
* @param {string} source Source. * @param {string} source Source.
* @struct * @struct
*/ */
const _ol_webgl_Shader_ = function(source) { const WebGLShader = function(source) {
/** /**
* @private * @private
@@ -24,13 +24,13 @@ const _ol_webgl_Shader_ = function(source) {
* @abstract * @abstract
* @return {number} Type. * @return {number} Type.
*/ */
_ol_webgl_Shader_.prototype.getType = function() {}; WebGLShader.prototype.getType = function() {};
/** /**
* @return {string} Source. * @return {string} Source.
*/ */
_ol_webgl_Shader_.prototype.getSource = function() { WebGLShader.prototype.getSource = function() {
return this.source_; return this.source_;
}; };
@@ -38,5 +38,5 @@ _ol_webgl_Shader_.prototype.getSource = function() {
/** /**
* @return {boolean} Is animated? * @return {boolean} Is animated?
*/ */
_ol_webgl_Shader_.prototype.isAnimated = FALSE; WebGLShader.prototype.isAnimated = FALSE;
export default _ol_webgl_Shader_; export default WebGLShader;
+3 -3
View File
@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_webgl_ from '../webgl.js'; import _ol_webgl_ from '../webgl.js';
import _ol_webgl_Shader_ from '../webgl/Shader.js'; import WebGLShader from '../webgl/Shader.js';
/** /**
* @constructor * @constructor
@@ -12,10 +12,10 @@ import _ol_webgl_Shader_ from '../webgl/Shader.js';
* @struct * @struct
*/ */
const _ol_webgl_Vertex_ = function(source) { const _ol_webgl_Vertex_ = function(source) {
_ol_webgl_Shader_.call(this, source); WebGLShader.call(this, source);
}; };
inherits(_ol_webgl_Vertex_, _ol_webgl_Shader_); inherits(_ol_webgl_Vertex_, WebGLShader);
/** /**