@rekurt/openkline - v0.2.0
    Preparing search index...

    Function buildCandleVertices

    • Build per-candle triangle geometry for the visible portion of view, in the exact same screen space the Canvas2D CandleRenderer draws into — so a WebGL pass is pixel-equivalent to the 2D pass it replaces.

      PURE: takes no GL context and touches no DOM, so it is fully unit-testable in jsdom. The WebGLCandleRenderer calls this each frame and uploads the result; a host can also call it directly to feed a custom GL pipeline.

      For every visible candle two quads are emitted — a thin WICK_WIDTH wick from priceToY(high) to priceToY(low), and a body from priceToY(max(open,close)) to priceToY(min(open,close)) floored to MIN_CANDLE_BODY_HEIGHT (so a doji stays visible) — giving VERTS_PER_CANDLE (12) vertices. Candles whose body lies entirely left of layout.chartLeft or right of layout.chartRight are culled and contribute nothing, matching the 2D renderer's skip test. Conflated (downsampled) views are positioned via repIndex[i] and their body is widened to ≥ 1px, again matching CandleRenderer.

      Color is per-vertex: a bullish candle (close >= open) uses theme.bullCandle, otherwise theme.bearCandle, each parsed to 0..1 RGB.

      Parameters

      Returns CandleVertexData