@crysound/crychart 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +288 -0
- package/LICENSE.zh-CN.md +290 -0
- package/README.md +82 -2
- package/README.zh-CN.md +79 -0
- package/dist/crychart.cjs +25234 -0
- package/dist/crychart.global.js +25236 -0
- package/dist/crychart.js +25211 -0
- package/dist/themes.js +357 -0
- package/dist/types/adapters/opentest.d.ts +69 -0
- package/dist/types/annotation-interaction.d.ts +36 -0
- package/dist/types/axis-canvas.d.ts +78 -0
- package/dist/types/axis-layout.d.ts +10 -0
- package/dist/types/axis-scroll-animation.d.ts +16 -0
- package/dist/types/axis.d.ts +532 -0
- package/dist/types/axis3d-label-layout.d.ts +45 -0
- package/dist/types/chart-events.d.ts +89 -0
- package/dist/types/chart.d.ts +674 -0
- package/dist/types/compatibility-types.d.ts +55 -0
- package/dist/types/component-highlight.d.ts +21 -0
- package/dist/types/contracts.d.ts +88 -0
- package/dist/types/core/data.d.ts +204 -0
- package/dist/types/core/events.d.ts +16 -0
- package/dist/types/core/line-delta-certificate.d.ts +70 -0
- package/dist/types/core/paged-columns.d.ts +180 -0
- package/dist/types/core/styles.d.ts +350 -0
- package/dist/types/css-text-fonts.d.ts +13 -0
- package/dist/types/cursor-api.d.ts +47 -0
- package/dist/types/custom-icon.d.ts +46 -0
- package/dist/types/data-bounds.d.ts +28 -0
- package/dist/types/data-order.d.ts +49 -0
- package/dist/types/data-runs.d.ts +15 -0
- package/dist/types/date-time-formatting.d.ts +32 -0
- package/dist/types/date-time-grid.d.ts +56 -0
- package/dist/types/formatting-functions.d.ts +16 -0
- package/dist/types/geometry.d.ts +378 -0
- package/dist/types/gradients.d.ts +37 -0
- package/dist/types/grid-layout.d.ts +10 -0
- package/dist/types/heatmap-stream.d.ts +38 -0
- package/dist/types/hierarchy.d.ts +191 -0
- package/dist/types/index.d.ts +75 -0
- package/dist/types/interaction-policy.d.ts +56 -0
- package/dist/types/line-block-cache.d.ts +146 -0
- package/dist/types/line-coverage-geometry.d.ts +28 -0
- package/dist/types/line-display-arena.d.ts +64 -0
- package/dist/types/line-display-cache.d.ts +144 -0
- package/dist/types/line-display-packets.d.ts +43 -0
- package/dist/types/line-extrema-pair-proof.d.ts +23 -0
- package/dist/types/line-palette-3d.d.ts +6 -0
- package/dist/types/line-selection-ledger.d.ts +143 -0
- package/dist/types/map.d.ts +219 -0
- package/dist/types/mesh3d.d.ts +306 -0
- package/dist/types/native-legend.d.ts +208 -0
- package/dist/types/point-fill.d.ts +14 -0
- package/dist/types/point-stroke-geometry.d.ts +12 -0
- package/dist/types/polar-heatmap.d.ts +68 -0
- package/dist/types/polar-layout.d.ts +100 -0
- package/dist/types/polar-series.d.ts +79 -0
- package/dist/types/raster-clip.d.ts +37 -0
- package/dist/types/render-heatmap.d.ts +117 -0
- package/dist/types/render-line-coverage.d.ts +95 -0
- package/dist/types/render-line-direction.d.ts +27 -0
- package/dist/types/render-line-offsets.d.ts +61 -0
- package/dist/types/render-line-strip.d.ts +102 -0
- package/dist/types/render-line-texture.d.ts +30 -0
- package/dist/types/render.d.ts +66 -0
- package/dist/types/render3d.d.ts +137 -0
- package/dist/types/result-table-layout.d.ts +39 -0
- package/dist/types/series-attributes.d.ts +7 -0
- package/dist/types/series.d.ts +404 -0
- package/dist/types/specialty.d.ts +551 -0
- package/dist/types/streaming-line-policy.d.ts +11 -0
- package/dist/types/stroke-geometry.d.ts +5 -0
- package/dist/types/themes.d.ts +32 -0
- package/dist/types/time-formatting.d.ts +23 -0
- package/dist/types/time-grid.d.ts +26 -0
- package/dist/types/ui.d.ts +207 -0
- package/dist/types/viewport.d.ts +18 -0
- package/dist/types/world-axis.d.ts +21 -0
- package/dist/types/world-camera.d.ts +88 -0
- package/dist/types/zoom-clock.d.ts +36 -0
- package/docs/npm-usage.md +31 -0
- package/package.json +66 -4
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { DrawPacket, Rect } from './contracts.js';
|
|
2
|
+
import { type GpuClipPolicy, type RasterTarget } from './raster-clip.js';
|
|
3
|
+
interface Range {
|
|
4
|
+
first: number;
|
|
5
|
+
count: number;
|
|
6
|
+
}
|
|
7
|
+
/** Reuse patches only against an exact retained GPU revision. Growth or missed
|
|
8
|
+
* revisions require full initialization, including every halo and NaN pair. */
|
|
9
|
+
export declare function linePositionUploadRanges(packet: DrawPacket, revision: number, count: number, grow: boolean): readonly Range[];
|
|
10
|
+
/** Explicit candidate: conservative capsule bounds, a per-stroke coverage
|
|
11
|
+
* union, and exactly one color/alpha composite. One lazily grown R8 scratch
|
|
12
|
+
* texture is reused across every line and clipped to its visible ROI. Source
|
|
13
|
+
* data and display selection are not changed here. All modified GL state is
|
|
14
|
+
* restored before returning, including when allocation or drawing throws. */
|
|
15
|
+
export declare class LineCoverageRenderer {
|
|
16
|
+
readonly gl: WebGL2RenderingContext;
|
|
17
|
+
readonly options: {
|
|
18
|
+
stateScope?: 'draw' | 'frame';
|
|
19
|
+
clipPolicy?: GpuClipPolicy;
|
|
20
|
+
positionSource?: (packet: DrawPacket) => {
|
|
21
|
+
buffer: WebGLBuffer;
|
|
22
|
+
strideBytes: number;
|
|
23
|
+
offsetBytes: number;
|
|
24
|
+
} | undefined;
|
|
25
|
+
};
|
|
26
|
+
readonly stats: {
|
|
27
|
+
uploads: number;
|
|
28
|
+
uploadedBytes: number;
|
|
29
|
+
drawCalls: number;
|
|
30
|
+
vertices: number;
|
|
31
|
+
submittedSamples: number;
|
|
32
|
+
maskPasses: number;
|
|
33
|
+
compositePasses: number;
|
|
34
|
+
maskPixels: number;
|
|
35
|
+
scratchBytes: number;
|
|
36
|
+
residentBufferBytes: number;
|
|
37
|
+
stateCaptures: number;
|
|
38
|
+
stateRestores: number;
|
|
39
|
+
knownFrameBaselines: number;
|
|
40
|
+
};
|
|
41
|
+
private maskProgram?;
|
|
42
|
+
private compositeProgram?;
|
|
43
|
+
private vao?;
|
|
44
|
+
private compositeVAO?;
|
|
45
|
+
private framebuffer?;
|
|
46
|
+
private texture?;
|
|
47
|
+
private textureWidth;
|
|
48
|
+
private textureHeight;
|
|
49
|
+
private buffers;
|
|
50
|
+
private live;
|
|
51
|
+
private disposed;
|
|
52
|
+
private frameState?;
|
|
53
|
+
private capturedFrameActive;
|
|
54
|
+
private knownFrameActive;
|
|
55
|
+
private ownedMaskStateReady;
|
|
56
|
+
/** Frame scope is an explicit exclusive-GL contract: the caller must invoke
|
|
57
|
+
* flushState() before another renderer reads or changes context state. The
|
|
58
|
+
* default continues to restore every individual stroke immediately. */
|
|
59
|
+
constructor(gl: WebGL2RenderingContext, options?: {
|
|
60
|
+
stateScope?: 'draw' | 'frame';
|
|
61
|
+
clipPolicy?: GpuClipPolicy;
|
|
62
|
+
positionSource?: (packet: DrawPacket) => {
|
|
63
|
+
buffer: WebGLBuffer;
|
|
64
|
+
strideBytes: number;
|
|
65
|
+
offsetBytes: number;
|
|
66
|
+
} | undefined;
|
|
67
|
+
});
|
|
68
|
+
canDraw(packet: DrawPacket): boolean;
|
|
69
|
+
beginFrame(): void;
|
|
70
|
+
/** Synchronous all-coverage batch: capture actual incoming state, never an
|
|
71
|
+
* assumed private-context baseline. No other renderer may enter until flush. */
|
|
72
|
+
beginCapturedFrame(): void;
|
|
73
|
+
/** Internal capability, only after DataRenderer established this exact private
|
|
74
|
+
* default-target baseline. Standalone draw()/frame users keep full capture.
|
|
75
|
+
* This record is ephemeral and cleared by every flush/end/context/dispose. */
|
|
76
|
+
beginKnownOwnedFrame(program: WebGLProgram, viewport: readonly [number, number, number, number]): void;
|
|
77
|
+
draw(packet: DrawPacket, rect: Rect, dpr: number, range?: Range, rasterTarget?: RasterTarget): boolean;
|
|
78
|
+
drawGroup(packets: readonly DrawPacket[], rect: Rect, dpr: number, ranges?: readonly Range[], rasterTarget?: RasterTarget): boolean;
|
|
79
|
+
/** Finish the current exclusive batch before any mixed-pipeline operation. */
|
|
80
|
+
flushState(): boolean;
|
|
81
|
+
endFrame(): void;
|
|
82
|
+
restoreContext(): void;
|
|
83
|
+
dispose(): void;
|
|
84
|
+
private validateGroup;
|
|
85
|
+
private drawMask;
|
|
86
|
+
private composite;
|
|
87
|
+
private uploadArena;
|
|
88
|
+
private upload;
|
|
89
|
+
private ensureScratch;
|
|
90
|
+
private initialize;
|
|
91
|
+
private createProgram;
|
|
92
|
+
private saveState;
|
|
93
|
+
private restoreState;
|
|
94
|
+
}
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Experimental alternative for the existing solid-line rasterizer. It changes
|
|
2
|
+
* the order of floating-point operations, so its pixels must not be described
|
|
3
|
+
* as identical to the projected-subtraction path without an actual comparison.
|
|
4
|
+
* Both paths preserve every submitted source point and use the same AA fragment.
|
|
5
|
+
*/
|
|
6
|
+
export type LineDirectionMode = 'projected' | 'relative';
|
|
7
|
+
/** Conservative per-segment bounds for the explicit coverage-union candidate.
|
|
8
|
+
* The original miter experiment below remains available for historical probes;
|
|
9
|
+
* it is not used by this shader. Coordinates are relative framebuffer pixels. */
|
|
10
|
+
export declare const lineCapsuleVertex = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location=0) in vec2 a_start;\nlayout(location=1) in vec2 a_end;\nuniform vec4 u_domain;\nuniform vec2 u_size;\nuniform float u_width;\nflat out vec2 v_lineStart;\nflat out vec2 v_lineEnd;\nflat out float v_valid;\nbool finite(vec2 p){return !any(isnan(p))&&!any(isinf(p));}\nvoid main(){\n vec2 a=(a_start-u_domain.xy)/u_domain.zw*u_size;\n vec2 b=(a_end-u_domain.xy)/u_domain.zw*u_size;\n vec2 delta=b-a;\n bool valid=finite(a_start)&&finite(a_end)&&finite(a)&&finite(b)&&finite(delta);\n float scale=max(abs(delta.x),abs(delta.y));\n vec2 tangent=scale>0.?normalize(delta/scale):vec2(1.,0.);\n vec2 normal=vec2(-tangent.y,tangent.x);\n bool ending=gl_VertexID%2==1;\n float side=gl_VertexID<2?-1.:1.;\n vec2 pixel=(ending?b:a)+(normal*side+tangent*(ending?1.:-1.))*(u_width*.5+1.);\n v_lineStart=a;v_lineEnd=b;v_valid=valid?1.:0.;\n gl_Position=valid?vec4(pixel/u_size*2.-1.,0.,1.):vec4(2.,2.,2.,1.);\n}";
|
|
11
|
+
export declare const lineCoverageFragment = "#version 300 es\nprecision highp float;\nuniform vec2 u_plotOrigin;\nuniform float u_width;\nflat in vec2 v_lineStart;\nflat in vec2 v_lineEnd;\nflat in float v_valid;\nout vec4 color;\nvoid main(){\n if(v_valid<.5)discard;\n vec2 pixel=gl_FragCoord.xy-u_plotOrigin,delta=v_lineEnd-v_lineStart;\n float scale=max(abs(delta.x),abs(delta.y)),t=0.;\n if(scale>0.){vec2 direction=delta/scale;t=clamp(dot((pixel-v_lineStart)/scale,direction)/dot(direction,direction),0.,1.);}\n float distance=length(pixel-mix(v_lineStart,v_lineEnd,t));\n float coverage=clamp(u_width*.5+.5-distance,0.,1.);\n if(coverage<=0.)discard;\n color=vec4(coverage,0.,0.,1.);\n}";
|
|
12
|
+
/** The direct renderer and transform-feedback cache deliberately share this
|
|
13
|
+
* exact expression order. Deltas are formed before viewport translation. This
|
|
14
|
+
* makes the offset calculation independent of pan at an unchanged pixel scale.
|
|
15
|
+
*/
|
|
16
|
+
export declare const relativeLineDirectionGLSL = "\nvec2 lineDelta(vec2 center,vec2 neighbor){\n return (center-neighbor)*(2.0*u_size/u_domain.zw);\n}\nbool lineNeighbor(vec2 neighbor,vec2 delta){\n return finite(neighbor)&&dot(delta,delta)>0.0000000001;\n}\nvec4 lineOffsets(vec2 previous,vec2 center,vec2 next){\n vec2 incoming=lineDelta(center,previous),outgoing=lineDelta(next,center);\n bool hasPrevious=lineNeighbor(previous,incoming),hasNext=lineNeighbor(next,outgoing);\n vec2 incomingNormal=hasPrevious?vec2(-incoming.y,incoming.x)/length(incoming):vec2(0.,1.);\n vec2 outgoingNormal=hasNext?vec2(-outgoing.y,outgoing.x)/length(outgoing):incomingNormal;\n if(!hasPrevious)incomingNormal=outgoingNormal;\n vec2 sum=incomingNormal+outgoingNormal;\n vec2 miter=length(sum)>.00001?normalize(sum):incomingNormal;\n miter/=max(.25,dot(miter,incomingNormal));\n vec2 cap=vec2(0.);\n if(!hasPrevious&&hasNext)cap-=outgoing/length(outgoing);\n if(hasPrevious&&!hasNext)cap+=incoming/length(incoming);\n vec2 scale=(u_width+2.)/u_size;\n return finite(center)?vec4((-miter+cap)*scale,(miter+cap)*scale):vec4(0.);\n}\n";
|
|
17
|
+
export declare const relativeLineVertex = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location=0) in vec2 a_previous;\nlayout(location=1) in vec2 a_center;\nlayout(location=2) in vec2 a_next;\nuniform vec4 u_domain;\nuniform vec2 u_size;\nuniform float u_width;\nflat out vec2 v_lineStart;\nflat out vec2 v_lineEnd;\nflat out float v_valid;\nbool finite(vec2 p){return !any(isnan(p))&&!any(isinf(p));}\nvec2 project(vec2 p){return (p-u_domain.xy)/u_domain.zw*2.0-1.0;}\n\nvec2 lineDelta(vec2 center,vec2 neighbor){\n return (center-neighbor)*(2.0*u_size/u_domain.zw);\n}\nbool lineNeighbor(vec2 neighbor,vec2 delta){\n return finite(neighbor)&&dot(delta,delta)>0.0000000001;\n}\nvec4 lineOffsets(vec2 previous,vec2 center,vec2 next){\n vec2 incoming=lineDelta(center,previous),outgoing=lineDelta(next,center);\n bool hasPrevious=lineNeighbor(previous,incoming),hasNext=lineNeighbor(next,outgoing);\n vec2 incomingNormal=hasPrevious?vec2(-incoming.y,incoming.x)/length(incoming):vec2(0.,1.);\n vec2 outgoingNormal=hasNext?vec2(-outgoing.y,outgoing.x)/length(outgoing):incomingNormal;\n if(!hasPrevious)incomingNormal=outgoingNormal;\n vec2 sum=incomingNormal+outgoingNormal;\n vec2 miter=length(sum)>.00001?normalize(sum):incomingNormal;\n miter/=max(.25,dot(miter,incomingNormal));\n vec2 cap=vec2(0.);\n if(!hasPrevious&&hasNext)cap-=outgoing/length(outgoing);\n if(hasPrevious&&!hasNext)cap+=incoming/length(incoming);\n vec2 scale=(u_width+2.)/u_size;\n return finite(center)?vec4((-miter+cap)*scale,(miter+cap)*scale):vec4(0.);\n}\n\nvoid main(){\n vec2 p=project(a_center),before=project(a_previous);\n vec4 offsets=lineOffsets(a_previous,a_center,a_next);\n vec2 offset=gl_VertexID%2==0?offsets.xy:offsets.zw;\n v_lineStart=(before+1.)*.5*u_size;\n v_lineEnd=(p+1.)*.5*u_size;\n v_valid=finite(a_center)&&lineNeighbor(a_previous,lineDelta(a_center,a_previous))?1.:0.;\n gl_Position=finite(a_center)?vec4(p+offset,0.,1.):vec4(2.,2.,2.,1.);\n}";
|
|
18
|
+
export declare const relativeCachedLineVertex = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location=0) in vec2 a_previous;\nlayout(location=1) in vec2 a_center;\nlayout(location=2) in vec2 a_offset;\nuniform vec4 u_domain;\nuniform vec2 u_size;\nuniform float u_width;\nflat out vec2 v_lineStart;\nflat out vec2 v_lineEnd;\nflat out float v_valid;\nbool finite(vec2 p){return !any(isnan(p))&&!any(isinf(p));}\nvec2 project(vec2 p){return (p-u_domain.xy)/u_domain.zw*2.0-1.0;}\n\nvec2 lineDelta(vec2 center,vec2 neighbor){\n return (center-neighbor)*(2.0*u_size/u_domain.zw);\n}\nbool lineNeighbor(vec2 neighbor,vec2 delta){\n return finite(neighbor)&&dot(delta,delta)>0.0000000001;\n}\nvec4 lineOffsets(vec2 previous,vec2 center,vec2 next){\n vec2 incoming=lineDelta(center,previous),outgoing=lineDelta(next,center);\n bool hasPrevious=lineNeighbor(previous,incoming),hasNext=lineNeighbor(next,outgoing);\n vec2 incomingNormal=hasPrevious?vec2(-incoming.y,incoming.x)/length(incoming):vec2(0.,1.);\n vec2 outgoingNormal=hasNext?vec2(-outgoing.y,outgoing.x)/length(outgoing):incomingNormal;\n if(!hasPrevious)incomingNormal=outgoingNormal;\n vec2 sum=incomingNormal+outgoingNormal;\n vec2 miter=length(sum)>.00001?normalize(sum):incomingNormal;\n miter/=max(.25,dot(miter,incomingNormal));\n vec2 cap=vec2(0.);\n if(!hasPrevious&&hasNext)cap-=outgoing/length(outgoing);\n if(hasPrevious&&!hasNext)cap+=incoming/length(incoming);\n vec2 scale=(u_width+2.)/u_size;\n return finite(center)?vec4((-miter+cap)*scale,(miter+cap)*scale):vec4(0.);\n}\n\nvoid main(){\n vec2 p=project(a_center),before=project(a_previous);\n v_lineStart=(before+1.)*.5*u_size;\n v_lineEnd=(p+1.)*.5*u_size;\n v_valid=finite(a_center)&&lineNeighbor(a_previous,lineDelta(a_center,a_previous))?1.:0.;\n gl_Position=finite(a_center)?vec4(p+a_offset,0.,1.):vec4(2.,2.,2.,1.);\n}";
|
|
19
|
+
export declare const relativeOffsetVertex = "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location=0) in vec2 a_previous;\nlayout(location=1) in vec2 a_center;\nlayout(location=2) in vec2 a_next;\nuniform vec4 u_domain;\nuniform vec2 u_size;\nuniform float u_width;\nout vec4 v_offsets;\nbool finite(vec2 p){return !any(isnan(p))&&!any(isinf(p));}\n\nvec2 lineDelta(vec2 center,vec2 neighbor){\n return (center-neighbor)*(2.0*u_size/u_domain.zw);\n}\nbool lineNeighbor(vec2 neighbor,vec2 delta){\n return finite(neighbor)&&dot(delta,delta)>0.0000000001;\n}\nvec4 lineOffsets(vec2 previous,vec2 center,vec2 next){\n vec2 incoming=lineDelta(center,previous),outgoing=lineDelta(next,center);\n bool hasPrevious=lineNeighbor(previous,incoming),hasNext=lineNeighbor(next,outgoing);\n vec2 incomingNormal=hasPrevious?vec2(-incoming.y,incoming.x)/length(incoming):vec2(0.,1.);\n vec2 outgoingNormal=hasNext?vec2(-outgoing.y,outgoing.x)/length(outgoing):incomingNormal;\n if(!hasPrevious)incomingNormal=outgoingNormal;\n vec2 sum=incomingNormal+outgoingNormal;\n vec2 miter=length(sum)>.00001?normalize(sum):incomingNormal;\n miter/=max(.25,dot(miter,incomingNormal));\n vec2 cap=vec2(0.);\n if(!hasPrevious&&hasNext)cap-=outgoing/length(outgoing);\n if(hasPrevious&&!hasNext)cap+=incoming/length(incoming);\n vec2 scale=(u_width+2.)/u_size;\n return finite(center)?vec4((-miter+cap)*scale,(miter+cap)*scale):vec4(0.);\n}\n\nvoid main(){\n v_offsets=lineOffsets(a_previous,a_center,a_next);\n gl_Position=vec4(0.,0.,0.,1.);\n}";
|
|
20
|
+
type Pair = readonly [number, number];
|
|
21
|
+
/** Float64 geometry oracle for the existing miter/cap rule. It is independent
|
|
22
|
+
* of the GPU cache and its raster output. Returned offsets are clip-space pairs
|
|
23
|
+
* [left.x,left.y,right.x,right.y]; multiply by half the pixel size for pixels.
|
|
24
|
+
* The oracle does not turn a pixel difference into an equivalence claim.
|
|
25
|
+
*/
|
|
26
|
+
export declare function lineDirectionOracle(previous: Pair, center: Pair, next: Pair, span: Pair, size: Pair, width: number): [number, number, number, number];
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { DrawPacket, Rect } from './contracts.js';
|
|
2
|
+
import { type LineDirectionMode } from './render-line-direction.js';
|
|
3
|
+
export interface LinePositionBuffer {
|
|
4
|
+
buffer: WebGLBuffer;
|
|
5
|
+
/** Bytes between adjacent source samples, not between strip vertices. */
|
|
6
|
+
strideBytes: number;
|
|
7
|
+
/** Byte offset of sample 0. One real or duplicated neighbor must precede it. */
|
|
8
|
+
centerOffsetBytes: number;
|
|
9
|
+
}
|
|
10
|
+
export interface LineOffsetBuffer {
|
|
11
|
+
buffer: WebGLBuffer;
|
|
12
|
+
/** Per sample: left.x, left.y, right.x, right.y in clip-space offsets. */
|
|
13
|
+
bytesPerSample: 16;
|
|
14
|
+
count: number;
|
|
15
|
+
revision: number;
|
|
16
|
+
computedFrom: number;
|
|
17
|
+
computedCount: number;
|
|
18
|
+
reused: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Experimental transform-feedback cache. Not enabled by this module itself.
|
|
21
|
+
* The owner supplies a GPU position buffer with both endpoint neighbors. This
|
|
22
|
+
* class never uploads or resamples source positions and never clears a canvas.
|
|
23
|
+
* update() leaves its program active, a null VAO/TF, and RASTERIZER_DISCARD off.
|
|
24
|
+
* Source: https://registry.khronos.org/webgl/specs/latest/2.0/#3.7.15
|
|
25
|
+
*
|
|
26
|
+
* Translation is omitted from the cache key because offsets are mathematically
|
|
27
|
+
* translation invariant. The current projected-subtraction shader can still
|
|
28
|
+
* round differently after panning. Pixel comparisons across pan/epoch/extreme
|
|
29
|
+
* aspect ratio are required before enabling this candidate in the renderer.
|
|
30
|
+
*/
|
|
31
|
+
export declare class LineOffsetCache {
|
|
32
|
+
readonly gl: WebGL2RenderingContext;
|
|
33
|
+
readonly options: {
|
|
34
|
+
directionMode?: LineDirectionMode;
|
|
35
|
+
};
|
|
36
|
+
readonly stats: {
|
|
37
|
+
computations: number;
|
|
38
|
+
computedSamples: number;
|
|
39
|
+
allocations: number;
|
|
40
|
+
allocatedBytes: number;
|
|
41
|
+
residentAllocatedBytes: number;
|
|
42
|
+
peakResidentAllocatedBytes: number;
|
|
43
|
+
cacheHits: number;
|
|
44
|
+
};
|
|
45
|
+
private program?;
|
|
46
|
+
private vao?;
|
|
47
|
+
private feedback?;
|
|
48
|
+
private uniforms;
|
|
49
|
+
private entries;
|
|
50
|
+
private live;
|
|
51
|
+
private disposed;
|
|
52
|
+
constructor(gl: WebGL2RenderingContext, options?: {
|
|
53
|
+
directionMode?: LineDirectionMode;
|
|
54
|
+
});
|
|
55
|
+
beginFrame(): void;
|
|
56
|
+
update(packet: DrawPacket, rect: Rect, dpr: number, positions: LinePositionBuffer): LineOffsetBuffer;
|
|
57
|
+
endFrame(): void;
|
|
58
|
+
restoreContext(): void;
|
|
59
|
+
dispose(): void;
|
|
60
|
+
private initialize;
|
|
61
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { DrawPacket, Rect } from './contracts.js';
|
|
2
|
+
import { type LineDirectionMode } from './render-line-direction.js';
|
|
3
|
+
import { type GpuClipPolicy, type RasterTarget } from './raster-clip.js';
|
|
4
|
+
export interface LineStripRange {
|
|
5
|
+
first: number;
|
|
6
|
+
count: number;
|
|
7
|
+
}
|
|
8
|
+
export interface LineStripStats {
|
|
9
|
+
uploads: number;
|
|
10
|
+
uploadedBytes: number;
|
|
11
|
+
drawCalls: number;
|
|
12
|
+
vertices: number;
|
|
13
|
+
submittedSamples: number;
|
|
14
|
+
}
|
|
15
|
+
/** Original sources shared with isolated diagnostic renderers. */
|
|
16
|
+
export declare const lineStripShaderSources: {
|
|
17
|
+
readonly vertex: "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location=0) in vec2 a_previous;\nlayout(location=1) in vec2 a_center;\nlayout(location=2) in vec2 a_next;\nuniform vec4 u_domain;\nuniform vec2 u_size;\nuniform float u_width;\nflat out vec2 v_lineStart;\nflat out vec2 v_lineEnd;\nflat out float v_valid;\nbool finite(vec2 p){return !any(isnan(p))&&!any(isinf(p));}\nvec2 project(vec2 p){return (p-u_domain.xy)/u_domain.zw*2.0-1.0;}\nvoid main(){\n vec2 p=project(a_center),before=project(a_previous),after=project(a_next);\n vec2 incoming=(p-before)*u_size,outgoing=(after-p)*u_size;\n float incomingLength=length(incoming),outgoingLength=length(outgoing);\n bool hasPrevious=finite(a_previous)&&incomingLength>0.00001;\n bool hasNext=finite(a_next)&&outgoingLength>0.00001;\n vec2 incomingNormal=hasPrevious?vec2(-incoming.y,incoming.x)/incomingLength:vec2(0.,1.);\n vec2 outgoingNormal=hasNext?vec2(-outgoing.y,outgoing.x)/outgoingLength:incomingNormal;\n if(!hasPrevious)incomingNormal=outgoingNormal;\n vec2 sum=incomingNormal+outgoingNormal;\n vec2 miter=length(sum)>.00001?normalize(sum):incomingNormal;\n miter/=max(.25,dot(miter,incomingNormal));\n float side=gl_VertexID%2==0?-1.:1.;\n vec2 edge=miter*side;\n if(!hasPrevious&&hasNext)edge-=outgoing/outgoingLength;\n if(hasPrevious&&!hasNext)edge+=incoming/incomingLength;\n v_lineStart=(before+1.)*.5*u_size;\n v_lineEnd=(p+1.)*.5*u_size;\n v_valid=finite(a_center)&&hasPrevious?1.:0.;\n p+=edge*(u_width+2.)/u_size;\n gl_Position=finite(a_center)?vec4(p,0.,1.):vec4(2.,2.,2.,1.);\n}";
|
|
18
|
+
readonly fragment: "#version 300 es\nprecision highp float;\nuniform vec4 u_color;\nuniform vec2 u_plotOrigin;\nuniform float u_width;\nflat in vec2 v_lineStart;\nflat in vec2 v_lineEnd;\nflat in float v_valid;\nout vec4 color;\nvoid main(){\n if(v_valid<.5)discard;\n vec2 pixel=gl_FragCoord.xy-u_plotOrigin,delta=v_lineEnd-v_lineStart;\n float squared=dot(delta,delta);\n float t=clamp(squared>0.000001?dot(pixel-v_lineStart,delta)/squared:0.,0.,1.);\n float distance=length(pixel-mix(v_lineStart,v_lineEnd,t));\n float coverage=clamp(u_width*.5+.5-distance,0.,1.);\n if(coverage<=0.)discard;\n color=u_color;\n color.a*=coverage;\n}";
|
|
19
|
+
readonly relativeVertex: "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location=0) in vec2 a_previous;\nlayout(location=1) in vec2 a_center;\nlayout(location=2) in vec2 a_next;\nuniform vec4 u_domain;\nuniform vec2 u_size;\nuniform float u_width;\nflat out vec2 v_lineStart;\nflat out vec2 v_lineEnd;\nflat out float v_valid;\nbool finite(vec2 p){return !any(isnan(p))&&!any(isinf(p));}\nvec2 project(vec2 p){return (p-u_domain.xy)/u_domain.zw*2.0-1.0;}\n\nvec2 lineDelta(vec2 center,vec2 neighbor){\n return (center-neighbor)*(2.0*u_size/u_domain.zw);\n}\nbool lineNeighbor(vec2 neighbor,vec2 delta){\n return finite(neighbor)&&dot(delta,delta)>0.0000000001;\n}\nvec4 lineOffsets(vec2 previous,vec2 center,vec2 next){\n vec2 incoming=lineDelta(center,previous),outgoing=lineDelta(next,center);\n bool hasPrevious=lineNeighbor(previous,incoming),hasNext=lineNeighbor(next,outgoing);\n vec2 incomingNormal=hasPrevious?vec2(-incoming.y,incoming.x)/length(incoming):vec2(0.,1.);\n vec2 outgoingNormal=hasNext?vec2(-outgoing.y,outgoing.x)/length(outgoing):incomingNormal;\n if(!hasPrevious)incomingNormal=outgoingNormal;\n vec2 sum=incomingNormal+outgoingNormal;\n vec2 miter=length(sum)>.00001?normalize(sum):incomingNormal;\n miter/=max(.25,dot(miter,incomingNormal));\n vec2 cap=vec2(0.);\n if(!hasPrevious&&hasNext)cap-=outgoing/length(outgoing);\n if(hasPrevious&&!hasNext)cap+=incoming/length(incoming);\n vec2 scale=(u_width+2.)/u_size;\n return finite(center)?vec4((-miter+cap)*scale,(miter+cap)*scale):vec4(0.);\n}\n\nvoid main(){\n vec2 p=project(a_center),before=project(a_previous);\n vec4 offsets=lineOffsets(a_previous,a_center,a_next);\n vec2 offset=gl_VertexID%2==0?offsets.xy:offsets.zw;\n v_lineStart=(before+1.)*.5*u_size;\n v_lineEnd=(p+1.)*.5*u_size;\n v_valid=finite(a_center)&&lineNeighbor(a_previous,lineDelta(a_center,a_previous))?1.:0.;\n gl_Position=finite(a_center)?vec4(p+offset,0.,1.):vec4(2.,2.,2.,1.);\n}";
|
|
20
|
+
readonly relativeCachedVertex: "#version 300 es\nprecision highp float;\nprecision highp int;\nlayout(location=0) in vec2 a_previous;\nlayout(location=1) in vec2 a_center;\nlayout(location=2) in vec2 a_offset;\nuniform vec4 u_domain;\nuniform vec2 u_size;\nuniform float u_width;\nflat out vec2 v_lineStart;\nflat out vec2 v_lineEnd;\nflat out float v_valid;\nbool finite(vec2 p){return !any(isnan(p))&&!any(isinf(p));}\nvec2 project(vec2 p){return (p-u_domain.xy)/u_domain.zw*2.0-1.0;}\n\nvec2 lineDelta(vec2 center,vec2 neighbor){\n return (center-neighbor)*(2.0*u_size/u_domain.zw);\n}\nbool lineNeighbor(vec2 neighbor,vec2 delta){\n return finite(neighbor)&&dot(delta,delta)>0.0000000001;\n}\nvec4 lineOffsets(vec2 previous,vec2 center,vec2 next){\n vec2 incoming=lineDelta(center,previous),outgoing=lineDelta(next,center);\n bool hasPrevious=lineNeighbor(previous,incoming),hasNext=lineNeighbor(next,outgoing);\n vec2 incomingNormal=hasPrevious?vec2(-incoming.y,incoming.x)/length(incoming):vec2(0.,1.);\n vec2 outgoingNormal=hasNext?vec2(-outgoing.y,outgoing.x)/length(outgoing):incomingNormal;\n if(!hasPrevious)incomingNormal=outgoingNormal;\n vec2 sum=incomingNormal+outgoingNormal;\n vec2 miter=length(sum)>.00001?normalize(sum):incomingNormal;\n miter/=max(.25,dot(miter,incomingNormal));\n vec2 cap=vec2(0.);\n if(!hasPrevious&&hasNext)cap-=outgoing/length(outgoing);\n if(hasPrevious&&!hasNext)cap+=incoming/length(incoming);\n vec2 scale=(u_width+2.)/u_size;\n return finite(center)?vec4((-miter+cap)*scale,(miter+cap)*scale):vec4(0.);\n}\n\nvoid main(){\n vec2 p=project(a_center),before=project(a_previous);\n v_lineStart=(before+1.)*.5*u_size;\n v_lineEnd=(p+1.)*.5*u_size;\n v_valid=finite(a_center)&&lineNeighbor(a_previous,lineDelta(a_center,a_previous))?1.:0.;\n gl_Position=finite(a_center)?vec4(p+a_offset,0.,1.):vec4(2.,2.,2.,1.);\n}";
|
|
21
|
+
};
|
|
22
|
+
/** Strictly increasing-X solid XY line candidate. The caller owns clearing,
|
|
23
|
+
* ordering and context events. Duplicate/reversing/nonfinite X stays on the
|
|
24
|
+
* general pipeline; nonfinite Y is allowed and produces disconnected segments.
|
|
25
|
+
* draw() leaves this program active and unbinds its private VAO. The caller must
|
|
26
|
+
* restore its program before drawing with another pipeline. No source samples
|
|
27
|
+
* are removed: the optional range changes submitted vertices only.
|
|
28
|
+
*/
|
|
29
|
+
export declare class LineStripRenderer {
|
|
30
|
+
readonly gl: WebGL2RenderingContext;
|
|
31
|
+
readonly options: {
|
|
32
|
+
cacheOffsets?: boolean;
|
|
33
|
+
directionMode?: LineDirectionMode;
|
|
34
|
+
coverageUnion?: boolean;
|
|
35
|
+
coverageStateScope?: 'draw' | 'frame';
|
|
36
|
+
clipPolicy?: GpuClipPolicy;
|
|
37
|
+
};
|
|
38
|
+
readonly stats: LineStripStats;
|
|
39
|
+
private program?;
|
|
40
|
+
private vao?;
|
|
41
|
+
private uniforms;
|
|
42
|
+
private buffers;
|
|
43
|
+
private live;
|
|
44
|
+
private experimentalFrame;
|
|
45
|
+
private experimentalAliveOwners?;
|
|
46
|
+
private experimentalLastUsed;
|
|
47
|
+
setExperimentalAliveOwners(ids: ReadonlySet<number>): void;
|
|
48
|
+
private disposed;
|
|
49
|
+
private offsetCache?;
|
|
50
|
+
private coverage?;
|
|
51
|
+
private checkedRasterTarget?;
|
|
52
|
+
constructor(gl: WebGL2RenderingContext, options?: {
|
|
53
|
+
cacheOffsets?: boolean;
|
|
54
|
+
directionMode?: LineDirectionMode;
|
|
55
|
+
coverageUnion?: boolean;
|
|
56
|
+
coverageStateScope?: 'draw' | 'frame';
|
|
57
|
+
clipPolicy?: GpuClipPolicy;
|
|
58
|
+
});
|
|
59
|
+
getOffsetStats(): {
|
|
60
|
+
computations: number;
|
|
61
|
+
computedSamples: number;
|
|
62
|
+
allocations: number;
|
|
63
|
+
allocatedBytes: number;
|
|
64
|
+
residentAllocatedBytes: number;
|
|
65
|
+
peakResidentAllocatedBytes: number;
|
|
66
|
+
cacheHits: number;
|
|
67
|
+
} | undefined;
|
|
68
|
+
/** Coverage candidates use independent segment bounds, not miter offsets. */
|
|
69
|
+
getCoverageStats(): {
|
|
70
|
+
uploads: number;
|
|
71
|
+
uploadedBytes: number;
|
|
72
|
+
drawCalls: number;
|
|
73
|
+
vertices: number;
|
|
74
|
+
submittedSamples: number;
|
|
75
|
+
maskPasses: number;
|
|
76
|
+
compositePasses: number;
|
|
77
|
+
maskPixels: number;
|
|
78
|
+
scratchBytes: number;
|
|
79
|
+
residentBufferBytes: number;
|
|
80
|
+
stateCaptures: number;
|
|
81
|
+
stateRestores: number;
|
|
82
|
+
knownFrameBaselines: number;
|
|
83
|
+
} | undefined;
|
|
84
|
+
/** Call before entering a different pipeline during an exclusive frame. */
|
|
85
|
+
flushCoverageState(): boolean;
|
|
86
|
+
beginCapturedCoverageFrame(): void;
|
|
87
|
+
canDraw(packet: DrawPacket): boolean;
|
|
88
|
+
beginFrame(): void;
|
|
89
|
+
draw(packet: DrawPacket, rect: Rect, dpr: number, range?: LineStripRange, rasterTarget?: RasterTarget): boolean;
|
|
90
|
+
/** Consecutive blocks of one stroke share a coverage union when the explicit
|
|
91
|
+
* candidate is enabled. The baseline preserves its original per-packet draw. */
|
|
92
|
+
drawGroup(packets: readonly DrawPacket[], rect: Rect, dpr: number, rasterTarget?: RasterTarget): boolean;
|
|
93
|
+
/** Internal Chart-owned default-target entry; ordinary low-level calls do
|
|
94
|
+
* not activate it and continue saving/restoring arbitrary incoming state. */
|
|
95
|
+
beginKnownOwnedFrame(program: WebGLProgram, viewport: readonly [number, number, number, number]): void;
|
|
96
|
+
endFrame(): void;
|
|
97
|
+
/** Call only after WebGL context restoration; old handles are invalid. */
|
|
98
|
+
restoreContext(): void;
|
|
99
|
+
dispose(): void;
|
|
100
|
+
private upload;
|
|
101
|
+
private initialize;
|
|
102
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DrawPacket, Rect } from './contracts.js';
|
|
2
|
+
import { type LineStripRange, type LineStripStats } from './render-line-strip.js';
|
|
3
|
+
/** Experimental RG32F coordinate fetcher, deliberately not used by DataRenderer.
|
|
4
|
+
* No resampling, coordinate quantization, or source reduction is performed.
|
|
5
|
+
* Like LineStripRenderer, draw() leaves its program active and unbinds its VAO.
|
|
6
|
+
* It additionally leaves TEXTURE0 active with its private texture bound. A host
|
|
7
|
+
* that mixes pipelines must restore the texture state required by the next one.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TextureLineRenderer {
|
|
10
|
+
readonly gl: WebGL2RenderingContext;
|
|
11
|
+
readonly stats: LineStripStats;
|
|
12
|
+
readonly uploadKind: "RG32F-texture";
|
|
13
|
+
private program?;
|
|
14
|
+
private vao?;
|
|
15
|
+
private uniforms;
|
|
16
|
+
private textures;
|
|
17
|
+
private live;
|
|
18
|
+
private disposed;
|
|
19
|
+
private textureWidth;
|
|
20
|
+
private maxTextureSize;
|
|
21
|
+
constructor(gl: WebGL2RenderingContext);
|
|
22
|
+
canDraw(packet: DrawPacket): boolean;
|
|
23
|
+
beginFrame(): void;
|
|
24
|
+
draw(packet: DrawPacket, rect: Rect, dpr: number, range?: LineStripRange): boolean;
|
|
25
|
+
endFrame(): void;
|
|
26
|
+
restoreContext(): void;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
private upload;
|
|
29
|
+
private initialize;
|
|
30
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { DrawPacket, Rect } from "./contracts.js";
|
|
2
|
+
import { type GpuClipPolicy, type RasterTarget } from './raster-clip.js';
|
|
3
|
+
export declare class DataRenderer {
|
|
4
|
+
readonly canvas: HTMLCanvasElement;
|
|
5
|
+
readonly backend: "webgl2" | "canvas2d";
|
|
6
|
+
readonly gl: WebGL2RenderingContext | null;
|
|
7
|
+
private ctx;
|
|
8
|
+
private program?;
|
|
9
|
+
private lineStrip?;
|
|
10
|
+
private readonly lineCoverageUnion;
|
|
11
|
+
private readonly lineCoverageStateScope;
|
|
12
|
+
private readonly ownedCoverageFrame;
|
|
13
|
+
readonly ownedFrameAdmission: {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
private readonly gpuClipPolicy;
|
|
18
|
+
private buffers;
|
|
19
|
+
private uniforms;
|
|
20
|
+
private attrStart;
|
|
21
|
+
private attrEnd;
|
|
22
|
+
private attrDash;
|
|
23
|
+
private attrPrevious;
|
|
24
|
+
private attrNext;
|
|
25
|
+
private attrColorStart;
|
|
26
|
+
private attrColorEnd;
|
|
27
|
+
private attrSize;
|
|
28
|
+
private attrRotation;
|
|
29
|
+
private attributeBuffers;
|
|
30
|
+
private lost;
|
|
31
|
+
private iconPipeline?;
|
|
32
|
+
private readonly iconTextures;
|
|
33
|
+
readonly stats: {
|
|
34
|
+
frames: number;
|
|
35
|
+
uploads: number;
|
|
36
|
+
uploadedBytes: number;
|
|
37
|
+
drawCalls: number;
|
|
38
|
+
vertices: number;
|
|
39
|
+
submittedSamples: number;
|
|
40
|
+
renderTimeMs: number;
|
|
41
|
+
};
|
|
42
|
+
constructor(canvas: HTMLCanvasElement, options?: {
|
|
43
|
+
antialias?: boolean;
|
|
44
|
+
renderer?: 'auto' | 'webgl2' | 'canvas2d';
|
|
45
|
+
lineCoverageUnion?: boolean;
|
|
46
|
+
lineCoverageStateScope?: 'draw' | 'frame';
|
|
47
|
+
ownedCoverageFrame?: boolean;
|
|
48
|
+
gpuClipPolicy?: GpuClipPolicy;
|
|
49
|
+
});
|
|
50
|
+
private onLost;
|
|
51
|
+
private clearIcons;
|
|
52
|
+
private getIconPipeline;
|
|
53
|
+
private drawIconGPU;
|
|
54
|
+
private onRestore;
|
|
55
|
+
private init;
|
|
56
|
+
render(packets: DrawPacket[], rect: Rect, dpr: number, options?: {
|
|
57
|
+
clear?: boolean;
|
|
58
|
+
rasterTarget?: RasterTarget;
|
|
59
|
+
experimentalHiddenLineOwners?: ReadonlySet<number>;
|
|
60
|
+
}): void;
|
|
61
|
+
private canUseKnownOwnedFrame;
|
|
62
|
+
private establishKnownPrivateBaseline;
|
|
63
|
+
private drawGPU;
|
|
64
|
+
private drawCPU;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { Rect } from './contracts.js';
|
|
2
|
+
import type { WorldCameraFrame } from './world-camera.js';
|
|
3
|
+
/** Public silhouette-constrained world-size unit; no vendor implementation constant is assumed. */
|
|
4
|
+
export declare const NORMALIZED_WORLD_STYLE_UNIT = 0.001;
|
|
5
|
+
export declare function worldStylePixels3D(size: number, depth: number, frame: WorldCameraFrame): number;
|
|
6
|
+
export interface DrawPacket3D {
|
|
7
|
+
id: number;
|
|
8
|
+
revision: number;
|
|
9
|
+
/** Normalized XYZ coordinates. Certified constant dimensions use zero placeholders. */
|
|
10
|
+
positions: Float32Array;
|
|
11
|
+
/** Source-certified constant coordinates, normalized with exact Float32 rounding. */
|
|
12
|
+
constantCoordinates?: Readonly<Partial<{
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z: number;
|
|
16
|
+
}>>;
|
|
17
|
+
count: number;
|
|
18
|
+
mode: 'line' | 'points' | 'triangles' | 'boxes';
|
|
19
|
+
color: readonly [number, number, number, number];
|
|
20
|
+
/** Optional absolute per-vertex RGBA colors, in [0, 1]. */
|
|
21
|
+
colors?: Float32Array;
|
|
22
|
+
indices?: Uint32Array;
|
|
23
|
+
indexRevision?: number;
|
|
24
|
+
/** Producer has checked that every position in this revision is finite. */
|
|
25
|
+
allFinite?: boolean;
|
|
26
|
+
normals?: Float32Array;
|
|
27
|
+
lighting?: boolean;
|
|
28
|
+
/** Explicit Simple shading also disables the legacy Sphere highlight. */
|
|
29
|
+
unshaded?: boolean;
|
|
30
|
+
depthTestEnabled?: boolean;
|
|
31
|
+
backfaceCullingMode?: 'disabled' | 'cull-back' | 'cull-front';
|
|
32
|
+
pointSizes?: Float32Array;
|
|
33
|
+
/** World-camera positive line/Sphere sizes; surface/box/pixel paths omit this flag. */
|
|
34
|
+
worldStyleUnits?: boolean;
|
|
35
|
+
pointShape?: 'circle' | 'square' | 'sphere';
|
|
36
|
+
/** Per-instance normalized XYZ dimensions for procedural, instanced cuboids. */
|
|
37
|
+
boxSizes?: Float32Array;
|
|
38
|
+
boxTopColors?: Float32Array;
|
|
39
|
+
/** Corner radius as a fraction of the smallest full box dimension, in [0, .5]. */
|
|
40
|
+
roundness?: number;
|
|
41
|
+
/** Optional partial uploads; coordinates are float-element offsets, not byte offsets. */
|
|
42
|
+
positionUpdateRanges?: readonly {
|
|
43
|
+
start: number;
|
|
44
|
+
count: number;
|
|
45
|
+
}[];
|
|
46
|
+
colorUpdateRanges?: readonly {
|
|
47
|
+
start: number;
|
|
48
|
+
count: number;
|
|
49
|
+
}[];
|
|
50
|
+
normalUpdateRanges?: readonly {
|
|
51
|
+
start: number;
|
|
52
|
+
count: number;
|
|
53
|
+
}[];
|
|
54
|
+
previousRevision?: number;
|
|
55
|
+
thickness: number;
|
|
56
|
+
pointSize: number;
|
|
57
|
+
}
|
|
58
|
+
export type Packet3D = DrawPacket3D;
|
|
59
|
+
export interface Camera3D {
|
|
60
|
+
worldFrame?: WorldCameraFrame;
|
|
61
|
+
azimuth: number;
|
|
62
|
+
elevation: number;
|
|
63
|
+
zoom: number;
|
|
64
|
+
boundingBox?: {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
z: number;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** Bounding dimensions describe ratios, so a uniform multiplier has no effect. */
|
|
71
|
+
export declare function cameraVolumeScale(camera: Camera3D): {
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
z: number;
|
|
75
|
+
};
|
|
76
|
+
export interface PreparedVertices3D {
|
|
77
|
+
positions: Float32Array;
|
|
78
|
+
colors?: Float32Array;
|
|
79
|
+
count: number;
|
|
80
|
+
}
|
|
81
|
+
/** Column-major rotation: first azimuth around Y, then elevation around X. */
|
|
82
|
+
export declare function cameraRotationMatrix(camera: Camera3D): Float32Array;
|
|
83
|
+
export declare function cameraProjectionScales(camera: Camera3D, rect: Pick<Rect, 'width' | 'height'>): {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
};
|
|
87
|
+
/** CPU equivalent for picking and tests; drawing uses the same transform on the GPU. */
|
|
88
|
+
export declare function projectNormalized3D(point: {
|
|
89
|
+
x: number;
|
|
90
|
+
y: number;
|
|
91
|
+
z: number;
|
|
92
|
+
}, rect: Rect, camera: Camera3D): {
|
|
93
|
+
x: number;
|
|
94
|
+
y: number;
|
|
95
|
+
depth: number;
|
|
96
|
+
};
|
|
97
|
+
/** Remove complete invalid triangles, preserving color alignment and valid input buffers. */
|
|
98
|
+
export declare function prepareTriangles3D(positions: Float32Array, colors?: Float32Array, count?: number): PreparedVertices3D;
|
|
99
|
+
/** GPU 3D renderer with an explicit camera-uniform/data-upload separation. */
|
|
100
|
+
export declare class DataRenderer3D {
|
|
101
|
+
readonly gl: WebGL2RenderingContext;
|
|
102
|
+
readonly canvas: HTMLCanvasElement;
|
|
103
|
+
readonly backend = "webgl2";
|
|
104
|
+
readonly stats: {
|
|
105
|
+
frames: number;
|
|
106
|
+
uploads: number;
|
|
107
|
+
bufferUploads: number;
|
|
108
|
+
uploadedBytes: number;
|
|
109
|
+
drawCalls: number;
|
|
110
|
+
vertices: number;
|
|
111
|
+
submittedVertices: number;
|
|
112
|
+
renderTimeMs: number;
|
|
113
|
+
cachedBuffers: number;
|
|
114
|
+
cacheBytes: number;
|
|
115
|
+
contextRestores: number;
|
|
116
|
+
};
|
|
117
|
+
private program?;
|
|
118
|
+
private legacyProgram?;
|
|
119
|
+
private worldProgram?;
|
|
120
|
+
private readonly buffers;
|
|
121
|
+
private uniforms;
|
|
122
|
+
private worldStyleScale;
|
|
123
|
+
private maximumPointSize;
|
|
124
|
+
private lost;
|
|
125
|
+
private disposed;
|
|
126
|
+
constructor(gl: WebGL2RenderingContext, canvas: HTMLCanvasElement);
|
|
127
|
+
private contextLost;
|
|
128
|
+
private contextRestored;
|
|
129
|
+
private initialize;
|
|
130
|
+
render(packets: readonly DrawPacket3D[], rect: Rect, dpr: number, camera: Camera3D): void;
|
|
131
|
+
private validatePacket;
|
|
132
|
+
private upload;
|
|
133
|
+
private configureArray;
|
|
134
|
+
private draw;
|
|
135
|
+
private deleteEntry;
|
|
136
|
+
dispose(): void;
|
|
137
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FontSettings, type FillStyle } from './core/styles.js';
|
|
2
|
+
interface PreparedCell {
|
|
3
|
+
text: string;
|
|
4
|
+
lines: string[];
|
|
5
|
+
font: FontSettings;
|
|
6
|
+
fill: string;
|
|
7
|
+
symbol?: string;
|
|
8
|
+
symbolSize: number;
|
|
9
|
+
symbolGap: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
lineHeight: number;
|
|
13
|
+
ascent: number;
|
|
14
|
+
descent: number;
|
|
15
|
+
textWidth: number;
|
|
16
|
+
column: number;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
interface PreparedRow {
|
|
21
|
+
cells: PreparedCell[];
|
|
22
|
+
top: number;
|
|
23
|
+
height: number;
|
|
24
|
+
fill?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ResultTableLayout {
|
|
27
|
+
rich: boolean;
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
padding: number;
|
|
31
|
+
plainText: string;
|
|
32
|
+
contentWidth: number;
|
|
33
|
+
rows: PreparedRow[];
|
|
34
|
+
}
|
|
35
|
+
/** A per-draw snapshot: component names and cell getters are read just once. */
|
|
36
|
+
export declare function prepareResultTableLayout(ctx: CanvasRenderingContext2D, content: any[][], font: FontSettings, fill: FillStyle, padding: number): ResultTableLayout;
|
|
37
|
+
/** Draw exactly the measured cells; no source rows, names or fonts are reread. */
|
|
38
|
+
export declare function drawResultTableCells(ctx: CanvasRenderingContext2D, layout: ResultTableLayout, left: number, top: number): void;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Color, type LUT } from "./core/styles.js";
|
|
2
|
+
export declare function writeColor(target: Float32Array | number[], offset: number, color: Color): void;
|
|
3
|
+
/** Insert palette boundaries so RGB interpolation cannot skip a LUT stop. */
|
|
4
|
+
export declare function colorMappedLine(positions: Float32Array, values: Float64Array, lut: LUT): {
|
|
5
|
+
positions: Float32Array;
|
|
6
|
+
colors: Float32Array;
|
|
7
|
+
};
|