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

Function createAreaVertices

src/renderers/createAreaRenderer.ts:113–129  ·  view source on GitHub ↗
(data: ResolvedAreaSeriesConfig['data'])

Source from the content-addressed store, hash-verified

111};
112
113const createAreaVertices = (data: ResolvedAreaSeriesConfig['data']): Float32Array => {
114 // Triangle-strip expects duplicated vertices:
115 // p0,p0,p1,p1,... and WGSL uses vertex_index parity to swap y to baseline for odd indices.
116 const n = data.length;
117 const out = new Float32Array(n * 2 * 2); // n * 2 vertices * vec2<f32>
118
119 let idx = 0;
120 for (let i = 0; i < n; i++) {
121 const { x, y } = getPointXY(data[i]);
122 out[idx++] = x;
123 out[idx++] = y;
124 out[idx++] = x;
125 out[idx++] = y;
126 }
127
128 return out;
129};
130
131export function createAreaRenderer(device: GPUDevice, options?: AreaRendererOptions): AreaRenderer {
132 let disposed = false;

Callers 1

prepareFunction · 0.85

Calls 1

getPointXYFunction · 0.70

Tested by

no test coverage detected