@antv/l7-renderer 2.21.2 → 2.21.4-beta.0
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/LICENSE.md +21 -0
- package/es/device/DeviceAttribute.js +1 -9
- package/es/device/DeviceCache.js +9 -12
- package/es/device/DeviceElements.js +2 -6
- package/es/device/DeviceFramebuffer.js +4 -12
- package/es/device/DeviceModel.js +6 -27
- package/es/device/index.js +1 -6
- package/es/regl/ReglModel.js +5 -29
- package/lib/device/DeviceAttribute.js +1 -9
- package/lib/device/DeviceCache.js +8 -6
- package/lib/device/DeviceElements.js +2 -6
- package/lib/device/DeviceFramebuffer.js +4 -12
- package/lib/device/DeviceModel.js +6 -27
- package/lib/device/index.js +1 -6
- package/lib/regl/ReglModel.js +4 -24
- package/package.json +17 -17
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 AntV team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
// src/device/DeviceAttribute.ts
|
|
2
2
|
var DeviceAttribute = class {
|
|
3
3
|
constructor(device, options) {
|
|
4
|
-
const {
|
|
5
|
-
buffer,
|
|
6
|
-
offset,
|
|
7
|
-
stride,
|
|
8
|
-
normalized,
|
|
9
|
-
size,
|
|
10
|
-
divisor,
|
|
11
|
-
shaderLocation
|
|
12
|
-
} = options;
|
|
4
|
+
const { buffer, offset, stride, normalized, size, divisor, shaderLocation } = options;
|
|
13
5
|
this.buffer = buffer;
|
|
14
6
|
this.attribute = {
|
|
15
7
|
shaderLocation,
|
package/es/device/DeviceCache.js
CHANGED
|
@@ -8,12 +8,7 @@ import {
|
|
|
8
8
|
renderPipelineDescriptorCopy,
|
|
9
9
|
renderPipelineDescriptorEquals
|
|
10
10
|
} from "@antv/g-device-api";
|
|
11
|
-
import {
|
|
12
|
-
HashMap,
|
|
13
|
-
hashCodeNumberFinish,
|
|
14
|
-
hashCodeNumberUpdate,
|
|
15
|
-
nullHashFunc
|
|
16
|
-
} from "./utils/HashMap";
|
|
11
|
+
import { HashMap, hashCodeNumberFinish, hashCodeNumberUpdate, nullHashFunc } from "./utils/HashMap";
|
|
17
12
|
function blendStateHash(hash, a) {
|
|
18
13
|
hash = hashCodeNumberUpdate(hash, a.blendMode);
|
|
19
14
|
hash = hashCodeNumberUpdate(hash, a.blendSrcFactor);
|
|
@@ -27,10 +22,7 @@ function attachmentStateHash(hash, a) {
|
|
|
27
22
|
return hash;
|
|
28
23
|
}
|
|
29
24
|
function colorHash(hash, a) {
|
|
30
|
-
hash = hashCodeNumberUpdate(
|
|
31
|
-
hash,
|
|
32
|
-
a.r << 24 | a.g << 16 | a.b << 8 | a.a
|
|
33
|
-
);
|
|
25
|
+
hash = hashCodeNumberUpdate(hash, a.r << 24 | a.g << 16 | a.b << 8 | a.a);
|
|
34
26
|
return hash;
|
|
35
27
|
}
|
|
36
28
|
function megaStateDescriptorHash(hash, a) {
|
|
@@ -129,7 +121,10 @@ var RenderCache = class {
|
|
|
129
121
|
bindingsDescriptorEquals,
|
|
130
122
|
bindingsDescriptorHash
|
|
131
123
|
);
|
|
132
|
-
this.renderPipelinesCache = new HashMap(
|
|
124
|
+
this.renderPipelinesCache = new HashMap(
|
|
125
|
+
renderPipelineDescriptorEquals,
|
|
126
|
+
renderPipelineDescriptorHash
|
|
127
|
+
);
|
|
133
128
|
this.inputLayoutsCache = new HashMap(
|
|
134
129
|
inputLayoutDescriptorEquals,
|
|
135
130
|
nullHashFunc
|
|
@@ -156,7 +151,9 @@ var RenderCache = class {
|
|
|
156
151
|
let renderPipeline = this.renderPipelinesCache.get(descriptor);
|
|
157
152
|
if (renderPipeline === null) {
|
|
158
153
|
const descriptorCopy = renderPipelineDescriptorCopy(descriptor);
|
|
159
|
-
descriptorCopy.colorAttachmentFormats = descriptorCopy.colorAttachmentFormats.filter(
|
|
154
|
+
descriptorCopy.colorAttachmentFormats = descriptorCopy.colorAttachmentFormats.filter(
|
|
155
|
+
(f) => f
|
|
156
|
+
);
|
|
160
157
|
renderPipeline = this.device.createRenderPipeline(descriptorCopy);
|
|
161
158
|
this.renderPipelinesCache.add(descriptorCopy, renderPipeline);
|
|
162
159
|
}
|
|
@@ -10,9 +10,7 @@ var DeviceElements = class {
|
|
|
10
10
|
if (isTypedArray(data)) {
|
|
11
11
|
typed = data;
|
|
12
12
|
} else {
|
|
13
|
-
typed = new typedArrayCtorMap[this.type || gl.UNSIGNED_INT](
|
|
14
|
-
data
|
|
15
|
-
);
|
|
13
|
+
typed = new typedArrayCtorMap[this.type || gl.UNSIGNED_INT](data);
|
|
16
14
|
}
|
|
17
15
|
this.type = type;
|
|
18
16
|
this.count = count;
|
|
@@ -31,9 +29,7 @@ var DeviceElements = class {
|
|
|
31
29
|
if (isTypedArray(data)) {
|
|
32
30
|
typed = data;
|
|
33
31
|
} else {
|
|
34
|
-
typed = new typedArrayCtorMap[this.type || gl.UNSIGNED_INT](
|
|
35
|
-
data
|
|
36
|
-
);
|
|
32
|
+
typed = new typedArrayCtorMap[this.type || gl.UNSIGNED_INT](data);
|
|
37
33
|
}
|
|
38
34
|
this.indexBuffer.setSubData(0, new Uint8Array(typed.buffer));
|
|
39
35
|
}
|
|
@@ -16,9 +16,7 @@ var DeviceFramebuffer = class {
|
|
|
16
16
|
color.resize({ width, height });
|
|
17
17
|
}
|
|
18
18
|
this.colorTexture = color.get();
|
|
19
|
-
this.colorRenderTarget = this.device.createRenderTargetFromTexture(
|
|
20
|
-
this.colorTexture
|
|
21
|
-
);
|
|
19
|
+
this.colorRenderTarget = this.device.createRenderTargetFromTexture(this.colorTexture);
|
|
22
20
|
this.width = color["width"];
|
|
23
21
|
this.height = color["height"];
|
|
24
22
|
} else if (width && height) {
|
|
@@ -28,9 +26,7 @@ var DeviceFramebuffer = class {
|
|
|
28
26
|
width,
|
|
29
27
|
height
|
|
30
28
|
});
|
|
31
|
-
this.colorRenderTarget = this.device.createRenderTargetFromTexture(
|
|
32
|
-
this.colorTexture
|
|
33
|
-
);
|
|
29
|
+
this.colorRenderTarget = this.device.createRenderTargetFromTexture(this.colorTexture);
|
|
34
30
|
this.width = width;
|
|
35
31
|
this.height = height;
|
|
36
32
|
}
|
|
@@ -44,9 +40,7 @@ var DeviceFramebuffer = class {
|
|
|
44
40
|
depth.resize({ width, height });
|
|
45
41
|
}
|
|
46
42
|
this.depthTexture = depth.get();
|
|
47
|
-
this.depthRenderTarget = this.device.createRenderTargetFromTexture(
|
|
48
|
-
this.depthTexture
|
|
49
|
-
);
|
|
43
|
+
this.depthRenderTarget = this.device.createRenderTargetFromTexture(this.depthTexture);
|
|
50
44
|
this.width = depth["width"];
|
|
51
45
|
this.height = depth["height"];
|
|
52
46
|
} else if (width && height) {
|
|
@@ -56,9 +50,7 @@ var DeviceFramebuffer = class {
|
|
|
56
50
|
width,
|
|
57
51
|
height
|
|
58
52
|
});
|
|
59
|
-
this.depthRenderTarget = this.device.createRenderTargetFromTexture(
|
|
60
|
-
this.depthTexture
|
|
61
|
-
);
|
|
53
|
+
this.depthRenderTarget = this.device.createRenderTargetFromTexture(this.depthTexture);
|
|
62
54
|
this.width = width;
|
|
63
55
|
this.height = height;
|
|
64
56
|
}
|
package/es/device/DeviceModel.js
CHANGED
|
@@ -54,15 +54,7 @@ var DeviceModel = class {
|
|
|
54
54
|
this.destroyed = false;
|
|
55
55
|
this.uniforms = {};
|
|
56
56
|
this.vertexBuffers = [];
|
|
57
|
-
const {
|
|
58
|
-
vs,
|
|
59
|
-
fs,
|
|
60
|
-
attributes,
|
|
61
|
-
uniforms,
|
|
62
|
-
count,
|
|
63
|
-
elements,
|
|
64
|
-
diagnosticDerivativeUniformityEnabled
|
|
65
|
-
} = options;
|
|
57
|
+
const { vs, fs, attributes, uniforms, count, elements, diagnosticDerivativeUniformityEnabled } = options;
|
|
66
58
|
this.options = options;
|
|
67
59
|
const diagnosticDerivativeUniformityHeader = diagnosticDerivativeUniformityEnabled ? "" : this.service["viewportOrigin"] === ViewportOrigin.UPPER_LEFT ? "diagnostic(off,derivative_uniformity);" : "";
|
|
68
60
|
this.program = service.renderCache.createProgram({
|
|
@@ -290,9 +282,7 @@ var DeviceModel = class {
|
|
|
290
282
|
this.pipeline.destroy();
|
|
291
283
|
this.destroyed = true;
|
|
292
284
|
}
|
|
293
|
-
initDepthDrawParams({
|
|
294
|
-
depth
|
|
295
|
-
}) {
|
|
285
|
+
initDepthDrawParams({ depth }) {
|
|
296
286
|
if (depth) {
|
|
297
287
|
return {
|
|
298
288
|
enable: depth.enable === void 0 ? true : !!depth.enable,
|
|
@@ -302,9 +292,7 @@ var DeviceModel = class {
|
|
|
302
292
|
};
|
|
303
293
|
}
|
|
304
294
|
}
|
|
305
|
-
getBlendDrawParams({
|
|
306
|
-
blend
|
|
307
|
-
}) {
|
|
295
|
+
getBlendDrawParams({ blend }) {
|
|
308
296
|
const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
|
|
309
297
|
return {
|
|
310
298
|
enable: !!enable,
|
|
@@ -324,9 +312,7 @@ var DeviceModel = class {
|
|
|
324
312
|
/**
|
|
325
313
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
326
314
|
*/
|
|
327
|
-
getStencilDrawParams({
|
|
328
|
-
stencil
|
|
329
|
-
}) {
|
|
315
|
+
getStencilDrawParams({ stencil }) {
|
|
330
316
|
const {
|
|
331
317
|
enable,
|
|
332
318
|
mask = 4294967295,
|
|
@@ -369,9 +355,7 @@ var DeviceModel = class {
|
|
|
369
355
|
/**
|
|
370
356
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
|
|
371
357
|
*/
|
|
372
|
-
initCullDrawParams({
|
|
373
|
-
cull
|
|
374
|
-
}) {
|
|
358
|
+
initCullDrawParams({ cull }) {
|
|
375
359
|
if (cull) {
|
|
376
360
|
const { enable, face = gl.BACK } = cull;
|
|
377
361
|
return {
|
|
@@ -388,12 +372,7 @@ var DeviceModel = class {
|
|
|
388
372
|
extractUniforms(uniforms) {
|
|
389
373
|
const extractedUniforms = {};
|
|
390
374
|
Object.keys(uniforms).forEach((uniformName) => {
|
|
391
|
-
this.extractUniformsRecursively(
|
|
392
|
-
uniformName,
|
|
393
|
-
uniforms[uniformName],
|
|
394
|
-
extractedUniforms,
|
|
395
|
-
""
|
|
396
|
-
);
|
|
375
|
+
this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
|
|
397
376
|
});
|
|
398
377
|
return extractedUniforms;
|
|
399
378
|
}
|
package/es/device/index.js
CHANGED
|
@@ -242,12 +242,7 @@ var DeviceRendererService = class {
|
|
|
242
242
|
// @ts-ignore
|
|
243
243
|
(currentFramebuffer == null ? void 0 : currentFramebuffer.clearOptions) || {}
|
|
244
244
|
);
|
|
245
|
-
const colorClearColor = colorAttachment ? colorNewFromRGBA(
|
|
246
|
-
color[0] * 255,
|
|
247
|
-
color[1] * 255,
|
|
248
|
-
color[2] * 255,
|
|
249
|
-
color[3]
|
|
250
|
-
) : TransparentBlack;
|
|
245
|
+
const colorClearColor = colorAttachment ? colorNewFromRGBA(color[0] * 255, color[1] * 255, color[2] * 255, color[3]) : TransparentBlack;
|
|
251
246
|
const depthClearValue = depthStencilAttachment ? depth : void 0;
|
|
252
247
|
const stencilClearValue = depthStencilAttachment ? stencil : void 0;
|
|
253
248
|
const renderPass = this.device.createRenderPass({
|
package/es/regl/ReglModel.js
CHANGED
|
@@ -19,11 +19,7 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
|
|
21
21
|
// src/regl/ReglModel.ts
|
|
22
|
-
import {
|
|
23
|
-
ClipSpaceNearZ,
|
|
24
|
-
preprocessShader_GLSL,
|
|
25
|
-
ViewportOrigin
|
|
26
|
-
} from "@antv/g-device-api";
|
|
22
|
+
import { ClipSpaceNearZ, preprocessShader_GLSL, ViewportOrigin } from "@antv/g-device-api";
|
|
27
23
|
import { gl, removeDuplicateUniforms } from "@antv/l7-core";
|
|
28
24
|
import { lodashUtil } from "@antv/l7-utils";
|
|
29
25
|
import {
|
|
@@ -41,18 +37,7 @@ var ReglModel = class {
|
|
|
41
37
|
this.destroyed = false;
|
|
42
38
|
this.uniforms = {};
|
|
43
39
|
this.reGl = reGl;
|
|
44
|
-
const {
|
|
45
|
-
vs,
|
|
46
|
-
fs,
|
|
47
|
-
attributes,
|
|
48
|
-
uniforms,
|
|
49
|
-
primitive,
|
|
50
|
-
count,
|
|
51
|
-
elements,
|
|
52
|
-
depth,
|
|
53
|
-
cull,
|
|
54
|
-
instances
|
|
55
|
-
} = options;
|
|
40
|
+
const { vs, fs, attributes, uniforms, primitive, count, elements, depth, cull, instances } = options;
|
|
56
41
|
const vendorInfo = {
|
|
57
42
|
platformString: "WebGL1",
|
|
58
43
|
glslVersion: "#version 100",
|
|
@@ -190,9 +175,7 @@ var ReglModel = class {
|
|
|
190
175
|
};
|
|
191
176
|
}
|
|
192
177
|
}
|
|
193
|
-
getBlendDrawParams({
|
|
194
|
-
blend
|
|
195
|
-
}) {
|
|
178
|
+
getBlendDrawParams({ blend }) {
|
|
196
179
|
const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
|
|
197
180
|
return {
|
|
198
181
|
enable: !!enable,
|
|
@@ -212,9 +195,7 @@ var ReglModel = class {
|
|
|
212
195
|
/**
|
|
213
196
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
214
197
|
*/
|
|
215
|
-
getStencilDrawParams({
|
|
216
|
-
stencil
|
|
217
|
-
}) {
|
|
198
|
+
getStencilDrawParams({ stencil }) {
|
|
218
199
|
const {
|
|
219
200
|
enable,
|
|
220
201
|
mask = -1,
|
|
@@ -276,12 +257,7 @@ var ReglModel = class {
|
|
|
276
257
|
extractUniforms(uniforms) {
|
|
277
258
|
const extractedUniforms = {};
|
|
278
259
|
Object.keys(uniforms).forEach((uniformName) => {
|
|
279
|
-
this.extractUniformsRecursively(
|
|
280
|
-
uniformName,
|
|
281
|
-
uniforms[uniformName],
|
|
282
|
-
extractedUniforms,
|
|
283
|
-
""
|
|
284
|
-
);
|
|
260
|
+
this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
|
|
285
261
|
});
|
|
286
262
|
return extractedUniforms;
|
|
287
263
|
}
|
|
@@ -24,15 +24,7 @@ __export(DeviceAttribute_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(DeviceAttribute_exports);
|
|
25
25
|
var DeviceAttribute = class {
|
|
26
26
|
constructor(device, options) {
|
|
27
|
-
const {
|
|
28
|
-
buffer,
|
|
29
|
-
offset,
|
|
30
|
-
stride,
|
|
31
|
-
normalized,
|
|
32
|
-
size,
|
|
33
|
-
divisor,
|
|
34
|
-
shaderLocation
|
|
35
|
-
} = options;
|
|
27
|
+
const { buffer, offset, stride, normalized, size, divisor, shaderLocation } = options;
|
|
36
28
|
this.buffer = buffer;
|
|
37
29
|
this.attribute = {
|
|
38
30
|
shaderLocation,
|
|
@@ -37,10 +37,7 @@ function attachmentStateHash(hash, a) {
|
|
|
37
37
|
return hash;
|
|
38
38
|
}
|
|
39
39
|
function colorHash(hash, a) {
|
|
40
|
-
hash = (0, import_HashMap.hashCodeNumberUpdate)(
|
|
41
|
-
hash,
|
|
42
|
-
a.r << 24 | a.g << 16 | a.b << 8 | a.a
|
|
43
|
-
);
|
|
40
|
+
hash = (0, import_HashMap.hashCodeNumberUpdate)(hash, a.r << 24 | a.g << 16 | a.b << 8 | a.a);
|
|
44
41
|
return hash;
|
|
45
42
|
}
|
|
46
43
|
function megaStateDescriptorHash(hash, a) {
|
|
@@ -139,7 +136,10 @@ var RenderCache = class {
|
|
|
139
136
|
import_g_device_api.bindingsDescriptorEquals,
|
|
140
137
|
bindingsDescriptorHash
|
|
141
138
|
);
|
|
142
|
-
this.renderPipelinesCache = new import_HashMap.HashMap(
|
|
139
|
+
this.renderPipelinesCache = new import_HashMap.HashMap(
|
|
140
|
+
import_g_device_api.renderPipelineDescriptorEquals,
|
|
141
|
+
renderPipelineDescriptorHash
|
|
142
|
+
);
|
|
143
143
|
this.inputLayoutsCache = new import_HashMap.HashMap(
|
|
144
144
|
import_g_device_api.inputLayoutDescriptorEquals,
|
|
145
145
|
import_HashMap.nullHashFunc
|
|
@@ -166,7 +166,9 @@ var RenderCache = class {
|
|
|
166
166
|
let renderPipeline = this.renderPipelinesCache.get(descriptor);
|
|
167
167
|
if (renderPipeline === null) {
|
|
168
168
|
const descriptorCopy = (0, import_g_device_api.renderPipelineDescriptorCopy)(descriptor);
|
|
169
|
-
descriptorCopy.colorAttachmentFormats = descriptorCopy.colorAttachmentFormats.filter(
|
|
169
|
+
descriptorCopy.colorAttachmentFormats = descriptorCopy.colorAttachmentFormats.filter(
|
|
170
|
+
(f) => f
|
|
171
|
+
);
|
|
170
172
|
renderPipeline = this.device.createRenderPipeline(descriptorCopy);
|
|
171
173
|
this.renderPipelinesCache.add(descriptorCopy, renderPipeline);
|
|
172
174
|
}
|
|
@@ -33,9 +33,7 @@ var DeviceElements = class {
|
|
|
33
33
|
if ((0, import_typedarray.isTypedArray)(data)) {
|
|
34
34
|
typed = data;
|
|
35
35
|
} else {
|
|
36
|
-
typed = new import_constants.typedArrayCtorMap[this.type || import_l7_core.gl.UNSIGNED_INT](
|
|
37
|
-
data
|
|
38
|
-
);
|
|
36
|
+
typed = new import_constants.typedArrayCtorMap[this.type || import_l7_core.gl.UNSIGNED_INT](data);
|
|
39
37
|
}
|
|
40
38
|
this.type = type;
|
|
41
39
|
this.count = count;
|
|
@@ -54,9 +52,7 @@ var DeviceElements = class {
|
|
|
54
52
|
if ((0, import_typedarray.isTypedArray)(data)) {
|
|
55
53
|
typed = data;
|
|
56
54
|
} else {
|
|
57
|
-
typed = new import_constants.typedArrayCtorMap[this.type || import_l7_core.gl.UNSIGNED_INT](
|
|
58
|
-
data
|
|
59
|
-
);
|
|
55
|
+
typed = new import_constants.typedArrayCtorMap[this.type || import_l7_core.gl.UNSIGNED_INT](data);
|
|
60
56
|
}
|
|
61
57
|
this.indexBuffer.setSubData(0, new Uint8Array(typed.buffer));
|
|
62
58
|
}
|
|
@@ -39,9 +39,7 @@ var DeviceFramebuffer = class {
|
|
|
39
39
|
color.resize({ width, height });
|
|
40
40
|
}
|
|
41
41
|
this.colorTexture = color.get();
|
|
42
|
-
this.colorRenderTarget = this.device.createRenderTargetFromTexture(
|
|
43
|
-
this.colorTexture
|
|
44
|
-
);
|
|
42
|
+
this.colorRenderTarget = this.device.createRenderTargetFromTexture(this.colorTexture);
|
|
45
43
|
this.width = color["width"];
|
|
46
44
|
this.height = color["height"];
|
|
47
45
|
} else if (width && height) {
|
|
@@ -51,9 +49,7 @@ var DeviceFramebuffer = class {
|
|
|
51
49
|
width,
|
|
52
50
|
height
|
|
53
51
|
});
|
|
54
|
-
this.colorRenderTarget = this.device.createRenderTargetFromTexture(
|
|
55
|
-
this.colorTexture
|
|
56
|
-
);
|
|
52
|
+
this.colorRenderTarget = this.device.createRenderTargetFromTexture(this.colorTexture);
|
|
57
53
|
this.width = width;
|
|
58
54
|
this.height = height;
|
|
59
55
|
}
|
|
@@ -67,9 +63,7 @@ var DeviceFramebuffer = class {
|
|
|
67
63
|
depth.resize({ width, height });
|
|
68
64
|
}
|
|
69
65
|
this.depthTexture = depth.get();
|
|
70
|
-
this.depthRenderTarget = this.device.createRenderTargetFromTexture(
|
|
71
|
-
this.depthTexture
|
|
72
|
-
);
|
|
66
|
+
this.depthRenderTarget = this.device.createRenderTargetFromTexture(this.depthTexture);
|
|
73
67
|
this.width = depth["width"];
|
|
74
68
|
this.height = depth["height"];
|
|
75
69
|
} else if (width && height) {
|
|
@@ -79,9 +73,7 @@ var DeviceFramebuffer = class {
|
|
|
79
73
|
width,
|
|
80
74
|
height
|
|
81
75
|
});
|
|
82
|
-
this.depthRenderTarget = this.device.createRenderTargetFromTexture(
|
|
83
|
-
this.depthTexture
|
|
84
|
-
);
|
|
76
|
+
this.depthRenderTarget = this.device.createRenderTargetFromTexture(this.depthTexture);
|
|
85
77
|
this.width = width;
|
|
86
78
|
this.height = height;
|
|
87
79
|
}
|
|
@@ -64,15 +64,7 @@ var DeviceModel = class {
|
|
|
64
64
|
this.destroyed = false;
|
|
65
65
|
this.uniforms = {};
|
|
66
66
|
this.vertexBuffers = [];
|
|
67
|
-
const {
|
|
68
|
-
vs,
|
|
69
|
-
fs,
|
|
70
|
-
attributes,
|
|
71
|
-
uniforms,
|
|
72
|
-
count,
|
|
73
|
-
elements,
|
|
74
|
-
diagnosticDerivativeUniformityEnabled
|
|
75
|
-
} = options;
|
|
67
|
+
const { vs, fs, attributes, uniforms, count, elements, diagnosticDerivativeUniformityEnabled } = options;
|
|
76
68
|
this.options = options;
|
|
77
69
|
const diagnosticDerivativeUniformityHeader = diagnosticDerivativeUniformityEnabled ? "" : this.service["viewportOrigin"] === import_g_device_api.ViewportOrigin.UPPER_LEFT ? "diagnostic(off,derivative_uniformity);" : "";
|
|
78
70
|
this.program = service.renderCache.createProgram({
|
|
@@ -300,9 +292,7 @@ var DeviceModel = class {
|
|
|
300
292
|
this.pipeline.destroy();
|
|
301
293
|
this.destroyed = true;
|
|
302
294
|
}
|
|
303
|
-
initDepthDrawParams({
|
|
304
|
-
depth
|
|
305
|
-
}) {
|
|
295
|
+
initDepthDrawParams({ depth }) {
|
|
306
296
|
if (depth) {
|
|
307
297
|
return {
|
|
308
298
|
enable: depth.enable === void 0 ? true : !!depth.enable,
|
|
@@ -312,9 +302,7 @@ var DeviceModel = class {
|
|
|
312
302
|
};
|
|
313
303
|
}
|
|
314
304
|
}
|
|
315
|
-
getBlendDrawParams({
|
|
316
|
-
blend
|
|
317
|
-
}) {
|
|
305
|
+
getBlendDrawParams({ blend }) {
|
|
318
306
|
const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
|
|
319
307
|
return {
|
|
320
308
|
enable: !!enable,
|
|
@@ -334,9 +322,7 @@ var DeviceModel = class {
|
|
|
334
322
|
/**
|
|
335
323
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
336
324
|
*/
|
|
337
|
-
getStencilDrawParams({
|
|
338
|
-
stencil
|
|
339
|
-
}) {
|
|
325
|
+
getStencilDrawParams({ stencil }) {
|
|
340
326
|
const {
|
|
341
327
|
enable,
|
|
342
328
|
mask = 4294967295,
|
|
@@ -379,9 +365,7 @@ var DeviceModel = class {
|
|
|
379
365
|
/**
|
|
380
366
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#culling
|
|
381
367
|
*/
|
|
382
|
-
initCullDrawParams({
|
|
383
|
-
cull
|
|
384
|
-
}) {
|
|
368
|
+
initCullDrawParams({ cull }) {
|
|
385
369
|
if (cull) {
|
|
386
370
|
const { enable, face = import_l7_core.gl.BACK } = cull;
|
|
387
371
|
return {
|
|
@@ -398,12 +382,7 @@ var DeviceModel = class {
|
|
|
398
382
|
extractUniforms(uniforms) {
|
|
399
383
|
const extractedUniforms = {};
|
|
400
384
|
Object.keys(uniforms).forEach((uniformName) => {
|
|
401
|
-
this.extractUniformsRecursively(
|
|
402
|
-
uniformName,
|
|
403
|
-
uniforms[uniformName],
|
|
404
|
-
extractedUniforms,
|
|
405
|
-
""
|
|
406
|
-
);
|
|
385
|
+
this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
|
|
407
386
|
});
|
|
408
387
|
return extractedUniforms;
|
|
409
388
|
}
|
package/lib/device/index.js
CHANGED
|
@@ -266,12 +266,7 @@ var DeviceRendererService = class {
|
|
|
266
266
|
// @ts-ignore
|
|
267
267
|
(currentFramebuffer == null ? void 0 : currentFramebuffer.clearOptions) || {}
|
|
268
268
|
);
|
|
269
|
-
const colorClearColor = colorAttachment ? (0, import_g_device_api.colorNewFromRGBA)(
|
|
270
|
-
color[0] * 255,
|
|
271
|
-
color[1] * 255,
|
|
272
|
-
color[2] * 255,
|
|
273
|
-
color[3]
|
|
274
|
-
) : import_g_device_api.TransparentBlack;
|
|
269
|
+
const colorClearColor = colorAttachment ? (0, import_g_device_api.colorNewFromRGBA)(color[0] * 255, color[1] * 255, color[2] * 255, color[3]) : import_g_device_api.TransparentBlack;
|
|
275
270
|
const depthClearValue = depthStencilAttachment ? depth : void 0;
|
|
276
271
|
const stencilClearValue = depthStencilAttachment ? stencil : void 0;
|
|
277
272
|
const renderPass = this.device.createRenderPass({
|
package/lib/regl/ReglModel.js
CHANGED
|
@@ -49,18 +49,7 @@ var ReglModel = class {
|
|
|
49
49
|
this.destroyed = false;
|
|
50
50
|
this.uniforms = {};
|
|
51
51
|
this.reGl = reGl;
|
|
52
|
-
const {
|
|
53
|
-
vs,
|
|
54
|
-
fs,
|
|
55
|
-
attributes,
|
|
56
|
-
uniforms,
|
|
57
|
-
primitive,
|
|
58
|
-
count,
|
|
59
|
-
elements,
|
|
60
|
-
depth,
|
|
61
|
-
cull,
|
|
62
|
-
instances
|
|
63
|
-
} = options;
|
|
52
|
+
const { vs, fs, attributes, uniforms, primitive, count, elements, depth, cull, instances } = options;
|
|
64
53
|
const vendorInfo = {
|
|
65
54
|
platformString: "WebGL1",
|
|
66
55
|
glslVersion: "#version 100",
|
|
@@ -198,9 +187,7 @@ var ReglModel = class {
|
|
|
198
187
|
};
|
|
199
188
|
}
|
|
200
189
|
}
|
|
201
|
-
getBlendDrawParams({
|
|
202
|
-
blend
|
|
203
|
-
}) {
|
|
190
|
+
getBlendDrawParams({ blend }) {
|
|
204
191
|
const { enable, func, equation, color = [0, 0, 0, 0] } = blend || {};
|
|
205
192
|
return {
|
|
206
193
|
enable: !!enable,
|
|
@@ -220,9 +207,7 @@ var ReglModel = class {
|
|
|
220
207
|
/**
|
|
221
208
|
* @see https://github.com/regl-project/regl/blob/gh-pages/API.md#stencil
|
|
222
209
|
*/
|
|
223
|
-
getStencilDrawParams({
|
|
224
|
-
stencil
|
|
225
|
-
}) {
|
|
210
|
+
getStencilDrawParams({ stencil }) {
|
|
226
211
|
const {
|
|
227
212
|
enable,
|
|
228
213
|
mask = -1,
|
|
@@ -284,12 +269,7 @@ var ReglModel = class {
|
|
|
284
269
|
extractUniforms(uniforms) {
|
|
285
270
|
const extractedUniforms = {};
|
|
286
271
|
Object.keys(uniforms).forEach((uniformName) => {
|
|
287
|
-
this.extractUniformsRecursively(
|
|
288
|
-
uniformName,
|
|
289
|
-
uniforms[uniformName],
|
|
290
|
-
extractedUniforms,
|
|
291
|
-
""
|
|
292
|
-
);
|
|
272
|
+
this.extractUniformsRecursively(uniformName, uniforms[uniformName], extractedUniforms, "");
|
|
293
273
|
});
|
|
294
274
|
return extractedUniforms;
|
|
295
275
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-renderer",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.4-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "https://github.com/orgs/antvis/people",
|
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
"lib",
|
|
13
13
|
"es"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"dev": "father dev",
|
|
17
|
-
"build": "npm run clean && father build",
|
|
18
|
-
"check-deps": "father doctor",
|
|
19
|
-
"lint": "eslint src __tests__",
|
|
20
|
-
"clean": "rimraf dist es lib",
|
|
21
|
-
"sync": "tnpm sync"
|
|
22
|
-
},
|
|
23
15
|
"dependencies": {
|
|
24
16
|
"@antv/g-device-api": "^1.6.4",
|
|
25
|
-
"@antv/l7-core": "^2.21.2",
|
|
26
|
-
"@antv/l7-utils": "^2.21.2",
|
|
27
17
|
"@babel/runtime": "^7.7.7",
|
|
28
|
-
"regl": "1.6.1"
|
|
18
|
+
"regl": "1.6.1",
|
|
19
|
+
"@antv/l7-core": "2.21.4-beta.0",
|
|
20
|
+
"@antv/l7-utils": "2.21.4-beta.0"
|
|
29
21
|
},
|
|
30
|
-
"
|
|
31
|
-
"@antv/l7-test-utils": "
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@antv/l7-test-utils": "2.21.4-beta.0"
|
|
32
24
|
},
|
|
33
25
|
"publishConfig": {
|
|
34
|
-
"access": "public"
|
|
26
|
+
"access": "public",
|
|
27
|
+
"registry": "https://registry.npmjs.org"
|
|
35
28
|
},
|
|
36
|
-
"
|
|
37
|
-
|
|
29
|
+
"repository": "git@github.com:antvis/L7.git",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"dev": "father dev",
|
|
32
|
+
"build": "npm run clean && father build",
|
|
33
|
+
"check-deps": "father doctor",
|
|
34
|
+
"lint": "eslint src __tests__",
|
|
35
|
+
"clean": "rimraf dist es lib"
|
|
36
|
+
}
|
|
37
|
+
}
|