@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/lib/regl/constants.js
DELETED
|
@@ -1,170 +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/regl/constants.ts
|
|
20
|
-
var constants_exports = {};
|
|
21
|
-
__export(constants_exports, {
|
|
22
|
-
blendEquationMap: () => blendEquationMap,
|
|
23
|
-
blendFuncMap: () => blendFuncMap,
|
|
24
|
-
colorSpaceMap: () => colorSpaceMap,
|
|
25
|
-
cullFaceMap: () => cullFaceMap,
|
|
26
|
-
dataTypeMap: () => dataTypeMap,
|
|
27
|
-
depthFuncMap: () => depthFuncMap,
|
|
28
|
-
filterMap: () => filterMap,
|
|
29
|
-
formatMap: () => formatMap,
|
|
30
|
-
mipmapMap: () => mipmapMap,
|
|
31
|
-
primitiveMap: () => primitiveMap,
|
|
32
|
-
stencilFuncMap: () => stencilFuncMap,
|
|
33
|
-
stencilOpMap: () => stencilOpMap,
|
|
34
|
-
usageMap: () => usageMap,
|
|
35
|
-
wrapModeMap: () => wrapModeMap
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(constants_exports);
|
|
38
|
-
var import_l7_core = require("@antv/l7-core");
|
|
39
|
-
var primitiveMap = {
|
|
40
|
-
[import_l7_core.gl.POINTS]: "points",
|
|
41
|
-
[import_l7_core.gl.LINES]: "lines",
|
|
42
|
-
[import_l7_core.gl.LINE_LOOP]: "line loop",
|
|
43
|
-
[import_l7_core.gl.LINE_STRIP]: "line strip",
|
|
44
|
-
[import_l7_core.gl.TRIANGLES]: "triangles",
|
|
45
|
-
[import_l7_core.gl.TRIANGLE_FAN]: "triangle fan",
|
|
46
|
-
[import_l7_core.gl.TRIANGLE_STRIP]: "triangle strip"
|
|
47
|
-
};
|
|
48
|
-
var usageMap = {
|
|
49
|
-
[import_l7_core.gl.STATIC_DRAW]: "static",
|
|
50
|
-
[import_l7_core.gl.DYNAMIC_DRAW]: "dynamic",
|
|
51
|
-
[import_l7_core.gl.STREAM_DRAW]: "stream"
|
|
52
|
-
};
|
|
53
|
-
var dataTypeMap = {
|
|
54
|
-
[import_l7_core.gl.BYTE]: "int8",
|
|
55
|
-
// [gl.UNSIGNED_INT]: 'int16',
|
|
56
|
-
[import_l7_core.gl.INT]: "int32",
|
|
57
|
-
[import_l7_core.gl.UNSIGNED_BYTE]: "uint8",
|
|
58
|
-
[import_l7_core.gl.UNSIGNED_SHORT]: "uint16",
|
|
59
|
-
[import_l7_core.gl.UNSIGNED_INT]: "uint32",
|
|
60
|
-
[import_l7_core.gl.FLOAT]: "float"
|
|
61
|
-
};
|
|
62
|
-
var formatMap = {
|
|
63
|
-
[import_l7_core.gl.ALPHA]: "alpha",
|
|
64
|
-
[import_l7_core.gl.LUMINANCE]: "luminance",
|
|
65
|
-
[import_l7_core.gl.LUMINANCE_ALPHA]: "luminance alpha",
|
|
66
|
-
[import_l7_core.gl.RGB]: "rgb",
|
|
67
|
-
[import_l7_core.gl.RGBA]: "rgba",
|
|
68
|
-
[import_l7_core.gl.RGBA4]: "rgba4",
|
|
69
|
-
[import_l7_core.gl.RGB5_A1]: "rgb5 a1",
|
|
70
|
-
[import_l7_core.gl.RGB565]: "rgb565",
|
|
71
|
-
[import_l7_core.gl.DEPTH_COMPONENT]: "depth",
|
|
72
|
-
[import_l7_core.gl.DEPTH_STENCIL]: "depth stencil"
|
|
73
|
-
};
|
|
74
|
-
var mipmapMap = {
|
|
75
|
-
[import_l7_core.gl.DONT_CARE]: "dont care",
|
|
76
|
-
[import_l7_core.gl.NICEST]: "nice",
|
|
77
|
-
[import_l7_core.gl.FASTEST]: "fast"
|
|
78
|
-
};
|
|
79
|
-
var filterMap = {
|
|
80
|
-
[import_l7_core.gl.NEAREST]: "nearest",
|
|
81
|
-
[import_l7_core.gl.LINEAR]: "linear",
|
|
82
|
-
[import_l7_core.gl.LINEAR_MIPMAP_LINEAR]: "mipmap",
|
|
83
|
-
[import_l7_core.gl.NEAREST_MIPMAP_LINEAR]: "nearest mipmap linear",
|
|
84
|
-
[import_l7_core.gl.LINEAR_MIPMAP_NEAREST]: "linear mipmap nearest",
|
|
85
|
-
[import_l7_core.gl.NEAREST_MIPMAP_NEAREST]: "nearest mipmap nearest"
|
|
86
|
-
};
|
|
87
|
-
var wrapModeMap = {
|
|
88
|
-
[import_l7_core.gl.REPEAT]: "repeat",
|
|
89
|
-
[import_l7_core.gl.CLAMP_TO_EDGE]: "clamp",
|
|
90
|
-
[import_l7_core.gl.MIRRORED_REPEAT]: "mirror"
|
|
91
|
-
};
|
|
92
|
-
var colorSpaceMap = {
|
|
93
|
-
[import_l7_core.gl.NONE]: "none",
|
|
94
|
-
[import_l7_core.gl.BROWSER_DEFAULT_WEBGL]: "browser"
|
|
95
|
-
};
|
|
96
|
-
var depthFuncMap = {
|
|
97
|
-
[import_l7_core.gl.NEVER]: "never",
|
|
98
|
-
[import_l7_core.gl.ALWAYS]: "always",
|
|
99
|
-
[import_l7_core.gl.LESS]: "less",
|
|
100
|
-
[import_l7_core.gl.LEQUAL]: "lequal",
|
|
101
|
-
[import_l7_core.gl.GREATER]: "greater",
|
|
102
|
-
[import_l7_core.gl.GEQUAL]: "gequal",
|
|
103
|
-
[import_l7_core.gl.EQUAL]: "equal",
|
|
104
|
-
[import_l7_core.gl.NOTEQUAL]: "notequal"
|
|
105
|
-
};
|
|
106
|
-
var blendEquationMap = {
|
|
107
|
-
[import_l7_core.gl.FUNC_ADD]: "add",
|
|
108
|
-
[import_l7_core.gl.MIN_EXT]: "min",
|
|
109
|
-
[import_l7_core.gl.MAX_EXT]: "max",
|
|
110
|
-
[import_l7_core.gl.FUNC_SUBTRACT]: "subtract",
|
|
111
|
-
[import_l7_core.gl.FUNC_REVERSE_SUBTRACT]: "reverse subtract"
|
|
112
|
-
};
|
|
113
|
-
var blendFuncMap = {
|
|
114
|
-
[import_l7_core.gl.ZERO]: "zero",
|
|
115
|
-
[import_l7_core.gl.ONE]: "one",
|
|
116
|
-
[import_l7_core.gl.SRC_COLOR]: "src color",
|
|
117
|
-
[import_l7_core.gl.ONE_MINUS_SRC_COLOR]: "one minus src color",
|
|
118
|
-
[import_l7_core.gl.SRC_ALPHA]: "src alpha",
|
|
119
|
-
[import_l7_core.gl.ONE_MINUS_SRC_ALPHA]: "one minus src alpha",
|
|
120
|
-
[import_l7_core.gl.DST_COLOR]: "dst color",
|
|
121
|
-
[import_l7_core.gl.ONE_MINUS_DST_COLOR]: "one minus dst color",
|
|
122
|
-
[import_l7_core.gl.DST_ALPHA]: "dst alpha",
|
|
123
|
-
[import_l7_core.gl.ONE_MINUS_DST_ALPHA]: "one minus dst alpha",
|
|
124
|
-
[import_l7_core.gl.CONSTANT_COLOR]: "constant color",
|
|
125
|
-
[import_l7_core.gl.ONE_MINUS_CONSTANT_COLOR]: "one minus constant color",
|
|
126
|
-
[import_l7_core.gl.CONSTANT_ALPHA]: "constant alpha",
|
|
127
|
-
[import_l7_core.gl.ONE_MINUS_CONSTANT_ALPHA]: "one minus constant alpha",
|
|
128
|
-
[import_l7_core.gl.SRC_ALPHA_SATURATE]: "src alpha saturate"
|
|
129
|
-
};
|
|
130
|
-
var stencilFuncMap = {
|
|
131
|
-
[import_l7_core.gl.NEVER]: "never",
|
|
132
|
-
[import_l7_core.gl.ALWAYS]: "always",
|
|
133
|
-
[import_l7_core.gl.LESS]: "less",
|
|
134
|
-
[import_l7_core.gl.LEQUAL]: "lequal",
|
|
135
|
-
[import_l7_core.gl.GREATER]: "greater",
|
|
136
|
-
[import_l7_core.gl.GEQUAL]: "gequal",
|
|
137
|
-
[import_l7_core.gl.EQUAL]: "equal",
|
|
138
|
-
[import_l7_core.gl.NOTEQUAL]: "notequal"
|
|
139
|
-
};
|
|
140
|
-
var stencilOpMap = {
|
|
141
|
-
[import_l7_core.gl.ZERO]: "zero",
|
|
142
|
-
[import_l7_core.gl.KEEP]: "keep",
|
|
143
|
-
[import_l7_core.gl.REPLACE]: "replace",
|
|
144
|
-
[import_l7_core.gl.INVERT]: "invert",
|
|
145
|
-
[import_l7_core.gl.INCR]: "increment",
|
|
146
|
-
[import_l7_core.gl.DECR]: "decrement",
|
|
147
|
-
[import_l7_core.gl.INCR_WRAP]: "increment wrap",
|
|
148
|
-
[import_l7_core.gl.DECR_WRAP]: "decrement wrap"
|
|
149
|
-
};
|
|
150
|
-
var cullFaceMap = {
|
|
151
|
-
[import_l7_core.gl.FRONT]: "front",
|
|
152
|
-
[import_l7_core.gl.BACK]: "back"
|
|
153
|
-
};
|
|
154
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
-
0 && (module.exports = {
|
|
156
|
-
blendEquationMap,
|
|
157
|
-
blendFuncMap,
|
|
158
|
-
colorSpaceMap,
|
|
159
|
-
cullFaceMap,
|
|
160
|
-
dataTypeMap,
|
|
161
|
-
depthFuncMap,
|
|
162
|
-
filterMap,
|
|
163
|
-
formatMap,
|
|
164
|
-
mipmapMap,
|
|
165
|
-
primitiveMap,
|
|
166
|
-
stencilFuncMap,
|
|
167
|
-
stencilOpMap,
|
|
168
|
-
usageMap,
|
|
169
|
-
wrapModeMap
|
|
170
|
-
});
|
package/lib/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/lib/regl/index.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// src/regl/index.ts
|
|
50
|
-
var regl_exports = {};
|
|
51
|
-
__export(regl_exports, {
|
|
52
|
-
default: () => ReglRendererService
|
|
53
|
-
});
|
|
54
|
-
module.exports = __toCommonJS(regl_exports);
|
|
55
|
-
var import_regl = __toESM(require("regl"));
|
|
56
|
-
var import_ReglAttribute = __toESM(require("./ReglAttribute"));
|
|
57
|
-
var import_ReglBuffer = __toESM(require("./ReglBuffer"));
|
|
58
|
-
var import_ReglElements = __toESM(require("./ReglElements"));
|
|
59
|
-
var import_ReglFramebuffer = __toESM(require("./ReglFramebuffer"));
|
|
60
|
-
var import_ReglModel = __toESM(require("./ReglModel"));
|
|
61
|
-
var import_ReglTexture2D = __toESM(require("./ReglTexture2D"));
|
|
62
|
-
var ReglRendererService = class {
|
|
63
|
-
constructor() {
|
|
64
|
-
this.uniformBuffers = [];
|
|
65
|
-
this.queryVerdorInfo = () => {
|
|
66
|
-
return "WebGL1";
|
|
67
|
-
};
|
|
68
|
-
this.createModel = (options) => new import_ReglModel.default(this.gl, options);
|
|
69
|
-
this.createAttribute = (options) => new import_ReglAttribute.default(this.gl, options);
|
|
70
|
-
this.createBuffer = (options) => new import_ReglBuffer.default(this.gl, options);
|
|
71
|
-
this.createElements = (options) => new import_ReglElements.default(this.gl, options);
|
|
72
|
-
this.createTexture2D = (options) => new import_ReglTexture2D.default(this.gl, options);
|
|
73
|
-
this.createFramebuffer = (options) => new import_ReglFramebuffer.default(this.gl, options);
|
|
74
|
-
this.useFramebuffer = (framebuffer, drawCommands) => {
|
|
75
|
-
this.gl({
|
|
76
|
-
framebuffer: framebuffer ? framebuffer.get() : null
|
|
77
|
-
})(drawCommands);
|
|
78
|
-
};
|
|
79
|
-
this.useFramebufferAsync = (framebuffer, drawCommands) => __async(this, null, function* () {
|
|
80
|
-
this.gl({
|
|
81
|
-
framebuffer: framebuffer ? framebuffer.get() : null
|
|
82
|
-
})(drawCommands);
|
|
83
|
-
});
|
|
84
|
-
this.clear = (options) => {
|
|
85
|
-
var _a;
|
|
86
|
-
const { color, depth, stencil, framebuffer = null } = options;
|
|
87
|
-
const reglClearOptions = {
|
|
88
|
-
color,
|
|
89
|
-
depth,
|
|
90
|
-
stencil
|
|
91
|
-
};
|
|
92
|
-
reglClearOptions.framebuffer = framebuffer === null ? framebuffer : framebuffer.get();
|
|
93
|
-
(_a = this.gl) == null ? void 0 : _a.clear(reglClearOptions);
|
|
94
|
-
};
|
|
95
|
-
this.viewport = ({
|
|
96
|
-
x,
|
|
97
|
-
y,
|
|
98
|
-
width,
|
|
99
|
-
height
|
|
100
|
-
}) => {
|
|
101
|
-
this.gl._gl.viewport(x, y, width, height);
|
|
102
|
-
this.width = width;
|
|
103
|
-
this.height = height;
|
|
104
|
-
this.gl._refresh();
|
|
105
|
-
};
|
|
106
|
-
this.readPixels = (options) => {
|
|
107
|
-
const { framebuffer, x, y, width, height } = options;
|
|
108
|
-
const readPixelsOptions = {
|
|
109
|
-
x,
|
|
110
|
-
y,
|
|
111
|
-
width,
|
|
112
|
-
height
|
|
113
|
-
};
|
|
114
|
-
if (framebuffer) {
|
|
115
|
-
readPixelsOptions.framebuffer = framebuffer.get();
|
|
116
|
-
}
|
|
117
|
-
return this.gl.read(readPixelsOptions);
|
|
118
|
-
};
|
|
119
|
-
this.readPixelsAsync = (options) => __async(this, null, function* () {
|
|
120
|
-
return this.readPixels(options);
|
|
121
|
-
});
|
|
122
|
-
this.getViewportSize = () => {
|
|
123
|
-
return {
|
|
124
|
-
width: this.gl._gl.drawingBufferWidth,
|
|
125
|
-
height: this.gl._gl.drawingBufferHeight
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
this.getContainer = () => {
|
|
129
|
-
var _a;
|
|
130
|
-
return (_a = this.canvas) == null ? void 0 : _a.parentElement;
|
|
131
|
-
};
|
|
132
|
-
this.getCanvas = () => {
|
|
133
|
-
return this.canvas;
|
|
134
|
-
};
|
|
135
|
-
this.getGLContext = () => {
|
|
136
|
-
return this.gl._gl;
|
|
137
|
-
};
|
|
138
|
-
this.destroy = () => {
|
|
139
|
-
var _a, _b, _c;
|
|
140
|
-
this.canvas = null;
|
|
141
|
-
(_c = (_b = (_a = this.gl) == null ? void 0 : _a._gl) == null ? void 0 : _b.getExtension("WEBGL_lose_context")) == null ? void 0 : _c.loseContext();
|
|
142
|
-
this.gl.destroy();
|
|
143
|
-
this.gl = null;
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
init(canvas, cfg, gl) {
|
|
147
|
-
return __async(this, null, function* () {
|
|
148
|
-
this.canvas = canvas;
|
|
149
|
-
if (gl) {
|
|
150
|
-
this.gl = gl;
|
|
151
|
-
} else {
|
|
152
|
-
this.gl = yield new Promise((resolve, reject) => {
|
|
153
|
-
(0, import_regl.default)({
|
|
154
|
-
canvas: this.canvas,
|
|
155
|
-
attributes: {
|
|
156
|
-
alpha: true,
|
|
157
|
-
// use TAA instead of MSAA
|
|
158
|
-
// @see https://www.khronos.org/registry/webgl/specs/1.0/#5.2.1
|
|
159
|
-
antialias: cfg.antialias,
|
|
160
|
-
premultipliedAlpha: true,
|
|
161
|
-
preserveDrawingBuffer: cfg.preserveDrawingBuffer,
|
|
162
|
-
stencil: cfg.stencil
|
|
163
|
-
},
|
|
164
|
-
// TODO: use extensions
|
|
165
|
-
extensions: [
|
|
166
|
-
"OES_element_index_uint",
|
|
167
|
-
"OES_standard_derivatives",
|
|
168
|
-
// wireframe
|
|
169
|
-
"ANGLE_instanced_arrays"
|
|
170
|
-
// VSM shadow map
|
|
171
|
-
],
|
|
172
|
-
optionalExtensions: [
|
|
173
|
-
"oes_texture_float_linear",
|
|
174
|
-
"OES_texture_float",
|
|
175
|
-
"EXT_texture_filter_anisotropic",
|
|
176
|
-
"EXT_blend_minmax",
|
|
177
|
-
"WEBGL_depth_texture",
|
|
178
|
-
"WEBGL_lose_context"
|
|
179
|
-
],
|
|
180
|
-
profile: true,
|
|
181
|
-
onDone: (err, r) => {
|
|
182
|
-
if (err || !r) {
|
|
183
|
-
reject(err);
|
|
184
|
-
}
|
|
185
|
-
resolve(r);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
this.extensionObject = {
|
|
191
|
-
OES_texture_float: this.testExtension("OES_texture_float")
|
|
192
|
-
};
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
getPointSizeRange() {
|
|
196
|
-
return this.gl._gl.getParameter(this.gl._gl.ALIASED_POINT_SIZE_RANGE);
|
|
197
|
-
}
|
|
198
|
-
testExtension(name) {
|
|
199
|
-
return !!this.getGLContext().getExtension(name);
|
|
200
|
-
}
|
|
201
|
-
// TODO: 临时方法
|
|
202
|
-
setState() {
|
|
203
|
-
this.gl({
|
|
204
|
-
cull: {
|
|
205
|
-
enable: false,
|
|
206
|
-
face: "back"
|
|
207
|
-
},
|
|
208
|
-
viewport: {
|
|
209
|
-
x: 0,
|
|
210
|
-
y: 0,
|
|
211
|
-
height: this.width,
|
|
212
|
-
width: this.height
|
|
213
|
-
},
|
|
214
|
-
blend: {
|
|
215
|
-
enable: true,
|
|
216
|
-
equation: "add"
|
|
217
|
-
},
|
|
218
|
-
framebuffer: null
|
|
219
|
-
});
|
|
220
|
-
this.gl._refresh();
|
|
221
|
-
}
|
|
222
|
-
setBaseState() {
|
|
223
|
-
this.gl({
|
|
224
|
-
cull: {
|
|
225
|
-
enable: false,
|
|
226
|
-
face: "back"
|
|
227
|
-
},
|
|
228
|
-
viewport: {
|
|
229
|
-
x: 0,
|
|
230
|
-
y: 0,
|
|
231
|
-
height: this.width,
|
|
232
|
-
width: this.height
|
|
233
|
-
},
|
|
234
|
-
blend: {
|
|
235
|
-
enable: false,
|
|
236
|
-
equation: "add"
|
|
237
|
-
},
|
|
238
|
-
framebuffer: null
|
|
239
|
-
});
|
|
240
|
-
this.gl._refresh();
|
|
241
|
-
}
|
|
242
|
-
setCustomLayerDefaults() {
|
|
243
|
-
const gl = this.getGLContext();
|
|
244
|
-
gl.disable(gl.CULL_FACE);
|
|
245
|
-
}
|
|
246
|
-
setDirty(flag) {
|
|
247
|
-
this.isDirty = flag;
|
|
248
|
-
}
|
|
249
|
-
getDirty() {
|
|
250
|
-
return this.isDirty;
|
|
251
|
-
}
|
|
252
|
-
beginFrame() {
|
|
253
|
-
}
|
|
254
|
-
endFrame() {
|
|
255
|
-
}
|
|
256
|
-
};
|