@antv/g-webgpu 1.7.54 → 1.7.55
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/dist/index.umd.js +17 -16
- package/dist/index.umd.min.js +1 -1
- package/package.json +4 -4
package/dist/index.umd.js
CHANGED
|
@@ -10051,7 +10051,7 @@
|
|
|
10051
10051
|
packed.push(x1 - defX + startOffsetX, y1 - defY + startOffsetY, z1, x2 - defX + endOffsetX, y2 - defY + endOffsetY, z2);
|
|
10052
10052
|
});
|
|
10053
10053
|
this.geometry.updateVertexBuffer(InstancedLineVertexAttributeBufferIndex.POINT, InstancedLineVertexAttributeLocation.POINTA, startIndex, new Uint8Array(new Float32Array(packed).buffer));
|
|
10054
|
-
} else if (name === 'lineDashOffset' || name === 'lineDash') {
|
|
10054
|
+
} else if (name === 'lineDashOffset' || name === 'lineDash' || name === 'isBillboard') {
|
|
10055
10055
|
var _packed = [];
|
|
10056
10056
|
objects.forEach(function (object) {
|
|
10057
10057
|
var totalLength = object.getTotalLength();
|
|
@@ -11464,7 +11464,7 @@
|
|
|
11464
11464
|
}(Instanced);
|
|
11465
11465
|
var frag$3 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n }\n}"; // eslint-disable-line
|
|
11466
11466
|
|
|
11467
|
-
var vert$3 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in
|
|
11467
|
+
var vert$3 = "#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec4 a_Size;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\nbool isPerspectiveMatrix(mat4 m) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec2 offset = (a_Uv - u_Anchor.xy) * a_Size.xy;\n\n bool isPerspective = isPerspectiveMatrix(u_ProjectionMatrix);\n\n float isBillboard = a_Size.w;\n if (isBillboard < 0.5) {\n gl_Position = project(vec4(offset, u_ZIndex, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n } else {\n gl_Position = project(vec4(offset, a_Size.z, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n }\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n}"; // eslint-disable-line
|
|
11468
11468
|
|
|
11469
11469
|
var ImageMesh = /*#__PURE__*/function (_Instanced) {
|
|
11470
11470
|
_inheritsLoose$1(ImageMesh, _Instanced);
|
|
@@ -11504,8 +11504,10 @@
|
|
|
11504
11504
|
var offset = i * 4;
|
|
11505
11505
|
var _image$parsedStyle = image.parsedStyle,
|
|
11506
11506
|
width = _image$parsedStyle.width,
|
|
11507
|
-
height = _image$parsedStyle.height
|
|
11508
|
-
|
|
11507
|
+
height = _image$parsedStyle.height,
|
|
11508
|
+
z = _image$parsedStyle.z,
|
|
11509
|
+
isBillboard = _image$parsedStyle.isBillboard;
|
|
11510
|
+
instanced.push(width, height, z, isBillboard ? 1 : 0);
|
|
11509
11511
|
interleaved.push(0, 0, 1, 0, 1, 1, 0, 1);
|
|
11510
11512
|
indices.push(0 + offset, 2 + offset, 1 + offset, 0 + offset, 3 + offset, 2 + offset);
|
|
11511
11513
|
});
|
|
@@ -11513,10 +11515,10 @@
|
|
|
11513
11515
|
this.geometry.vertexCount = 6;
|
|
11514
11516
|
this.geometry.setVertexBuffer({
|
|
11515
11517
|
bufferIndex: VertexAttributeBufferIndex.POSITION,
|
|
11516
|
-
byteStride: 4 *
|
|
11518
|
+
byteStride: 4 * 4,
|
|
11517
11519
|
frequency: VertexBufferFrequency.PerInstance,
|
|
11518
11520
|
attributes: [{
|
|
11519
|
-
format: Format.
|
|
11521
|
+
format: Format.F32_RGBA,
|
|
11520
11522
|
bufferByteOffset: 4 * 0,
|
|
11521
11523
|
location: VertexAttributeLocation.POSITION
|
|
11522
11524
|
}],
|
|
@@ -11537,14 +11539,16 @@
|
|
|
11537
11539
|
_proto.updateAttribute = function updateAttribute(objects, startIndex, name, value) {
|
|
11538
11540
|
_Instanced.prototype.updateAttribute.call(this, objects, startIndex, name, value);
|
|
11539
11541
|
this.updateBatchedAttribute(objects, startIndex, name, value);
|
|
11540
|
-
if (name === 'width' || name === 'height') {
|
|
11542
|
+
if (name === 'width' || name === 'height' || name === 'z' || name === 'isBillboard') {
|
|
11541
11543
|
var packed = [];
|
|
11542
11544
|
objects.forEach(function (object) {
|
|
11543
11545
|
var image = object;
|
|
11544
11546
|
var _image$parsedStyle2 = image.parsedStyle,
|
|
11545
11547
|
width = _image$parsedStyle2.width,
|
|
11546
|
-
height = _image$parsedStyle2.height
|
|
11547
|
-
|
|
11548
|
+
height = _image$parsedStyle2.height,
|
|
11549
|
+
z = _image$parsedStyle2.z,
|
|
11550
|
+
isBillboard = _image$parsedStyle2.isBillboard;
|
|
11551
|
+
packed.push(width, height, z, isBillboard ? 1 : 0);
|
|
11548
11552
|
});
|
|
11549
11553
|
this.geometry.updateVertexBuffer(VertexAttributeBufferIndex.POSITION, VertexAttributeLocation.POSITION, startIndex, new Uint8Array(new Float32Array(packed).buffer));
|
|
11550
11554
|
} else if (name === 'img') {
|
|
@@ -14209,8 +14213,7 @@
|
|
|
14209
14213
|
var _this = this;
|
|
14210
14214
|
var camera = context.camera,
|
|
14211
14215
|
renderingContext = context.renderingContext,
|
|
14212
|
-
renderingService = context.renderingService
|
|
14213
|
-
displayObjectPool = context.displayObjectPool;
|
|
14216
|
+
renderingService = context.renderingService;
|
|
14214
14217
|
this.context = context;
|
|
14215
14218
|
var canvas = renderingContext.root.ownerDocument.defaultView;
|
|
14216
14219
|
var setTransform = function setTransform(object, $el) {
|
|
@@ -14234,6 +14237,7 @@
|
|
|
14234
14237
|
_this.updateAttribute(name, object);
|
|
14235
14238
|
});
|
|
14236
14239
|
setTransform(object, $el);
|
|
14240
|
+
gLite.runtime.nativeHTMLMap.set($el, object);
|
|
14237
14241
|
}
|
|
14238
14242
|
};
|
|
14239
14243
|
var handleUnmounted = function handleUnmounted(e) {
|
|
@@ -14242,6 +14246,7 @@
|
|
|
14242
14246
|
var $el = _this.getOrCreateEl(object);
|
|
14243
14247
|
if ($el) {
|
|
14244
14248
|
$el.remove();
|
|
14249
|
+
gLite.runtime.nativeHTMLMap.delete($el);
|
|
14245
14250
|
}
|
|
14246
14251
|
// const existedId = this.getId(object);
|
|
14247
14252
|
// const $existedElement: HTMLElement | null = this.$camera.querySelector('#' + existedId);
|
|
@@ -14278,16 +14283,12 @@
|
|
|
14278
14283
|
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
14279
14284
|
while (1) switch (_context.prev = _context.next) {
|
|
14280
14285
|
case 0:
|
|
14281
|
-
if (displayObjectPool.getHTMLs().length) {
|
|
14282
|
-
// append camera
|
|
14283
|
-
_this.$camera = _this.createCamera(camera);
|
|
14284
|
-
}
|
|
14285
14286
|
canvas.addEventListener(gLite.CanvasEvent.RESIZE, handleCanvasResize);
|
|
14286
14287
|
canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
|
|
14287
14288
|
canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
14288
14289
|
canvas.addEventListener(gLite.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
14289
14290
|
canvas.addEventListener(gLite.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
14290
|
-
case
|
|
14291
|
+
case 5:
|
|
14291
14292
|
case "end":
|
|
14292
14293
|
return _context.stop();
|
|
14293
14294
|
}
|