@antv/l7-renderer 2.25.6 → 2.25.7
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/package.json +4 -4
- package/es/device/DeviceAttribute.d.ts +0 -13
- package/es/device/DeviceAttribute.js +0 -30
- package/es/device/DeviceBuffer.d.ts +0 -18
- package/es/device/DeviceBuffer.js +0 -51
- package/es/device/DeviceCache.d.ts +0 -14
- package/es/device/DeviceCache.js +0 -198
- package/es/device/DeviceElements.d.ts +0 -13
- package/es/device/DeviceElements.js +0 -42
- package/es/device/DeviceFramebuffer.d.ts +0 -24
- package/es/device/DeviceFramebuffer.js +0 -81
- package/es/device/DeviceModel.d.ts +0 -61
- package/es/device/DeviceModel.js +0 -488
- package/es/device/DeviceTexture2D.d.ts +0 -23
- package/es/device/DeviceTexture2D.js +0 -132
- package/es/device/constants.d.ts +0 -35
- package/es/device/constants.js +0 -117
- package/es/device/index.d.ts +0 -68
- package/es/device/index.js +0 -311
- package/es/device/utils/HashMap.d.ts +0 -24
- package/es/device/utils/HashMap.js +0 -86
- package/es/device/utils/pipeline.d.ts +0 -1
- package/es/device/utils/pipeline.js +0 -6
- package/es/device/utils/typedarray.d.ts +0 -7
- package/es/device/utils/typedarray.js +0 -33
- package/es/device/utils/webgl.d.ts +0 -1
- package/es/device/utils/webgl.js +0 -10
- package/es/index.d.ts +0 -3
- package/es/index.js +0 -7
- package/es/regl/ReglAttribute.d.ts +0 -16
- package/es/regl/ReglAttribute.js +0 -29
- package/es/regl/ReglBuffer.d.ts +0 -17
- package/es/regl/ReglBuffer.js +0 -33
- package/es/regl/ReglElements.d.ts +0 -14
- package/es/regl/ReglElements.js +0 -27
- package/es/regl/ReglFramebuffer.d.ts +0 -16
- package/es/regl/ReglFramebuffer.js +0 -31
- package/es/regl/ReglModel.d.ts +0 -46
- package/es/regl/ReglModel.js +0 -302
- package/es/regl/ReglRenderbuffer.d.ts +0 -16
- package/es/regl/ReglRenderbuffer.js +0 -24
- package/es/regl/ReglTexture2D.d.ts +0 -22
- package/es/regl/ReglTexture2D.js +0 -94
- package/es/regl/constants.d.ts +0 -43
- package/es/regl/constants.js +0 -133
- package/es/regl/index.d.ts +0 -56
- package/es/regl/index.js +0 -227
- package/lib/device/DeviceAttribute.d.ts +0 -13
- package/lib/device/DeviceAttribute.js +0 -50
- package/lib/device/DeviceBuffer.d.ts +0 -18
- package/lib/device/DeviceBuffer.js +0 -71
- package/lib/device/DeviceCache.d.ts +0 -14
- package/lib/device/DeviceCache.js +0 -214
- package/lib/device/DeviceElements.d.ts +0 -13
- package/lib/device/DeviceElements.js +0 -62
- package/lib/device/DeviceFramebuffer.d.ts +0 -24
- package/lib/device/DeviceFramebuffer.js +0 -101
- package/lib/device/DeviceModel.d.ts +0 -61
- package/lib/device/DeviceModel.js +0 -495
- package/lib/device/DeviceTexture2D.d.ts +0 -23
- package/lib/device/DeviceTexture2D.js +0 -151
- package/lib/device/constants.d.ts +0 -35
- package/lib/device/constants.js +0 -141
- package/lib/device/index.d.ts +0 -68
- package/lib/device/index.js +0 -332
- package/lib/device/utils/HashMap.d.ts +0 -24
- package/lib/device/utils/HashMap.js +0 -113
- package/lib/device/utils/pipeline.d.ts +0 -1
- package/lib/device/utils/pipeline.js +0 -30
- package/lib/device/utils/typedarray.d.ts +0 -7
- package/lib/device/utils/typedarray.js +0 -58
- package/lib/device/utils/webgl.d.ts +0 -1
- package/lib/device/utils/webgl.js +0 -34
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -42
- package/lib/regl/ReglAttribute.d.ts +0 -16
- package/lib/regl/ReglAttribute.js +0 -49
- package/lib/regl/ReglBuffer.d.ts +0 -17
- package/lib/regl/ReglBuffer.js +0 -53
- package/lib/regl/ReglElements.d.ts +0 -14
- package/lib/regl/ReglElements.js +0 -47
- package/lib/regl/ReglFramebuffer.d.ts +0 -16
- package/lib/regl/ReglFramebuffer.js +0 -51
- package/lib/regl/ReglModel.d.ts +0 -46
- package/lib/regl/ReglModel.js +0 -311
- package/lib/regl/ReglRenderbuffer.d.ts +0 -16
- package/lib/regl/ReglRenderbuffer.js +0 -44
- package/lib/regl/ReglTexture2D.d.ts +0 -22
- package/lib/regl/ReglTexture2D.js +0 -107
- package/lib/regl/constants.d.ts +0 -43
- package/lib/regl/constants.js +0 -170
- package/lib/regl/index.d.ts +0 -56
- package/lib/regl/index.js +0 -256
package/es/regl/constants.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type regl from 'regl';
|
|
2
|
-
export declare const primitiveMap: {
|
|
3
|
-
[key: string]: 'points' | 'lines' | 'line loop' | 'line strip' | 'triangles' | 'triangle strip' | 'triangle fan';
|
|
4
|
-
};
|
|
5
|
-
export declare const usageMap: {
|
|
6
|
-
[key: string]: 'static' | 'dynamic' | 'stream';
|
|
7
|
-
};
|
|
8
|
-
export declare const dataTypeMap: {
|
|
9
|
-
[key: string]: 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16' | 'uint32' | 'float';
|
|
10
|
-
};
|
|
11
|
-
export declare const formatMap: {
|
|
12
|
-
[key: string]: 'alpha' | 'luminance' | 'luminance alpha' | 'rgb' | 'rgba' | 'rgba4' | 'rgb5 a1' | 'rgb565' | 'depth' | 'depth stencil';
|
|
13
|
-
};
|
|
14
|
-
export declare const mipmapMap: {
|
|
15
|
-
[key: string]: 'dont care' | 'nice' | 'fast';
|
|
16
|
-
};
|
|
17
|
-
export declare const filterMap: {
|
|
18
|
-
[key: string]: 'nearest' | 'linear' | 'mipmap' | 'nearest mipmap linear' | 'linear mipmap nearest' | 'nearest mipmap nearest';
|
|
19
|
-
};
|
|
20
|
-
export declare const wrapModeMap: {
|
|
21
|
-
[key: string]: 'repeat' | 'clamp' | 'mirror';
|
|
22
|
-
};
|
|
23
|
-
export declare const colorSpaceMap: {
|
|
24
|
-
[key: string]: 'none' | 'browser';
|
|
25
|
-
};
|
|
26
|
-
export declare const depthFuncMap: {
|
|
27
|
-
[key: string]: 'never' | 'always' | 'less' | 'lequal' | 'greater' | 'gequal' | 'equal' | 'notequal';
|
|
28
|
-
};
|
|
29
|
-
export declare const blendEquationMap: {
|
|
30
|
-
[key: string]: regl.BlendingEquation;
|
|
31
|
-
};
|
|
32
|
-
export declare const blendFuncMap: {
|
|
33
|
-
[key: string]: regl.BlendingFunction;
|
|
34
|
-
};
|
|
35
|
-
export declare const stencilFuncMap: {
|
|
36
|
-
[key: string]: regl.ComparisonOperatorType;
|
|
37
|
-
};
|
|
38
|
-
export declare const stencilOpMap: {
|
|
39
|
-
[key: string]: regl.StencilOperationType;
|
|
40
|
-
};
|
|
41
|
-
export declare const cullFaceMap: {
|
|
42
|
-
[key: string]: regl.FaceOrientationType;
|
|
43
|
-
};
|
package/es/regl/constants.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
// src/regl/constants.ts
|
|
2
|
-
import { gl } from "@antv/l7-core";
|
|
3
|
-
var primitiveMap = {
|
|
4
|
-
[gl.POINTS]: "points",
|
|
5
|
-
[gl.LINES]: "lines",
|
|
6
|
-
[gl.LINE_LOOP]: "line loop",
|
|
7
|
-
[gl.LINE_STRIP]: "line strip",
|
|
8
|
-
[gl.TRIANGLES]: "triangles",
|
|
9
|
-
[gl.TRIANGLE_FAN]: "triangle fan",
|
|
10
|
-
[gl.TRIANGLE_STRIP]: "triangle strip"
|
|
11
|
-
};
|
|
12
|
-
var usageMap = {
|
|
13
|
-
[gl.STATIC_DRAW]: "static",
|
|
14
|
-
[gl.DYNAMIC_DRAW]: "dynamic",
|
|
15
|
-
[gl.STREAM_DRAW]: "stream"
|
|
16
|
-
};
|
|
17
|
-
var dataTypeMap = {
|
|
18
|
-
[gl.BYTE]: "int8",
|
|
19
|
-
// [gl.UNSIGNED_INT]: 'int16',
|
|
20
|
-
[gl.INT]: "int32",
|
|
21
|
-
[gl.UNSIGNED_BYTE]: "uint8",
|
|
22
|
-
[gl.UNSIGNED_SHORT]: "uint16",
|
|
23
|
-
[gl.UNSIGNED_INT]: "uint32",
|
|
24
|
-
[gl.FLOAT]: "float"
|
|
25
|
-
};
|
|
26
|
-
var formatMap = {
|
|
27
|
-
[gl.ALPHA]: "alpha",
|
|
28
|
-
[gl.LUMINANCE]: "luminance",
|
|
29
|
-
[gl.LUMINANCE_ALPHA]: "luminance alpha",
|
|
30
|
-
[gl.RGB]: "rgb",
|
|
31
|
-
[gl.RGBA]: "rgba",
|
|
32
|
-
[gl.RGBA4]: "rgba4",
|
|
33
|
-
[gl.RGB5_A1]: "rgb5 a1",
|
|
34
|
-
[gl.RGB565]: "rgb565",
|
|
35
|
-
[gl.DEPTH_COMPONENT]: "depth",
|
|
36
|
-
[gl.DEPTH_STENCIL]: "depth stencil"
|
|
37
|
-
};
|
|
38
|
-
var mipmapMap = {
|
|
39
|
-
[gl.DONT_CARE]: "dont care",
|
|
40
|
-
[gl.NICEST]: "nice",
|
|
41
|
-
[gl.FASTEST]: "fast"
|
|
42
|
-
};
|
|
43
|
-
var filterMap = {
|
|
44
|
-
[gl.NEAREST]: "nearest",
|
|
45
|
-
[gl.LINEAR]: "linear",
|
|
46
|
-
[gl.LINEAR_MIPMAP_LINEAR]: "mipmap",
|
|
47
|
-
[gl.NEAREST_MIPMAP_LINEAR]: "nearest mipmap linear",
|
|
48
|
-
[gl.LINEAR_MIPMAP_NEAREST]: "linear mipmap nearest",
|
|
49
|
-
[gl.NEAREST_MIPMAP_NEAREST]: "nearest mipmap nearest"
|
|
50
|
-
};
|
|
51
|
-
var wrapModeMap = {
|
|
52
|
-
[gl.REPEAT]: "repeat",
|
|
53
|
-
[gl.CLAMP_TO_EDGE]: "clamp",
|
|
54
|
-
[gl.MIRRORED_REPEAT]: "mirror"
|
|
55
|
-
};
|
|
56
|
-
var colorSpaceMap = {
|
|
57
|
-
[gl.NONE]: "none",
|
|
58
|
-
[gl.BROWSER_DEFAULT_WEBGL]: "browser"
|
|
59
|
-
};
|
|
60
|
-
var depthFuncMap = {
|
|
61
|
-
[gl.NEVER]: "never",
|
|
62
|
-
[gl.ALWAYS]: "always",
|
|
63
|
-
[gl.LESS]: "less",
|
|
64
|
-
[gl.LEQUAL]: "lequal",
|
|
65
|
-
[gl.GREATER]: "greater",
|
|
66
|
-
[gl.GEQUAL]: "gequal",
|
|
67
|
-
[gl.EQUAL]: "equal",
|
|
68
|
-
[gl.NOTEQUAL]: "notequal"
|
|
69
|
-
};
|
|
70
|
-
var blendEquationMap = {
|
|
71
|
-
[gl.FUNC_ADD]: "add",
|
|
72
|
-
[gl.MIN_EXT]: "min",
|
|
73
|
-
[gl.MAX_EXT]: "max",
|
|
74
|
-
[gl.FUNC_SUBTRACT]: "subtract",
|
|
75
|
-
[gl.FUNC_REVERSE_SUBTRACT]: "reverse subtract"
|
|
76
|
-
};
|
|
77
|
-
var blendFuncMap = {
|
|
78
|
-
[gl.ZERO]: "zero",
|
|
79
|
-
[gl.ONE]: "one",
|
|
80
|
-
[gl.SRC_COLOR]: "src color",
|
|
81
|
-
[gl.ONE_MINUS_SRC_COLOR]: "one minus src color",
|
|
82
|
-
[gl.SRC_ALPHA]: "src alpha",
|
|
83
|
-
[gl.ONE_MINUS_SRC_ALPHA]: "one minus src alpha",
|
|
84
|
-
[gl.DST_COLOR]: "dst color",
|
|
85
|
-
[gl.ONE_MINUS_DST_COLOR]: "one minus dst color",
|
|
86
|
-
[gl.DST_ALPHA]: "dst alpha",
|
|
87
|
-
[gl.ONE_MINUS_DST_ALPHA]: "one minus dst alpha",
|
|
88
|
-
[gl.CONSTANT_COLOR]: "constant color",
|
|
89
|
-
[gl.ONE_MINUS_CONSTANT_COLOR]: "one minus constant color",
|
|
90
|
-
[gl.CONSTANT_ALPHA]: "constant alpha",
|
|
91
|
-
[gl.ONE_MINUS_CONSTANT_ALPHA]: "one minus constant alpha",
|
|
92
|
-
[gl.SRC_ALPHA_SATURATE]: "src alpha saturate"
|
|
93
|
-
};
|
|
94
|
-
var stencilFuncMap = {
|
|
95
|
-
[gl.NEVER]: "never",
|
|
96
|
-
[gl.ALWAYS]: "always",
|
|
97
|
-
[gl.LESS]: "less",
|
|
98
|
-
[gl.LEQUAL]: "lequal",
|
|
99
|
-
[gl.GREATER]: "greater",
|
|
100
|
-
[gl.GEQUAL]: "gequal",
|
|
101
|
-
[gl.EQUAL]: "equal",
|
|
102
|
-
[gl.NOTEQUAL]: "notequal"
|
|
103
|
-
};
|
|
104
|
-
var stencilOpMap = {
|
|
105
|
-
[gl.ZERO]: "zero",
|
|
106
|
-
[gl.KEEP]: "keep",
|
|
107
|
-
[gl.REPLACE]: "replace",
|
|
108
|
-
[gl.INVERT]: "invert",
|
|
109
|
-
[gl.INCR]: "increment",
|
|
110
|
-
[gl.DECR]: "decrement",
|
|
111
|
-
[gl.INCR_WRAP]: "increment wrap",
|
|
112
|
-
[gl.DECR_WRAP]: "decrement wrap"
|
|
113
|
-
};
|
|
114
|
-
var cullFaceMap = {
|
|
115
|
-
[gl.FRONT]: "front",
|
|
116
|
-
[gl.BACK]: "back"
|
|
117
|
-
};
|
|
118
|
-
export {
|
|
119
|
-
blendEquationMap,
|
|
120
|
-
blendFuncMap,
|
|
121
|
-
colorSpaceMap,
|
|
122
|
-
cullFaceMap,
|
|
123
|
-
dataTypeMap,
|
|
124
|
-
depthFuncMap,
|
|
125
|
-
filterMap,
|
|
126
|
-
formatMap,
|
|
127
|
-
mipmapMap,
|
|
128
|
-
primitiveMap,
|
|
129
|
-
stencilFuncMap,
|
|
130
|
-
stencilOpMap,
|
|
131
|
-
usageMap,
|
|
132
|
-
wrapModeMap
|
|
133
|
-
};
|
package/es/regl/index.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* render w/ regl
|
|
3
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md
|
|
4
|
-
*/
|
|
5
|
-
import type { IAttribute, IAttributeInitializationOptions, IBuffer, IBufferInitializationOptions, IClearOptions, IElements, IElementsInitializationOptions, IExtensions, IFramebuffer, IFramebufferInitializationOptions, IModel, IModelInitializationOptions, IReadPixelsOptions, IRenderConfig, IRendererService, ITexture2D, ITexture2DInitializationOptions } from '@antv/l7-core';
|
|
6
|
-
import regl from 'regl';
|
|
7
|
-
import ReglFramebuffer from './ReglFramebuffer';
|
|
8
|
-
/**
|
|
9
|
-
* regl renderer
|
|
10
|
-
*/
|
|
11
|
-
export default class ReglRendererService implements IRendererService {
|
|
12
|
-
uniformBuffers: IBuffer[];
|
|
13
|
-
extensionObject: IExtensions;
|
|
14
|
-
private gl;
|
|
15
|
-
private $container;
|
|
16
|
-
private canvas;
|
|
17
|
-
private width;
|
|
18
|
-
private height;
|
|
19
|
-
private isDirty;
|
|
20
|
-
queryVerdorInfo: () => string;
|
|
21
|
-
init(canvas: HTMLCanvasElement, cfg: IRenderConfig, gl?: regl.Regl): Promise<void>;
|
|
22
|
-
getPointSizeRange(): any;
|
|
23
|
-
testExtension(name: string): boolean;
|
|
24
|
-
createModel: (options: IModelInitializationOptions) => IModel;
|
|
25
|
-
createAttribute: (options: IAttributeInitializationOptions) => IAttribute;
|
|
26
|
-
createBuffer: (options: IBufferInitializationOptions) => IBuffer;
|
|
27
|
-
createElements: (options: IElementsInitializationOptions) => IElements;
|
|
28
|
-
createTexture2D: (options: ITexture2DInitializationOptions) => ITexture2D;
|
|
29
|
-
createFramebuffer: (options: IFramebufferInitializationOptions) => ReglFramebuffer;
|
|
30
|
-
useFramebuffer: (framebuffer: IFramebuffer | null, drawCommands: () => void) => void;
|
|
31
|
-
useFramebufferAsync: (framebuffer: IFramebuffer | null, drawCommands: () => Promise<void>) => Promise<void>;
|
|
32
|
-
clear: (options: IClearOptions) => void;
|
|
33
|
-
viewport: ({ x, y, width, height, }: {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
width: number;
|
|
37
|
-
height: number;
|
|
38
|
-
}) => void;
|
|
39
|
-
readPixels: (options: IReadPixelsOptions) => Uint8Array;
|
|
40
|
-
readPixelsAsync: (options: IReadPixelsOptions) => Promise<Uint8Array>;
|
|
41
|
-
getViewportSize: () => {
|
|
42
|
-
width: number;
|
|
43
|
-
height: number;
|
|
44
|
-
};
|
|
45
|
-
getContainer: () => HTMLElement | null;
|
|
46
|
-
getCanvas: () => HTMLCanvasElement;
|
|
47
|
-
getGLContext: () => WebGLRenderingContext;
|
|
48
|
-
setState(): void;
|
|
49
|
-
setBaseState(): void;
|
|
50
|
-
setCustomLayerDefaults(): void;
|
|
51
|
-
setDirty(flag: boolean): void;
|
|
52
|
-
getDirty(): boolean;
|
|
53
|
-
destroy: () => void;
|
|
54
|
-
beginFrame(): void;
|
|
55
|
-
endFrame(): void;
|
|
56
|
-
}
|
package/es/regl/index.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/regl/index.ts
|
|
23
|
-
import regl from "regl";
|
|
24
|
-
import ReglAttribute from "./ReglAttribute";
|
|
25
|
-
import ReglBuffer from "./ReglBuffer";
|
|
26
|
-
import ReglElements from "./ReglElements";
|
|
27
|
-
import ReglFramebuffer from "./ReglFramebuffer";
|
|
28
|
-
import ReglModel from "./ReglModel";
|
|
29
|
-
import ReglTexture2D from "./ReglTexture2D";
|
|
30
|
-
var ReglRendererService = class {
|
|
31
|
-
constructor() {
|
|
32
|
-
this.uniformBuffers = [];
|
|
33
|
-
this.queryVerdorInfo = () => {
|
|
34
|
-
return "WebGL1";
|
|
35
|
-
};
|
|
36
|
-
this.createModel = (options) => new ReglModel(this.gl, options);
|
|
37
|
-
this.createAttribute = (options) => new ReglAttribute(this.gl, options);
|
|
38
|
-
this.createBuffer = (options) => new ReglBuffer(this.gl, options);
|
|
39
|
-
this.createElements = (options) => new ReglElements(this.gl, options);
|
|
40
|
-
this.createTexture2D = (options) => new ReglTexture2D(this.gl, options);
|
|
41
|
-
this.createFramebuffer = (options) => new ReglFramebuffer(this.gl, options);
|
|
42
|
-
this.useFramebuffer = (framebuffer, drawCommands) => {
|
|
43
|
-
this.gl({
|
|
44
|
-
framebuffer: framebuffer ? framebuffer.get() : null
|
|
45
|
-
})(drawCommands);
|
|
46
|
-
};
|
|
47
|
-
this.useFramebufferAsync = (framebuffer, drawCommands) => __async(this, null, function* () {
|
|
48
|
-
this.gl({
|
|
49
|
-
framebuffer: framebuffer ? framebuffer.get() : null
|
|
50
|
-
})(drawCommands);
|
|
51
|
-
});
|
|
52
|
-
this.clear = (options) => {
|
|
53
|
-
var _a;
|
|
54
|
-
const { color, depth, stencil, framebuffer = null } = options;
|
|
55
|
-
const reglClearOptions = {
|
|
56
|
-
color,
|
|
57
|
-
depth,
|
|
58
|
-
stencil
|
|
59
|
-
};
|
|
60
|
-
reglClearOptions.framebuffer = framebuffer === null ? framebuffer : framebuffer.get();
|
|
61
|
-
(_a = this.gl) == null ? void 0 : _a.clear(reglClearOptions);
|
|
62
|
-
};
|
|
63
|
-
this.viewport = ({
|
|
64
|
-
x,
|
|
65
|
-
y,
|
|
66
|
-
width,
|
|
67
|
-
height
|
|
68
|
-
}) => {
|
|
69
|
-
this.gl._gl.viewport(x, y, width, height);
|
|
70
|
-
this.width = width;
|
|
71
|
-
this.height = height;
|
|
72
|
-
this.gl._refresh();
|
|
73
|
-
};
|
|
74
|
-
this.readPixels = (options) => {
|
|
75
|
-
const { framebuffer, x, y, width, height } = options;
|
|
76
|
-
const readPixelsOptions = {
|
|
77
|
-
x,
|
|
78
|
-
y,
|
|
79
|
-
width,
|
|
80
|
-
height
|
|
81
|
-
};
|
|
82
|
-
if (framebuffer) {
|
|
83
|
-
readPixelsOptions.framebuffer = framebuffer.get();
|
|
84
|
-
}
|
|
85
|
-
return this.gl.read(readPixelsOptions);
|
|
86
|
-
};
|
|
87
|
-
this.readPixelsAsync = (options) => __async(this, null, function* () {
|
|
88
|
-
return this.readPixels(options);
|
|
89
|
-
});
|
|
90
|
-
this.getViewportSize = () => {
|
|
91
|
-
return {
|
|
92
|
-
width: this.gl._gl.drawingBufferWidth,
|
|
93
|
-
height: this.gl._gl.drawingBufferHeight
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
this.getContainer = () => {
|
|
97
|
-
var _a;
|
|
98
|
-
return (_a = this.canvas) == null ? void 0 : _a.parentElement;
|
|
99
|
-
};
|
|
100
|
-
this.getCanvas = () => {
|
|
101
|
-
return this.canvas;
|
|
102
|
-
};
|
|
103
|
-
this.getGLContext = () => {
|
|
104
|
-
return this.gl._gl;
|
|
105
|
-
};
|
|
106
|
-
this.destroy = () => {
|
|
107
|
-
var _a, _b, _c;
|
|
108
|
-
this.canvas = null;
|
|
109
|
-
(_c = (_b = (_a = this.gl) == null ? void 0 : _a._gl) == null ? void 0 : _b.getExtension("WEBGL_lose_context")) == null ? void 0 : _c.loseContext();
|
|
110
|
-
this.gl.destroy();
|
|
111
|
-
this.gl = null;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
init(canvas, cfg, gl) {
|
|
115
|
-
return __async(this, null, function* () {
|
|
116
|
-
this.canvas = canvas;
|
|
117
|
-
if (gl) {
|
|
118
|
-
this.gl = gl;
|
|
119
|
-
} else {
|
|
120
|
-
this.gl = yield new Promise((resolve, reject) => {
|
|
121
|
-
regl({
|
|
122
|
-
canvas: this.canvas,
|
|
123
|
-
attributes: {
|
|
124
|
-
alpha: true,
|
|
125
|
-
// use TAA instead of MSAA
|
|
126
|
-
// @see https://www.khronos.org/registry/webgl/specs/1.0/#5.2.1
|
|
127
|
-
antialias: cfg.antialias,
|
|
128
|
-
premultipliedAlpha: true,
|
|
129
|
-
preserveDrawingBuffer: cfg.preserveDrawingBuffer,
|
|
130
|
-
stencil: cfg.stencil
|
|
131
|
-
},
|
|
132
|
-
// TODO: use extensions
|
|
133
|
-
extensions: [
|
|
134
|
-
"OES_element_index_uint",
|
|
135
|
-
"OES_standard_derivatives",
|
|
136
|
-
// wireframe
|
|
137
|
-
"ANGLE_instanced_arrays"
|
|
138
|
-
// VSM shadow map
|
|
139
|
-
],
|
|
140
|
-
optionalExtensions: [
|
|
141
|
-
"oes_texture_float_linear",
|
|
142
|
-
"OES_texture_float",
|
|
143
|
-
"EXT_texture_filter_anisotropic",
|
|
144
|
-
"EXT_blend_minmax",
|
|
145
|
-
"WEBGL_depth_texture",
|
|
146
|
-
"WEBGL_lose_context"
|
|
147
|
-
],
|
|
148
|
-
profile: true,
|
|
149
|
-
onDone: (err, r) => {
|
|
150
|
-
if (err || !r) {
|
|
151
|
-
reject(err);
|
|
152
|
-
}
|
|
153
|
-
resolve(r);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
this.extensionObject = {
|
|
159
|
-
OES_texture_float: this.testExtension("OES_texture_float")
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
getPointSizeRange() {
|
|
164
|
-
return this.gl._gl.getParameter(this.gl._gl.ALIASED_POINT_SIZE_RANGE);
|
|
165
|
-
}
|
|
166
|
-
testExtension(name) {
|
|
167
|
-
return !!this.getGLContext().getExtension(name);
|
|
168
|
-
}
|
|
169
|
-
// TODO: 临时方法
|
|
170
|
-
setState() {
|
|
171
|
-
this.gl({
|
|
172
|
-
cull: {
|
|
173
|
-
enable: false,
|
|
174
|
-
face: "back"
|
|
175
|
-
},
|
|
176
|
-
viewport: {
|
|
177
|
-
x: 0,
|
|
178
|
-
y: 0,
|
|
179
|
-
height: this.width,
|
|
180
|
-
width: this.height
|
|
181
|
-
},
|
|
182
|
-
blend: {
|
|
183
|
-
enable: true,
|
|
184
|
-
equation: "add"
|
|
185
|
-
},
|
|
186
|
-
framebuffer: null
|
|
187
|
-
});
|
|
188
|
-
this.gl._refresh();
|
|
189
|
-
}
|
|
190
|
-
setBaseState() {
|
|
191
|
-
this.gl({
|
|
192
|
-
cull: {
|
|
193
|
-
enable: false,
|
|
194
|
-
face: "back"
|
|
195
|
-
},
|
|
196
|
-
viewport: {
|
|
197
|
-
x: 0,
|
|
198
|
-
y: 0,
|
|
199
|
-
height: this.width,
|
|
200
|
-
width: this.height
|
|
201
|
-
},
|
|
202
|
-
blend: {
|
|
203
|
-
enable: false,
|
|
204
|
-
equation: "add"
|
|
205
|
-
},
|
|
206
|
-
framebuffer: null
|
|
207
|
-
});
|
|
208
|
-
this.gl._refresh();
|
|
209
|
-
}
|
|
210
|
-
setCustomLayerDefaults() {
|
|
211
|
-
const gl = this.getGLContext();
|
|
212
|
-
gl.disable(gl.CULL_FACE);
|
|
213
|
-
}
|
|
214
|
-
setDirty(flag) {
|
|
215
|
-
this.isDirty = flag;
|
|
216
|
-
}
|
|
217
|
-
getDirty() {
|
|
218
|
-
return this.isDirty;
|
|
219
|
-
}
|
|
220
|
-
beginFrame() {
|
|
221
|
-
}
|
|
222
|
-
endFrame() {
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
export {
|
|
226
|
-
ReglRendererService as default
|
|
227
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Device } from '@antv/g-device-api';
|
|
2
|
-
import type { IAttribute, IAttributeInitializationOptions, IBuffer } from '@antv/l7-core';
|
|
3
|
-
export default class DeviceAttribute implements IAttribute {
|
|
4
|
-
private attribute;
|
|
5
|
-
private buffer;
|
|
6
|
-
constructor(device: Device, options: IAttributeInitializationOptions);
|
|
7
|
-
get(): IBuffer;
|
|
8
|
-
updateBuffer(options: {
|
|
9
|
-
data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
|
|
10
|
-
offset: number;
|
|
11
|
-
}): void;
|
|
12
|
-
destroy(): void;
|
|
13
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/device/DeviceAttribute.ts
|
|
20
|
-
var DeviceAttribute_exports = {};
|
|
21
|
-
__export(DeviceAttribute_exports, {
|
|
22
|
-
default: () => DeviceAttribute
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(DeviceAttribute_exports);
|
|
25
|
-
var DeviceAttribute = class {
|
|
26
|
-
constructor(device, options) {
|
|
27
|
-
const { buffer, offset, stride, normalized, size, divisor, shaderLocation } = options;
|
|
28
|
-
this.buffer = buffer;
|
|
29
|
-
this.attribute = {
|
|
30
|
-
shaderLocation,
|
|
31
|
-
buffer: buffer.get(),
|
|
32
|
-
offset: offset || 0,
|
|
33
|
-
stride: stride || 0,
|
|
34
|
-
normalized: normalized || false,
|
|
35
|
-
divisor: divisor || 0
|
|
36
|
-
};
|
|
37
|
-
if (size) {
|
|
38
|
-
this.attribute.size = size;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
get() {
|
|
42
|
-
return this.buffer;
|
|
43
|
-
}
|
|
44
|
-
updateBuffer(options) {
|
|
45
|
-
this.buffer.subData(options);
|
|
46
|
-
}
|
|
47
|
-
destroy() {
|
|
48
|
-
this.buffer.destroy();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Buffer, Device } from '@antv/g-device-api';
|
|
2
|
-
import type { IBuffer, IBufferInitializationOptions } from '@antv/l7-core';
|
|
3
|
-
/**
|
|
4
|
-
* Use Buffer from @antv/g-device-api
|
|
5
|
-
*/
|
|
6
|
-
export default class DeviceBuffer implements IBuffer {
|
|
7
|
-
private buffer;
|
|
8
|
-
private isDestroyed;
|
|
9
|
-
private type;
|
|
10
|
-
private size;
|
|
11
|
-
constructor(device: Device, options: IBufferInitializationOptions);
|
|
12
|
-
get(): Buffer;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
subData({ data, offset, }: {
|
|
15
|
-
data: number[] | number[][] | Uint8Array | Uint16Array | Uint32Array;
|
|
16
|
-
offset: number;
|
|
17
|
-
}): void;
|
|
18
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/device/DeviceBuffer.ts
|
|
20
|
-
var DeviceBuffer_exports = {};
|
|
21
|
-
__export(DeviceBuffer_exports, {
|
|
22
|
-
default: () => DeviceBuffer
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(DeviceBuffer_exports);
|
|
25
|
-
var import_g_device_api = require("@antv/g-device-api");
|
|
26
|
-
var import_l7_core = require("@antv/l7-core");
|
|
27
|
-
var import_constants = require("./constants");
|
|
28
|
-
var import_typedarray = require("./utils/typedarray");
|
|
29
|
-
var DeviceBuffer = class {
|
|
30
|
-
constructor(device, options) {
|
|
31
|
-
this.isDestroyed = false;
|
|
32
|
-
const { data, usage, type, isUBO, label } = options;
|
|
33
|
-
let typed;
|
|
34
|
-
if ((0, import_typedarray.isTypedArray)(data)) {
|
|
35
|
-
typed = data;
|
|
36
|
-
} else {
|
|
37
|
-
typed = new import_constants.typedArrayCtorMap[this.type || import_l7_core.gl.FLOAT](data);
|
|
38
|
-
}
|
|
39
|
-
this.type = type;
|
|
40
|
-
this.size = typed.byteLength;
|
|
41
|
-
this.buffer = device.createBuffer({
|
|
42
|
-
viewOrSize: typed,
|
|
43
|
-
usage: isUBO ? import_g_device_api.BufferUsage.UNIFORM : import_g_device_api.BufferUsage.VERTEX,
|
|
44
|
-
hint: import_constants.hintMap[usage || import_l7_core.gl.STATIC_DRAW]
|
|
45
|
-
});
|
|
46
|
-
if (label) {
|
|
47
|
-
device.setResourceName(this.buffer, label);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
get() {
|
|
51
|
-
return this.buffer;
|
|
52
|
-
}
|
|
53
|
-
destroy() {
|
|
54
|
-
if (!this.isDestroyed) {
|
|
55
|
-
this.buffer.destroy();
|
|
56
|
-
}
|
|
57
|
-
this.isDestroyed = true;
|
|
58
|
-
}
|
|
59
|
-
subData({
|
|
60
|
-
data,
|
|
61
|
-
offset
|
|
62
|
-
}) {
|
|
63
|
-
let typed;
|
|
64
|
-
if ((0, import_typedarray.isTypedArray)(data)) {
|
|
65
|
-
typed = data;
|
|
66
|
-
} else {
|
|
67
|
-
typed = new import_constants.typedArrayCtorMap[this.type || import_l7_core.gl.FLOAT](data);
|
|
68
|
-
}
|
|
69
|
-
this.buffer.setSubData(offset, new Uint8Array(typed.buffer));
|
|
70
|
-
}
|
|
71
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Bindings, BindingsDescriptor, Device, InputLayout, InputLayoutDescriptor, Program, ProgramDescriptor, RenderPipeline, RenderPipelineDescriptor } from '@antv/g-device-api';
|
|
2
|
-
export declare class RenderCache {
|
|
3
|
-
private device;
|
|
4
|
-
constructor(device: Device);
|
|
5
|
-
private bindingsCache;
|
|
6
|
-
private renderPipelinesCache;
|
|
7
|
-
private inputLayoutsCache;
|
|
8
|
-
private programCache;
|
|
9
|
-
createBindings(descriptor: BindingsDescriptor): Bindings;
|
|
10
|
-
createRenderPipeline(descriptor: RenderPipelineDescriptor): RenderPipeline;
|
|
11
|
-
createInputLayout(descriptor: InputLayoutDescriptor): InputLayout;
|
|
12
|
-
createProgram(descriptor: ProgramDescriptor): Program;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
}
|