@shopware-ag/dive 1.9.0 → 1.10.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/build/dive.cjs +33 -0
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +3 -2
- package/build/dive.d.ts +3 -2
- package/build/dive.js +48 -15
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/com/types.ts +3 -2
- package/src/model/Model.ts +50 -1
- package/src/model/__test__/Model.test.ts +68 -19
- package/src/primitive/__test__/Primitive.test.ts +2 -4
- package/src/scene/root/modelroot/ModelRoot.ts +1 -0
- package/src/scene/root/modelroot/__test__/ModelRoot.test.ts +3 -0
package/build/dive.d.cts
CHANGED
|
@@ -226,6 +226,7 @@ type COMModel = COMBaseEntity & {
|
|
|
226
226
|
rotation: Vector3Like;
|
|
227
227
|
scale: Vector3Like;
|
|
228
228
|
loaded: boolean;
|
|
229
|
+
material?: COMMaterial;
|
|
229
230
|
};
|
|
230
231
|
type COMGeometry = {
|
|
231
232
|
name: string;
|
|
@@ -236,9 +237,9 @@ type COMGeometry = {
|
|
|
236
237
|
type COMMaterial = {
|
|
237
238
|
color: string | number;
|
|
238
239
|
roughness: number;
|
|
239
|
-
roughnessMap
|
|
240
|
+
roughnessMap?: Texture;
|
|
240
241
|
metalness: number;
|
|
241
|
-
metalnessMap
|
|
242
|
+
metalnessMap?: Texture;
|
|
242
243
|
};
|
|
243
244
|
type COMPrimitive = COMBaseEntity & {
|
|
244
245
|
position: Vector3Like;
|
package/build/dive.d.ts
CHANGED
|
@@ -226,6 +226,7 @@ type COMModel = COMBaseEntity & {
|
|
|
226
226
|
rotation: Vector3Like;
|
|
227
227
|
scale: Vector3Like;
|
|
228
228
|
loaded: boolean;
|
|
229
|
+
material?: COMMaterial;
|
|
229
230
|
};
|
|
230
231
|
type COMGeometry = {
|
|
231
232
|
name: string;
|
|
@@ -236,9 +237,9 @@ type COMGeometry = {
|
|
|
236
237
|
type COMMaterial = {
|
|
237
238
|
color: string | number;
|
|
238
239
|
roughness: number;
|
|
239
|
-
roughnessMap
|
|
240
|
+
roughnessMap?: Texture;
|
|
240
241
|
metalness: number;
|
|
241
|
-
metalnessMap
|
|
242
|
+
metalnessMap?: Texture;
|
|
242
243
|
};
|
|
243
244
|
type COMPrimitive = COMBaseEntity & {
|
|
244
245
|
position: Vector3Like;
|
package/build/dive.js
CHANGED
|
@@ -649,7 +649,7 @@ var DIVERenderer = class extends WebGLRenderer {
|
|
|
649
649
|
};
|
|
650
650
|
|
|
651
651
|
// src/scene/Scene.ts
|
|
652
|
-
import { Color as
|
|
652
|
+
import { Color as Color8, Scene as Scene2 } from "three";
|
|
653
653
|
|
|
654
654
|
// src/scene/root/Root.ts
|
|
655
655
|
import { Box3 as Box33, Object3D as Object3D11 } from "three";
|
|
@@ -1195,7 +1195,7 @@ import { Object3D as Object3D7 } from "three";
|
|
|
1195
1195
|
|
|
1196
1196
|
// src/model/Model.ts
|
|
1197
1197
|
init_VisibilityLayerMask();
|
|
1198
|
-
import { Box3, Object3D as Object3D6, Raycaster as Raycaster2, Vector3 as Vector32 } from "three";
|
|
1198
|
+
import { Box3, Color as Color5, MeshStandardMaterial, Object3D as Object3D6, Raycaster as Raycaster2, Vector3 as Vector32 } from "three";
|
|
1199
1199
|
|
|
1200
1200
|
// src/helper/findSceneRecursive/findSceneRecursive.ts
|
|
1201
1201
|
var findSceneRecursive = (object) => {
|
|
@@ -1212,6 +1212,8 @@ var DIVEModel = class extends Object3D6 {
|
|
|
1212
1212
|
this.isSelectable = true;
|
|
1213
1213
|
this.isMoveable = true;
|
|
1214
1214
|
this.gizmo = null;
|
|
1215
|
+
this._mesh = null;
|
|
1216
|
+
this._material = null;
|
|
1215
1217
|
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
1216
1218
|
this.boundingBox = new Box3();
|
|
1217
1219
|
}
|
|
@@ -1222,6 +1224,14 @@ var DIVEModel = class extends Object3D6 {
|
|
|
1222
1224
|
child.receiveShadow = true;
|
|
1223
1225
|
child.layers.mask = this.layers.mask;
|
|
1224
1226
|
this.boundingBox.expandByObject(child);
|
|
1227
|
+
if (!this._mesh && "isMesh" in child) {
|
|
1228
|
+
this._mesh = child;
|
|
1229
|
+
if (this._material) {
|
|
1230
|
+
this._mesh.material = this._material;
|
|
1231
|
+
} else {
|
|
1232
|
+
this._material = child.material;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1225
1235
|
});
|
|
1226
1236
|
this.add(gltf.scene);
|
|
1227
1237
|
}
|
|
@@ -1239,6 +1249,28 @@ var DIVEModel = class extends Object3D6 {
|
|
|
1239
1249
|
child.visible = visible;
|
|
1240
1250
|
});
|
|
1241
1251
|
}
|
|
1252
|
+
SetMaterial(material) {
|
|
1253
|
+
console.error("HERE", this._mesh);
|
|
1254
|
+
if (!this._material) {
|
|
1255
|
+
this._material = new MeshStandardMaterial();
|
|
1256
|
+
}
|
|
1257
|
+
this._material.color = new Color5(material.color);
|
|
1258
|
+
if (material.roughnessMap) {
|
|
1259
|
+
this._material.roughnessMap = material.roughnessMap;
|
|
1260
|
+
this._material.roughness = 1;
|
|
1261
|
+
} else {
|
|
1262
|
+
this._material.roughness = material.roughness;
|
|
1263
|
+
}
|
|
1264
|
+
if (material.metalnessMap) {
|
|
1265
|
+
this._material.metalnessMap = material.metalnessMap;
|
|
1266
|
+
this._material.metalness = 0;
|
|
1267
|
+
} else {
|
|
1268
|
+
this._material.metalness = material.metalness;
|
|
1269
|
+
}
|
|
1270
|
+
if (this._mesh) {
|
|
1271
|
+
this._mesh.material = this._material;
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1242
1274
|
SetToWorldOrigin() {
|
|
1243
1275
|
var _a;
|
|
1244
1276
|
this.position.set(0, 0, 0);
|
|
@@ -1354,6 +1386,7 @@ var DIVEModelRoot = class extends Object3D7 {
|
|
|
1354
1386
|
if (object.rotation !== void 0) sceneObject.SetRotation(object.rotation);
|
|
1355
1387
|
if (object.scale !== void 0) sceneObject.SetScale(object.scale);
|
|
1356
1388
|
if (object.visible !== void 0) sceneObject.SetVisibility(object.visible);
|
|
1389
|
+
if (object.material !== void 0) sceneObject.SetMaterial(object.material);
|
|
1357
1390
|
}
|
|
1358
1391
|
DeleteModel(object) {
|
|
1359
1392
|
if (object.id === void 0) {
|
|
@@ -1392,7 +1425,7 @@ var DIVEModelRoot = class extends Object3D7 {
|
|
|
1392
1425
|
import { Object3D as Object3D9 } from "three";
|
|
1393
1426
|
|
|
1394
1427
|
// src/primitive/Primitive.ts
|
|
1395
|
-
import { Box3 as Box32, BoxGeometry, BufferGeometry, Color as
|
|
1428
|
+
import { Box3 as Box32, BoxGeometry, BufferGeometry, Color as Color6, CylinderGeometry, Float32BufferAttribute, Mesh as Mesh3, Object3D as Object3D8, Raycaster as Raycaster3, SphereGeometry as SphereGeometry2, Uint32BufferAttribute, Vector3 as Vector33 } from "three";
|
|
1396
1429
|
init_VisibilityLayerMask();
|
|
1397
1430
|
var DIVEPrimitive = class extends Object3D8 {
|
|
1398
1431
|
constructor() {
|
|
@@ -1401,7 +1434,7 @@ var DIVEPrimitive = class extends Object3D8 {
|
|
|
1401
1434
|
this.isMoveable = true;
|
|
1402
1435
|
this.gizmo = null;
|
|
1403
1436
|
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
1404
|
-
this._mesh = new
|
|
1437
|
+
this._mesh = new Mesh3();
|
|
1405
1438
|
this._mesh.layers.mask = PRODUCT_LAYER_MASK;
|
|
1406
1439
|
this._mesh.castShadow = true;
|
|
1407
1440
|
this._mesh.receiveShadow = true;
|
|
@@ -1429,7 +1462,7 @@ var DIVEPrimitive = class extends Object3D8 {
|
|
|
1429
1462
|
}
|
|
1430
1463
|
SetMaterial(material) {
|
|
1431
1464
|
const primitiveMaterial = this._mesh.material;
|
|
1432
|
-
primitiveMaterial.color = new
|
|
1465
|
+
primitiveMaterial.color = new Color6(material.color);
|
|
1433
1466
|
if (material.roughnessMap) {
|
|
1434
1467
|
primitiveMaterial.roughnessMap = material.roughnessMap;
|
|
1435
1468
|
primitiveMaterial.roughness = 1;
|
|
@@ -1643,10 +1676,10 @@ var DIVEPrimitiveRoot = class extends Object3D9 {
|
|
|
1643
1676
|
|
|
1644
1677
|
// src/primitive/floor/Floor.ts
|
|
1645
1678
|
init_VisibilityLayerMask();
|
|
1646
|
-
import { Color as
|
|
1647
|
-
var DIVEFloor = class extends
|
|
1679
|
+
import { Color as Color7, Mesh as Mesh4, MeshStandardMaterial as MeshStandardMaterial3, PlaneGeometry } from "three";
|
|
1680
|
+
var DIVEFloor = class extends Mesh4 {
|
|
1648
1681
|
constructor() {
|
|
1649
|
-
super(new PlaneGeometry(1e4, 1e4), new
|
|
1682
|
+
super(new PlaneGeometry(1e4, 1e4), new MeshStandardMaterial3({ color: new Color7(150 / 255, 150 / 255, 150 / 255) }));
|
|
1650
1683
|
this.isFloor = true;
|
|
1651
1684
|
this.name = "Floor";
|
|
1652
1685
|
this.layers.mask = PRODUCT_LAYER_MASK;
|
|
@@ -1657,7 +1690,7 @@ var DIVEFloor = class extends Mesh3 {
|
|
|
1657
1690
|
this.visible = visible;
|
|
1658
1691
|
}
|
|
1659
1692
|
SetColor(color) {
|
|
1660
|
-
this.material.color = new
|
|
1693
|
+
this.material.color = new Color7(color);
|
|
1661
1694
|
}
|
|
1662
1695
|
};
|
|
1663
1696
|
|
|
@@ -1816,12 +1849,12 @@ var DIVEScene = class extends Scene2 {
|
|
|
1816
1849
|
}
|
|
1817
1850
|
constructor() {
|
|
1818
1851
|
super();
|
|
1819
|
-
this.background = new
|
|
1852
|
+
this.background = new Color8(16777215);
|
|
1820
1853
|
this.root = new DIVERoot();
|
|
1821
1854
|
this.add(this.root);
|
|
1822
1855
|
}
|
|
1823
1856
|
SetBackground(color) {
|
|
1824
|
-
this.background = new
|
|
1857
|
+
this.background = new Color8(color);
|
|
1825
1858
|
}
|
|
1826
1859
|
ComputeSceneBB() {
|
|
1827
1860
|
return this.Root.ComputeSceneBB();
|
|
@@ -2059,7 +2092,7 @@ var DIVEAnimationSystem = class {
|
|
|
2059
2092
|
|
|
2060
2093
|
// src/axiscamera/AxisCamera.ts
|
|
2061
2094
|
init_VisibilityLayerMask();
|
|
2062
|
-
import { AxesHelper, Color as
|
|
2095
|
+
import { AxesHelper, Color as Color9, Matrix4, OrthographicCamera, Vector4 } from "three";
|
|
2063
2096
|
import SpriteText from "three-spritetext";
|
|
2064
2097
|
|
|
2065
2098
|
// src/constant/AxisHelperColors.ts
|
|
@@ -2080,9 +2113,9 @@ var DIVEAxisCamera = class extends OrthographicCamera {
|
|
|
2080
2113
|
this.axesHelper.material.depthTest = false;
|
|
2081
2114
|
this.axesHelper.position.set(0, 0, -1);
|
|
2082
2115
|
this.axesHelper.setColors(
|
|
2083
|
-
new
|
|
2084
|
-
new
|
|
2085
|
-
new
|
|
2116
|
+
new Color9(AxesColorRed),
|
|
2117
|
+
new Color9(AxesColorGreen),
|
|
2118
|
+
new Color9(AxesColorBlue)
|
|
2086
2119
|
);
|
|
2087
2120
|
const x = new SpriteText("X", 0.2, AxesColorRedLetter);
|
|
2088
2121
|
const y = new SpriteText("Y", 0.2, AxesColorGreenLetter);
|