MCPcopy Create free account
hub / github.com/ChartGPU/ChartGPU / render

Function render

src/renderers/createCandlestickRenderer.ts:456–484  ·  view source on GitHub ↗
(passEncoder)

Source from the content-addressed store, hash-verified

454 };
455
456 const render: CandlestickRenderer['render'] = (passEncoder) => {
457 assertNotDisposed();
458
459 if (!instanceBuffer || instanceCount === 0) return;
460
461 // Apply scissor rect to clip to plot area
462 if (lastScissor && lastCanvasWidth > 0 && lastCanvasHeight > 0) {
463 passEncoder.setScissorRect(lastScissor.x, lastScissor.y, lastScissor.w, lastScissor.h);
464 }
465
466 passEncoder.setPipeline(pipeline);
467 passEncoder.setBindGroup(0, bindGroup);
468
469 // Pass 1: Draw all candles (18 vertices per instance)
470 passEncoder.setVertexBuffer(0, instanceBuffer);
471 passEncoder.draw(18, instanceCount);
472
473 // Pass 2: For hollow mode, draw body-only punch-out for UP candles
474 if (hollowMode && hollowInstanceBuffer && hollowInstanceCount > 0) {
475 passEncoder.setVertexBuffer(0, hollowInstanceBuffer);
476 // Draw only body vertices (0-5) by drawing 6 vertices per instance
477 passEncoder.draw(6, hollowInstanceCount);
478 }
479
480 // Reset scissor to full canvas
481 if (lastScissor && lastCanvasWidth > 0 && lastCanvasHeight > 0) {
482 passEncoder.setScissorRect(0, 0, lastCanvasWidth, lastCanvasHeight);
483 }
484 };
485
486 const dispose: CandlestickRenderer['dispose'] = () => {
487 if (disposed) return;

Callers

nothing calls this directly

Calls 1

assertNotDisposedFunction · 0.70

Tested by

no test coverage detected