@inweb/viewer-three 26.5.5 → 26.6.1
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/plugins/components/LightHelperComponent.js +9 -3
- package/dist/plugins/components/LightHelperComponent.js.map +1 -1
- package/dist/plugins/components/LightHelperComponent.min.js +1 -1
- package/dist/plugins/components/LightHelperComponent.module.js +5 -4
- package/dist/plugins/components/LightHelperComponent.module.js.map +1 -1
- package/dist/plugins/components/RoomEnvironmentComponent.js +178 -0
- package/dist/plugins/components/RoomEnvironmentComponent.js.map +1 -0
- package/dist/plugins/components/RoomEnvironmentComponent.min.js +1 -0
- package/dist/plugins/components/RoomEnvironmentComponent.module.js +21 -0
- package/dist/plugins/components/RoomEnvironmentComponent.module.js.map +1 -0
- package/dist/plugins/loaders/IFCXLoader.js +21 -27
- package/dist/plugins/loaders/IFCXLoader.js.map +1 -1
- package/dist/plugins/loaders/IFCXLoader.min.js +1 -1
- package/dist/plugins/loaders/IFCXLoader.module.js +7 -18
- package/dist/plugins/loaders/IFCXLoader.module.js.map +1 -1
- package/dist/viewer-three.js +25 -173
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +2 -2
- package/dist/viewer-three.module.js +21 -21
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/components/LightComponent.d.ts +3 -1
- package/package.json +5 -5
- package/plugins/components/LightHelperComponent.ts +10 -5
- package/{src/Viewer → plugins}/components/RoomEnvironmentComponent.ts +4 -4
- package/plugins/loaders/IFCX/render.js +26 -21
- package/src/Viewer/components/LightComponent.ts +33 -4
- package/src/Viewer/components/index.ts +0 -2
- package/lib/Viewer/components/RoomEnvironmentComponent.d.ts +0 -7
|
@@ -35,10 +35,16 @@
|
|
|
35
35
|
});
|
|
36
36
|
this.lightHelpers.length = 0;
|
|
37
37
|
const extentsSize = this.viewer.extents.getBoundingSphere(new three.Sphere()).radius * 2;
|
|
38
|
-
const size = extentsSize /
|
|
38
|
+
const size = extentsSize / 20;
|
|
39
39
|
this.viewer.scene.traverse((object) => {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
let helper;
|
|
41
|
+
if (object.isDirectionalLight)
|
|
42
|
+
helper = new three.DirectionalLightHelper(object, size, "#aa0000");
|
|
43
|
+
else if (object.isHemisphereLight)
|
|
44
|
+
helper = new three.HemisphereLightHelper(object, size, "#ff9800");
|
|
45
|
+
else if (object.isPointLight)
|
|
46
|
+
helper = new three.PointLightHelper(object, size, "#ff9800");
|
|
47
|
+
if (helper) {
|
|
42
48
|
this.lightHelpers.push(helper);
|
|
43
49
|
this.viewer.helpers.add(helper);
|
|
44
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightHelperComponent.js","sources":["../../../plugins/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, Sphere } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: DirectionalLightHelper[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.addEventListener(\"clear\", this.geometryEnd);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.removeEventListener(\"clear\", this.geometryEnd);\n }\n\n geometryEnd = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const size = extentsSize /
|
|
1
|
+
{"version":3,"file":"LightHelperComponent.js","sources":["../../../plugins/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, HemisphereLightHelper, PointLightHelper, Sphere } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: (DirectionalLightHelper | HemisphereLightHelper | PointLightHelper)[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.addEventListener(\"clear\", this.geometryEnd);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.removeEventListener(\"clear\", this.geometryEnd);\n }\n\n geometryEnd = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const size = extentsSize / 20;\n\n this.viewer.scene.traverse((object: any) => {\n let helper: DirectionalLightHelper | HemisphereLightHelper | PointLightHelper;\n\n if (object.isDirectionalLight) helper = new DirectionalLightHelper(object, size, \"#aa0000\");\n else if (object.isHemisphereLight) helper = new HemisphereLightHelper(object, size, \"#ff9800\");\n else if (object.isPointLight) helper = new PointLightHelper(object, size, \"#ff9800\");\n\n if (helper) {\n this.lightHelpers.push(helper);\n this.viewer.helpers.add(helper);\n }\n });\n };\n}\n\ncomponents.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n"],"names":["Sphere","DirectionalLightHelper","HemisphereLightHelper","PointLightHelper","components"],"mappings":";;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAKA,MAAM,oBAAoB,CAAA;IAIxB,IAAA,WAAA,CAAY,MAAc,EAAA;YAkB1B,IAAW,CAAA,WAAA,GAAG,MAAK;gBACjB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;oBACnC,MAAM,CAAC,gBAAgB,EAAE;oBACzB,MAAM,CAAC,OAAO,EAAE;IAClB,aAAC,CAAC;IACF,YAAA,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;IAE5B,YAAA,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAIA,YAAM,EAAE,C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AAW,CAAC;YAChE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC;;IA0B7D;AAEDC,0BAAU,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,MAAM,KAAK,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,(function(e,t){"use strict";class i{constructor(t){this.geometryEnd=()=>{this.lightHelpers.forEach((e=>{e.removeFromParent(),e.dispose()})),this.lightHelpers.length=0;const t=2*this.viewer.extents.getBoundingSphere(new e.Sphere).radius/
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,(function(e,t){"use strict";class i{constructor(t){this.geometryEnd=()=>{this.lightHelpers.forEach((e=>{e.removeFromParent(),e.dispose()})),this.lightHelpers.length=0;const t=2*this.viewer.extents.getBoundingSphere(new e.Sphere).radius/20;this.viewer.scene.traverse((i=>{let r;i.isDirectionalLight?r=new e.DirectionalLightHelper(i,t,"#aa0000"):i.isHemisphereLight?r=new e.HemisphereLightHelper(i,t,"#ff9800"):i.isPointLight&&(r=new e.PointLightHelper(i,t,"#ff9800")),r&&(this.lightHelpers.push(r),this.viewer.helpers.add(r))}))},this.lightHelpers=[],this.viewer=t,this.viewer.addEventListener("geometryend",this.geometryEnd),this.viewer.addEventListener("clear",this.geometryEnd)}dispose(){this.lightHelpers.forEach((e=>{e.removeFromParent(),e.dispose()})),this.lightHelpers.length=0,this.viewer.removeEventListener("geometryend",this.geometryEnd),this.viewer.removeEventListener("clear",this.geometryEnd)}}t.components.registerComponent("LightHelperComponent",(e=>new i(e)))}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Sphere, DirectionalLightHelper } from "three";
|
|
1
|
+
import { Sphere, DirectionalLightHelper, HemisphereLightHelper, PointLightHelper } from "three";
|
|
2
2
|
|
|
3
3
|
import { components } from "@inweb/viewer-three";
|
|
4
4
|
|
|
@@ -11,10 +11,11 @@ class LightHelperComponent {
|
|
|
11
11
|
}));
|
|
12
12
|
this.lightHelpers.length = 0;
|
|
13
13
|
const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere).radius * 2;
|
|
14
|
-
const size = extentsSize /
|
|
14
|
+
const size = extentsSize / 20;
|
|
15
15
|
this.viewer.scene.traverse((object => {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
let helper;
|
|
17
|
+
if (object.isDirectionalLight) helper = new DirectionalLightHelper(object, size, "#aa0000"); else if (object.isHemisphereLight) helper = new HemisphereLightHelper(object, size, "#ff9800"); else if (object.isPointLight) helper = new PointLightHelper(object, size, "#ff9800");
|
|
18
|
+
if (helper) {
|
|
18
19
|
this.lightHelpers.push(helper);
|
|
19
20
|
this.viewer.helpers.add(helper);
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LightHelperComponent.module.js","sources":["../../../plugins/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, Sphere } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: DirectionalLightHelper[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.addEventListener(\"clear\", this.geometryEnd);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.removeEventListener(\"clear\", this.geometryEnd);\n }\n\n geometryEnd = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const size = extentsSize /
|
|
1
|
+
{"version":3,"file":"LightHelperComponent.module.js","sources":["../../../plugins/components/LightHelperComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { DirectionalLightHelper, HemisphereLightHelper, PointLightHelper, Sphere } from \"three\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass LightHelperComponent implements IComponent {\n private viewer: Viewer;\n private lightHelpers: (DirectionalLightHelper | HemisphereLightHelper | PointLightHelper)[];\n\n constructor(viewer: Viewer) {\n this.lightHelpers = [];\n this.viewer = viewer;\n this.viewer.addEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.addEventListener(\"clear\", this.geometryEnd);\n }\n\n dispose() {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n this.viewer.removeEventListener(\"geometryend\", this.geometryEnd);\n this.viewer.removeEventListener(\"clear\", this.geometryEnd);\n }\n\n geometryEnd = () => {\n this.lightHelpers.forEach((helper) => {\n helper.removeFromParent();\n helper.dispose();\n });\n this.lightHelpers.length = 0;\n\n const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;\n const size = extentsSize / 20;\n\n this.viewer.scene.traverse((object: any) => {\n let helper: DirectionalLightHelper | HemisphereLightHelper | PointLightHelper;\n\n if (object.isDirectionalLight) helper = new DirectionalLightHelper(object, size, \"#aa0000\");\n else if (object.isHemisphereLight) helper = new HemisphereLightHelper(object, size, \"#ff9800\");\n else if (object.isPointLight) helper = new PointLightHelper(object, size, \"#ff9800\");\n\n if (helper) {\n this.lightHelpers.push(helper);\n this.viewer.helpers.add(helper);\n }\n });\n };\n}\n\ncomponents.registerComponent(\"LightHelperComponent\", (viewer) => new LightHelperComponent(viewer));\n"],"names":["LightHelperComponent","constructor","viewer","this","geometryEnd","lightHelpers","forEach","helper","removeFromParent","dispose","length","extentsSize","extents","getBoundingSphere","Sphere","radius","size","scene","traverse","object","isDirectionalLight","DirectionalLightHelper","isHemisphereLight","HemisphereLightHelper","isPointLight","PointLightHelper","push","helpers","add","addEventListener","removeEventListener","components","registerComponent"],"mappings":";;;;AA0BA,MAAMA;IAIJ,WAAAC,CAAYC;QAkBZC,KAAWC,cAAG;YACZD,KAAKE,aAAaC,SAASC;gBACzBA,OAAOC;gBACPD,OAAOE;AAAS;YAElBN,KAAKE,aAAaK,SAAS;YAE3B,MAAMC,cAAcR,KAAKD,OAAOU,QAAQC,kBAAkB,IAAIC,QAAUC,SAAS;YACjF,MAAMC,OAAOL,cAAc;YAE3BR,KAAKD,OAAOe,MAAMC,UAAUC;gBAC1B,IAAIZ;gBAEJ,IAAIY,OAAOC,oBAAoBb,SAAS,IAAIc,uBAAuBF,QAAQH,MAAM,iBAC5E,IAAIG,OAAOG,mBAAmBf,SAAS,IAAIgB,sBAAsBJ,QAAQH,MAAM,iBAC/E,IAAIG,OAAOK,cAAcjB,SAAS,IAAIkB,iBAAiBN,QAAQH,MAAM;gBAE1E,IAAIT,QAAQ;oBACVJ,KAAKE,aAAaqB,KAAKnB;oBACvBJ,KAAKD,OAAOyB,QAAQC,IAAIrB;;;AAE1B;QAtCFJ,KAAKE,eAAe;QACpBF,KAAKD,SAASA;QACdC,KAAKD,OAAO2B,iBAAiB,eAAe1B,KAAKC;QACjDD,KAAKD,OAAO2B,iBAAiB,SAAS1B,KAAKC;;IAG7C,OAAAK;QACEN,KAAKE,aAAaC,SAASC;YACzBA,OAAOC;YACPD,OAAOE;AAAS;QAElBN,KAAKE,aAAaK,SAAS;QAE3BP,KAAKD,OAAO4B,oBAAoB,eAAe3B,KAAKC;QACpDD,KAAKD,OAAO4B,oBAAoB,SAAS3B,KAAKC;;;;AA4BlD2B,WAAWC,kBAAkB,yBAAyB9B,UAAW,IAAIF,qBAAqBE"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('three'), require('@inweb/viewer-three')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['three', '@inweb/viewer-three'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE, global.ODA.Three));
|
|
5
|
+
})(this, (function (three, viewerThree) { 'use strict';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RoomEnvironment extends three.Scene {
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
|
|
16
|
+
super();
|
|
17
|
+
|
|
18
|
+
const geometry = new three.BoxGeometry();
|
|
19
|
+
geometry.deleteAttribute( 'uv' );
|
|
20
|
+
|
|
21
|
+
const roomMaterial = new three.MeshStandardMaterial( { side: three.BackSide } );
|
|
22
|
+
const boxMaterial = new three.MeshStandardMaterial();
|
|
23
|
+
|
|
24
|
+
const mainLight = new three.PointLight( 0xffffff, 900, 28, 2 );
|
|
25
|
+
mainLight.position.set( 0.418, 16.199, 0.300 );
|
|
26
|
+
this.add( mainLight );
|
|
27
|
+
|
|
28
|
+
const room = new three.Mesh( geometry, roomMaterial );
|
|
29
|
+
room.position.set( -0.757, 13.219, 0.717 );
|
|
30
|
+
room.scale.set( 31.713, 28.305, 28.591 );
|
|
31
|
+
this.add( room );
|
|
32
|
+
|
|
33
|
+
const box1 = new three.Mesh( geometry, boxMaterial );
|
|
34
|
+
box1.position.set( -10.906, 2.009, 1.846 );
|
|
35
|
+
box1.rotation.set( 0, -0.195, 0 );
|
|
36
|
+
box1.scale.set( 2.328, 7.905, 4.651 );
|
|
37
|
+
this.add( box1 );
|
|
38
|
+
|
|
39
|
+
const box2 = new three.Mesh( geometry, boxMaterial );
|
|
40
|
+
box2.position.set( -5.607, -0.754, -0.758 );
|
|
41
|
+
box2.rotation.set( 0, 0.994, 0 );
|
|
42
|
+
box2.scale.set( 1.970, 1.534, 3.955 );
|
|
43
|
+
this.add( box2 );
|
|
44
|
+
|
|
45
|
+
const box3 = new three.Mesh( geometry, boxMaterial );
|
|
46
|
+
box3.position.set( 6.167, 0.857, 7.803 );
|
|
47
|
+
box3.rotation.set( 0, 0.561, 0 );
|
|
48
|
+
box3.scale.set( 3.927, 6.285, 3.687 );
|
|
49
|
+
this.add( box3 );
|
|
50
|
+
|
|
51
|
+
const box4 = new three.Mesh( geometry, boxMaterial );
|
|
52
|
+
box4.position.set( -2.017, 0.018, 6.124 );
|
|
53
|
+
box4.rotation.set( 0, 0.333, 0 );
|
|
54
|
+
box4.scale.set( 2.002, 4.566, 2.064 );
|
|
55
|
+
this.add( box4 );
|
|
56
|
+
|
|
57
|
+
const box5 = new three.Mesh( geometry, boxMaterial );
|
|
58
|
+
box5.position.set( 2.291, -0.756, -2.621 );
|
|
59
|
+
box5.rotation.set( 0, -0.286, 0 );
|
|
60
|
+
box5.scale.set( 1.546, 1.552, 1.496 );
|
|
61
|
+
this.add( box5 );
|
|
62
|
+
|
|
63
|
+
const box6 = new three.Mesh( geometry, boxMaterial );
|
|
64
|
+
box6.position.set( -2.193, -0.369, -5.547 );
|
|
65
|
+
box6.rotation.set( 0, 0.516, 0 );
|
|
66
|
+
box6.scale.set( 3.875, 3.487, 2.986 );
|
|
67
|
+
this.add( box6 );
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// -x right
|
|
71
|
+
const light1 = new three.Mesh( geometry, createAreaLightMaterial( 50 ) );
|
|
72
|
+
light1.position.set( -16.116, 14.37, 8.208 );
|
|
73
|
+
light1.scale.set( 0.1, 2.428, 2.739 );
|
|
74
|
+
this.add( light1 );
|
|
75
|
+
|
|
76
|
+
// -x left
|
|
77
|
+
const light2 = new three.Mesh( geometry, createAreaLightMaterial( 50 ) );
|
|
78
|
+
light2.position.set( -16.109, 18.021, -8.207 );
|
|
79
|
+
light2.scale.set( 0.1, 2.425, 2.751 );
|
|
80
|
+
this.add( light2 );
|
|
81
|
+
|
|
82
|
+
// +x
|
|
83
|
+
const light3 = new three.Mesh( geometry, createAreaLightMaterial( 17 ) );
|
|
84
|
+
light3.position.set( 14.904, 12.198, -1.832 );
|
|
85
|
+
light3.scale.set( 0.15, 4.265, 6.331 );
|
|
86
|
+
this.add( light3 );
|
|
87
|
+
|
|
88
|
+
// +z
|
|
89
|
+
const light4 = new three.Mesh( geometry, createAreaLightMaterial( 43 ) );
|
|
90
|
+
light4.position.set( -0.462, 8.89, 14.520 );
|
|
91
|
+
light4.scale.set( 4.38, 5.441, 0.088 );
|
|
92
|
+
this.add( light4 );
|
|
93
|
+
|
|
94
|
+
// -z
|
|
95
|
+
const light5 = new three.Mesh( geometry, createAreaLightMaterial( 20 ) );
|
|
96
|
+
light5.position.set( 3.235, 11.486, -12.541 );
|
|
97
|
+
light5.scale.set( 2.5, 2.0, 0.1 );
|
|
98
|
+
this.add( light5 );
|
|
99
|
+
|
|
100
|
+
// +y
|
|
101
|
+
const light6 = new three.Mesh( geometry, createAreaLightMaterial( 100 ) );
|
|
102
|
+
light6.position.set( 0.0, 20.0, 0.0 );
|
|
103
|
+
light6.scale.set( 1.0, 0.1, 1.0 );
|
|
104
|
+
this.add( light6 );
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
dispose() {
|
|
109
|
+
|
|
110
|
+
const resources = new Set();
|
|
111
|
+
|
|
112
|
+
this.traverse( ( object ) => {
|
|
113
|
+
|
|
114
|
+
if ( object.isMesh ) {
|
|
115
|
+
|
|
116
|
+
resources.add( object.geometry );
|
|
117
|
+
resources.add( object.material );
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
} );
|
|
122
|
+
|
|
123
|
+
for ( const resource of resources ) {
|
|
124
|
+
|
|
125
|
+
resource.dispose();
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function createAreaLightMaterial( intensity ) {
|
|
134
|
+
|
|
135
|
+
const material = new three.MeshBasicMaterial();
|
|
136
|
+
material.color.setScalar( intensity );
|
|
137
|
+
return material;
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
142
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
143
|
+
// All rights reserved.
|
|
144
|
+
//
|
|
145
|
+
// This software and its documentation and related materials are owned by
|
|
146
|
+
// the Alliance. The software may only be incorporated into application
|
|
147
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
148
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
149
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
150
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
151
|
+
// protected by copyright law and international treaty provisions. Application
|
|
152
|
+
// programs incorporating this software must include the following statement
|
|
153
|
+
// with their copyright notices:
|
|
154
|
+
//
|
|
155
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
156
|
+
// license agreement with Open Design Alliance.
|
|
157
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
158
|
+
// All rights reserved.
|
|
159
|
+
//
|
|
160
|
+
// By use of this software, its documentation or related materials, you
|
|
161
|
+
// acknowledge and accept the above terms.
|
|
162
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
163
|
+
class RoomEnvironmentComponent {
|
|
164
|
+
constructor(viewer) {
|
|
165
|
+
this.viewer = viewer;
|
|
166
|
+
const environment = new RoomEnvironment();
|
|
167
|
+
const pmremGenerator = new three.PMREMGenerator(this.viewer.renderer);
|
|
168
|
+
this.viewer.scene.environment = pmremGenerator.fromScene(environment).texture;
|
|
169
|
+
environment.dispose();
|
|
170
|
+
}
|
|
171
|
+
dispose() {
|
|
172
|
+
this.viewer.scene.environment = undefined;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
viewerThree.components.registerComponent("LightComponent", (viewer) => new RoomEnvironmentComponent(viewer));
|
|
176
|
+
|
|
177
|
+
}));
|
|
178
|
+
//# sourceMappingURL=RoomEnvironmentComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoomEnvironmentComponent.js","sources":["../../../../../node_modules/three/examples/jsm/environments/RoomEnvironment.js","../../../plugins/components/RoomEnvironmentComponent.ts"],"sourcesContent":["/**\n * https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts\n */\n\nimport {\n \tBackSide,\n \tBoxGeometry,\n \tMesh,\n\tMeshBasicMaterial,\n \tMeshStandardMaterial,\n \tPointLight,\n \tScene,\n} from 'three';\n\nclass RoomEnvironment extends Scene {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tconst geometry = new BoxGeometry();\n\t\tgeometry.deleteAttribute( 'uv' );\n\n\t\tconst roomMaterial = new MeshStandardMaterial( { side: BackSide } );\n\t\tconst boxMaterial = new MeshStandardMaterial();\n\n\t\tconst mainLight = new PointLight( 0xffffff, 900, 28, 2 );\n\t\tmainLight.position.set( 0.418, 16.199, 0.300 );\n\t\tthis.add( mainLight );\n\n\t\tconst room = new Mesh( geometry, roomMaterial );\n\t\troom.position.set( - 0.757, 13.219, 0.717 );\n\t\troom.scale.set( 31.713, 28.305, 28.591 );\n\t\tthis.add( room );\n\n\t\tconst box1 = new Mesh( geometry, boxMaterial );\n\t\tbox1.position.set( - 10.906, 2.009, 1.846 );\n\t\tbox1.rotation.set( 0, - 0.195, 0 );\n\t\tbox1.scale.set( 2.328, 7.905, 4.651 );\n\t\tthis.add( box1 );\n\n\t\tconst box2 = new Mesh( geometry, boxMaterial );\n\t\tbox2.position.set( - 5.607, - 0.754, - 0.758 );\n\t\tbox2.rotation.set( 0, 0.994, 0 );\n\t\tbox2.scale.set( 1.970, 1.534, 3.955 );\n\t\tthis.add( box2 );\n\n\t\tconst box3 = new Mesh( geometry, boxMaterial );\n\t\tbox3.position.set( 6.167, 0.857, 7.803 );\n\t\tbox3.rotation.set( 0, 0.561, 0 );\n\t\tbox3.scale.set( 3.927, 6.285, 3.687 );\n\t\tthis.add( box3 );\n\n\t\tconst box4 = new Mesh( geometry, boxMaterial );\n\t\tbox4.position.set( - 2.017, 0.018, 6.124 );\n\t\tbox4.rotation.set( 0, 0.333, 0 );\n\t\tbox4.scale.set( 2.002, 4.566, 2.064 );\n\t\tthis.add( box4 );\n\n\t\tconst box5 = new Mesh( geometry, boxMaterial );\n\t\tbox5.position.set( 2.291, - 0.756, - 2.621 );\n\t\tbox5.rotation.set( 0, - 0.286, 0 );\n\t\tbox5.scale.set( 1.546, 1.552, 1.496 );\n\t\tthis.add( box5 );\n\n\t\tconst box6 = new Mesh( geometry, boxMaterial );\n\t\tbox6.position.set( - 2.193, - 0.369, - 5.547 );\n\t\tbox6.rotation.set( 0, 0.516, 0 );\n\t\tbox6.scale.set( 3.875, 3.487, 2.986 );\n\t\tthis.add( box6 );\n\n\n\t\t// -x right\n\t\tconst light1 = new Mesh( geometry, createAreaLightMaterial( 50 ) );\n\t\tlight1.position.set( - 16.116, 14.37, 8.208 );\n\t\tlight1.scale.set( 0.1, 2.428, 2.739 );\n\t\tthis.add( light1 );\n\n\t\t// -x left\n\t\tconst light2 = new Mesh( geometry, createAreaLightMaterial( 50 ) );\n\t\tlight2.position.set( - 16.109, 18.021, - 8.207 );\n\t\tlight2.scale.set( 0.1, 2.425, 2.751 );\n\t\tthis.add( light2 );\n\n\t\t// +x\n\t\tconst light3 = new Mesh( geometry, createAreaLightMaterial( 17 ) );\n\t\tlight3.position.set( 14.904, 12.198, - 1.832 );\n\t\tlight3.scale.set( 0.15, 4.265, 6.331 );\n\t\tthis.add( light3 );\n\n\t\t// +z\n\t\tconst light4 = new Mesh( geometry, createAreaLightMaterial( 43 ) );\n\t\tlight4.position.set( - 0.462, 8.89, 14.520 );\n\t\tlight4.scale.set( 4.38, 5.441, 0.088 );\n\t\tthis.add( light4 );\n\n\t\t// -z\n\t\tconst light5 = new Mesh( geometry, createAreaLightMaterial( 20 ) );\n\t\tlight5.position.set( 3.235, 11.486, - 12.541 );\n\t\tlight5.scale.set( 2.5, 2.0, 0.1 );\n\t\tthis.add( light5 );\n\n\t\t// +y\n\t\tconst light6 = new Mesh( geometry, createAreaLightMaterial( 100 ) );\n\t\tlight6.position.set( 0.0, 20.0, 0.0 );\n\t\tlight6.scale.set( 1.0, 0.1, 1.0 );\n\t\tthis.add( light6 );\n\n\t}\n\n\tdispose() {\n\n\t\tconst resources = new Set();\n\n\t\tthis.traverse( ( object ) => {\n\n\t\t\tif ( object.isMesh ) {\n\n\t\t\t\tresources.add( object.geometry );\n\t\t\t\tresources.add( object.material );\n\n\t\t\t}\n\n\t\t} );\n\n\t\tfor ( const resource of resources ) {\n\n\t\t\tresource.dispose();\n\n\t\t}\n\n\t}\n\n}\n\nfunction createAreaLightMaterial( intensity ) {\n\n\tconst material = new MeshBasicMaterial();\n\tmaterial.color.setScalar( intensity );\n\treturn material;\n\n}\n\nexport { RoomEnvironment };\n","///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { PMREMGenerator } from \"three\";\nimport { RoomEnvironment } from \"three/examples/jsm/environments/RoomEnvironment.js\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass RoomEnvironmentComponent implements IComponent {\n protected viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n\n const environment = new RoomEnvironment();\n const pmremGenerator = new PMREMGenerator(this.viewer.renderer);\n\n this.viewer.scene.environment = pmremGenerator.fromScene(environment).texture;\n\n environment.dispose();\n }\n\n dispose() {\n this.viewer.scene.environment = undefined;\n }\n}\n\ncomponents.registerComponent(\"LightComponent\", (viewer) => new RoomEnvironmentComponent(viewer));\n"],"names":["Scene","BoxGeometry","MeshStandardMaterial","BackSide","PointLight","Mesh","MeshBasicMaterial","PMREMGenerator","components"],"mappings":";;;;;;CAAA;CACA;CACA;;;CAYA,MAAM,eAAe,SAASA,WAAK,CAAC;;CAEpC,CAAC,WAAW,GAAG;;CAEf,EAAE,KAAK,EAAE;;CAET,EAAE,MAAM,QAAQ,GAAG,IAAIC,iBAAW,EAAE;CACpC,EAAE,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE;;CAElC,EAAE,MAAM,YAAY,GAAG,IAAIC,0BAAoB,EAAE,EAAE,IAAI,EAAEC,cAAQ,EAAE,EAAE;CACrE,EAAE,MAAM,WAAW,GAAG,IAAID,0BAAoB,EAAE;;CAEhD,EAAE,MAAM,SAAS,GAAG,IAAIE,gBAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;CAC1D,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;CAChD,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE;;CAEvB,EAAE,MAAM,IAAI,GAAG,IAAIC,UAAI,EAAE,QAAQ,EAAE,YAAY,EAAE;CACjD,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAO,EAAE,MAAM,EAAE,KAAK,EAAE;CAC7C,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;CAC1C,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE;;CAElB,EAAE,MAAM,IAAI,GAAG,IAAIA,UAAI,E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B,CAAA;CAG5B,IAAA,WAAA,CAAY,MAAc,EAAA;CACxB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;CAEpB,QAAA,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE;SACzC,MAAM,cAAc,GAAG,IAAIC,oBAAc,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;CAE/D,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO;SAE7E,WAAW,CAAC,OAAO,EAAE;;KAGvB,OAAO,GAAA;SACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS;;CAE5C;AAEDC,uBAAU,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,MAAM,KAAK,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?s(require("three"),require("@inweb/viewer-three")):"function"==typeof define&&define.amd?define(["three","@inweb/viewer-three"],s):s((e="undefined"!=typeof globalThis?globalThis:e||self).THREE,e.ODA.Three)}(this,(function(e,s){"use strict";class t extends e.Scene{constructor(){super();const s=new e.BoxGeometry;s.deleteAttribute("uv");const t=new e.MeshStandardMaterial({side:e.BackSide}),o=new e.MeshStandardMaterial,i=new e.PointLight(16777215,900,28,2);i.position.set(.418,16.199,.3),this.add(i);const a=new e.Mesh(s,t);a.position.set(-.757,13.219,.717),a.scale.set(31.713,28.305,28.591),this.add(a);const d=new e.Mesh(s,o);d.position.set(-10.906,2.009,1.846),d.rotation.set(0,-.195,0),d.scale.set(2.328,7.905,4.651),this.add(d);const r=new e.Mesh(s,o);r.position.set(-5.607,-.754,-.758),r.rotation.set(0,.994,0),r.scale.set(1.97,1.534,3.955),this.add(r);const c=new e.Mesh(s,o);c.position.set(6.167,.857,7.803),c.rotation.set(0,.561,0),c.scale.set(3.927,6.285,3.687),this.add(c);const h=new e.Mesh(s,o);h.position.set(-2.017,.018,6.124),h.rotation.set(0,.333,0),h.scale.set(2.002,4.566,2.064),this.add(h);const w=new e.Mesh(s,o);w.position.set(2.291,-.756,-2.621),w.rotation.set(0,-.286,0),w.scale.set(1.546,1.552,1.496),this.add(w);const l=new e.Mesh(s,o);l.position.set(-2.193,-.369,-5.547),l.rotation.set(0,.516,0),l.scale.set(3.875,3.487,2.986),this.add(l);const p=new e.Mesh(s,n(50));p.position.set(-16.116,14.37,8.208),p.scale.set(.1,2.428,2.739),this.add(p);const M=new e.Mesh(s,n(50));M.position.set(-16.109,18.021,-8.207),M.scale.set(.1,2.425,2.751),this.add(M);const f=new e.Mesh(s,n(17));f.position.set(14.904,12.198,-1.832),f.scale.set(.15,4.265,6.331),this.add(f);const u=new e.Mesh(s,n(43));u.position.set(-.462,8.89,14.52),u.scale.set(4.38,5.441,.088),this.add(u);const m=new e.Mesh(s,n(20));m.position.set(3.235,11.486,-12.541),m.scale.set(2.5,2,.1),this.add(m);const v=new e.Mesh(s,n(100));v.position.set(0,20,0),v.scale.set(1,.1,1),this.add(v)}dispose(){const e=new Set;this.traverse((s=>{s.isMesh&&(e.add(s.geometry),e.add(s.material))}));for(const s of e)s.dispose()}}function n(s){const t=new e.MeshBasicMaterial;return t.color.setScalar(s),t}class o{constructor(s){this.viewer=s;const n=new t,o=new e.PMREMGenerator(this.viewer.renderer);this.viewer.scene.environment=o.fromScene(n).texture,n.dispose()}dispose(){this.viewer.scene.environment=void 0}}s.components.registerComponent("LightComponent",(e=>new o(e)))}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PMREMGenerator } from "three";
|
|
2
|
+
|
|
3
|
+
import { RoomEnvironment } from "three/examples/jsm/environments/RoomEnvironment.js";
|
|
4
|
+
|
|
5
|
+
import { components } from "@inweb/viewer-three";
|
|
6
|
+
|
|
7
|
+
class RoomEnvironmentComponent {
|
|
8
|
+
constructor(viewer) {
|
|
9
|
+
this.viewer = viewer;
|
|
10
|
+
const environment = new RoomEnvironment;
|
|
11
|
+
const pmremGenerator = new PMREMGenerator(this.viewer.renderer);
|
|
12
|
+
this.viewer.scene.environment = pmremGenerator.fromScene(environment).texture;
|
|
13
|
+
environment.dispose();
|
|
14
|
+
}
|
|
15
|
+
dispose() {
|
|
16
|
+
this.viewer.scene.environment = undefined;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
components.registerComponent("LightComponent", (viewer => new RoomEnvironmentComponent(viewer)));
|
|
21
|
+
//# sourceMappingURL=RoomEnvironmentComponent.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoomEnvironmentComponent.module.js","sources":["../../../plugins/components/RoomEnvironmentComponent.ts"],"sourcesContent":["///////////////////////////////////////////////////////////////////////////////\n// Copyright (C) 2002-2025, Open Design Alliance (the \"Alliance\").\n// All rights reserved.\n//\n// This software and its documentation and related materials are owned by\n// the Alliance. The software may only be incorporated into application\n// programs owned by members of the Alliance, subject to a signed\n// Membership Agreement and Supplemental Software License Agreement with the\n// Alliance. The structure and organization of this software are the valuable\n// trade secrets of the Alliance and its suppliers. The software is also\n// protected by copyright law and international treaty provisions. Application\n// programs incorporating this software must include the following statement\n// with their copyright notices:\n//\n// This application incorporates Open Design Alliance software pursuant to a\n// license agreement with Open Design Alliance.\n// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.\n// All rights reserved.\n//\n// By use of this software, its documentation or related materials, you\n// acknowledge and accept the above terms.\n///////////////////////////////////////////////////////////////////////////////\n\nimport { PMREMGenerator } from \"three\";\nimport { RoomEnvironment } from \"three/examples/jsm/environments/RoomEnvironment.js\";\nimport { IComponent, components, Viewer } from \"@inweb/viewer-three\";\n\nclass RoomEnvironmentComponent implements IComponent {\n protected viewer: Viewer;\n\n constructor(viewer: Viewer) {\n this.viewer = viewer;\n\n const environment = new RoomEnvironment();\n const pmremGenerator = new PMREMGenerator(this.viewer.renderer);\n\n this.viewer.scene.environment = pmremGenerator.fromScene(environment).texture;\n\n environment.dispose();\n }\n\n dispose() {\n this.viewer.scene.environment = undefined;\n }\n}\n\ncomponents.registerComponent(\"LightComponent\", (viewer) => new RoomEnvironmentComponent(viewer));\n"],"names":["RoomEnvironmentComponent","constructor","viewer","this","environment","RoomEnvironment","pmremGenerator","PMREMGenerator","renderer","scene","fromScene","texture","dispose","undefined","components","registerComponent"],"mappings":";;;;;;AA2BA,MAAMA;IAGJ,WAAAC,CAAYC;QACVC,KAAKD,SAASA;QAEd,MAAME,cAAc,IAAIC;QACxB,MAAMC,iBAAiB,IAAIC,eAAeJ,KAAKD,OAAOM;QAEtDL,KAAKD,OAAOO,MAAML,cAAcE,eAAeI,UAAUN,aAAaO;QAEtEP,YAAYQ;;IAGd,OAAAA;QACET,KAAKD,OAAOO,MAAML,cAAcS;;;;AAIpCC,WAAWC,kBAAkB,mBAAmBb,UAAW,IAAIF,yBAAyBE"}
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
}
|
|
157
157
|
visit(path);
|
|
158
158
|
});
|
|
159
|
-
} catch {
|
|
159
|
+
} catch (e) {
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
162
162
|
return roots;
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
let inputNodes = /* @__PURE__ */ new Map();
|
|
244
244
|
data.forEach((ifcxNode) => {
|
|
245
245
|
let node = {
|
|
246
|
-
path: ifcxNode.
|
|
246
|
+
path: ifcxNode.path,
|
|
247
247
|
children: ifcxNode.children ? ifcxNode.children : {},
|
|
248
248
|
inherits: ifcxNode.inherits ? ifcxNode.inherits : {},
|
|
249
249
|
attributes: ifcxNode.attributes ? ifcxNode.attributes : {},
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
let collapsed = Collapse(nodes, deleteEmpty);
|
|
413
413
|
if (collapsed)
|
|
414
414
|
result.data.push({
|
|
415
|
-
|
|
415
|
+
path: collapsed.path,
|
|
416
416
|
children: collapsed.children,
|
|
417
417
|
inherits: collapsed.inherits,
|
|
418
418
|
attributes: collapsed.attributes,
|
|
@@ -477,8 +477,8 @@
|
|
|
477
477
|
camera.lookAt(0, 0, 0);
|
|
478
478
|
// const nd = document.querySelector(".viewport");
|
|
479
479
|
// renderer = new THREE.WebGLRenderer({
|
|
480
|
-
//
|
|
481
|
-
//
|
|
480
|
+
// alpha: true,
|
|
481
|
+
// logarithmicDepthBuffer: true,
|
|
482
482
|
// });
|
|
483
483
|
// renderer.setSize(nd.offsetWidth, nd.offsetHeight);
|
|
484
484
|
// controls = new THREE.OrbitControls(camera, renderer.domElement);
|
|
@@ -492,15 +492,6 @@
|
|
|
492
492
|
if (!node || !node.attributes) return false;
|
|
493
493
|
return !!node.attributes[attrName];
|
|
494
494
|
}
|
|
495
|
-
function FindChildWithAttr(node, attrName) {
|
|
496
|
-
if (!node || !node.children) return undefined;
|
|
497
|
-
for (let i = 0; i < node.children.length; i++) {
|
|
498
|
-
if (HasAttr(node.children[i], attrName)) {
|
|
499
|
-
return node.children[i];
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
return undefined;
|
|
503
|
-
}
|
|
504
495
|
function createMaterialFromParent(parent, root) {
|
|
505
496
|
let reference = parent.attributes["usd::usdshade::materialbindingapi::material::binding"];
|
|
506
497
|
let material = {
|
|
@@ -510,13 +501,12 @@
|
|
|
510
501
|
};
|
|
511
502
|
if (reference) {
|
|
512
503
|
const materialNode = getChildByName(root, reference.ref);
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
let color = shader?.attributes["usd::materials::inputs::diffuseColor"];
|
|
504
|
+
if (materialNode) {
|
|
505
|
+
let color = materialNode?.attributes["bsi::presentation::diffuseColor"];
|
|
516
506
|
material.color = new THREE.Color(...color);
|
|
517
|
-
if (
|
|
507
|
+
if (materialNode?.attributes["bsi::presentation::opacity"]) {
|
|
518
508
|
material.transparent = true;
|
|
519
|
-
material.opacity =
|
|
509
|
+
material.opacity = materialNode.attributes["bsi::presentation::opacity"];
|
|
520
510
|
}
|
|
521
511
|
}
|
|
522
512
|
}
|
|
@@ -577,17 +567,23 @@
|
|
|
577
567
|
// var icons = {
|
|
578
568
|
// "usd::usdgeom::mesh::points": "deployed_code",
|
|
579
569
|
// "usd::usdgeom::basiscurves::points": "line_curve",
|
|
580
|
-
// "usd::usdshade::material::outputs::surface.connect": "line_style"
|
|
570
|
+
// "usd::usdshade::material::outputs::surface.connect": "line_style",
|
|
581
571
|
// };
|
|
582
572
|
// function buildDomTree(prim, node) {
|
|
583
573
|
// const elem = document.createElement("div");
|
|
584
574
|
// let span;
|
|
585
575
|
// elem.appendChild(document.createTextNode(prim.name ? prim.name.split("/").reverse()[0] : "root"));
|
|
586
|
-
// elem.appendChild(span = document.createElement("span"));
|
|
587
|
-
// Object.entries(icons).forEach(([k, v]) => span.innerText += (prim.attributes || {})[k] ? v : " ");
|
|
576
|
+
// elem.appendChild((span = document.createElement("span")));
|
|
577
|
+
// Object.entries(icons).forEach(([k, v]) => (span.innerText += (prim.attributes || {})[k] ? v : " "));
|
|
588
578
|
// span.className = "material-symbols-outlined";
|
|
589
579
|
// elem.onclick = (evt) => {
|
|
590
|
-
// let rows = [["name", prim.name]]
|
|
580
|
+
// let rows = [["name", prim.name]]
|
|
581
|
+
// .concat(Object.entries(prim.attributes))
|
|
582
|
+
// .map(
|
|
583
|
+
// ([k, v]) =>
|
|
584
|
+
// `<tr><td>${encodeHtmlEntities(k)}</td><td>${encodeHtmlEntities(typeof v === "object" ? JSON.stringify(v) : v)}</td>`
|
|
585
|
+
// )
|
|
586
|
+
// .join("");
|
|
591
587
|
// document.querySelector(".attributes .table").innerHTML = `<table border="0">${rows}</table>`;
|
|
592
588
|
// evt.stopPropagation();
|
|
593
589
|
// };
|
|
@@ -666,10 +662,8 @@
|
|
|
666
662
|
// controls.update();
|
|
667
663
|
// renderer.render(scene, camera);
|
|
668
664
|
// }
|
|
669
|
-
// export {
|
|
670
|
-
|
|
671
|
-
// addModel as default
|
|
672
|
-
// };
|
|
665
|
+
// export { composeAndRender, addModel as default };
|
|
666
|
+
|
|
673
667
|
function parse(m, name) {
|
|
674
668
|
datas.push([name, m]);
|
|
675
669
|
composeAndRender();
|