@antv/l7-renderer 2.21.0 → 2.21.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/es/device/DeviceAttribute.js +26 -32
- package/es/device/DeviceBuffer.js +31 -49
- package/es/device/DeviceCache.js +136 -170
- package/es/device/DeviceElements.js +32 -38
- package/es/device/DeviceFramebuffer.js +76 -104
- package/es/device/DeviceModel.js +358 -384
- package/es/device/DeviceTexture2D.js +103 -122
- package/es/device/constants.js +117 -34
- package/es/device/index.js +254 -381
- package/es/device/utils/HashMap.js +71 -138
- package/es/device/utils/pipeline.js +6 -1
- package/es/device/utils/typedarray.js +23 -24
- package/es/device/utils/webgl.js +7 -6
- package/es/index.js +5 -4
- package/es/regl/ReglAttribute.js +17 -33
- package/es/regl/ReglBuffer.js +25 -40
- package/es/regl/ReglElements.js +21 -36
- package/es/regl/ReglFramebuffer.js +24 -44
- package/es/regl/ReglModel.js +266 -306
- package/es/regl/ReglRenderbuffer.js +19 -36
- package/es/regl/ReglTexture2D.js +72 -103
- package/es/regl/constants.js +133 -21
- package/es/regl/index.js +205 -290
- package/lib/device/DeviceAttribute.d.ts +13 -0
- package/lib/device/DeviceBuffer.d.ts +18 -0
- package/lib/device/DeviceCache.d.ts +14 -0
- package/lib/device/DeviceElements.d.ts +13 -0
- package/lib/device/DeviceFramebuffer.d.ts +24 -0
- package/lib/device/DeviceModel.d.ts +53 -0
- package/lib/device/DeviceModel.js +22 -15
- package/lib/device/DeviceTexture2D.d.ts +23 -0
- package/lib/device/constants.d.ts +35 -0
- package/lib/device/index.d.ts +68 -0
- package/lib/device/index.js +58 -36
- package/lib/device/utils/HashMap.d.ts +24 -0
- package/lib/device/utils/pipeline.d.ts +1 -0
- package/lib/device/utils/typedarray.d.ts +7 -0
- package/lib/device/utils/webgl.d.ts +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/regl/ReglAttribute.d.ts +16 -0
- package/lib/regl/ReglBuffer.d.ts +17 -0
- package/lib/regl/ReglElements.d.ts +14 -0
- package/lib/regl/ReglFramebuffer.d.ts +16 -0
- package/lib/regl/ReglModel.d.ts +46 -0
- package/lib/regl/ReglModel.js +21 -11
- package/lib/regl/ReglRenderbuffer.d.ts +16 -0
- package/lib/regl/ReglTexture2D.d.ts +22 -0
- package/lib/regl/constants.d.ts +43 -0
- package/lib/regl/index.d.ts +56 -0
- package/lib/regl/index.js +70 -48
- package/package.json +14 -18
- package/CHANGELOG.md +0 -350
- package/LICENSE.md +0 -21
|
@@ -1,41 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
1
|
+
// src/regl/ReglRenderbuffer.ts
|
|
3
2
|
import { formatMap } from "./constants";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#renderbuffers
|
|
8
|
-
*/
|
|
9
|
-
var ReglRenderbuffer = /*#__PURE__*/function () {
|
|
10
|
-
function ReglRenderbuffer(reGl, options) {
|
|
11
|
-
_classCallCheck(this, ReglRenderbuffer);
|
|
12
|
-
var width = options.width,
|
|
13
|
-
height = options.height,
|
|
14
|
-
format = options.format;
|
|
3
|
+
var ReglRenderbuffer = class {
|
|
4
|
+
constructor(reGl, options) {
|
|
5
|
+
const { width, height, format } = options;
|
|
15
6
|
this.renderbuffer = reGl.renderbuffer({
|
|
16
|
-
width
|
|
17
|
-
height
|
|
7
|
+
width,
|
|
8
|
+
height,
|
|
18
9
|
format: formatMap[format]
|
|
19
10
|
});
|
|
20
11
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var width = _ref.width,
|
|
35
|
-
height = _ref.height;
|
|
36
|
-
this.renderbuffer.resize(width, height);
|
|
37
|
-
}
|
|
38
|
-
}]);
|
|
39
|
-
return ReglRenderbuffer;
|
|
40
|
-
}();
|
|
41
|
-
export { ReglRenderbuffer as default };
|
|
12
|
+
get() {
|
|
13
|
+
return this.renderbuffer;
|
|
14
|
+
}
|
|
15
|
+
destroy() {
|
|
16
|
+
this.renderbuffer.destroy();
|
|
17
|
+
}
|
|
18
|
+
resize({ width, height }) {
|
|
19
|
+
this.renderbuffer.resize(width, height);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
ReglRenderbuffer as default
|
|
24
|
+
};
|
package/es/regl/ReglTexture2D.js
CHANGED
|
@@ -1,55 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var ReglTexture2D =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_options$premultiplyA = options.premultiplyAlpha,
|
|
35
|
-
premultiplyAlpha = _options$premultiplyA === void 0 ? false : _options$premultiplyA,
|
|
36
|
-
_options$mag = options.mag,
|
|
37
|
-
mag = _options$mag === void 0 ? gl.NEAREST : _options$mag,
|
|
38
|
-
_options$min = options.min,
|
|
39
|
-
min = _options$min === void 0 ? gl.NEAREST : _options$min,
|
|
40
|
-
_options$colorSpace = options.colorSpace,
|
|
41
|
-
colorSpace = _options$colorSpace === void 0 ? gl.BROWSER_DEFAULT_WEBGL : _options$colorSpace,
|
|
42
|
-
_options$x = options.x,
|
|
43
|
-
x = _options$x === void 0 ? 0 : _options$x,
|
|
44
|
-
_options$y = options.y,
|
|
45
|
-
y = _options$y === void 0 ? 0 : _options$y,
|
|
46
|
-
_options$copy = options.copy,
|
|
47
|
-
copy = _options$copy === void 0 ? false : _options$copy;
|
|
1
|
+
// src/regl/ReglTexture2D.ts
|
|
2
|
+
import { gl } from "@antv/l7-core";
|
|
3
|
+
import {
|
|
4
|
+
colorSpaceMap,
|
|
5
|
+
dataTypeMap,
|
|
6
|
+
filterMap,
|
|
7
|
+
formatMap,
|
|
8
|
+
mipmapMap,
|
|
9
|
+
wrapModeMap
|
|
10
|
+
} from "./constants";
|
|
11
|
+
var ReglTexture2D = class {
|
|
12
|
+
constructor(reGl, options) {
|
|
13
|
+
this.isDestroy = false;
|
|
14
|
+
const {
|
|
15
|
+
data,
|
|
16
|
+
type = gl.UNSIGNED_BYTE,
|
|
17
|
+
width,
|
|
18
|
+
height,
|
|
19
|
+
flipY = false,
|
|
20
|
+
format = gl.RGBA,
|
|
21
|
+
mipmap = false,
|
|
22
|
+
wrapS = gl.CLAMP_TO_EDGE,
|
|
23
|
+
wrapT = gl.CLAMP_TO_EDGE,
|
|
24
|
+
aniso = 0,
|
|
25
|
+
alignment = 1,
|
|
26
|
+
premultiplyAlpha = false,
|
|
27
|
+
mag = gl.NEAREST,
|
|
28
|
+
min = gl.NEAREST,
|
|
29
|
+
colorSpace = gl.BROWSER_DEFAULT_WEBGL,
|
|
30
|
+
x = 0,
|
|
31
|
+
y = 0,
|
|
32
|
+
copy = false
|
|
33
|
+
} = options;
|
|
48
34
|
this.width = width;
|
|
49
35
|
this.height = height;
|
|
50
|
-
|
|
51
|
-
width
|
|
52
|
-
height
|
|
36
|
+
const textureOptions = {
|
|
37
|
+
width,
|
|
38
|
+
height,
|
|
53
39
|
// @ts-ignore
|
|
54
40
|
type: dataTypeMap[type],
|
|
55
41
|
format: formatMap[format],
|
|
@@ -58,68 +44,51 @@ var ReglTexture2D = /*#__PURE__*/function () {
|
|
|
58
44
|
// @ts-ignore
|
|
59
45
|
mag: filterMap[mag],
|
|
60
46
|
min: filterMap[min],
|
|
61
|
-
alignment
|
|
62
|
-
flipY
|
|
47
|
+
alignment,
|
|
48
|
+
flipY,
|
|
63
49
|
colorSpace: colorSpaceMap[colorSpace],
|
|
64
|
-
premultiplyAlpha
|
|
65
|
-
aniso
|
|
50
|
+
premultiplyAlpha,
|
|
51
|
+
aniso,
|
|
66
52
|
// copy pixels from current bind framebuffer
|
|
67
|
-
x
|
|
68
|
-
y
|
|
69
|
-
copy
|
|
53
|
+
x,
|
|
54
|
+
y,
|
|
55
|
+
copy
|
|
70
56
|
};
|
|
71
57
|
if (data) {
|
|
72
|
-
// @ts-ignore
|
|
73
58
|
textureOptions.data = data;
|
|
74
59
|
}
|
|
75
|
-
if (typeof mipmap ===
|
|
60
|
+
if (typeof mipmap === "number") {
|
|
76
61
|
textureOptions.mipmap = mipmapMap[mipmap];
|
|
77
|
-
} else if (typeof mipmap ===
|
|
62
|
+
} else if (typeof mipmap === "boolean") {
|
|
78
63
|
textureOptions.mipmap = mipmap;
|
|
79
64
|
}
|
|
80
65
|
this.texture = reGl.texture(textureOptions);
|
|
81
66
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
height = _ref.height;
|
|
104
|
-
this.texture.resize(width, height);
|
|
105
|
-
this.width = width;
|
|
106
|
-
this.height = height;
|
|
107
|
-
}
|
|
108
|
-
}, {
|
|
109
|
-
key: "getSize",
|
|
110
|
-
value: function getSize() {
|
|
111
|
-
return [this.width, this.height];
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
|
-
key: "destroy",
|
|
115
|
-
value: function destroy() {
|
|
116
|
-
if (!this.isDestroy) {
|
|
117
|
-
var _this$texture;
|
|
118
|
-
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
119
|
-
}
|
|
120
|
-
this.isDestroy = true;
|
|
67
|
+
get() {
|
|
68
|
+
return this.texture;
|
|
69
|
+
}
|
|
70
|
+
update(props = {}) {
|
|
71
|
+
this.texture(props);
|
|
72
|
+
}
|
|
73
|
+
bind() {
|
|
74
|
+
this.texture._texture.bind();
|
|
75
|
+
}
|
|
76
|
+
resize({ width, height }) {
|
|
77
|
+
this.texture.resize(width, height);
|
|
78
|
+
this.width = width;
|
|
79
|
+
this.height = height;
|
|
80
|
+
}
|
|
81
|
+
getSize() {
|
|
82
|
+
return [this.width, this.height];
|
|
83
|
+
}
|
|
84
|
+
destroy() {
|
|
85
|
+
var _a;
|
|
86
|
+
if (!this.isDestroy) {
|
|
87
|
+
(_a = this.texture) == null ? void 0 : _a.destroy();
|
|
121
88
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
export {
|
|
89
|
+
this.isDestroy = true;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
ReglTexture2D as default
|
|
94
|
+
};
|
package/es/regl/constants.js
CHANGED
|
@@ -1,21 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
};
|