Private if not used elsewhere; underscore suffix only if private
This commit is contained in:
@@ -36,19 +36,19 @@ class AbstractBatchRenderer {
|
||||
constructor(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
||||
/**
|
||||
* @type {import("../../webgl/Helper.js").default}
|
||||
* @protected
|
||||
* @private
|
||||
*/
|
||||
this.helper_ = helper;
|
||||
|
||||
/**
|
||||
* @type {Worker}
|
||||
* @protected
|
||||
* @private
|
||||
*/
|
||||
this.worker_ = worker;
|
||||
|
||||
/**
|
||||
* @type {WebGLProgram}
|
||||
* @protected
|
||||
* @private
|
||||
*/
|
||||
this.program_ = this.helper_.getProgram(fragmentShader, vertexShader);
|
||||
|
||||
@@ -57,13 +57,13 @@ class AbstractBatchRenderer {
|
||||
* @type {Array<import('../../webgl/Helper.js').AttributeDescription>}
|
||||
* @protected
|
||||
*/
|
||||
this.attributes_ = [];
|
||||
this.attributes = [];
|
||||
|
||||
/**
|
||||
* @type {Array<CustomAttribute>}
|
||||
* @protected
|
||||
*/
|
||||
this.customAttributes_ = customAttributes;
|
||||
this.customAttributes = customAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ class AbstractBatchRenderer {
|
||||
this.helper_.useProgram(this.program_, frameState);
|
||||
this.helper_.bindBuffer(batch.verticesBuffer);
|
||||
this.helper_.bindBuffer(batch.indicesBuffer);
|
||||
this.helper_.enableAttributes(this.attributes_);
|
||||
this.helper_.enableAttributes(this.attributes);
|
||||
|
||||
const renderCount = batch.indicesBuffer.getSize();
|
||||
this.helper_.drawElements(0, renderCount);
|
||||
@@ -150,7 +150,7 @@ class AbstractBatchRenderer {
|
||||
type: messageType,
|
||||
renderInstructions: batch.renderInstructions.buffer,
|
||||
renderInstructionsTransform: batch.renderInstructionsTransform,
|
||||
customAttributesCount: this.customAttributes_.length,
|
||||
customAttributesCount: this.customAttributes.length,
|
||||
};
|
||||
this.worker_.postMessage(message, [batch.renderInstructions.buffer]);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class LineStringBatchRenderer extends AbstractBatchRenderer {
|
||||
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
||||
|
||||
// vertices for lines must hold both a position (x,y) and an offset (dx,dy)
|
||||
this.attributes_ = [
|
||||
this.attributes = [
|
||||
{
|
||||
name: Attributes.SEGMENT_START,
|
||||
size: 2,
|
||||
@@ -68,7 +68,7 @@ class LineStringBatchRenderer extends AbstractBatchRenderer {
|
||||
// + 1 instruction per line (for vertices count)
|
||||
const totalInstructionsCount =
|
||||
2 * batch.verticesCount +
|
||||
(1 + this.customAttributes_.length) * batch.geometriesCount;
|
||||
(1 + this.customAttributes.length) * batch.geometriesCount;
|
||||
if (
|
||||
!batch.renderInstructions ||
|
||||
batch.renderInstructions.length !== totalInstructionsCount
|
||||
@@ -95,8 +95,8 @@ class LineStringBatchRenderer extends AbstractBatchRenderer {
|
||||
);
|
||||
|
||||
// custom attributes
|
||||
for (let k = 0, kk = this.customAttributes_.length; k < kk; k++) {
|
||||
value = this.customAttributes_[k].callback(
|
||||
for (let k = 0, kk = this.customAttributes.length; k < kk; k++) {
|
||||
value = this.customAttributes[k].callback(
|
||||
batchEntry.feature,
|
||||
batchEntry.properties
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ class PointBatchRenderer extends AbstractBatchRenderer {
|
||||
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
||||
|
||||
// vertices for point must hold both a position (x,y) and an index (their position in the quad)
|
||||
this.attributes_ = [
|
||||
this.attributes = [
|
||||
{
|
||||
name: Attributes.POSITION,
|
||||
size: 2,
|
||||
@@ -61,7 +61,7 @@ class PointBatchRenderer extends AbstractBatchRenderer {
|
||||
// 2 instructions per vertex for position (x and y)
|
||||
// + 1 instruction per vertex per custom attributes
|
||||
const totalInstructionsCount =
|
||||
(2 + this.customAttributes_.length) * batch.geometriesCount;
|
||||
(2 + this.customAttributes.length) * batch.geometriesCount;
|
||||
if (
|
||||
!batch.renderInstructions ||
|
||||
batch.renderInstructions.length !== totalInstructionsCount
|
||||
@@ -85,8 +85,8 @@ class PointBatchRenderer extends AbstractBatchRenderer {
|
||||
batch.renderInstructions[renderIndex++] = tmpCoords[1];
|
||||
|
||||
// pushing custom attributes
|
||||
for (let j = 0, jj = this.customAttributes_.length; j < jj; j++) {
|
||||
value = this.customAttributes_[j].callback(
|
||||
for (let j = 0, jj = this.customAttributes.length; j < jj; j++) {
|
||||
value = this.customAttributes[j].callback(
|
||||
batchEntry.feature,
|
||||
batchEntry.properties
|
||||
);
|
||||
|
||||
@@ -26,7 +26,7 @@ class PolygonBatchRenderer extends AbstractBatchRenderer {
|
||||
super(helper, worker, vertexShader, fragmentShader, customAttributes);
|
||||
|
||||
// By default only a position attribute is required to render polygons
|
||||
this.attributes_ = [
|
||||
this.attributes = [
|
||||
{
|
||||
name: Attributes.POSITION,
|
||||
size: 2,
|
||||
@@ -57,7 +57,7 @@ class PolygonBatchRenderer extends AbstractBatchRenderer {
|
||||
// + 1 instruction per ring (for vertices count in ring)
|
||||
const totalInstructionsCount =
|
||||
2 * batch.verticesCount +
|
||||
(1 + this.customAttributes_.length) * batch.geometriesCount +
|
||||
(1 + this.customAttributes.length) * batch.geometriesCount +
|
||||
batch.ringsCount;
|
||||
if (
|
||||
!batch.renderInstructions ||
|
||||
@@ -85,8 +85,8 @@ class PolygonBatchRenderer extends AbstractBatchRenderer {
|
||||
);
|
||||
|
||||
// custom attributes
|
||||
for (let k = 0, kk = this.customAttributes_.length; k < kk; k++) {
|
||||
value = this.customAttributes_[k].callback(
|
||||
for (let k = 0, kk = this.customAttributes.length; k < kk; k++) {
|
||||
value = this.customAttributes[k].callback(
|
||||
batchEntry.feature,
|
||||
batchEntry.properties
|
||||
);
|
||||
|
||||
@@ -292,7 +292,11 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
|
||||
*/
|
||||
this.generateBuffersRun_ = 0;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this.worker_ = createWebGLWorker();
|
||||
|
||||
this.worker_.addEventListener(
|
||||
'message',
|
||||
/**
|
||||
|
||||
@@ -156,8 +156,14 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
||||
DEFAULT_POINT_FRAGMENT;
|
||||
this.pointAttributes_ = toAttributesArray(pointAttributesWithDefault);
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this.worker_ = createWebGLWorker();
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this.batch_ = new MixedGeometryBatch();
|
||||
|
||||
const source = this.getLayer().getSource();
|
||||
|
||||
@@ -89,7 +89,7 @@ describe('Batch renderers', function () {
|
||||
});
|
||||
describe('constructor', function () {
|
||||
it('generates the attributes list', function () {
|
||||
expect(batchRenderer.attributes_).to.eql([
|
||||
expect(batchRenderer.attributes).to.eql([
|
||||
{name: 'a_position', size: 2, type: FLOAT},
|
||||
{name: 'a_index', size: 1, type: FLOAT},
|
||||
{name: 'a_test', size: 1, type: FLOAT},
|
||||
@@ -192,7 +192,7 @@ describe('Batch renderers', function () {
|
||||
});
|
||||
describe('constructor', function () {
|
||||
it('generates the attributes list', function () {
|
||||
expect(batchRenderer.attributes_).to.eql([
|
||||
expect(batchRenderer.attributes).to.eql([
|
||||
{name: 'a_segmentStart', size: 2, type: FLOAT},
|
||||
{name: 'a_segmentEnd', size: 2, type: FLOAT},
|
||||
{name: 'a_parameters', size: 1, type: FLOAT},
|
||||
@@ -257,7 +257,7 @@ describe('Batch renderers', function () {
|
||||
});
|
||||
describe('constructor', function () {
|
||||
it('generates the attributes list', function () {
|
||||
expect(batchRenderer.attributes_).to.eql([
|
||||
expect(batchRenderer.attributes).to.eql([
|
||||
{name: 'a_position', size: 2, type: FLOAT},
|
||||
{name: 'a_test', size: 1, type: FLOAT},
|
||||
]);
|
||||
Reference in New Issue
Block a user