Skip to content

Commit

Permalink
Add more comments about buffers and flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Sep 19, 2019
1 parent 46a1c58 commit 7ce2a0c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/webgl/lineFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 7ce2a0c

Please sign in to comment.