Remove ol.DEBUG

This commit is contained in:
Tim Schaub
2016-12-29 09:09:24 -07:00
parent 7b9690a691
commit 137cdc04c8
128 changed files with 309 additions and 2027 deletions

View File

@@ -178,10 +178,6 @@ ol.render.webgl.CircleReplay.prototype.getDeleteResourcesFunction = function(con
// be used by other CircleReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
return function() {
@@ -251,9 +247,6 @@ ol.render.webgl.CircleReplay.prototype.drawReplay = function(gl, context, skippe
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
//Draw by style groups to minimize drawElements() calls.
var i, start, end, nextStyle;
end = this.startIndices[this.startIndices.length - 1];
@@ -275,11 +268,6 @@ ol.render.webgl.CircleReplay.prototype.drawReplay = function(gl, context, skippe
*/
ol.render.webgl.CircleReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
@@ -326,9 +314,6 @@ ol.render.webgl.CircleReplay.prototype.drawHitDetectionReplayOneByOne = function
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
ol.render.webgl.CircleReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
@@ -388,7 +373,6 @@ ol.render.webgl.CircleReplay.prototype.setStrokeStyle_ = function(gl, color, lin
* @inheritDoc
*/
ol.render.webgl.CircleReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
var strokeStyleColor, strokeStyleWidth;
if (strokeStyle) {
var strokeStyleLineDash = strokeStyle.getLineDash();

View File

@@ -35,9 +35,7 @@ ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'precisio
* @const
* @type {string}
*/
ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.circlereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.fragment = new ol.render.webgl.circlereplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'varying ve
* @const
* @type {string}
*/
ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.circlereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.vertex = new ol.render.webgl.circlereplay.defaultshader.Vertex();
@@ -91,72 +87,60 @@ ol.render.webgl.circlereplay.defaultshader.Locations = function(gl, program) {
/**
* @type {WebGLUniformLocation}
*/
this.u_fillColor = gl.getUniformLocation(
program, ol.DEBUG ? 'u_fillColor' : 'n');
this.u_fillColor = gl.getUniformLocation(program, 'n');
/**
* @type {WebGLUniformLocation}
*/
this.u_lineWidth = gl.getUniformLocation(
program, ol.DEBUG ? 'u_lineWidth' : 'k');
this.u_lineWidth = gl.getUniformLocation(program, 'k');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'j');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'i');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'm');
this.u_opacity = gl.getUniformLocation(program, 'm');
/**
* @type {WebGLUniformLocation}
*/
this.u_pixelRatio = gl.getUniformLocation(
program, ol.DEBUG ? 'u_pixelRatio' : 'l');
this.u_pixelRatio = gl.getUniformLocation(program, 'l');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'h');
this.u_projectionMatrix = gl.getUniformLocation(program, 'h');
/**
* @type {WebGLUniformLocation}
*/
this.u_size = gl.getUniformLocation(
program, ol.DEBUG ? 'u_size' : 'p');
this.u_size = gl.getUniformLocation(program, 'p');
/**
* @type {WebGLUniformLocation}
*/
this.u_strokeColor = gl.getUniformLocation(
program, ol.DEBUG ? 'u_strokeColor' : 'o');
this.u_strokeColor = gl.getUniformLocation(program, 'o');
/**
* @type {number}
*/
this.a_instruction = gl.getAttribLocation(
program, ol.DEBUG ? 'a_instruction' : 'f');
this.a_instruction = gl.getAttribLocation(program, 'f');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'e');
this.a_position = gl.getAttribLocation(program, 'e');
/**
* @type {number}
*/
this.a_radius = gl.getAttribLocation(
program, ol.DEBUG ? 'a_radius' : 'g');
this.a_radius = gl.getAttribLocation(program, 'g');
};

View File

@@ -142,14 +142,6 @@ ol.inherits(ol.render.webgl.ImageReplay, ol.render.webgl.Replay);
* @inheritDoc
*/
ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may
// be used by other ImageReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
var textures = this.textures_;
@@ -180,20 +172,6 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction = function(cont
* @private
*/
ol.render.webgl.ImageReplay.prototype.drawCoordinates_ = function(flatCoordinates, offset, end, stride) {
ol.DEBUG && console.assert(this.anchorX_ !== undefined, 'anchorX is defined');
ol.DEBUG && console.assert(this.anchorY_ !== undefined, 'anchorY is defined');
ol.DEBUG && console.assert(this.height_ !== undefined, 'height is defined');
ol.DEBUG && console.assert(this.imageHeight_ !== undefined,
'imageHeight is defined');
ol.DEBUG && console.assert(this.imageWidth_ !== undefined, 'imageWidth is defined');
ol.DEBUG && console.assert(this.opacity_ !== undefined, 'opacity is defined');
ol.DEBUG && console.assert(this.originX_ !== undefined, 'originX is defined');
ol.DEBUG && console.assert(this.originY_ !== undefined, 'originY is defined');
ol.DEBUG && console.assert(this.rotateWithView_ !== undefined,
'rotateWithView is defined');
ol.DEBUG && console.assert(this.rotation_ !== undefined, 'rotation is defined');
ol.DEBUG && console.assert(this.scale_ !== undefined, 'scale is defined');
ol.DEBUG && console.assert(this.width_ !== undefined, 'width is defined');
var anchorX = /** @type {number} */ (this.anchorX_);
var anchorY = /** @type {number} */ (this.anchorY_);
var height = /** @type {number} */ (this.height_);
@@ -321,21 +299,12 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
var gl = context.getGL();
this.groupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.images_.length === this.groupIndices_.length,
'number of images and groupIndices match');
this.hitDetectionGroupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.hitDetectionImages_.length ===
this.hitDetectionGroupIndices_.length,
'number of hitDetectionImages and hitDetectionGroupIndices match');
// create, bind, and populate the vertices buffer
this.verticesBuffer = new ol.webgl.Buffer(this.vertices);
var indices = this.indices;
var bits = context.hasOESElementIndexUint ? 32 : 16;
ol.DEBUG && console.assert(indices[indices.length - 1] < Math.pow(2, bits),
'Too large element index detected [%s] (OES_element_index_uint "%s")',
indices[indices.length - 1], context.hasOESElementIndexUint);
// create, bind, and populate the indices buffer
this.indicesBuffer = new ol.webgl.Buffer(indices);
@@ -345,14 +314,9 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
var texturePerImage = {};
this.createTextures_(this.textures_, this.images_, texturePerImage, gl);
ol.DEBUG && console.assert(this.textures_.length === this.groupIndices_.length,
'number of textures and groupIndices match');
this.createTextures_(this.hitDetectionTextures_, this.hitDetectionImages_,
texturePerImage, gl);
ol.DEBUG && console.assert(this.hitDetectionTextures_.length ===
this.hitDetectionGroupIndices_.length,
'number of hitDetectionTextures and hitDetectionGroupIndices match');
this.anchorX_ = undefined;
this.anchorY_ = undefined;
@@ -382,9 +346,6 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
* @param {WebGLRenderingContext} gl Gl.
*/
ol.render.webgl.ImageReplay.prototype.createTextures_ = function(textures, images, texturePerImage, gl) {
ol.DEBUG && console.assert(textures.length === 0,
'upon creation, textures is empty');
var texture, image, uid, i;
var ii = images.length;
for (i = 0; i < ii; ++i) {
@@ -468,8 +429,6 @@ ol.render.webgl.ImageReplay.prototype.shutDownProgram = function(gl, locations)
ol.render.webgl.ImageReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) {
var textures = hitDetection ? this.hitDetectionTextures_ : this.textures_;
var groupIndices = hitDetection ? this.hitDetectionGroupIndices_ : this.groupIndices_;
ol.DEBUG && console.assert(textures.length === groupIndices.length,
'number of textures and groupIndeces match');
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(
@@ -561,10 +520,6 @@ ol.render.webgl.ImageReplay.prototype.drawReplaySkipping_ = function(gl, context
*/
ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.hitDetectionTextures_.length ===
this.hitDetectionGroupIndices_.length,
'number of hitDetectionTextures and hitDetectionGroupIndices match');
var i, groupStart, start, end, feature, featureUid;
var featureIndex = this.startIndices.length - 1;
for (i = this.hitDetectionTextures_.length - 1; i >= 0; --i) {
@@ -609,28 +564,12 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
var image = imageStyle.getImage(1);
var imageSize = imageStyle.getImageSize();
var hitDetectionImage = imageStyle.getHitDetectionImage(1);
var hitDetectionImageSize = imageStyle.getHitDetectionImageSize();
var opacity = imageStyle.getOpacity();
var origin = imageStyle.getOrigin();
var rotateWithView = imageStyle.getRotateWithView();
var rotation = imageStyle.getRotation();
var size = imageStyle.getSize();
var scale = imageStyle.getScale();
ol.DEBUG && console.assert(anchor, 'imageStyle anchor is not null');
ol.DEBUG && console.assert(image, 'imageStyle image is not null');
ol.DEBUG && console.assert(imageSize,
'imageStyle imageSize is not null');
ol.DEBUG && console.assert(hitDetectionImage,
'imageStyle hitDetectionImage is not null');
ol.DEBUG && console.assert(hitDetectionImageSize,
'imageStyle hitDetectionImageSize is not null');
ol.DEBUG && console.assert(opacity !== undefined, 'imageStyle opacity is defined');
ol.DEBUG && console.assert(origin, 'imageStyle origin is not null');
ol.DEBUG && console.assert(rotateWithView !== undefined,
'imageStyle rotateWithView is defined');
ol.DEBUG && console.assert(rotation !== undefined, 'imageStyle rotation is defined');
ol.DEBUG && console.assert(size, 'imageStyle size is not null');
ol.DEBUG && console.assert(scale !== undefined, 'imageStyle scale is defined');
var currentImage;
if (this.images_.length === 0) {
@@ -639,8 +578,6 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
currentImage = this.images_[this.images_.length - 1];
if (ol.getUid(currentImage) != ol.getUid(image)) {
this.groupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.groupIndices_.length === this.images_.length,
'number of groupIndices and images match');
this.images_.push(image);
}
}
@@ -652,9 +589,6 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
this.hitDetectionImages_[this.hitDetectionImages_.length - 1];
if (ol.getUid(currentImage) != ol.getUid(hitDetectionImage)) {
this.hitDetectionGroupIndices_.push(this.indices.length);
ol.DEBUG && console.assert(this.hitDetectionGroupIndices_.length ===
this.hitDetectionImages_.length,
'number of hitDetectionGroupIndices and hitDetectionImages match');
this.hitDetectionImages_.push(hitDetectionImage);
}
}

View File

@@ -35,9 +35,7 @@ ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'precision
* @const
* @type {string}
*/
ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.imagereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.fragment = new ol.render.webgl.imagereplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'varying vec
* @const
* @type {string}
*/
ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.imagereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.vertex = new ol.render.webgl.imagereplay.defaultshader.Vertex();
@@ -91,60 +87,50 @@ ol.render.webgl.imagereplay.defaultshader.Locations = function(gl, program) {
/**
* @type {WebGLUniformLocation}
*/
this.u_image = gl.getUniformLocation(
program, ol.DEBUG ? 'u_image' : 'l');
this.u_image = gl.getUniformLocation(program, 'l');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'j');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'i');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'k');
this.u_opacity = gl.getUniformLocation(program, 'k');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'h');
this.u_projectionMatrix = gl.getUniformLocation(program, 'h');
/**
* @type {number}
*/
this.a_offsets = gl.getAttribLocation(
program, ol.DEBUG ? 'a_offsets' : 'e');
this.a_offsets = gl.getAttribLocation(program, 'e');
/**
* @type {number}
*/
this.a_opacity = gl.getAttribLocation(
program, ol.DEBUG ? 'a_opacity' : 'f');
this.a_opacity = gl.getAttribLocation(program, 'f');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'c');
this.a_position = gl.getAttribLocation(program, 'c');
/**
* @type {number}
*/
this.a_rotateWithView = gl.getAttribLocation(
program, ol.DEBUG ? 'a_rotateWithView' : 'g');
this.a_rotateWithView = gl.getAttribLocation(program, 'g');
/**
* @type {number}
*/
this.a_texCoord = gl.getAttribLocation(
program, ol.DEBUG ? 'a_texCoord' : 'd');
this.a_texCoord = gl.getAttribLocation(program, 'd');
};

