@antv/l7-renderer 2.18.0 → 2.18.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/package.json +5 -5
- package/es/index.d.ts +0 -5
- package/es/index.js +0 -5
- package/es/regl/ReglAttribute.d.ts +0 -16
- package/es/regl/ReglAttribute.js +0 -45
- package/es/regl/ReglBuffer.d.ts +0 -17
- package/es/regl/ReglBuffer.js +0 -48
- package/es/regl/ReglElements.d.ts +0 -14
- package/es/regl/ReglElements.js +0 -42
- package/es/regl/ReglFramebuffer.d.ts +0 -16
- package/es/regl/ReglFramebuffer.js +0 -51
- package/es/regl/ReglModel.d.ts +0 -46
- package/es/regl/ReglModel.js +0 -350
- package/es/regl/ReglRenderbuffer.d.ts +0 -16
- package/es/regl/ReglRenderbuffer.js +0 -41
- package/es/regl/ReglTexture2D.d.ts +0 -22
- package/es/regl/ReglTexture2D.js +0 -125
- package/es/regl/constants.d.ts +0 -43
- package/es/regl/constants.js +0 -21
- package/es/regl/index.d.ts +0 -51
- package/es/regl/index.js +0 -271
- package/lib/index.js +0 -39
- package/lib/regl/ReglAttribute.js +0 -49
- package/lib/regl/ReglBuffer.js +0 -53
- package/lib/regl/ReglElements.js +0 -47
- package/lib/regl/ReglFramebuffer.js +0 -51
- package/lib/regl/ReglModel.js +0 -305
- package/lib/regl/ReglRenderbuffer.js +0 -44
- package/lib/regl/ReglTexture2D.js +0 -107
- package/lib/regl/constants.js +0 -170
- package/lib/regl/index.js +0 -232
package/es/regl/index.js
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
-
var _dec, _class;
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
/**
|
|
8
|
-
* render w/ regl
|
|
9
|
-
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { injectable } from 'inversify';
|
|
13
|
-
import 'reflect-metadata';
|
|
14
|
-
import regl from 'regl';
|
|
15
|
-
import ReglAttribute from "./ReglAttribute";
|
|
16
|
-
import ReglBuffer from "./ReglBuffer";
|
|
17
|
-
import ReglElements from "./ReglElements";
|
|
18
|
-
import ReglFramebuffer from "./ReglFramebuffer";
|
|
19
|
-
import ReglModel from "./ReglModel";
|
|
20
|
-
import ReglTexture2D from "./ReglTexture2D";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* regl renderer
|
|
24
|
-
*/
|
|
25
|
-
var ReglRendererService = (_dec = injectable(), _dec(_class = /*#__PURE__*/function () {
|
|
26
|
-
function ReglRendererService() {
|
|
27
|
-
var _this = this;
|
|
28
|
-
_classCallCheck(this, ReglRendererService);
|
|
29
|
-
_defineProperty(this, "createModel", function (options) {
|
|
30
|
-
return new ReglModel(_this.gl, options);
|
|
31
|
-
});
|
|
32
|
-
_defineProperty(this, "createAttribute", function (options) {
|
|
33
|
-
return new ReglAttribute(_this.gl, options);
|
|
34
|
-
});
|
|
35
|
-
_defineProperty(this, "createBuffer", function (options) {
|
|
36
|
-
return new ReglBuffer(_this.gl, options);
|
|
37
|
-
});
|
|
38
|
-
_defineProperty(this, "createElements", function (options) {
|
|
39
|
-
return new ReglElements(_this.gl, options);
|
|
40
|
-
});
|
|
41
|
-
_defineProperty(this, "createTexture2D", function (options) {
|
|
42
|
-
return new ReglTexture2D(_this.gl, options);
|
|
43
|
-
});
|
|
44
|
-
_defineProperty(this, "createFramebuffer", function (options) {
|
|
45
|
-
return new ReglFramebuffer(_this.gl, options);
|
|
46
|
-
});
|
|
47
|
-
_defineProperty(this, "useFramebuffer", function (framebuffer, drawCommands) {
|
|
48
|
-
_this.gl({
|
|
49
|
-
framebuffer: framebuffer ? framebuffer.get() : null
|
|
50
|
-
})(drawCommands);
|
|
51
|
-
});
|
|
52
|
-
_defineProperty(this, "clear", function (options) {
|
|
53
|
-
var _this$gl;
|
|
54
|
-
// @see https://github.com/regl-project/regl/blob/gh-pages/API.md#clear-the-draw-buffer
|
|
55
|
-
var color = options.color,
|
|
56
|
-
depth = options.depth,
|
|
57
|
-
stencil = options.stencil,
|
|
58
|
-
_options$framebuffer = options.framebuffer,
|
|
59
|
-
framebuffer = _options$framebuffer === void 0 ? null : _options$framebuffer;
|
|
60
|
-
var reglClearOptions = {
|
|
61
|
-
color: color,
|
|
62
|
-
depth: depth,
|
|
63
|
-
stencil: stencil
|
|
64
|
-
};
|
|
65
|
-
reglClearOptions.framebuffer = framebuffer === null ? framebuffer : framebuffer.get();
|
|
66
|
-
(_this$gl = _this.gl) === null || _this$gl === void 0 ? void 0 : _this$gl.clear(reglClearOptions);
|
|
67
|
-
});
|
|
68
|
-
_defineProperty(this, "viewport", function (_ref) {
|
|
69
|
-
var x = _ref.x,
|
|
70
|
-
y = _ref.y,
|
|
71
|
-
width = _ref.width,
|
|
72
|
-
height = _ref.height;
|
|
73
|
-
// use WebGL context directly
|
|
74
|
-
// @see https://github.com/regl-project/regl/blob/gh-pages/API.md#unsafe-escape-hatch
|
|
75
|
-
_this.gl._gl.viewport(x, y, width, height);
|
|
76
|
-
_this.width = width;
|
|
77
|
-
_this.height = height;
|
|
78
|
-
_this.gl._refresh();
|
|
79
|
-
});
|
|
80
|
-
_defineProperty(this, "readPixels", function (options) {
|
|
81
|
-
var framebuffer = options.framebuffer,
|
|
82
|
-
x = options.x,
|
|
83
|
-
y = options.y,
|
|
84
|
-
width = options.width,
|
|
85
|
-
height = options.height;
|
|
86
|
-
var readPixelsOptions = {
|
|
87
|
-
x: x,
|
|
88
|
-
y: y,
|
|
89
|
-
width: width,
|
|
90
|
-
height: height
|
|
91
|
-
};
|
|
92
|
-
if (framebuffer) {
|
|
93
|
-
readPixelsOptions.framebuffer = framebuffer.get();
|
|
94
|
-
}
|
|
95
|
-
return _this.gl.read(readPixelsOptions);
|
|
96
|
-
});
|
|
97
|
-
_defineProperty(this, "getViewportSize", function () {
|
|
98
|
-
return {
|
|
99
|
-
width: _this.gl._gl.drawingBufferWidth,
|
|
100
|
-
height: _this.gl._gl.drawingBufferHeight
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
_defineProperty(this, "getContainer", function () {
|
|
104
|
-
var _this$canvas;
|
|
105
|
-
return (_this$canvas = _this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.parentElement;
|
|
106
|
-
});
|
|
107
|
-
_defineProperty(this, "getCanvas", function () {
|
|
108
|
-
// return this.$container?.getElementsByTagName('canvas')[0] || null;
|
|
109
|
-
return _this.canvas;
|
|
110
|
-
});
|
|
111
|
-
_defineProperty(this, "getGLContext", function () {
|
|
112
|
-
return _this.gl._gl;
|
|
113
|
-
});
|
|
114
|
-
_defineProperty(this, "destroy", function () {
|
|
115
|
-
var _this$gl2, _this$gl2$_gl, _this$gl2$_gl$getExte;
|
|
116
|
-
// this.canvas = null 清除对 webgl 实例的引用
|
|
117
|
-
// @ts-ignore
|
|
118
|
-
_this.canvas = null;
|
|
119
|
-
|
|
120
|
-
// make sure release webgl context
|
|
121
|
-
(_this$gl2 = _this.gl) === null || _this$gl2 === void 0 ? void 0 : (_this$gl2$_gl = _this$gl2._gl) === null || _this$gl2$_gl === void 0 ? void 0 : (_this$gl2$_gl$getExte = _this$gl2$_gl.getExtension('WEBGL_lose_context')) === null || _this$gl2$_gl$getExte === void 0 ? void 0 : _this$gl2$_gl$getExte.loseContext();
|
|
122
|
-
|
|
123
|
-
// @see https://github.com/regl-project/regl/blob/gh-pages/API.md#clean-up
|
|
124
|
-
_this.gl.destroy();
|
|
125
|
-
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
_this.gl = null;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
_createClass(ReglRendererService, [{
|
|
131
|
-
key: "init",
|
|
132
|
-
value: function () {
|
|
133
|
-
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(canvas, cfg, gl) {
|
|
134
|
-
var _this2 = this;
|
|
135
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
136
|
-
while (1) switch (_context.prev = _context.next) {
|
|
137
|
-
case 0:
|
|
138
|
-
// this.$container = $container;
|
|
139
|
-
this.canvas = canvas;
|
|
140
|
-
if (!gl) {
|
|
141
|
-
_context.next = 5;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
this.gl = gl;
|
|
145
|
-
_context.next = 8;
|
|
146
|
-
break;
|
|
147
|
-
case 5:
|
|
148
|
-
_context.next = 7;
|
|
149
|
-
return new Promise(function (resolve, reject) {
|
|
150
|
-
regl({
|
|
151
|
-
canvas: _this2.canvas,
|
|
152
|
-
attributes: {
|
|
153
|
-
alpha: true,
|
|
154
|
-
// use TAA instead of MSAA
|
|
155
|
-
// @see https://www.khronos.org/registry/webgl/specs/1.0/#5.2.1
|
|
156
|
-
antialias: cfg.antialias,
|
|
157
|
-
premultipliedAlpha: true,
|
|
158
|
-
preserveDrawingBuffer: cfg.preserveDrawingBuffer,
|
|
159
|
-
stencil: cfg.stencil
|
|
160
|
-
},
|
|
161
|
-
// TODO: use extensions
|
|
162
|
-
extensions: ['OES_element_index_uint', 'OES_standard_derivatives',
|
|
163
|
-
// wireframe
|
|
164
|
-
'ANGLE_instanced_arrays' // VSM shadow map
|
|
165
|
-
],
|
|
166
|
-
|
|
167
|
-
optionalExtensions: ['oes_texture_float_linear', 'OES_texture_float', 'EXT_texture_filter_anisotropic', 'EXT_blend_minmax', 'WEBGL_depth_texture', 'WEBGL_lose_context'],
|
|
168
|
-
profile: true,
|
|
169
|
-
onDone: function onDone(err, r) {
|
|
170
|
-
if (err || !r) {
|
|
171
|
-
reject(err);
|
|
172
|
-
}
|
|
173
|
-
// @ts-ignore
|
|
174
|
-
resolve(r);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
case 7:
|
|
179
|
-
this.gl = _context.sent;
|
|
180
|
-
case 8:
|
|
181
|
-
this.extensionObject = {
|
|
182
|
-
OES_texture_float: this.testExtension('OES_texture_float')
|
|
183
|
-
};
|
|
184
|
-
case 9:
|
|
185
|
-
case "end":
|
|
186
|
-
return _context.stop();
|
|
187
|
-
}
|
|
188
|
-
}, _callee, this);
|
|
189
|
-
}));
|
|
190
|
-
function init(_x, _x2, _x3) {
|
|
191
|
-
return _init.apply(this, arguments);
|
|
192
|
-
}
|
|
193
|
-
return init;
|
|
194
|
-
}()
|
|
195
|
-
}, {
|
|
196
|
-
key: "getPointSizeRange",
|
|
197
|
-
value: function getPointSizeRange() {
|
|
198
|
-
return this.gl._gl.getParameter(this.gl._gl.ALIASED_POINT_SIZE_RANGE);
|
|
199
|
-
}
|
|
200
|
-
}, {
|
|
201
|
-
key: "testExtension",
|
|
202
|
-
value: function testExtension(name) {
|
|
203
|
-
// OES_texture_float
|
|
204
|
-
return !!this.getGLContext().getExtension(name);
|
|
205
|
-
}
|
|
206
|
-
}, {
|
|
207
|
-
key: "setState",
|
|
208
|
-
value:
|
|
209
|
-
// TODO: 临时方法
|
|
210
|
-
function setState() {
|
|
211
|
-
this.gl({
|
|
212
|
-
cull: {
|
|
213
|
-
enable: false,
|
|
214
|
-
face: 'back'
|
|
215
|
-
},
|
|
216
|
-
viewport: {
|
|
217
|
-
x: 0,
|
|
218
|
-
y: 0,
|
|
219
|
-
height: this.width,
|
|
220
|
-
width: this.height
|
|
221
|
-
},
|
|
222
|
-
blend: {
|
|
223
|
-
enable: true,
|
|
224
|
-
equation: 'add'
|
|
225
|
-
},
|
|
226
|
-
framebuffer: null
|
|
227
|
-
});
|
|
228
|
-
this.gl._refresh();
|
|
229
|
-
}
|
|
230
|
-
}, {
|
|
231
|
-
key: "setBaseState",
|
|
232
|
-
value: function setBaseState() {
|
|
233
|
-
this.gl({
|
|
234
|
-
cull: {
|
|
235
|
-
enable: false,
|
|
236
|
-
face: 'back'
|
|
237
|
-
},
|
|
238
|
-
viewport: {
|
|
239
|
-
x: 0,
|
|
240
|
-
y: 0,
|
|
241
|
-
height: this.width,
|
|
242
|
-
width: this.height
|
|
243
|
-
},
|
|
244
|
-
blend: {
|
|
245
|
-
enable: false,
|
|
246
|
-
equation: 'add'
|
|
247
|
-
},
|
|
248
|
-
framebuffer: null
|
|
249
|
-
});
|
|
250
|
-
this.gl._refresh();
|
|
251
|
-
}
|
|
252
|
-
}, {
|
|
253
|
-
key: "setCustomLayerDefaults",
|
|
254
|
-
value: function setCustomLayerDefaults() {
|
|
255
|
-
var gl = this.getGLContext();
|
|
256
|
-
gl.disable(gl.CULL_FACE);
|
|
257
|
-
}
|
|
258
|
-
}, {
|
|
259
|
-
key: "setDirty",
|
|
260
|
-
value: function setDirty(flag) {
|
|
261
|
-
this.isDirty = flag;
|
|
262
|
-
}
|
|
263
|
-
}, {
|
|
264
|
-
key: "getDirty",
|
|
265
|
-
value: function getDirty() {
|
|
266
|
-
return this.isDirty;
|
|
267
|
-
}
|
|
268
|
-
}]);
|
|
269
|
-
return ReglRendererService;
|
|
270
|
-
}()) || _class);
|
|
271
|
-
export { ReglRendererService as default };
|
package/lib/index.js
DELETED
|
@@ -1,39 +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
|
-
|
|
29
|
-
// src/index.ts
|
|
30
|
-
var src_exports = {};
|
|
31
|
-
__export(src_exports, {
|
|
32
|
-
ReglRendererService: () => import_regl.default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(src_exports);
|
|
35
|
-
var import_regl = __toESM(require("./regl"));
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
ReglRendererService
|
|
39
|
-
});
|
|
@@ -1,49 +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/ReglAttribute.ts
|
|
20
|
-
var ReglAttribute_exports = {};
|
|
21
|
-
__export(ReglAttribute_exports, {
|
|
22
|
-
default: () => ReglAttribute
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglAttribute_exports);
|
|
25
|
-
var ReglAttribute = class {
|
|
26
|
-
constructor(gl, options) {
|
|
27
|
-
const { buffer, offset, stride, normalized, size, divisor } = options;
|
|
28
|
-
this.buffer = buffer;
|
|
29
|
-
this.attribute = {
|
|
30
|
-
buffer: buffer.get(),
|
|
31
|
-
offset: offset || 0,
|
|
32
|
-
stride: stride || 0,
|
|
33
|
-
normalized: normalized || false,
|
|
34
|
-
divisor: divisor || 0
|
|
35
|
-
};
|
|
36
|
-
if (size) {
|
|
37
|
-
this.attribute.size = size;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
get() {
|
|
41
|
-
return this.attribute;
|
|
42
|
-
}
|
|
43
|
-
updateBuffer(options) {
|
|
44
|
-
this.buffer.subData(options);
|
|
45
|
-
}
|
|
46
|
-
destroy() {
|
|
47
|
-
this.buffer.destroy();
|
|
48
|
-
}
|
|
49
|
-
};
|
package/lib/regl/ReglBuffer.js
DELETED
|
@@ -1,53 +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/ReglBuffer.ts
|
|
20
|
-
var ReglBuffer_exports = {};
|
|
21
|
-
__export(ReglBuffer_exports, {
|
|
22
|
-
default: () => ReglBuffer
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglBuffer_exports);
|
|
25
|
-
var import_l7_core = require("@antv/l7-core");
|
|
26
|
-
var import_constants = require("./constants");
|
|
27
|
-
var ReglBuffer = class {
|
|
28
|
-
constructor(reGl, options) {
|
|
29
|
-
this.isDestroyed = false;
|
|
30
|
-
const { data, usage, type } = options;
|
|
31
|
-
this.buffer = reGl.buffer({
|
|
32
|
-
data,
|
|
33
|
-
usage: import_constants.usageMap[usage || import_l7_core.gl.STATIC_DRAW],
|
|
34
|
-
type: import_constants.dataTypeMap[type || import_l7_core.gl.UNSIGNED_BYTE]
|
|
35
|
-
// length: 0,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
get() {
|
|
39
|
-
return this.buffer;
|
|
40
|
-
}
|
|
41
|
-
destroy() {
|
|
42
|
-
if (!this.isDestroyed) {
|
|
43
|
-
this.buffer.destroy();
|
|
44
|
-
}
|
|
45
|
-
this.isDestroyed = true;
|
|
46
|
-
}
|
|
47
|
-
subData({
|
|
48
|
-
data,
|
|
49
|
-
offset
|
|
50
|
-
}) {
|
|
51
|
-
this.buffer.subdata(data, offset);
|
|
52
|
-
}
|
|
53
|
-
};
|
package/lib/regl/ReglElements.js
DELETED
|
@@ -1,47 +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/ReglElements.ts
|
|
20
|
-
var ReglElements_exports = {};
|
|
21
|
-
__export(ReglElements_exports, {
|
|
22
|
-
default: () => ReglElements
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglElements_exports);
|
|
25
|
-
var import_l7_core = require("@antv/l7-core");
|
|
26
|
-
var import_constants = require("./constants");
|
|
27
|
-
var ReglElements = class {
|
|
28
|
-
constructor(reGl, options) {
|
|
29
|
-
const { data, usage, type, count } = options;
|
|
30
|
-
this.elements = reGl.elements({
|
|
31
|
-
data,
|
|
32
|
-
usage: import_constants.usageMap[usage || import_l7_core.gl.STATIC_DRAW],
|
|
33
|
-
type: import_constants.dataTypeMap[type || import_l7_core.gl.UNSIGNED_BYTE],
|
|
34
|
-
count
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
get() {
|
|
38
|
-
return this.elements;
|
|
39
|
-
}
|
|
40
|
-
subData({
|
|
41
|
-
data
|
|
42
|
-
}) {
|
|
43
|
-
this.elements.subdata(data);
|
|
44
|
-
}
|
|
45
|
-
destroy() {
|
|
46
|
-
}
|
|
47
|
-
};
|
|
@@ -1,51 +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/ReglFramebuffer.ts
|
|
20
|
-
var ReglFramebuffer_exports = {};
|
|
21
|
-
__export(ReglFramebuffer_exports, {
|
|
22
|
-
default: () => ReglFramebuffer
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(ReglFramebuffer_exports);
|
|
25
|
-
var ReglFramebuffer = class {
|
|
26
|
-
constructor(reGl, options) {
|
|
27
|
-
const { width, height, color, colors } = options;
|
|
28
|
-
const framebufferOptions = {
|
|
29
|
-
width,
|
|
30
|
-
height
|
|
31
|
-
};
|
|
32
|
-
if (Array.isArray(colors)) {
|
|
33
|
-
framebufferOptions.colors = colors.map(
|
|
34
|
-
(c) => c.get()
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
if (color && typeof color !== "boolean") {
|
|
38
|
-
framebufferOptions.color = color.get();
|
|
39
|
-
}
|
|
40
|
-
this.framebuffer = reGl.framebuffer(framebufferOptions);
|
|
41
|
-
}
|
|
42
|
-
get() {
|
|
43
|
-
return this.framebuffer;
|
|
44
|
-
}
|
|
45
|
-
destroy() {
|
|
46
|
-
this.framebuffer.destroy();
|
|
47
|
-
}
|
|
48
|
-
resize({ width, height }) {
|
|
49
|
-
this.framebuffer.resize(width, height);
|
|
50
|
-
}
|
|
51
|
-
};
|