@inweb/viewer-three 26.9.3 → 26.9.4
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/AxesHelperComponent.js +23 -22
- package/dist/plugins/components/AxesHelperComponent.js.map +1 -1
- package/dist/plugins/components/AxesHelperComponent.min.js +23 -0
- package/dist/plugins/components/AxesHelperComponent.module.js +31 -9
- package/dist/plugins/components/AxesHelperComponent.module.js.map +1 -1
- package/dist/plugins/components/ExtentsHelperComponent.js +23 -22
- package/dist/plugins/components/ExtentsHelperComponent.js.map +1 -1
- package/dist/plugins/components/ExtentsHelperComponent.min.js +23 -0
- package/dist/plugins/components/ExtentsHelperComponent.module.js +28 -6
- package/dist/plugins/components/ExtentsHelperComponent.module.js.map +1 -1
- package/dist/plugins/components/LightHelperComponent.js +23 -22
- package/dist/plugins/components/LightHelperComponent.js.map +1 -1
- package/dist/plugins/components/LightHelperComponent.min.js +23 -0
- package/dist/plugins/components/LightHelperComponent.module.js +35 -9
- package/dist/plugins/components/LightHelperComponent.module.js.map +1 -1
- package/dist/plugins/components/RoomEnvironmentComponent.js +23 -97
- package/dist/plugins/components/RoomEnvironmentComponent.js.map +1 -1
- package/dist/plugins/components/RoomEnvironmentComponent.min.js +23 -0
- package/dist/plugins/components/RoomEnvironmentComponent.module.js +27 -7
- package/dist/plugins/components/RoomEnvironmentComponent.module.js.map +1 -1
- package/dist/plugins/components/StatsPanelComponent.js +23 -92
- package/dist/plugins/components/StatsPanelComponent.js.map +1 -1
- package/dist/plugins/components/StatsPanelComponent.min.js +23 -0
- package/dist/plugins/components/StatsPanelComponent.module.js +26 -5
- package/dist/plugins/components/StatsPanelComponent.module.js.map +1 -1
- package/dist/plugins/loaders/GLTFCloudLoader.js +31 -2515
- package/dist/plugins/loaders/GLTFCloudLoader.js.map +1 -1
- package/dist/plugins/loaders/GLTFCloudLoader.min.js +23 -0
- package/dist/plugins/loaders/GLTFCloudLoader.module.js +35 -20
- package/dist/plugins/loaders/GLTFCloudLoader.module.js.map +1 -1
- package/dist/plugins/loaders/IFCXLoader.js +35 -689
- package/dist/plugins/loaders/IFCXLoader.js.map +1 -1
- package/dist/plugins/loaders/IFCXLoader.min.js +23 -0
- package/dist/plugins/loaders/IFCXLoader.module.js +833 -859
- package/dist/plugins/loaders/IFCXLoader.module.js.map +1 -1
- package/dist/plugins/loaders/PotreeLoader.js +26 -70
- package/dist/plugins/loaders/PotreeLoader.js.map +1 -1
- package/dist/plugins/loaders/PotreeLoader.min.js +23 -0
- package/dist/plugins/loaders/PotreeLoader.module.js +37 -15
- package/dist/plugins/loaders/PotreeLoader.module.js.map +1 -1
- package/dist/viewer-three.js +1502 -55140
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +26 -3
- package/dist/viewer-three.module.js +3584 -3660
- package/dist/viewer-three.module.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,20 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
23
|
|
|
3
|
-
import {
|
|
24
|
+
import { Sphere, DirectionalLightHelper, HemisphereLightHelper, PointLightHelper } from 'three';
|
|
25
|
+
import { components } from '@inweb/viewer-three';
|
|
4
26
|
|
|
5
27
|
class LightHelperComponent {
|
|
6
28
|
constructor(viewer) {
|
|
7
29
|
this.syncHelper = () => {
|
|
8
|
-
this.lightHelpers.forEach(helper => {
|
|
30
|
+
this.lightHelpers.forEach((helper) => {
|
|
9
31
|
helper.removeFromParent();
|
|
10
32
|
helper.dispose();
|
|
11
33
|
});
|
|
12
34
|
this.lightHelpers.length = 0;
|
|
13
|
-
const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere).radius * 2;
|
|
35
|
+
const extentsSize = this.viewer.extents.getBoundingSphere(new Sphere()).radius * 2;
|
|
14
36
|
const size = extentsSize / 20;
|
|
15
|
-
this.viewer.scene.traverse(object => {
|
|
37
|
+
this.viewer.scene.traverse((object) => {
|
|
16
38
|
let helper;
|
|
17
|
-
if (object.isDirectionalLight)
|
|
39
|
+
if (object.isDirectionalLight)
|
|
40
|
+
helper = new DirectionalLightHelper(object, size, "#aa0000");
|
|
41
|
+
else if (object.isHemisphereLight)
|
|
42
|
+
helper = new HemisphereLightHelper(object, size, "#ff9800");
|
|
43
|
+
else if (object.isPointLight)
|
|
44
|
+
helper = new PointLightHelper(object, size, "#ff9800");
|
|
18
45
|
if (helper) {
|
|
19
46
|
this.lightHelpers.push(helper);
|
|
20
47
|
this.viewer.helpers.add(helper);
|
|
@@ -27,7 +54,7 @@ class LightHelperComponent {
|
|
|
27
54
|
this.viewer.addEventListener("clear", this.syncHelper);
|
|
28
55
|
}
|
|
29
56
|
dispose() {
|
|
30
|
-
this.lightHelpers.forEach(helper => {
|
|
57
|
+
this.lightHelpers.forEach((helper) => {
|
|
31
58
|
helper.removeFromParent();
|
|
32
59
|
helper.dispose();
|
|
33
60
|
});
|
|
@@ -36,6 +63,5 @@ class LightHelperComponent {
|
|
|
36
63
|
this.viewer.removeEventListener("clear", this.syncHelper);
|
|
37
64
|
}
|
|
38
65
|
}
|
|
39
|
-
|
|
40
|
-
components.registerComponent("LightHelperComponent", viewer => new LightHelperComponent(viewer));
|
|
66
|
+
components.registerComponent("LightHelperComponent", (viewer) => new LightHelperComponent(viewer));
|
|
41
67
|
//# sourceMappingURL=LightHelperComponent.module.js.map
|
|
@@ -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, 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.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\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.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\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":[
|
|
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.syncHelper);\n this.viewer.addEventListener(\"clear\", this.syncHelper);\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.syncHelper);\n this.viewer.removeEventListener(\"clear\", this.syncHelper);\n }\n\n syncHelper = () => {\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,oBAAoB,CAAA;AAIxB,IAAA,WAAA,CAAY,MAAc,EAAA;QAkB1B,IAAA,CAAA,UAAU,GAAG,MAAK;YAChB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;gBACnC,MAAM,CAAC,gBAAgB,EAAE;gBACzB,MAAM,CAAC,OAAO,EAAE;AAClB,YAAA,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EAAE;YACzB,MAAM,CAAC,OAAO,EAAE;AAClB,QAAA,CAAC,CAAC;AACF,QAAA,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;QAE5B,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC;QAC/D,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;IAC3D;AAyBD;AAED,UAAU,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,MAAM,KAAK,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1,200 +1,126 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
1
24
|
(function (global, factory) {
|
|
2
25
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('three'), require('@inweb/viewer-three')) :
|
|
3
26
|
typeof define === 'function' && define.amd ? define(['three', '@inweb/viewer-three'], factory) :
|
|
4
27
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE, global.ODA.Three));
|
|
5
28
|
})(this, (function (three, viewerThree) { 'use strict';
|
|
6
29
|
|
|
7
|
-
/**
|
|
8
|
-
* This class represents a scene with a basic room setup that can be used as
|
|
9
|
-
* input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's
|
|
10
|
-
* lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment}
|
|
11
|
-
* or directly as an environment map to PBR materials.
|
|
12
|
-
*
|
|
13
|
-
* The implementation is based on the [EnvironmentScene](https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts)
|
|
14
|
-
* component from the `model-viewer` project.
|
|
15
|
-
*
|
|
16
|
-
* ```js
|
|
17
|
-
* const environment = new RoomEnvironment();
|
|
18
|
-
* const pmremGenerator = new THREE.PMREMGenerator( renderer );
|
|
19
|
-
*
|
|
20
|
-
* const envMap = pmremGenerator.fromScene( environment ).texture;
|
|
21
|
-
* scene.environment = envMap;
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @augments Scene
|
|
25
|
-
* @three_import import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
|
|
26
|
-
*/
|
|
27
30
|
class RoomEnvironment extends three.Scene {
|
|
28
|
-
|
|
29
31
|
constructor() {
|
|
30
|
-
|
|
31
32
|
super();
|
|
32
|
-
|
|
33
33
|
const geometry = new three.BoxGeometry();
|
|
34
34
|
geometry.deleteAttribute( 'uv' );
|
|
35
|
-
|
|
36
35
|
const roomMaterial = new three.MeshStandardMaterial( { side: three.BackSide } );
|
|
37
36
|
const boxMaterial = new three.MeshStandardMaterial();
|
|
38
|
-
|
|
39
37
|
const mainLight = new three.PointLight( 0xffffff, 900, 28, 2 );
|
|
40
38
|
mainLight.position.set( 0.418, 16.199, 0.300 );
|
|
41
39
|
this.add( mainLight );
|
|
42
|
-
|
|
43
40
|
const room = new three.Mesh( geometry, roomMaterial );
|
|
44
41
|
room.position.set( -0.757, 13.219, 0.717 );
|
|
45
42
|
room.scale.set( 31.713, 28.305, 28.591 );
|
|
46
43
|
this.add( room );
|
|
47
|
-
|
|
48
44
|
const boxes = new three.InstancedMesh( geometry, boxMaterial, 6 );
|
|
49
45
|
const transform = new three.Object3D();
|
|
50
|
-
|
|
51
|
-
// box1
|
|
52
46
|
transform.position.set( -10.906, 2.009, 1.846 );
|
|
53
47
|
transform.rotation.set( 0, -0.195, 0 );
|
|
54
48
|
transform.scale.set( 2.328, 7.905, 4.651 );
|
|
55
49
|
transform.updateMatrix();
|
|
56
50
|
boxes.setMatrixAt( 0, transform.matrix );
|
|
57
|
-
|
|
58
|
-
// box2
|
|
59
51
|
transform.position.set( -5.607, -0.754, -0.758 );
|
|
60
52
|
transform.rotation.set( 0, 0.994, 0 );
|
|
61
53
|
transform.scale.set( 1.970, 1.534, 3.955 );
|
|
62
54
|
transform.updateMatrix();
|
|
63
55
|
boxes.setMatrixAt( 1, transform.matrix );
|
|
64
|
-
|
|
65
|
-
// box3
|
|
66
56
|
transform.position.set( 6.167, 0.857, 7.803 );
|
|
67
57
|
transform.rotation.set( 0, 0.561, 0 );
|
|
68
58
|
transform.scale.set( 3.927, 6.285, 3.687 );
|
|
69
59
|
transform.updateMatrix();
|
|
70
60
|
boxes.setMatrixAt( 2, transform.matrix );
|
|
71
|
-
|
|
72
|
-
// box4
|
|
73
61
|
transform.position.set( -2.017, 0.018, 6.124 );
|
|
74
62
|
transform.rotation.set( 0, 0.333, 0 );
|
|
75
63
|
transform.scale.set( 2.002, 4.566, 2.064 );
|
|
76
64
|
transform.updateMatrix();
|
|
77
65
|
boxes.setMatrixAt( 3, transform.matrix );
|
|
78
|
-
|
|
79
|
-
// box5
|
|
80
66
|
transform.position.set( 2.291, -0.756, -2.621 );
|
|
81
67
|
transform.rotation.set( 0, -0.286, 0 );
|
|
82
68
|
transform.scale.set( 1.546, 1.552, 1.496 );
|
|
83
69
|
transform.updateMatrix();
|
|
84
70
|
boxes.setMatrixAt( 4, transform.matrix );
|
|
85
|
-
|
|
86
|
-
// box6
|
|
87
71
|
transform.position.set( -2.193, -0.369, -5.547 );
|
|
88
72
|
transform.rotation.set( 0, 0.516, 0 );
|
|
89
73
|
transform.scale.set( 3.875, 3.487, 2.986 );
|
|
90
74
|
transform.updateMatrix();
|
|
91
75
|
boxes.setMatrixAt( 5, transform.matrix );
|
|
92
|
-
|
|
93
76
|
this.add( boxes );
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// -x right
|
|
97
77
|
const light1 = new three.Mesh( geometry, createAreaLightMaterial( 50 ) );
|
|
98
78
|
light1.position.set( -16.116, 14.37, 8.208 );
|
|
99
79
|
light1.scale.set( 0.1, 2.428, 2.739 );
|
|
100
80
|
this.add( light1 );
|
|
101
|
-
|
|
102
|
-
// -x left
|
|
103
81
|
const light2 = new three.Mesh( geometry, createAreaLightMaterial( 50 ) );
|
|
104
82
|
light2.position.set( -16.109, 18.021, -8.207 );
|
|
105
83
|
light2.scale.set( 0.1, 2.425, 2.751 );
|
|
106
84
|
this.add( light2 );
|
|
107
|
-
|
|
108
|
-
// +x
|
|
109
85
|
const light3 = new three.Mesh( geometry, createAreaLightMaterial( 17 ) );
|
|
110
86
|
light3.position.set( 14.904, 12.198, -1.832 );
|
|
111
87
|
light3.scale.set( 0.15, 4.265, 6.331 );
|
|
112
88
|
this.add( light3 );
|
|
113
|
-
|
|
114
|
-
// +z
|
|
115
89
|
const light4 = new three.Mesh( geometry, createAreaLightMaterial( 43 ) );
|
|
116
90
|
light4.position.set( -0.462, 8.89, 14.520 );
|
|
117
91
|
light4.scale.set( 4.38, 5.441, 0.088 );
|
|
118
92
|
this.add( light4 );
|
|
119
|
-
|
|
120
|
-
// -z
|
|
121
93
|
const light5 = new three.Mesh( geometry, createAreaLightMaterial( 20 ) );
|
|
122
94
|
light5.position.set( 3.235, 11.486, -12.541 );
|
|
123
95
|
light5.scale.set( 2.5, 2.0, 0.1 );
|
|
124
96
|
this.add( light5 );
|
|
125
|
-
|
|
126
|
-
// +y
|
|
127
97
|
const light6 = new three.Mesh( geometry, createAreaLightMaterial( 100 ) );
|
|
128
98
|
light6.position.set( 0.0, 20.0, 0.0 );
|
|
129
99
|
light6.scale.set( 1.0, 0.1, 1.0 );
|
|
130
100
|
this.add( light6 );
|
|
131
|
-
|
|
132
101
|
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Frees internal resources. This method should be called
|
|
136
|
-
* when the environment is no longer required.
|
|
137
|
-
*/
|
|
138
102
|
dispose() {
|
|
139
|
-
|
|
140
103
|
const resources = new Set();
|
|
141
|
-
|
|
142
104
|
this.traverse( ( object ) => {
|
|
143
|
-
|
|
144
105
|
if ( object.isMesh ) {
|
|
145
|
-
|
|
146
106
|
resources.add( object.geometry );
|
|
147
107
|
resources.add( object.material );
|
|
148
|
-
|
|
149
108
|
}
|
|
150
|
-
|
|
151
109
|
} );
|
|
152
|
-
|
|
153
110
|
for ( const resource of resources ) {
|
|
154
|
-
|
|
155
111
|
resource.dispose();
|
|
156
|
-
|
|
157
112
|
}
|
|
158
|
-
|
|
159
113
|
}
|
|
160
|
-
|
|
161
114
|
}
|
|
162
|
-
|
|
163
115
|
function createAreaLightMaterial( intensity ) {
|
|
164
|
-
|
|
165
|
-
// create an emissive-only material. see #31348
|
|
166
116
|
const material = new three.MeshLambertMaterial( {
|
|
167
117
|
color: 0x000000,
|
|
168
118
|
emissive: 0xffffff,
|
|
169
119
|
emissiveIntensity: intensity
|
|
170
120
|
} );
|
|
171
|
-
|
|
172
121
|
return material;
|
|
173
|
-
|
|
174
122
|
}
|
|
175
123
|
|
|
176
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
177
|
-
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
178
|
-
// All rights reserved.
|
|
179
|
-
//
|
|
180
|
-
// This software and its documentation and related materials are owned by
|
|
181
|
-
// the Alliance. The software may only be incorporated into application
|
|
182
|
-
// programs owned by members of the Alliance, subject to a signed
|
|
183
|
-
// Membership Agreement and Supplemental Software License Agreement with the
|
|
184
|
-
// Alliance. The structure and organization of this software are the valuable
|
|
185
|
-
// trade secrets of the Alliance and its suppliers. The software is also
|
|
186
|
-
// protected by copyright law and international treaty provisions. Application
|
|
187
|
-
// programs incorporating this software must include the following statement
|
|
188
|
-
// with their copyright notices:
|
|
189
|
-
//
|
|
190
|
-
// This application incorporates Open Design Alliance software pursuant to a
|
|
191
|
-
// license agreement with Open Design Alliance.
|
|
192
|
-
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
193
|
-
// All rights reserved.
|
|
194
|
-
//
|
|
195
|
-
// By use of this software, its documentation or related materials, you
|
|
196
|
-
// acknowledge and accept the above terms.
|
|
197
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
198
124
|
class RoomEnvironmentComponent {
|
|
199
125
|
constructor(viewer) {
|
|
200
126
|
this.viewer = viewer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoomEnvironmentComponent.js","sources":["../../../../../node_modules/three/examples/jsm/environments/RoomEnvironment.js","../../../plugins/components/RoomEnvironmentComponent.ts"],"sourcesContent":["import {\n \tBackSide,\n \tBoxGeometry,\n \tInstancedMesh,\n \tMesh,\n\tMeshLambertMaterial,\n \tMeshStandardMaterial,\n \tPointLight,\n \tScene,\n \tObject3D,\n} from 'three';\n\n/**\n * This class represents a scene with a basic room setup that can be used as\n * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's\n * lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment}\n * or directly as an environment map to PBR materials.\n *\n * The implementation is based on the [EnvironmentScene](https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts)\n * component from the `model-viewer` project.\n *\n * ```js\n * const environment = new RoomEnvironment();\n * const pmremGenerator = new THREE.PMREMGenerator( renderer );\n *\n * const envMap = pmremGenerator.fromScene( environment ).texture;\n * scene.environment = envMap;\n * ```\n *\n * @augments Scene\n * @three_import import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';\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 boxes = new InstancedMesh( geometry, boxMaterial, 6 );\n\t\tconst transform = new Object3D();\n\n\t\t// box1\n\t\ttransform.position.set( - 10.906, 2.009, 1.846 );\n\t\ttransform.rotation.set( 0, - 0.195, 0 );\n\t\ttransform.scale.set( 2.328, 7.905, 4.651 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 0, transform.matrix );\n\n\t\t// box2\n\t\ttransform.position.set( - 5.607, - 0.754, - 0.758 );\n\t\ttransform.rotation.set( 0, 0.994, 0 );\n\t\ttransform.scale.set( 1.970, 1.534, 3.955 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 1, transform.matrix );\n\n\t\t// box3\n\t\ttransform.position.set( 6.167, 0.857, 7.803 );\n\t\ttransform.rotation.set( 0, 0.561, 0 );\n\t\ttransform.scale.set( 3.927, 6.285, 3.687 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 2, transform.matrix );\n\n\t\t// box4\n\t\ttransform.position.set( - 2.017, 0.018, 6.124 );\n\t\ttransform.rotation.set( 0, 0.333, 0 );\n\t\ttransform.scale.set( 2.002, 4.566, 2.064 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 3, transform.matrix );\n\n\t\t// box5\n\t\ttransform.position.set( 2.291, - 0.756, - 2.621 );\n\t\ttransform.rotation.set( 0, - 0.286, 0 );\n\t\ttransform.scale.set( 1.546, 1.552, 1.496 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 4, transform.matrix );\n\n\t\t// box6\n\t\ttransform.position.set( - 2.193, - 0.369, - 5.547 );\n\t\ttransform.rotation.set( 0, 0.516, 0 );\n\t\ttransform.scale.set( 3.875, 3.487, 2.986 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 5, transform.matrix );\n\n\t\tthis.add( boxes );\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\t/**\n\t * Frees internal resources. This method should be called\n\t * when the environment is no longer required.\n\t */\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\t// create an emissive-only material. see #31348\n\tconst material = new MeshLambertMaterial( {\n\t\tcolor: 0x000000,\n\t\temissive: 0xffffff,\n\t\temissiveIntensity: intensity\n\t} );\n\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","InstancedMesh","Object3D","MeshLambertMaterial","PMREMGenerator","components"],"mappings":";;;;;;CAYA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,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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Q,CAAC,OAAO,EAAE;;CAErB,EAAE;;CAEF,CAAC;;CAED;;CAEA,SAAS,uBAAuB,EAAE,SAAS,GAAG;;CAE9C;CACA,CAAC,MAAM,QAAQ,GAAG,IAAIG,yBAAmB,EAAE;CAC3C,EAAE,KAAK,EAAE,QAAQ;CACjB,EAAE,QAAQ,EAAE,QAAQ;CACpB,EAAE,iBAAiB,EAAE;CACrB,EAAE,EAAE;;CAEJ,CAAC,OAAO,QAAQ;;CAEhB;;CCnLA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAMA,MAAM,wBAAwB,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;KACvB;KAEA,OAAO,GAAA;SACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS;KAC3C;CACD;AAEDC,uBAAU,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,MAAM,KAAK,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"RoomEnvironmentComponent.js","sources":["../../../../../node_modules/three/examples/jsm/environments/RoomEnvironment.js","../../../plugins/components/RoomEnvironmentComponent.ts"],"sourcesContent":["import {\n \tBackSide,\n \tBoxGeometry,\n \tInstancedMesh,\n \tMesh,\n\tMeshLambertMaterial,\n \tMeshStandardMaterial,\n \tPointLight,\n \tScene,\n \tObject3D,\n} from 'three';\n\n/**\n * This class represents a scene with a basic room setup that can be used as\n * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's\n * lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment}\n * or directly as an environment map to PBR materials.\n *\n * The implementation is based on the [EnvironmentScene](https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts)\n * component from the `model-viewer` project.\n *\n * ```js\n * const environment = new RoomEnvironment();\n * const pmremGenerator = new THREE.PMREMGenerator( renderer );\n *\n * const envMap = pmremGenerator.fromScene( environment ).texture;\n * scene.environment = envMap;\n * ```\n *\n * @augments Scene\n * @three_import import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';\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 boxes = new InstancedMesh( geometry, boxMaterial, 6 );\n\t\tconst transform = new Object3D();\n\n\t\t// box1\n\t\ttransform.position.set( - 10.906, 2.009, 1.846 );\n\t\ttransform.rotation.set( 0, - 0.195, 0 );\n\t\ttransform.scale.set( 2.328, 7.905, 4.651 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 0, transform.matrix );\n\n\t\t// box2\n\t\ttransform.position.set( - 5.607, - 0.754, - 0.758 );\n\t\ttransform.rotation.set( 0, 0.994, 0 );\n\t\ttransform.scale.set( 1.970, 1.534, 3.955 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 1, transform.matrix );\n\n\t\t// box3\n\t\ttransform.position.set( 6.167, 0.857, 7.803 );\n\t\ttransform.rotation.set( 0, 0.561, 0 );\n\t\ttransform.scale.set( 3.927, 6.285, 3.687 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 2, transform.matrix );\n\n\t\t// box4\n\t\ttransform.position.set( - 2.017, 0.018, 6.124 );\n\t\ttransform.rotation.set( 0, 0.333, 0 );\n\t\ttransform.scale.set( 2.002, 4.566, 2.064 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 3, transform.matrix );\n\n\t\t// box5\n\t\ttransform.position.set( 2.291, - 0.756, - 2.621 );\n\t\ttransform.rotation.set( 0, - 0.286, 0 );\n\t\ttransform.scale.set( 1.546, 1.552, 1.496 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 4, transform.matrix );\n\n\t\t// box6\n\t\ttransform.position.set( - 2.193, - 0.369, - 5.547 );\n\t\ttransform.rotation.set( 0, 0.516, 0 );\n\t\ttransform.scale.set( 3.875, 3.487, 2.986 );\n\t\ttransform.updateMatrix();\n\t\tboxes.setMatrixAt( 5, transform.matrix );\n\n\t\tthis.add( boxes );\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\t/**\n\t * Frees internal resources. This method should be called\n\t * when the environment is no longer required.\n\t */\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\t// create an emissive-only material. see #31348\n\tconst material = new MeshLambertMaterial( {\n\t\tcolor: 0x000000,\n\t\temissive: 0xffffff,\n\t\temissiveIntensity: intensity\n\t} );\n\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","InstancedMesh","Object3D","MeshLambertMaterial","PMREMGenerator","components"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCA,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,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AAI,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,EAAE;CAEpC,GAAG;CAEH,EAAE,CAAC,EAAE;CAEL,EAAE,MAAM,MAAM,QAAQ,IAAI,SAAS,GAAG;CAEtC,GAAG,QAAQ,CAAC,OAAO,EAAE;CAErB,EAAE;CAEF,CAAC;CAED;CAEA,SAAS,uBAAuB,EAAE,SAAS,GAAG;CAG9C,CAAC,MAAM,QAAQ,GAAG,IAAIG,yBAAmB,EAAE;CAC3C,EAAE,KAAK,EAAE,QAAQ;CACjB,EAAE,QAAQ,EAAE,QAAQ;CACpB,EAAE,iBAAiB,EAAE;CACrB,EAAE,EAAE;CAEJ,CAAC,OAAO,QAAQ;CAEhB;;CCxJA,MAAM,wBAAwB,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;KACvB;KAEA,OAAO,GAAA;SACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS;KAC3C;CACD;AAEDC,uBAAU,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,MAAM,KAAK,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
|
|
1
24
|
!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 s extends e.Scene{constructor(){super();const t=new e.BoxGeometry;t.deleteAttribute("uv");const s=new e.MeshStandardMaterial({side:e.BackSide}),n=new e.MeshStandardMaterial,o=new e.PointLight(16777215,900,28,2);o.position.set(.418,16.199,.3),this.add(o);const a=new e.Mesh(t,s);a.position.set(-.757,13.219,.717),a.scale.set(31.713,28.305,28.591),this.add(a);const r=new e.InstancedMesh(t,n,6),d=new e.Object3D;d.position.set(-10.906,2.009,1.846),d.rotation.set(0,-.195,0),d.scale.set(2.328,7.905,4.651),d.updateMatrix(),r.setMatrixAt(0,d.matrix),d.position.set(-5.607,-.754,-.758),d.rotation.set(0,.994,0),d.scale.set(1.97,1.534,3.955),d.updateMatrix(),r.setMatrixAt(1,d.matrix),d.position.set(6.167,.857,7.803),d.rotation.set(0,.561,0),d.scale.set(3.927,6.285,3.687),d.updateMatrix(),r.setMatrixAt(2,d.matrix),d.position.set(-2.017,.018,6.124),d.rotation.set(0,.333,0),d.scale.set(2.002,4.566,2.064),d.updateMatrix(),r.setMatrixAt(3,d.matrix),d.position.set(2.291,-.756,-2.621),d.rotation.set(0,-.286,0),d.scale.set(1.546,1.552,1.496),d.updateMatrix(),r.setMatrixAt(4,d.matrix),d.position.set(-2.193,-.369,-5.547),d.rotation.set(0,.516,0),d.scale.set(3.875,3.487,2.986),d.updateMatrix(),r.setMatrixAt(5,d.matrix),this.add(r);const c=new e.Mesh(t,i(50));c.position.set(-16.116,14.37,8.208),c.scale.set(.1,2.428,2.739),this.add(c);const h=new e.Mesh(t,i(50));h.position.set(-16.109,18.021,-8.207),h.scale.set(.1,2.425,2.751),this.add(h);const p=new e.Mesh(t,i(17));p.position.set(14.904,12.198,-1.832),p.scale.set(.15,4.265,6.331),this.add(p);const M=new e.Mesh(t,i(43));M.position.set(-.462,8.89,14.52),M.scale.set(4.38,5.441,.088),this.add(M);const l=new e.Mesh(t,i(20));l.position.set(3.235,11.486,-12.541),l.scale.set(2.5,2,.1),this.add(l);const w=new e.Mesh(t,i(100));w.position.set(0,20,0),w.scale.set(1,.1,1),this.add(w)}dispose(){const e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(const t of e)t.dispose()}}function i(t){return new e.MeshLambertMaterial({color:0,emissive:16777215,emissiveIntensity:t})}class n{constructor(t){this.viewer=t;const i=new s,n=new e.PMREMGenerator(this.viewer.renderer);this.viewer.scene.environment=n.fromScene(i).texture,i.dispose()}dispose(){this.viewer.scene.environment=void 0}}t.components.registerComponent("LightComponent",e=>new n(e))});
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
|
|
3
|
+
// All rights reserved.
|
|
4
|
+
//
|
|
5
|
+
// This software and its documentation and related materials are owned by
|
|
6
|
+
// the Alliance. The software may only be incorporated into application
|
|
7
|
+
// programs owned by members of the Alliance, subject to a signed
|
|
8
|
+
// Membership Agreement and Supplemental Software License Agreement with the
|
|
9
|
+
// Alliance. The structure and organization of this software are the valuable
|
|
10
|
+
// trade secrets of the Alliance and its suppliers. The software is also
|
|
11
|
+
// protected by copyright law and international treaty provisions. Application
|
|
12
|
+
// programs incorporating this software must include the following statement
|
|
13
|
+
// with their copyright notices:
|
|
14
|
+
//
|
|
15
|
+
// This application incorporates Open Design Alliance software pursuant to a
|
|
16
|
+
// license agreement with Open Design Alliance.
|
|
17
|
+
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
|
|
18
|
+
// All rights reserved.
|
|
19
|
+
//
|
|
20
|
+
// By use of this software, its documentation or related materials, you
|
|
21
|
+
// acknowledge and accept the above terms.
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
23
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { components } from
|
|
24
|
+
import { PMREMGenerator } from 'three';
|
|
25
|
+
import { RoomEnvironment } from 'three/examples/jsm/environments/RoomEnvironment.js';
|
|
26
|
+
import { components } from '@inweb/viewer-three';
|
|
6
27
|
|
|
7
28
|
class RoomEnvironmentComponent {
|
|
8
29
|
constructor(viewer) {
|
|
9
30
|
this.viewer = viewer;
|
|
10
|
-
const environment = new RoomEnvironment;
|
|
31
|
+
const environment = new RoomEnvironment();
|
|
11
32
|
const pmremGenerator = new PMREMGenerator(this.viewer.renderer);
|
|
12
33
|
this.viewer.scene.environment = pmremGenerator.fromScene(environment).texture;
|
|
13
34
|
environment.dispose();
|
|
@@ -16,6 +37,5 @@ class RoomEnvironmentComponent {
|
|
|
16
37
|
this.viewer.scene.environment = undefined;
|
|
17
38
|
}
|
|
18
39
|
}
|
|
19
|
-
|
|
20
|
-
components.registerComponent("LightComponent", viewer => new RoomEnvironmentComponent(viewer));
|
|
40
|
+
components.registerComponent("LightComponent", (viewer) => new RoomEnvironmentComponent(viewer));
|
|
21
41
|
//# sourceMappingURL=RoomEnvironmentComponent.module.js.map
|
|
@@ -1 +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":[
|
|
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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,wBAAwB,CAAA;AAG5B,IAAA,WAAA,CAAY,MAAc,EAAA;AACxB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AAEpB,QAAA,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE;QACzC,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;AAE/D,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO;QAE7E,WAAW,CAAC,OAAO,EAAE;IACvB;IAEA,OAAO,GAAA;QACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS;IAC3C;AACD;AAED,UAAU,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,CAAC,MAAM,KAAK,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC"}
|