@antv/l7-renderer 2.9.20 → 2.9.22
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/index.js +5 -3
- package/es/regl/ReglAttribute.js +5 -8
- package/es/regl/ReglBuffer.js +9 -8
- package/es/regl/ReglElements.js +8 -8
- package/es/regl/ReglFramebuffer.js +8 -7
- package/es/regl/ReglModel.js +63 -42
- package/es/regl/ReglRenderbuffer.js +7 -7
- package/es/regl/ReglTexture2D.js +12 -10
- package/es/regl/constants.js +5 -2
- package/es/regl/index.js +43 -31
- package/lib/index.js +29 -13
- package/lib/regl/ReglAttribute.js +38 -48
- package/lib/regl/ReglBuffer.js +46 -52
- package/lib/regl/ReglElements.js +45 -51
- package/lib/regl/ReglFramebuffer.js +43 -58
- package/lib/regl/ReglModel.js +217 -283
- package/lib/regl/ReglRenderbuffer.js +42 -50
- package/lib/regl/ReglTexture2D.js +90 -122
- package/lib/regl/constants.js +168 -42
- package/lib/regl/index.js +204 -272
- package/package.json +12 -8
- package/es/index.js.map +0 -1
- package/es/regl/ReglAttribute.js.map +0 -1
- package/es/regl/ReglBuffer.js.map +0 -1
- package/es/regl/ReglElements.js.map +0 -1
- package/es/regl/ReglFramebuffer.js.map +0 -1
- package/es/regl/ReglModel.js.map +0 -1
- package/es/regl/ReglRenderbuffer.js.map +0 -1
- package/es/regl/ReglTexture2D.js.map +0 -1
- package/es/regl/constants.js.map +0 -1
- package/es/regl/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/regl/ReglAttribute.js.map +0 -1
- package/lib/regl/ReglBuffer.js.map +0 -1
- package/lib/regl/ReglElements.js.map +0 -1
- package/lib/regl/ReglFramebuffer.js.map +0 -1
- package/lib/regl/ReglModel.js.map +0 -1
- package/lib/regl/ReglRenderbuffer.js.map +0 -1
- package/lib/regl/ReglTexture2D.js.map +0 -1
- package/lib/regl/constants.js.map +0 -1
- package/lib/regl/index.js.map +0 -1
package/lib/regl/ReglModel.js
CHANGED
|
@@ -1,328 +1,262 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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/ReglModel.ts
|
|
20
|
+
var ReglModel_exports = {};
|
|
21
|
+
__export(ReglModel_exports, {
|
|
22
|
+
default: () => ReglModel
|
|
7
23
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
|
|
18
|
-
var _isTypedArray2 = _interopRequireDefault(require("lodash/isTypedArray"));
|
|
19
|
-
|
|
20
|
-
var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
|
|
21
|
-
|
|
22
|
-
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
23
|
-
|
|
24
|
-
var _l7Core = require("@antv/l7-core");
|
|
25
|
-
|
|
26
|
-
var _constants = require("./constants");
|
|
27
|
-
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
-
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
-
|
|
32
|
-
var ReglModel = function () {
|
|
33
|
-
function ReglModel(reGl, options) {
|
|
34
|
-
(0, _classCallCheck2.default)(this, ReglModel);
|
|
35
|
-
(0, _defineProperty2.default)(this, "reGl", void 0);
|
|
36
|
-
(0, _defineProperty2.default)(this, "destroyed", false);
|
|
37
|
-
(0, _defineProperty2.default)(this, "drawCommand", void 0);
|
|
38
|
-
(0, _defineProperty2.default)(this, "drawPickCommand", void 0);
|
|
39
|
-
(0, _defineProperty2.default)(this, "drawParams", void 0);
|
|
40
|
-
(0, _defineProperty2.default)(this, "options", void 0);
|
|
41
|
-
(0, _defineProperty2.default)(this, "uniforms", {});
|
|
24
|
+
module.exports = __toCommonJS(ReglModel_exports);
|
|
25
|
+
var import_l7_core = require("@antv/l7-core");
|
|
26
|
+
var import_lodash = require("lodash");
|
|
27
|
+
var import_constants = require("./constants");
|
|
28
|
+
var ReglModel = class {
|
|
29
|
+
constructor(reGl, options) {
|
|
30
|
+
this.destroyed = false;
|
|
31
|
+
this.uniforms = {};
|
|
42
32
|
this.reGl = reGl;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
33
|
+
const {
|
|
34
|
+
vs,
|
|
35
|
+
fs,
|
|
36
|
+
attributes,
|
|
37
|
+
uniforms,
|
|
38
|
+
primitive,
|
|
39
|
+
count,
|
|
40
|
+
elements,
|
|
41
|
+
depth,
|
|
42
|
+
blend,
|
|
43
|
+
stencil,
|
|
44
|
+
cull,
|
|
45
|
+
instances
|
|
46
|
+
} = options;
|
|
47
|
+
const reglUniforms = {};
|
|
56
48
|
this.options = options;
|
|
57
|
-
|
|
58
49
|
if (uniforms) {
|
|
59
50
|
this.uniforms = this.extractUniforms(uniforms);
|
|
60
|
-
Object.keys(uniforms).forEach(
|
|
51
|
+
Object.keys(uniforms).forEach((uniformName) => {
|
|
61
52
|
reglUniforms[uniformName] = reGl.prop(uniformName);
|
|
62
53
|
});
|
|
63
54
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Object.keys(attributes).forEach(function (name) {
|
|
55
|
+
const reglAttributes = {};
|
|
56
|
+
Object.keys(attributes).forEach((name) => {
|
|
67
57
|
reglAttributes[name] = attributes[name].get();
|
|
68
58
|
});
|
|
69
|
-
|
|
59
|
+
const drawParams = {
|
|
70
60
|
attributes: reglAttributes,
|
|
71
61
|
frag: fs,
|
|
72
62
|
uniforms: reglUniforms,
|
|
73
63
|
vert: vs,
|
|
74
64
|
blend: {},
|
|
75
|
-
primitive:
|
|
65
|
+
primitive: import_constants.primitiveMap[primitive === void 0 ? import_l7_core.gl.TRIANGLES : primitive]
|
|
76
66
|
};
|
|
77
|
-
|
|
78
67
|
if (instances) {
|
|
79
68
|
drawParams.instances = instances;
|
|
80
69
|
}
|
|
81
|
-
|
|
82
70
|
if (count) {
|
|
83
71
|
drawParams.count = count;
|
|
84
72
|
}
|
|
85
|
-
|
|
86
73
|
if (elements) {
|
|
87
74
|
drawParams.elements = elements.get();
|
|
88
75
|
}
|
|
89
|
-
|
|
90
|
-
this.
|
|
91
|
-
|
|
92
|
-
}, drawParams);
|
|
93
|
-
this.initBlendDrawParams({
|
|
94
|
-
blend: blend
|
|
95
|
-
}, drawParams);
|
|
96
|
-
this.initStencilDrawParams({
|
|
97
|
-
stencil: stencil
|
|
98
|
-
}, drawParams);
|
|
99
|
-
this.initCullDrawParams({
|
|
100
|
-
cull: cull
|
|
101
|
-
}, drawParams);
|
|
76
|
+
this.initDepthDrawParams({ depth }, drawParams);
|
|
77
|
+
this.initBlendDrawParams({ blend }, drawParams);
|
|
78
|
+
this.initStencilDrawParams({ stencil }, drawParams);
|
|
79
|
+
this.initCullDrawParams({ cull }, drawParams);
|
|
102
80
|
this.drawCommand = reGl(drawParams);
|
|
103
|
-
|
|
104
|
-
pickDrawParams.blend =
|
|
81
|
+
const pickDrawParams = (0, import_lodash.cloneDeep)(drawParams);
|
|
82
|
+
pickDrawParams.blend = {
|
|
83
|
+
...pickDrawParams.blend,
|
|
105
84
|
enable: false
|
|
106
|
-
}
|
|
85
|
+
};
|
|
107
86
|
this.drawPickCommand = reGl(pickDrawParams);
|
|
108
87
|
this.drawParams = drawParams;
|
|
109
88
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
89
|
+
updateAttributesAndElements(attributes, elements) {
|
|
90
|
+
const reglAttributes = {};
|
|
91
|
+
Object.keys(attributes).forEach((name) => {
|
|
92
|
+
reglAttributes[name] = attributes[name].get();
|
|
93
|
+
});
|
|
94
|
+
this.drawParams.attributes = reglAttributes;
|
|
95
|
+
this.drawParams.elements = elements.get();
|
|
96
|
+
this.drawCommand = this.reGl(this.drawParams);
|
|
97
|
+
const pickDrawParams = (0, import_lodash.cloneDeep)(this.drawParams);
|
|
98
|
+
pickDrawParams.blend = {
|
|
99
|
+
...pickDrawParams.blend,
|
|
100
|
+
enable: false
|
|
101
|
+
};
|
|
102
|
+
this.drawPickCommand = this.reGl(pickDrawParams);
|
|
103
|
+
}
|
|
104
|
+
updateAttributes(attributes) {
|
|
105
|
+
const reglAttributes = {};
|
|
106
|
+
Object.keys(attributes).forEach((name) => {
|
|
107
|
+
reglAttributes[name] = attributes[name].get();
|
|
108
|
+
});
|
|
109
|
+
this.drawParams.attributes = reglAttributes;
|
|
110
|
+
this.drawCommand = this.reGl(this.drawParams);
|
|
111
|
+
const pickDrawParams = (0, import_lodash.cloneDeep)(this.drawParams);
|
|
112
|
+
pickDrawParams.blend = {
|
|
113
|
+
...pickDrawParams.blend,
|
|
114
|
+
enable: false
|
|
115
|
+
};
|
|
116
|
+
this.drawPickCommand = this.reGl(pickDrawParams);
|
|
117
|
+
}
|
|
118
|
+
addUniforms(uniforms) {
|
|
119
|
+
this.uniforms = {
|
|
120
|
+
...this.uniforms,
|
|
121
|
+
...this.extractUniforms(uniforms)
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
draw(options, pick) {
|
|
125
|
+
if (this.drawParams.attributes && Object.keys(this.drawParams.attributes).length === 0) {
|
|
126
|
+
return;
|
|
146
127
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var reglDrawProps = {};
|
|
157
|
-
Object.keys(uniforms).forEach(function (uniformName) {
|
|
158
|
-
var type = (0, _typeof2.default)(uniforms[uniformName]);
|
|
159
|
-
|
|
160
|
-
if (type === 'boolean' || type === 'number' || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
|
|
161
|
-
reglDrawProps[uniformName] = uniforms[uniformName];
|
|
162
|
-
} else {
|
|
163
|
-
reglDrawProps[uniformName] = uniforms[uniformName].get();
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
if (!pick) {
|
|
168
|
-
this.drawCommand(reglDrawProps);
|
|
128
|
+
const uniforms = {
|
|
129
|
+
...this.uniforms,
|
|
130
|
+
...this.extractUniforms(options.uniforms || {})
|
|
131
|
+
};
|
|
132
|
+
const reglDrawProps = {};
|
|
133
|
+
Object.keys(uniforms).forEach((uniformName) => {
|
|
134
|
+
const type = typeof uniforms[uniformName];
|
|
135
|
+
if (type === "boolean" || type === "number" || Array.isArray(uniforms[uniformName]) || uniforms[uniformName].BYTES_PER_ELEMENT) {
|
|
136
|
+
reglDrawProps[uniformName] = uniforms[uniformName];
|
|
169
137
|
} else {
|
|
170
|
-
|
|
138
|
+
reglDrawProps[uniformName] = uniforms[uniformName].get();
|
|
171
139
|
}
|
|
140
|
+
});
|
|
141
|
+
if (!pick) {
|
|
142
|
+
this.drawCommand(reglDrawProps);
|
|
143
|
+
} else {
|
|
144
|
+
this.drawPickCommand(reglDrawProps);
|
|
172
145
|
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
attr.destroy();
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
this.destroyed = true;
|
|
146
|
+
}
|
|
147
|
+
destroy() {
|
|
148
|
+
this.drawParams.elements.destroy();
|
|
149
|
+
if (this.options.attributes) {
|
|
150
|
+
Object.values(this.options.attributes).forEach((attr) => {
|
|
151
|
+
attr.destroy();
|
|
152
|
+
});
|
|
185
153
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
range: depth.range || [0, 1]
|
|
197
|
-
};
|
|
198
|
-
}
|
|
154
|
+
this.destroyed = true;
|
|
155
|
+
}
|
|
156
|
+
initDepthDrawParams({ depth }, drawParams) {
|
|
157
|
+
if (depth) {
|
|
158
|
+
drawParams.depth = {
|
|
159
|
+
enable: depth.enable === void 0 ? true : !!depth.enable,
|
|
160
|
+
mask: depth.mask === void 0 ? true : !!depth.mask,
|
|
161
|
+
func: import_constants.depthFuncMap[depth.func || import_l7_core.gl.LESS],
|
|
162
|
+
range: depth.range || [0, 1]
|
|
163
|
+
};
|
|
199
164
|
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
},
|
|
219
|
-
equation: {
|
|
220
|
-
rgb: _constants.blendEquationMap[equation && equation.rgb || _l7Core.gl.FUNC_ADD],
|
|
221
|
-
alpha: _constants.blendEquationMap[equation && equation.alpha || _l7Core.gl.FUNC_ADD]
|
|
222
|
-
},
|
|
223
|
-
color: color
|
|
224
|
-
};
|
|
225
|
-
}
|
|
165
|
+
}
|
|
166
|
+
initBlendDrawParams({ blend }, drawParams) {
|
|
167
|
+
if (blend) {
|
|
168
|
+
const { enable, func, equation, color = [0, 0, 0, 0] } = blend;
|
|
169
|
+
drawParams.blend = {
|
|
170
|
+
enable: !!enable,
|
|
171
|
+
func: {
|
|
172
|
+
srcRGB: import_constants.blendFuncMap[func && func.srcRGB || import_l7_core.gl.SRC_ALPHA],
|
|
173
|
+
srcAlpha: import_constants.blendFuncMap[func && func.srcAlpha || import_l7_core.gl.SRC_ALPHA],
|
|
174
|
+
dstRGB: import_constants.blendFuncMap[func && func.dstRGB || import_l7_core.gl.ONE_MINUS_SRC_ALPHA],
|
|
175
|
+
dstAlpha: import_constants.blendFuncMap[func && func.dstAlpha || import_l7_core.gl.ONE_MINUS_SRC_ALPHA]
|
|
176
|
+
},
|
|
177
|
+
equation: {
|
|
178
|
+
rgb: import_constants.blendEquationMap[equation && equation.rgb || import_l7_core.gl.FUNC_ADD],
|
|
179
|
+
alpha: import_constants.blendEquationMap[equation && equation.alpha || import_l7_core.gl.FUNC_ADD]
|
|
180
|
+
},
|
|
181
|
+
color
|
|
182
|
+
};
|
|
226
183
|
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
mask = _stencil$mask === void 0 ? -1 : _stencil$mask,
|
|
236
|
-
_stencil$func = stencil.func,
|
|
237
|
-
func = _stencil$func === void 0 ? {
|
|
238
|
-
cmp: _l7Core.gl.ALWAYS,
|
|
184
|
+
}
|
|
185
|
+
initStencilDrawParams({ stencil }, drawParams) {
|
|
186
|
+
if (stencil) {
|
|
187
|
+
const {
|
|
188
|
+
enable,
|
|
189
|
+
mask = -1,
|
|
190
|
+
func = {
|
|
191
|
+
cmp: import_l7_core.gl.ALWAYS,
|
|
239
192
|
ref: 0,
|
|
240
193
|
mask: -1
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
func
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
194
|
+
},
|
|
195
|
+
opFront = {
|
|
196
|
+
fail: import_l7_core.gl.KEEP,
|
|
197
|
+
zfail: import_l7_core.gl.KEEP,
|
|
198
|
+
zpass: import_l7_core.gl.KEEP
|
|
199
|
+
},
|
|
200
|
+
opBack = {
|
|
201
|
+
fail: import_l7_core.gl.KEEP,
|
|
202
|
+
zfail: import_l7_core.gl.KEEP,
|
|
203
|
+
zpass: import_l7_core.gl.KEEP
|
|
204
|
+
}
|
|
205
|
+
} = stencil;
|
|
206
|
+
drawParams.stencil = {
|
|
207
|
+
enable: !!enable,
|
|
208
|
+
mask,
|
|
209
|
+
func: {
|
|
210
|
+
...func,
|
|
211
|
+
cmp: import_constants.stencilFuncMap[func.cmp]
|
|
212
|
+
},
|
|
213
|
+
opFront: {
|
|
214
|
+
fail: import_constants.stencilOpMap[opFront.fail],
|
|
215
|
+
zfail: import_constants.stencilOpMap[opFront.zfail],
|
|
216
|
+
zpass: import_constants.stencilOpMap[opFront.zpass]
|
|
217
|
+
},
|
|
218
|
+
opBack: {
|
|
219
|
+
fail: import_constants.stencilOpMap[opBack.fail],
|
|
220
|
+
zfail: import_constants.stencilOpMap[opBack.zfail],
|
|
221
|
+
zpass: import_constants.stencilOpMap[opBack.zpass]
|
|
222
|
+
}
|
|
223
|
+
};
|
|
272
224
|
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
face = _cull$face === void 0 ? _l7Core.gl.BACK : _cull$face;
|
|
282
|
-
drawParams.cull = {
|
|
283
|
-
enable: !!enable,
|
|
284
|
-
face: _constants.cullFaceMap[face]
|
|
285
|
-
};
|
|
286
|
-
}
|
|
225
|
+
}
|
|
226
|
+
initCullDrawParams({ cull }, drawParams) {
|
|
227
|
+
if (cull) {
|
|
228
|
+
const { enable, face = import_l7_core.gl.BACK } = cull;
|
|
229
|
+
drawParams.cull = {
|
|
230
|
+
enable: !!enable,
|
|
231
|
+
face: import_constants.cullFaceMap[face]
|
|
232
|
+
};
|
|
287
233
|
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
234
|
+
}
|
|
235
|
+
extractUniforms(uniforms) {
|
|
236
|
+
const extractedUniforms = {};
|
|
237
|
+
Object.keys(uniforms).forEach((uniformName) => {
|
|
238
|
+
this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
|
|
239
|
+
});
|
|
240
|
+
return extractedUniforms;
|
|
241
|
+
}
|
|
242
|
+
extractUniformsRecursively(uniformName, uniformValue, uniforms, prefix) {
|
|
243
|
+
if (uniformValue === null || typeof uniformValue === "number" || typeof uniformValue === "boolean" || Array.isArray(uniformValue) && typeof uniformValue[0] === "number" || (0, import_lodash.isTypedArray)(uniformValue) || uniformValue === "" || "resize" in uniformValue) {
|
|
244
|
+
uniforms[`${prefix && prefix + "."}${uniformName}`] = uniformValue;
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if ((0, import_lodash.isPlainObject)(uniformValue)) {
|
|
248
|
+
Object.keys(uniformValue).forEach((childName) => {
|
|
249
|
+
this.extractUniformsRecursively(childName, uniformValue[childName], uniforms, `${prefix && prefix + "."}${uniformName}`);
|
|
296
250
|
});
|
|
297
|
-
return extractedUniforms;
|
|
298
251
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
if (uniformValue === null || typeof uniformValue === 'number' || typeof uniformValue === 'boolean' || Array.isArray(uniformValue) && typeof uniformValue[0] === 'number' || (0, _isTypedArray2.default)(uniformValue) || uniformValue === '' || 'resize' in uniformValue) {
|
|
305
|
-
uniforms["".concat(prefix && prefix + '.').concat(uniformName)] = uniformValue;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if ((0, _isPlainObject2.default)(uniformValue)) {
|
|
310
|
-
Object.keys(uniformValue).forEach(function (childName) {
|
|
311
|
-
_this2.extractUniformsRecursively(childName, uniformValue[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName));
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (Array.isArray(uniformValue)) {
|
|
316
|
-
uniformValue.forEach(function (child, idx) {
|
|
317
|
-
Object.keys(child).forEach(function (childName) {
|
|
318
|
-
_this2.extractUniformsRecursively(childName, child[childName], uniforms, "".concat(prefix && prefix + '.').concat(uniformName, "[").concat(idx, "]"));
|
|
319
|
-
});
|
|
252
|
+
if (Array.isArray(uniformValue)) {
|
|
253
|
+
uniformValue.forEach((child, idx) => {
|
|
254
|
+
Object.keys(child).forEach((childName) => {
|
|
255
|
+
this.extractUniformsRecursively(childName, child[childName], uniforms, `${prefix && prefix + "."}${uniformName}[${idx}]`);
|
|
320
256
|
});
|
|
321
|
-
}
|
|
257
|
+
});
|
|
322
258
|
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
exports.default = ReglModel;
|
|
328
|
-
//# sourceMappingURL=ReglModel.js.map
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
262
|
+
0 && (module.exports = {});
|
|
@@ -1,54 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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/ReglRenderbuffer.ts
|
|
20
|
+
var ReglRenderbuffer_exports = {};
|
|
21
|
+
__export(ReglRenderbuffer_exports, {
|
|
22
|
+
default: () => ReglRenderbuffer
|
|
7
23
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
|
-
var _constants = require("./constants");
|
|
17
|
-
|
|
18
|
-
var ReglRenderbuffer = function () {
|
|
19
|
-
function ReglRenderbuffer(reGl, options) {
|
|
20
|
-
(0, _classCallCheck2.default)(this, ReglRenderbuffer);
|
|
21
|
-
(0, _defineProperty2.default)(this, "renderbuffer", void 0);
|
|
22
|
-
var width = options.width,
|
|
23
|
-
height = options.height,
|
|
24
|
-
format = options.format;
|
|
24
|
+
module.exports = __toCommonJS(ReglRenderbuffer_exports);
|
|
25
|
+
var import_constants = require("./constants");
|
|
26
|
+
var ReglRenderbuffer = class {
|
|
27
|
+
constructor(reGl, options) {
|
|
28
|
+
const { width, height, format } = options;
|
|
25
29
|
this.renderbuffer = reGl.renderbuffer({
|
|
26
|
-
width
|
|
27
|
-
height
|
|
28
|
-
format:
|
|
30
|
+
width,
|
|
31
|
+
height,
|
|
32
|
+
format: import_constants.formatMap[format]
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
key: "resize",
|
|
44
|
-
value: function resize(_ref) {
|
|
45
|
-
var width = _ref.width,
|
|
46
|
-
height = _ref.height;
|
|
47
|
-
this.renderbuffer.resize(width, height);
|
|
48
|
-
}
|
|
49
|
-
}]);
|
|
50
|
-
return ReglRenderbuffer;
|
|
51
|
-
}();
|
|
52
|
-
|
|
53
|
-
exports.default = ReglRenderbuffer;
|
|
54
|
-
//# sourceMappingURL=ReglRenderbuffer.js.map
|
|
35
|
+
get() {
|
|
36
|
+
return this.renderbuffer;
|
|
37
|
+
}
|
|
38
|
+
destroy() {
|
|
39
|
+
this.renderbuffer.destroy();
|
|
40
|
+
}
|
|
41
|
+
resize({ width, height }) {
|
|
42
|
+
this.renderbuffer.resize(width, height);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {});
|