From 7ce2a0c12283bc1ea86d4af28aea62e1e371574d Mon Sep 17 00:00:00 2001 From: David Manthey Date: Thu, 19 Sep 2019 12:29:33 -0400 Subject: [PATCH] Add more comments about buffers and flags. --- src/webgl/lineFeature.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/webgl/lineFeature.js b/src/webgl/lineFeature.js index a9e456b4a3..f4b9eb60db 100644 --- a/src/webgl/lineFeature.js +++ b/src/webgl/lineFeature.js @@ -6,7 +6,17 @@ var MAX_MITER_LIMIT = 100; /* Flags are passed to the vertex shader in a float. Since a 32-bit float has * 24 bits of mantissa, including the sign bit, a maximum of 23 bits of flags - * can be passed in a float without loss or complication. */ + * can be passed in a float without loss or complication. + * The flags*Shift values are the bit offsets within the flag value. The + * flags*Mult values are the bit-offset values converted to a multiplier (2 + * raised to the offset value). The overall flags value is composed of: + * bits 0-1: vertex (corner, near, far) used by the shader to know where in + * the geometry the vertex is used. + * 2-4: near cap/join style + * 5-7: far cap/join style + * 8-18: stroke offset as a signed value in the range [-1023,1023] which + * maps to a floating-point stroke offset of [-1,1]. + */ /* vertex flags specify which direction a vertex needs to be offset */ var flagsVertex = { // uses 2 bits corner: 0, @@ -136,6 +146,7 @@ var webgl_lineFeature = function (arg) { antialiasing = m_this.style.get('antialiasing')(data) || 0, order = m_this.featureVertices(), orderk0, prevkey, nextkey, offkey, orderLen = order.length, + // webgl buffers; see _init for details posBuf, prevBuf, nextBuf, farBuf, flagsBuf, fixedFlags = (flagsDebug[m_this.style.get('debug')(data) ? 'debug' : 'normal'] || 0), strokeWidthBuf, strokeColorBuf, strokeOpacityBuf,