View File

@@ -129,7 +129,7 @@ ol.render.webgl.Immediate.prototype.drawGeometry = function(geometry) {
this.drawCircle(/** @type {ol.geom.Circle} */ (geometry), null);
break;
default:
ol.DEBUG && console.assert(false, 'Unsupported geometry type: ' + type);
// pass
}
};
@@ -145,7 +145,6 @@ ol.render.webgl.Immediate.prototype.drawFeature = function(feature, style) {
return;
}
this.setStyle(style);
ol.DEBUG && console.assert(geometry, 'geometry must be truthy');
this.drawGeometry(geometry);
};

View File

@@ -149,8 +149,6 @@ ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoord
p2 = startCoords;
break;
} else {
//For the compiler not to complain. This will never be [0, 0].
ol.DEBUG && console.assert(p0, 'p0 should be defined');
p0 = p0 || [0, 0];
numVertices = this.addVertices_(p0, p1, [0, 0],
@@ -232,9 +230,6 @@ ol.render.webgl.LineStringReplay.prototype.drawCoordinates_ = function(flatCoord
}
if (closed) {
//Link the last triangle/rhombus to the first one.
//n will never be numVertices / 7 here. However, the compiler complains otherwise.
ol.DEBUG && console.assert(n, 'n should be defined');
n = n || numVertices / 7;
sign = ol.geom.flat.orient.linearRingIsClockwise([p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]], 0, 6, 2)
? 1 : -1;
@@ -425,11 +420,6 @@ ol.render.webgl.LineStringReplay.prototype.finish = function(context) {
* @inheritDoc
*/
ol.render.webgl.LineStringReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may
// be used by other LineStringReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer, 'verticesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
return function() {
@@ -514,9 +504,6 @@ ol.render.webgl.LineStringReplay.prototype.drawReplay = function(gl, context, sk
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
//Draw by style groups to minimize drawElements() calls.
var i, start, end, nextStyle;
end = this.startIndices[this.startIndices.length - 1];
@@ -546,9 +533,6 @@ ol.render.webgl.LineStringReplay.prototype.drawReplay = function(gl, context, sk
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
ol.render.webgl.LineStringReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
@@ -587,11 +571,6 @@ ol.render.webgl.LineStringReplay.prototype.drawReplaySkipping_ = function(gl, co
*/
ol.render.webgl.LineStringReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
@@ -647,7 +626,6 @@ ol.render.webgl.LineStringReplay.prototype.setStrokeStyle_ = function(gl, color,
* @inheritDoc
*/
ol.render.webgl.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
var strokeStyleLineCap = strokeStyle.getLineCap();
this.state_.lineCap = strokeStyleLineCap !== undefined ?
strokeStyleLineCap : ol.render.webgl.defaultLineCap;

View File

@@ -35,9 +35,7 @@ ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'prec
* @const
* @type {string}
*/
ol.render.webgl.linestringreplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.linestringreplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.Fragment.SOURCE = ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.fragment = new ol.render.webgl.linestringreplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'varyin
* @const
* @type {string}
*/
ol.render.webgl.linestringreplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.linestringreplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.Vertex.SOURCE = ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.vertex = new ol.render.webgl.linestringreplay.defaultshader.Vertex();
@@ -91,78 +87,65 @@ ol.render.webgl.linestringreplay.defaultshader.Locations = function(gl, program)
/**
* @type {WebGLUniformLocation}
*/
this.u_color = gl.getUniformLocation(
program, ol.DEBUG ? 'u_color' : 'n');
this.u_color = gl.getUniformLocation(program, 'n');
/**
* @type {WebGLUniformLocation}
*/
this.u_lineWidth = gl.getUniformLocation(
program, ol.DEBUG ? 'u_lineWidth' : 'k');
this.u_lineWidth = gl.getUniformLocation(program, 'k');
/**
* @type {WebGLUniformLocation}
*/
this.u_miterLimit = gl.getUniformLocation(
program, ol.DEBUG ? 'u_miterLimit' : 'l');
this.u_miterLimit = gl.getUniformLocation(program, 'l');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'j');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'i');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'm');
this.u_opacity = gl.getUniformLocation(program, 'm');
/**
* @type {WebGLUniformLocation}
*/
this.u_pixelRatio = gl.getUniformLocation(
program, ol.DEBUG ? 'u_pixelRatio' : 'p');
this.u_pixelRatio = gl.getUniformLocation(program, 'p');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'h');
this.u_projectionMatrix = gl.getUniformLocation(program, 'h');
/**
* @type {WebGLUniformLocation}
*/
this.u_size = gl.getUniformLocation(
program, ol.DEBUG ? 'u_size' : 'o');
this.u_size = gl.getUniformLocation(program, 'o');
/**
* @type {number}
*/
this.a_direction = gl.getAttribLocation(
program, ol.DEBUG ? 'a_direction' : 'g');
this.a_direction = gl.getAttribLocation(program, 'g');
/**
* @type {number}
*/
this.a_lastPos = gl.getAttribLocation(
program, ol.DEBUG ? 'a_lastPos' : 'd');
this.a_lastPos = gl.getAttribLocation(program, 'd');
/**
* @type {number}
*/
this.a_nextPos = gl.getAttribLocation(
program, ol.DEBUG ? 'a_nextPos' : 'f');
this.a_nextPos = gl.getAttribLocation(program, 'f');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'e');
this.a_position = gl.getAttribLocation(program, 'e');
};

View File

@@ -296,8 +296,6 @@ ol.render.webgl.PolygonReplay.prototype.triangulate_ = function(list, rtree) {
// Due to the behavior of OL's PIP algorithm, the ear clipping cannot
// introduce touching segments. However, the original data may have some.
if (!this.resolveLocalSelfIntersections_(list, rtree, true)) {
// Something went wrong.
ol.DEBUG && console.assert(false, 'Unexpected simple polygon geometry');
break;
}
}
@@ -809,14 +807,6 @@ ol.render.webgl.PolygonReplay.prototype.finish = function(context) {
* @inheritDoc
*/
ol.render.webgl.PolygonReplay.prototype.getDeleteResourcesFunction = function(context) {
// We only delete our stuff here. The shaders and the program may
// be used by other PolygonReplay instances (for other layers). And
// they will be deleted when disposing of the ol.webgl.Context
// object.
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
var verticesBuffer = this.verticesBuffer;
var indicesBuffer = this.indicesBuffer;
var lineDeleter = this.lineStringReplay.getDeleteResourcesFunction(context);
@@ -884,9 +874,6 @@ ol.render.webgl.PolygonReplay.prototype.drawReplay = function(gl, context, skipp
if (!ol.obj.isEmpty(skippedFeaturesHash)) {
this.drawReplaySkipping_(gl, context, skippedFeaturesHash);
} else {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
//Draw by style groups to minimize drawElements() calls.
var i, start, end, nextStyle;
end = this.startIndices[this.startIndices.length - 1];
@@ -913,11 +900,6 @@ ol.render.webgl.PolygonReplay.prototype.drawReplay = function(gl, context, skipp
*/
ol.render.webgl.PolygonReplay.prototype.drawHitDetectionReplayOneByOne = function(gl, context, skippedFeaturesHash,
featureCallback, opt_hitExtent) {
ol.DEBUG && console.assert(this.styles_.length === this.styleIndices_.length,
'number of styles and styleIndices match');
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
@@ -962,9 +944,6 @@ ol.render.webgl.PolygonReplay.prototype.drawHitDetectionReplayOneByOne = functio
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
ol.render.webgl.PolygonReplay.prototype.drawReplaySkipping_ = function(gl, context, skippedFeaturesHash) {
ol.DEBUG && console.assert(this.startIndices.length - 1 === this.startIndicesFeature.length,
'number of startIndices and startIndicesFeature match');
var i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
@@ -1012,7 +991,6 @@ ol.render.webgl.PolygonReplay.prototype.setFillStyle_ = function(gl, color) {
* @inheritDoc
*/
ol.render.webgl.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
ol.DEBUG && console.assert(this.state_, 'this.state_ should not be null');
var fillStyleColor = fillStyle ? fillStyle.getColor() : [0, 0, 0, 0];
if (!(fillStyleColor instanceof CanvasGradient) &&
!(fillStyleColor instanceof CanvasPattern)) {

View File

@@ -35,9 +35,7 @@ ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE = 'precisi
* @const
* @type {string}
*/
ol.render.webgl.polygonreplay.defaultshader.Fragment.SOURCE = ol.DEBUG ?
ol.render.webgl.polygonreplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.Fragment.SOURCE = ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.fragment = new ol.render.webgl.polygonreplay.defaultshader.Fragment();
@@ -72,9 +70,7 @@ ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE = 'attribute
* @const
* @type {string}
*/
ol.render.webgl.polygonreplay.defaultshader.Vertex.SOURCE = ol.DEBUG ?
ol.render.webgl.polygonreplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.Vertex.SOURCE = ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.vertex = new ol.render.webgl.polygonreplay.defaultshader.Vertex();
@@ -91,36 +87,30 @@ ol.render.webgl.polygonreplay.defaultshader.Locations = function(gl, program) {
/**
* @type {WebGLUniformLocation}
*/
this.u_color = gl.getUniformLocation(
program, ol.DEBUG ? 'u_color' : 'e');
this.u_color = gl.getUniformLocation(program, 'e');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetRotateMatrix' : 'd');
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'd');
/**
* @type {WebGLUniformLocation}
*/
this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_offsetScaleMatrix' : 'c');
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'c');
/**
* @type {WebGLUniformLocation}
*/
this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG ? 'u_opacity' : 'f');
this.u_opacity = gl.getUniformLocation(program, 'f');
/**
* @type {WebGLUniformLocation}
*/
this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG ? 'u_projectionMatrix' : 'b');
this.u_projectionMatrix = gl.getUniformLocation(program, 'b');
/**
* @type {number}
*/
this.a_position = gl.getAttribLocation(
program, ol.DEBUG ? 'a_position' : 'a');
this.a_position = gl.getAttribLocation(program, 'a');
};

View File

@@ -284,14 +284,8 @@ ol.render.webgl.Replay.prototype.replay = function(context,
gl.stencilFunc(gl.NOTEQUAL, 1, 255);
}
// bind the vertices buffer
ol.DEBUG && console.assert(this.verticesBuffer,
'verticesBuffer must not be null');
context.bindBuffer(ol.webgl.ARRAY_BUFFER, this.verticesBuffer);
// bind the indices buffer
ol.DEBUG && console.assert(this.indicesBuffer,
'indicesBuffer must not be null');
context.bindBuffer(ol.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer);
var locations = this.setUpProgram(gl, context, size, pixelRatio);
@@ -311,11 +305,11 @@ ol.render.webgl.Replay.prototype.replay = function(context,
}
gl.uniformMatrix4fv(locations.u_projectionMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, projectionMatrix));
ol.vec.Mat4.fromTransform(this.tmpMat4_, projectionMatrix));
gl.uniformMatrix4fv(locations.u_offsetScaleMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetScaleMatrix));
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetScaleMatrix));
gl.uniformMatrix4fv(locations.u_offsetRotateMatrix, false,
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetRotateMatrix));
ol.vec.Mat4.fromTransform(this.tmpMat4_, offsetRotateMatrix));
gl.uniform1f(locations.u_opacity, opacity);
// draw!
@@ -337,10 +331,10 @@ ol.render.webgl.Replay.prototype.replay = function(context,
}
gl.clear(gl.STENCIL_BUFFER_BIT);
gl.stencilFunc(/** @type {number} */ (tmpStencilFunc),
/** @type {number} */ (tmpStencilRef), /** @type {number} */ (tmpStencilMaskVal));
/** @type {number} */ (tmpStencilRef), /** @type {number} */ (tmpStencilMaskVal));
gl.stencilMask(/** @type {number} */ (tmpStencilMask));
gl.stencilOp(/** @type {number} */ (tmpStencilOpFail),
/** @type {number} */ (tmpStencilOpZFail), /** @type {number} */ (tmpStencilOpPass));
/** @type {number} */ (tmpStencilOpZFail), /** @type {number} */ (tmpStencilOpPass));
}
return result;

View File

@@ -107,9 +107,6 @@ ol.render.webgl.ReplayGroup.prototype.getReplay = function(zIndex, replayType) {
var replay = replays[replayType];
if (replay === undefined) {
var Constructor = ol.render.webgl.ReplayGroup.BATCH_CONSTRUCTORS_[replayType];
ol.DEBUG && console.assert(Constructor !== undefined,
replayType +
' constructor missing from ol.render.webgl.ReplayGroup.BATCH_CONSTRUCTORS_');
replay = new Constructor(this.tolerance_, this.maxExtent_);
replays[replayType] = replay;
}