Rename _ol_webgl_Buffer_ to WebGLBuffer

This commit is contained in:
Frederic Junod
2018-02-08 08:46:25 +01:00
parent d1c11d50eb
commit 62b2900348
8 changed files with 33 additions and 35 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
@@ -11,7 +11,7 @@ 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 WebGLContext from '../../webgl/Context.js'; import WebGLContext from '../../webgl/Context.js';
/** /**
@@ -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,
+2 -2
View File
@@ -18,7 +18,7 @@ import _ol_renderer_webgl_tilelayershader_Locations_ from '../webgl/tilelayersha
import _ol_size_ from '../../size.js'; import _ol_size_ 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_;