pacem 0.40.0-cosa → 0.40.0-delphi
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/css/pacem-dark-content.min.css +1 -1
- package/dist/css/pacem-dark-shell.min.css +1 -1
- package/dist/css/pacem-dark.min.css +1 -1
- package/dist/css/pacem-light-content.min.css +1 -1
- package/dist/css/pacem-light-shell.min.css +1 -1
- package/dist/css/pacem-light.min.css +1 -1
- package/dist/css/pacem-phousys-content.min.css +1 -1
- package/dist/css/pacem-phousys-shell.min.css +1 -1
- package/dist/css/pacem-phousys.min.css +1 -1
- package/dist/js/azure-maps.d.ts +1 -1
- package/dist/js/pacem-2d.d.ts +1 -1
- package/dist/js/pacem-2d.js +39 -26
- package/dist/js/pacem-2d.min.js +2 -2
- package/dist/js/pacem-3d.d.ts +18 -1
- package/dist/js/pacem-3d.js +211 -88
- package/dist/js/pacem-3d.min.js +2 -2
- package/dist/js/pacem-charts.d.ts +1 -1
- package/dist/js/pacem-charts.js +3 -3
- package/dist/js/pacem-charts.min.js +2 -2
- package/dist/js/pacem-cms.d.ts +1 -1
- package/dist/js/pacem-cms.js +96 -80
- package/dist/js/pacem-cms.min.js +2 -2
- package/dist/js/pacem-core.d.ts +1 -1
- package/dist/js/pacem-core.js +100 -68
- package/dist/js/pacem-core.min.js +2 -2
- package/dist/js/pacem-foundation.d.ts +1 -1
- package/dist/js/pacem-foundation.js +1 -1
- package/dist/js/pacem-foundation.min.js +1 -1
- package/dist/js/pacem-fx.d.ts +1 -1
- package/dist/js/pacem-fx.js +1 -1
- package/dist/js/pacem-fx.min.js +1 -1
- package/dist/js/pacem-logging.d.ts +1 -1
- package/dist/js/pacem-logging.js +1 -1
- package/dist/js/pacem-logging.min.js +1 -1
- package/dist/js/pacem-maps.d.ts +1 -1
- package/dist/js/pacem-maps.js +253 -234
- package/dist/js/pacem-maps.min.js +2 -2
- package/dist/js/pacem-media.d.ts +1 -1
- package/dist/js/pacem-media.js +9 -6
- package/dist/js/pacem-media.min.js +2 -2
- package/dist/js/pacem-networking.js +43 -30
- package/dist/js/pacem-networking.min.js +2 -2
- package/dist/js/pacem-numerical.d.ts +1 -1
- package/dist/js/pacem-numerical.js +1 -1
- package/dist/js/pacem-numerical.min.js +1 -1
- package/dist/js/pacem-plus.d.ts +1 -1
- package/dist/js/pacem-plus.js +82 -58
- package/dist/js/pacem-plus.min.js +2 -2
- package/dist/js/pacem-scaffolding.d.ts +8 -1
- package/dist/js/pacem-scaffolding.js +185 -147
- package/dist/js/pacem-scaffolding.min.js +2 -2
- package/dist/js/pacem-ui.d.ts +1 -1
- package/dist/js/pacem-ui.js +37 -24
- package/dist/js/pacem-ui.min.js +2 -2
- package/dist/js/swagger-types.d.ts +1 -1
- package/package.json +8 -6
package/dist/js/pacem-3d.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* pacem v0.40.0-
|
|
2
|
+
* pacem v0.40.0-delphi (https://js.pacem.it)
|
|
3
3
|
* Copyright 2023 Pacem (https://pacem.it)
|
|
4
4
|
* Licensed under MIT
|
|
5
5
|
*/
|
|
@@ -20,6 +20,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
20
20
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
21
21
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
22
22
|
};
|
|
23
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
23
32
|
var Pacem;
|
|
24
33
|
(function (Pacem) {
|
|
25
34
|
var Drawing3D;
|
|
@@ -323,13 +332,14 @@ var Pacem;
|
|
|
323
332
|
}
|
|
324
333
|
/** Calls for a redraw of the current element in the next rendering process. */
|
|
325
334
|
setAsDirty(...flags) {
|
|
335
|
+
var _a;
|
|
326
336
|
// set the flags that identify the stale part of the object to be updated.
|
|
327
337
|
for (let flag of flags) {
|
|
328
338
|
if (!this.flags.includes(flag)) {
|
|
329
339
|
this.flags.push(flag);
|
|
330
340
|
}
|
|
331
341
|
}
|
|
332
|
-
this.stage
|
|
342
|
+
(_a = this.stage) === null || _a === void 0 ? void 0 : _a.render(this);
|
|
333
343
|
}
|
|
334
344
|
}
|
|
335
345
|
_RenderableElement_staleFlags = new WeakMap();
|
|
@@ -576,6 +586,7 @@ var Pacem;
|
|
|
576
586
|
this._itemDispatch(object, point, type, evt);
|
|
577
587
|
};
|
|
578
588
|
this._moveHandler = (evt) => {
|
|
589
|
+
var _a, _b;
|
|
579
590
|
let me = this;
|
|
580
591
|
if (!me.adapter || !me.interactive) {
|
|
581
592
|
return;
|
|
@@ -585,8 +596,8 @@ var Pacem;
|
|
|
585
596
|
let result = me.adapter.raycast({ x: evt.pageX - rect.left, y: evt.pageY - rect.top }, rect);
|
|
586
597
|
// TODO: handle dragging
|
|
587
598
|
if (result != me._lastHitResult) {
|
|
588
|
-
if (result
|
|
589
|
-
const obj = result
|
|
599
|
+
if ((result === null || result === void 0 ? void 0 : result.object) != ((_a = me._lastHitResult) === null || _a === void 0 ? void 0 : _a.object)) {
|
|
600
|
+
const obj = result === null || result === void 0 ? void 0 : result.object, last = (_b = me._lastHitResult) === null || _b === void 0 ? void 0 : _b.object, pt = result === null || result === void 0 ? void 0 : result.point;
|
|
590
601
|
if (!Pacem.Utils.isNull(last)) {
|
|
591
602
|
this._itemDispatch(last, pt, 'out', evt);
|
|
592
603
|
}
|
|
@@ -650,7 +661,7 @@ var Pacem;
|
|
|
650
661
|
val.initialize(this).then(_ => {
|
|
651
662
|
this.items.forEach(i => this._add(i));
|
|
652
663
|
}, e => {
|
|
653
|
-
this.log(Pacem.Logging.LogLevel.Error, e
|
|
664
|
+
this.log(Pacem.Logging.LogLevel.Error, e === null || e === void 0 ? void 0 : e.toString());
|
|
654
665
|
});
|
|
655
666
|
}
|
|
656
667
|
resolve();
|
|
@@ -850,11 +861,12 @@ var Pacem;
|
|
|
850
861
|
this.material = this.createMaterial();
|
|
851
862
|
}
|
|
852
863
|
createMaterial() {
|
|
864
|
+
var _a, _b, _c;
|
|
853
865
|
return {
|
|
854
|
-
opacity: this.opacity
|
|
855
|
-
wireframe: this.wireframe
|
|
866
|
+
opacity: (_a = this.opacity) !== null && _a !== void 0 ? _a : 1.0,
|
|
867
|
+
wireframe: (_b = this.wireframe) !== null && _b !== void 0 ? _b : false,
|
|
856
868
|
color: this.color || Pacem.Utils.Css.getVariableValue(`--${Pacem.PCSS}-color-primary`),
|
|
857
|
-
visible: this.visible
|
|
869
|
+
visible: (_c = this.visible) !== null && _c !== void 0 ? _c : true,
|
|
858
870
|
map: this.map,
|
|
859
871
|
shader: this.shader
|
|
860
872
|
};
|
|
@@ -913,11 +925,12 @@ var Pacem;
|
|
|
913
925
|
}
|
|
914
926
|
return retval;
|
|
915
927
|
}
|
|
916
|
-
const threeJsVersion = '0.
|
|
928
|
+
const threeJsVersion = '0.152.2', lastOrditCtrlJsVersion = '0.147.0';
|
|
929
|
+
;
|
|
917
930
|
const consts = {
|
|
918
931
|
VERSION: threeJsVersion,
|
|
919
|
-
API_URI: `https://unpkg.com/three@${threeJsVersion}/build/three.js`,
|
|
920
|
-
ORBIT_URI: `https://unpkg.com/three@${
|
|
932
|
+
API_URI: `https://unpkg.com/three@${threeJsVersion}/build/three.min.js`,
|
|
933
|
+
ORBIT_URI: `https://unpkg.com/three@${lastOrditCtrlJsVersion}/examples/js/controls/OrbitControls.js`,
|
|
921
934
|
LOADERS: [
|
|
922
935
|
//`https://unpkg.com/three@${threeJsVersion}/examples/js/loaders/OBJLoader.js`,
|
|
923
936
|
//`https://unpkg.com/three@${threeJsVersion}/examples/js/loaders/MTLLoader.js`,
|
|
@@ -1007,17 +1020,18 @@ var Pacem;
|
|
|
1007
1020
|
return light;
|
|
1008
1021
|
}
|
|
1009
1022
|
function materialToMaterial(material) {
|
|
1023
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1010
1024
|
if (Pacem.Utils.isNull(material)) {
|
|
1011
1025
|
return null;
|
|
1012
1026
|
}
|
|
1013
1027
|
const lineBase = {
|
|
1014
1028
|
color: material.color,
|
|
1015
|
-
opacity: material.opacity
|
|
1029
|
+
opacity: (_a = material.opacity) !== null && _a !== void 0 ? _a : 1,
|
|
1016
1030
|
transparent: true,
|
|
1017
|
-
wireframe: material.wireframe
|
|
1018
|
-
visible: material.visible
|
|
1031
|
+
wireframe: (_b = material.wireframe) !== null && _b !== void 0 ? _b : false,
|
|
1032
|
+
visible: (_c = material.visible) !== null && _c !== void 0 ? _c : true
|
|
1019
1033
|
};
|
|
1020
|
-
const base = Pacem.Utils.extend({}, lineBase, { wireframe: material.wireframe
|
|
1034
|
+
const base = Pacem.Utils.extend({}, lineBase, { wireframe: (_d = material.wireframe) !== null && _d !== void 0 ? _d : false });
|
|
1021
1035
|
const mipMapMaterial = (m) => {
|
|
1022
1036
|
if (material.map) {
|
|
1023
1037
|
m['map'] = new THREE.TextureLoader().load(material.map, _ => {
|
|
@@ -1059,9 +1073,9 @@ var Pacem;
|
|
|
1059
1073
|
else if (Pacem.Drawing3D.isLineMaterial(material)) {
|
|
1060
1074
|
const dash = material.dashArray && material.dashArray[0] || null, gap = material.dashArray && material.dashArray.length > 1 && material.dashArray[1] || dash;
|
|
1061
1075
|
const lineMatOptions = Pacem.Utils.extend(lineBase, {
|
|
1062
|
-
linecap: material.lineCap
|
|
1063
|
-
linejoin: material.lineJoin
|
|
1064
|
-
linewidth: material.lineWidth
|
|
1076
|
+
linecap: (_e = material.lineCap) !== null && _e !== void 0 ? _e : 'round',
|
|
1077
|
+
linejoin: (_f = material.lineJoin) !== null && _f !== void 0 ? _f : 'round',
|
|
1078
|
+
linewidth: (_g = material.lineWidth) !== null && _g !== void 0 ? _g : 1
|
|
1065
1079
|
});
|
|
1066
1080
|
return Pacem.Utils.isNullOrEmpty(material.dashArray) ?
|
|
1067
1081
|
new THREE.LineBasicMaterial(lineMatOptions)
|
|
@@ -1103,8 +1117,9 @@ var Pacem;
|
|
|
1103
1117
|
return multi && materials.length > 1 ? materials : material;
|
|
1104
1118
|
}
|
|
1105
1119
|
function load(item) {
|
|
1120
|
+
var _a;
|
|
1106
1121
|
if (!Pacem.Utils.isNullOrEmpty(item.content)) {
|
|
1107
|
-
const type = item.type
|
|
1122
|
+
const type = (_a = item.type) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
1108
1123
|
switch (type) {
|
|
1109
1124
|
case 'obj':
|
|
1110
1125
|
const obj = new THREE['OBJLoader']();
|
|
@@ -1131,21 +1146,23 @@ var Pacem;
|
|
|
1131
1146
|
function isTHREEAvailable() {
|
|
1132
1147
|
return 'THREE' in window;
|
|
1133
1148
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1149
|
+
function whenTHREEAvailable(...args) {
|
|
1150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1151
|
+
const start = Date.now();
|
|
1152
|
+
var initialized = false;
|
|
1153
|
+
do {
|
|
1154
|
+
initialized = isTHREEAvailable();
|
|
1155
|
+
for (let pred of args) {
|
|
1156
|
+
initialized && (initialized = pred());
|
|
1157
|
+
}
|
|
1158
|
+
if (!initialized) {
|
|
1159
|
+
yield new Promise(resolve => setTimeout(resolve, 500));
|
|
1160
|
+
}
|
|
1161
|
+
} while (!initialized && (Date.now() - start) < 30000);
|
|
1142
1162
|
if (!initialized) {
|
|
1143
|
-
|
|
1163
|
+
throw new Error('The wait for THREE adapter initialization timed out.');
|
|
1144
1164
|
}
|
|
1145
|
-
}
|
|
1146
|
-
if (!initialized) {
|
|
1147
|
-
throw new Error('The wait for THREE adapter initialization timed out.');
|
|
1148
|
-
}
|
|
1165
|
+
});
|
|
1149
1166
|
}
|
|
1150
1167
|
let Pacem3DThreeAdapterElement = class Pacem3DThreeAdapterElement extends Drawing3D.Pacem3DAdapterElement {
|
|
1151
1168
|
constructor() {
|
|
@@ -1299,32 +1316,34 @@ var Pacem;
|
|
|
1299
1316
|
return null;
|
|
1300
1317
|
}
|
|
1301
1318
|
// #region ABSTRACT IMPLEMENTATION
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
.
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1319
|
+
initialize(container) {
|
|
1320
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1321
|
+
if (!Pacem.Utils.isNull(this._stage)) {
|
|
1322
|
+
return this._stage;
|
|
1323
|
+
}
|
|
1324
|
+
this._3d = container;
|
|
1325
|
+
const wrapper = container.stage;
|
|
1326
|
+
const stage = this._stage = document.createElement('canvas');
|
|
1327
|
+
wrapper.innerHTML = '';
|
|
1328
|
+
wrapper.appendChild(stage);
|
|
1329
|
+
yield Pacem.CustomElementUtils.importjs(consts.API_URI);
|
|
1330
|
+
yield whenTHREEAvailable();
|
|
1331
|
+
yield Promise.all([Pacem.CustomElementUtils.importjs(consts.ORBIT_URI)]
|
|
1332
|
+
.concat(consts.LOADERS.map(js => Pacem.CustomElementUtils.importjs(js))));
|
|
1333
|
+
// here comes THREE.js
|
|
1334
|
+
this._scene = new THREE.Scene();
|
|
1335
|
+
// this._scene.add(new THREE.Mesh(new THREE.PlaneGeometry(1, 1, 1, 1), consts.DEFAULT_MATERIAL()));
|
|
1336
|
+
this.invalidateSize(container.size);
|
|
1337
|
+
let w = this._stage.width, h = this._stage.height;
|
|
1338
|
+
//if (!ctrl.renderer)
|
|
1339
|
+
let parameters = {
|
|
1340
|
+
canvas: stage, antialias: true, stencil: false, alpha: true //, clearAlpha: 1
|
|
1341
|
+
};
|
|
1342
|
+
this._renderer = new THREE.WebGLRenderer(parameters);
|
|
1343
|
+
this._renderer.setSize(w, h);
|
|
1344
|
+
this.orbit = container.orbit;
|
|
1345
|
+
return stage;
|
|
1346
|
+
});
|
|
1328
1347
|
}
|
|
1329
1348
|
_setCamera(cam) {
|
|
1330
1349
|
this._camera = cam;
|
|
@@ -1485,6 +1504,106 @@ var Pacem;
|
|
|
1485
1504
|
})(Drawing3D = Components.Drawing3D || (Components.Drawing3D = {}));
|
|
1486
1505
|
})(Components = Pacem.Components || (Pacem.Components = {}));
|
|
1487
1506
|
})(Pacem || (Pacem = {}));
|
|
1507
|
+
/// <reference path="../../../../dist/js/pacem-core.d.ts" />
|
|
1508
|
+
/// <reference path="../types.ts" />
|
|
1509
|
+
/// <reference path="../materials/material.ts" />
|
|
1510
|
+
var Pacem;
|
|
1511
|
+
(function (Pacem) {
|
|
1512
|
+
var Components;
|
|
1513
|
+
(function (Components) {
|
|
1514
|
+
var Drawing3D;
|
|
1515
|
+
(function (Drawing3D) {
|
|
1516
|
+
var _Pacem3DWebGPUAdapterElement_stage, _Pacem3DWebGPUAdapterElement__3d;
|
|
1517
|
+
function meshToFloatArray(mesh) {
|
|
1518
|
+
const retval = [];
|
|
1519
|
+
for (let j = 0; j < mesh.triangleIndices.length; j += 3) {
|
|
1520
|
+
const i1 = mesh.triangleIndices[j], i2 = mesh.triangleIndices[j + 1], i3 = mesh.triangleIndices[j + 2];
|
|
1521
|
+
const v1 = mesh.positions[i1], v2 = mesh.positions[i2], v3 = mesh.positions[i3];
|
|
1522
|
+
const uv1 = mesh.textureCoordinates[i1], uv2 = mesh.textureCoordinates[i2], uv3 = mesh.textureCoordinates[i3];
|
|
1523
|
+
const norm1 = mesh.normals[i1], norm2 = mesh.normals[i2], norm3 = mesh.normals[i3];
|
|
1524
|
+
retval.push(v1.x, v1.y, v1.z, 1, norm1.x, norm1.y, norm1.z, 1, uv1.x, uv1.y, v2.x, v2.y, v2.z, 1, norm2.x, norm2.y, norm2.z, 1, uv2.x, uv2.y, v3.x, v3.y, v3.z, 1, norm3.x, norm3.y, norm3.z, 1, uv3.x, uv3.y);
|
|
1525
|
+
}
|
|
1526
|
+
return new Float32Array(retval);
|
|
1527
|
+
}
|
|
1528
|
+
let Pacem3DWebGPUAdapterElement = class Pacem3DWebGPUAdapterElement extends Drawing3D.Pacem3DAdapterElement {
|
|
1529
|
+
constructor() {
|
|
1530
|
+
super(...arguments);
|
|
1531
|
+
_Pacem3DWebGPUAdapterElement_stage.set(this, void 0);
|
|
1532
|
+
_Pacem3DWebGPUAdapterElement__3d.set(this, void 0);
|
|
1533
|
+
}
|
|
1534
|
+
get available() {
|
|
1535
|
+
return 'gpu' in navigator;
|
|
1536
|
+
}
|
|
1537
|
+
invalidateSize(size) {
|
|
1538
|
+
throw new Error("Method not implemented.");
|
|
1539
|
+
}
|
|
1540
|
+
initialize(scene) {
|
|
1541
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1542
|
+
if (!this.available) {
|
|
1543
|
+
return;
|
|
1544
|
+
//throw new Error("WebGPU unavailable.");
|
|
1545
|
+
}
|
|
1546
|
+
if (!Pacem.Utils.isNull(__classPrivateFieldGet(this, _Pacem3DWebGPUAdapterElement_stage, "f"))) {
|
|
1547
|
+
return __classPrivateFieldGet(this, _Pacem3DWebGPUAdapterElement_stage, "f");
|
|
1548
|
+
}
|
|
1549
|
+
__classPrivateFieldSet(this, _Pacem3DWebGPUAdapterElement__3d, scene, "f");
|
|
1550
|
+
const wrapper = scene.stage;
|
|
1551
|
+
const canvas = __classPrivateFieldSet(this, _Pacem3DWebGPUAdapterElement_stage, document.createElement('canvas'), "f");
|
|
1552
|
+
wrapper.innerHTML = '';
|
|
1553
|
+
wrapper.appendChild(canvas);
|
|
1554
|
+
// webgpu
|
|
1555
|
+
const adapter = yield navigator.gpu.requestAdapter();
|
|
1556
|
+
const device = yield adapter.requestDevice();
|
|
1557
|
+
const context = canvas.getContext('webgpu');
|
|
1558
|
+
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
1559
|
+
canvas.width = canvas.clientWidth * devicePixelRatio;
|
|
1560
|
+
canvas.height = canvas.clientHeight * devicePixelRatio;
|
|
1561
|
+
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
|
|
1562
|
+
context.configure({
|
|
1563
|
+
device,
|
|
1564
|
+
format: presentationFormat,
|
|
1565
|
+
alphaMode: 'premultiplied',
|
|
1566
|
+
});
|
|
1567
|
+
// https://github.com/webgpu/webgpu-samples/blob/main/src/sample/twoCubes/main.ts
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
render() {
|
|
1571
|
+
throw new Error("Method not implemented.");
|
|
1572
|
+
}
|
|
1573
|
+
raycast(point, size) {
|
|
1574
|
+
throw new Error("Method not implemented.");
|
|
1575
|
+
}
|
|
1576
|
+
addItem(item) {
|
|
1577
|
+
throw new Error("Method not implemented.");
|
|
1578
|
+
}
|
|
1579
|
+
removeItem(item) {
|
|
1580
|
+
throw new Error("Method not implemented.");
|
|
1581
|
+
}
|
|
1582
|
+
updateItem(item) {
|
|
1583
|
+
throw new Error("Method not implemented.");
|
|
1584
|
+
}
|
|
1585
|
+
zoomFit(...items) {
|
|
1586
|
+
throw new Error("Method not implemented.");
|
|
1587
|
+
}
|
|
1588
|
+
project(point3D) {
|
|
1589
|
+
throw new Error("Method not implemented.");
|
|
1590
|
+
}
|
|
1591
|
+
get scene() {
|
|
1592
|
+
throw new Error("Method not implemented.");
|
|
1593
|
+
}
|
|
1594
|
+
dispose(scene) {
|
|
1595
|
+
throw new Error("Method not implemented.");
|
|
1596
|
+
}
|
|
1597
|
+
};
|
|
1598
|
+
_Pacem3DWebGPUAdapterElement_stage = new WeakMap();
|
|
1599
|
+
_Pacem3DWebGPUAdapterElement__3d = new WeakMap();
|
|
1600
|
+
Pacem3DWebGPUAdapterElement = __decorate([
|
|
1601
|
+
Pacem.CustomElement({ tagName: Pacem.P + '-3d-webgpu-adapter' })
|
|
1602
|
+
], Pacem3DWebGPUAdapterElement);
|
|
1603
|
+
Drawing3D.Pacem3DWebGPUAdapterElement = Pacem3DWebGPUAdapterElement;
|
|
1604
|
+
})(Drawing3D = Components.Drawing3D || (Components.Drawing3D = {}));
|
|
1605
|
+
})(Components = Pacem.Components || (Pacem.Components = {}));
|
|
1606
|
+
})(Pacem || (Pacem = {}));
|
|
1488
1607
|
/// <reference path="material.ts" />
|
|
1489
1608
|
/// <reference path="../types.ts" />
|
|
1490
1609
|
var Pacem;
|
|
@@ -1517,10 +1636,11 @@ var Pacem;
|
|
|
1517
1636
|
super(Pacem.Drawing3D.KnownShader.Lambert);
|
|
1518
1637
|
}
|
|
1519
1638
|
createMaterial() {
|
|
1639
|
+
var _a, _b;
|
|
1520
1640
|
return Pacem.Utils.extend({
|
|
1521
1641
|
emissiveColor: this.emissiveColor || '#000',
|
|
1522
|
-
reflectivity: this.reflectivity
|
|
1523
|
-
refractionRatio: this.refractionRatio
|
|
1642
|
+
reflectivity: (_a = this.reflectivity) !== null && _a !== void 0 ? _a : 0,
|
|
1643
|
+
refractionRatio: (_b = this.refractionRatio) !== null && _b !== void 0 ? _b : 0
|
|
1524
1644
|
}, super.createMaterial());
|
|
1525
1645
|
}
|
|
1526
1646
|
propertyChangedCallback(name, old, val, first) {
|
|
@@ -1565,10 +1685,11 @@ var Pacem;
|
|
|
1565
1685
|
super(Pacem.Drawing3D.KnownShader.Line);
|
|
1566
1686
|
}
|
|
1567
1687
|
createMaterial() {
|
|
1688
|
+
var _a, _b, _c;
|
|
1568
1689
|
return Pacem.Utils.extend({
|
|
1569
|
-
lineWidth: this.lineWidth
|
|
1570
|
-
lineJoin: this.lineJoin
|
|
1571
|
-
lineCap: this.lineCap
|
|
1690
|
+
lineWidth: (_a = this.lineWidth) !== null && _a !== void 0 ? _a : 1,
|
|
1691
|
+
lineJoin: (_b = this.lineJoin) !== null && _b !== void 0 ? _b : 'round',
|
|
1692
|
+
lineCap: (_c = this.lineCap) !== null && _c !== void 0 ? _c : 'round',
|
|
1572
1693
|
dashArray: this.dashArray,
|
|
1573
1694
|
}, super.createMaterial());
|
|
1574
1695
|
}
|
|
@@ -1585,8 +1706,8 @@ var Pacem;
|
|
|
1585
1706
|
__decorate([
|
|
1586
1707
|
Pacem.Watch({
|
|
1587
1708
|
emit: false, converter: {
|
|
1588
|
-
convert: (attr) => attr
|
|
1589
|
-
convertBack: (prop) => prop
|
|
1709
|
+
convert: (attr) => attr === null || attr === void 0 ? void 0 : attr.split(',').map(i => parseInt(i)).filter(i => !Number.isNaN(i)),
|
|
1710
|
+
convertBack: (prop) => prop === null || prop === void 0 ? void 0 : prop.join(',')
|
|
1590
1711
|
}
|
|
1591
1712
|
})
|
|
1592
1713
|
], LineMaterialElement.prototype, "dashArray", void 0);
|
|
@@ -1609,13 +1730,14 @@ var Pacem;
|
|
|
1609
1730
|
super(Pacem.Drawing3D.KnownShader.Phong);
|
|
1610
1731
|
}
|
|
1611
1732
|
createMaterial() {
|
|
1733
|
+
var _a, _b, _c, _d;
|
|
1612
1734
|
return Pacem.Utils.extend({
|
|
1613
1735
|
emissiveColor: this.emissiveColor || '#000',
|
|
1614
|
-
reflectivity: this.reflectivity
|
|
1615
|
-
refractionRatio: this.refractionRatio
|
|
1736
|
+
reflectivity: (_a = this.reflectivity) !== null && _a !== void 0 ? _a : 0,
|
|
1737
|
+
refractionRatio: (_b = this.refractionRatio) !== null && _b !== void 0 ? _b : 0,
|
|
1616
1738
|
specularColor: this.specularColor || '#000',
|
|
1617
|
-
shininess: this.shininess
|
|
1618
|
-
flatShading: this.flatShading
|
|
1739
|
+
shininess: (_c = this.shininess) !== null && _c !== void 0 ? _c : 0,
|
|
1740
|
+
flatShading: (_d = this.flatShading) !== null && _d !== void 0 ? _d : true
|
|
1619
1741
|
}, super.createMaterial());
|
|
1620
1742
|
}
|
|
1621
1743
|
propertyChangedCallback(name, old, val, first) {
|
|
@@ -1671,12 +1793,13 @@ var Pacem;
|
|
|
1671
1793
|
super(Pacem.Drawing3D.KnownShader.Standard);
|
|
1672
1794
|
}
|
|
1673
1795
|
createMaterial() {
|
|
1796
|
+
var _a, _b, _c, _d;
|
|
1674
1797
|
return Pacem.Utils.extend({
|
|
1675
1798
|
emissiveColor: this.emissiveColor || '#000',
|
|
1676
|
-
refractionRatio: this.refractionRatio
|
|
1677
|
-
metalness: this.metalness
|
|
1678
|
-
roughness: this.roughness
|
|
1679
|
-
flatShading: this.flatShading
|
|
1799
|
+
refractionRatio: (_a = this.refractionRatio) !== null && _a !== void 0 ? _a : 0,
|
|
1800
|
+
metalness: (_b = this.metalness) !== null && _b !== void 0 ? _b : 0,
|
|
1801
|
+
roughness: (_c = this.roughness) !== null && _c !== void 0 ? _c : 0,
|
|
1802
|
+
flatShading: (_d = this.flatShading) !== null && _d !== void 0 ? _d : false
|
|
1680
1803
|
}, super.createMaterial());
|
|
1681
1804
|
}
|
|
1682
1805
|
propertyChangedCallback(name, old, val, first) {
|
|
@@ -2061,10 +2184,10 @@ var Pacem;
|
|
|
2061
2184
|
let PacemCylinderElement = PacemCylinderElement_1 = class PacemCylinderElement extends Drawing3D.Pacem3DPrimitiveElement {
|
|
2062
2185
|
static createMeshGeometry(radius, height, sides, heightSegments, capSegments) {
|
|
2063
2186
|
const r = radius || 1.0;
|
|
2064
|
-
height
|
|
2065
|
-
sides
|
|
2066
|
-
heightSegments
|
|
2067
|
-
capSegments
|
|
2187
|
+
height || (height = 1.0);
|
|
2188
|
+
sides || (sides = 18);
|
|
2189
|
+
heightSegments || (heightSegments = 5);
|
|
2190
|
+
capSegments || (capSegments = 1);
|
|
2068
2191
|
const nodes = [], uv = [], indices = [];
|
|
2069
2192
|
const theta = Drawing3D.DEG2RAD * (360.0 / sides);
|
|
2070
2193
|
// top & bottom vertices (pivot @(0,0,0))
|
|
@@ -2295,10 +2418,10 @@ var Pacem;
|
|
|
2295
2418
|
var PacemPlaneElement_1;
|
|
2296
2419
|
let PacemPlaneElement = PacemPlaneElement_1 = class PacemPlaneElement extends Drawing3D.Pacem3DPrimitiveElement {
|
|
2297
2420
|
static createMeshGeometry(width, length, widthSegments, lengthSegments) {
|
|
2298
|
-
width
|
|
2299
|
-
length
|
|
2300
|
-
widthSegments
|
|
2301
|
-
lengthSegments
|
|
2421
|
+
width || (width = 1.0);
|
|
2422
|
+
length || (length = 1.0);
|
|
2423
|
+
widthSegments || (widthSegments = 4);
|
|
2424
|
+
lengthSegments || (lengthSegments = 4);
|
|
2302
2425
|
const nodes = [];
|
|
2303
2426
|
const uv = [];
|
|
2304
2427
|
const indices = [];
|
|
@@ -2414,7 +2537,7 @@ var Pacem;
|
|
|
2414
2537
|
// #region Tetrahedron
|
|
2415
2538
|
let PacemTetrahedronElement = PacemTetrahedronElement_1 = class PacemTetrahedronElement extends PolyhedronElement {
|
|
2416
2539
|
static createMeshGeometry(radius) {
|
|
2417
|
-
radius
|
|
2540
|
+
radius || (radius = 1.0);
|
|
2418
2541
|
const nodesCoordsString = "0 0.5774 -0.8165, 0 0.5774 0.8165, 0.8165 -0.5774 0, -0.8165 -0.5774 0";
|
|
2419
2542
|
const nodesToParse = nodesCoordsString.split(',');
|
|
2420
2543
|
const nodes = [];
|
|
@@ -2449,7 +2572,7 @@ var Pacem;
|
|
|
2449
2572
|
// #region Octahedron
|
|
2450
2573
|
let PacemOctahedronElement = PacemOctahedronElement_1 = class PacemOctahedronElement extends PolyhedronElement {
|
|
2451
2574
|
static createMeshGeometry(radius) {
|
|
2452
|
-
radius
|
|
2575
|
+
radius || (radius = 1.0);
|
|
2453
2576
|
// -------------------------------------------------------------------------------------------------
|
|
2454
2577
|
const nodesCoordsString = "0 0.7071 -0.7071, 0 0.7071 0.7071, 1 0 0, 0 -0.7071 -0.7071, -1 0 0, 0 -0.7071 0.7071";
|
|
2455
2578
|
const indices = [1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 1, 0, 4, 5, 1, 5, 2, 1, 2, 5, 3, 4, 3, 5];
|
|
@@ -2486,7 +2609,7 @@ var Pacem;
|
|
|
2486
2609
|
// #region Hexahedron
|
|
2487
2610
|
let PacemHexahedronElement = PacemHexahedronElement_1 = class PacemHexahedronElement extends PolyhedronElement {
|
|
2488
2611
|
static createMeshGeometry(radius) {
|
|
2489
|
-
radius
|
|
2612
|
+
radius || (radius = 1.0);
|
|
2490
2613
|
const inv_sqrt3 = 1.0 / Math.sqrt(3.0);
|
|
2491
2614
|
const w = 2.0 * radius * inv_sqrt3;
|
|
2492
2615
|
return Pacem.Components.Drawing3D.PacemBoxElement.createMeshGeometry(w, w, w);
|
|
@@ -2503,7 +2626,7 @@ var Pacem;
|
|
|
2503
2626
|
// #region Icosahedron
|
|
2504
2627
|
let PacemIcosahedronElement = PacemIcosahedronElement_1 = class PacemIcosahedronElement extends PolyhedronElement {
|
|
2505
2628
|
static createMeshGeometry(radius) {
|
|
2506
|
-
radius
|
|
2629
|
+
radius || (radius = 1.0);
|
|
2507
2630
|
const nodesCoordsString = "0 0.850651 -0.525731, 0 0.850651 0.525731, 0.850651 0.525731 0, 0.525731 0 -0.850651, -0.525731 0 -0.850651, -0.850651 0.525731 0, -0.525731 0 0.850651, 0.525731 0 0.850651, 0.850651 -0.525731 0, 0 -0.850651 0.525731, 0 -0.850651 -0.525731, -0.850651 -0.525731 0";
|
|
2508
2631
|
const indices = [1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 5, 0, 5, 1, 0,
|
|
2509
2632
|
5, 6, 1, 6, 7, 1, 7, 2, 1, 2, 8, 3,
|
|
@@ -2561,7 +2684,7 @@ var Pacem;
|
|
|
2561
2684
|
// #region Dodecahedron
|
|
2562
2685
|
let PacemDodecahedronElement = PacemDodecahedronElement_1 = class PacemDodecahedronElement extends PolyhedronElement {
|
|
2563
2686
|
static createMeshGeometry(radius) {
|
|
2564
|
-
radius
|
|
2687
|
+
radius || (radius = 1.0);
|
|
2565
2688
|
const n1 = point3D.from(0.356822 * radius, 0.934172 * radius, 0 * radius);
|
|
2566
2689
|
const n2 = point3D.from(-0.356822 * radius, 0.934172 * radius, 0 * radius);
|
|
2567
2690
|
const n3 = point3D.from(0.57735 * radius, 0.57735 * radius, -0.57735 * radius);
|
|
@@ -2804,8 +2927,8 @@ var Pacem;
|
|
|
2804
2927
|
const uv = [];
|
|
2805
2928
|
const coords = [];
|
|
2806
2929
|
//
|
|
2807
|
-
segments
|
|
2808
|
-
sides
|
|
2930
|
+
segments || (segments = 24);
|
|
2931
|
+
sides || (sides = 12);
|
|
2809
2932
|
const theta = Drawing3D.DEG2RAD * (360.0 / segments);
|
|
2810
2933
|
const phi = Drawing3D.DEG2RAD * (360.0 / sides);
|
|
2811
2934
|
const r1 = radius || 1.0;
|