@inweb/viewer-three 26.8.1 → 26.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/components/RoomEnvironmentComponent.js +75 -40
- package/dist/plugins/components/RoomEnvironmentComponent.js.map +1 -1
- package/dist/plugins/components/RoomEnvironmentComponent.min.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.js.map +1 -1
- package/dist/plugins/components/StatsPanelComponent.min.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.module.js +1 -1
- package/dist/plugins/components/StatsPanelComponent.module.js.map +1 -1
- package/dist/plugins/loaders/GLTFCloudLoader.js +225 -94
- package/dist/plugins/loaders/GLTFCloudLoader.js.map +1 -1
- package/dist/plugins/loaders/GLTFCloudLoader.min.js +1 -1
- package/dist/plugins/loaders/IFCXLoader.js +169 -19
- package/dist/plugins/loaders/IFCXLoader.js.map +1 -1
- package/dist/plugins/loaders/IFCXLoader.min.js +1 -1
- package/dist/viewer-three.js +31138 -5501
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +3 -3
- package/dist/viewer-three.module.js +399 -296
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/Viewer.d.ts +17 -3
- package/lib/Viewer/commands/SetDefaultViewPosition.d.ts +6 -6
- package/lib/Viewer/components/HighlighterComponent.d.ts +5 -4
- package/lib/Viewer/components/SelectionComponent.d.ts +1 -1
- package/lib/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.d.ts +3 -1
- package/lib/Viewer/scenes/Helpers.d.ts +7 -0
- package/lib/index.d.ts +2 -1
- package/package.json +9 -9
- package/plugins/components/StatsPanelComponent.ts +1 -1
- package/src/Viewer/Viewer.ts +119 -49
- package/src/Viewer/commands/SetDefaultViewPosition.ts +8 -8
- package/src/Viewer/components/CameraComponent.ts +20 -16
- package/src/Viewer/components/ExtentsComponent.ts +1 -0
- package/src/Viewer/components/HighlighterComponent.ts +78 -80
- package/src/Viewer/components/LightComponent.ts +1 -1
- package/src/Viewer/components/ResizeCanvasComponent.ts +1 -0
- package/src/Viewer/components/SelectionComponent.ts +1 -1
- package/src/Viewer/helpers/WCSHelper.ts +8 -5
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicGltfLoader.js +33 -16
- package/src/Viewer/loaders/DynamicGltfLoader/DynamicModelImpl.ts +12 -5
- package/src/Viewer/loaders/DynamicGltfLoader/GltfStructure.js +100 -20
- package/src/Viewer/loaders/GLTFCloudDynamicLoader.ts +4 -2
- package/src/Viewer/loaders/GLTFFileLoader.ts +1 -1
- package/src/Viewer/postprocessing/SSAARenderPass.js +245 -0
- package/src/Viewer/{model/index.ts → scenes/Helpers.ts} +19 -2
- package/src/index.ts +2 -1
- package/lib/Viewer/model/index.d.ts +0 -2
- /package/lib/Viewer/{model → models}/IModelImpl.d.ts +0 -0
- /package/lib/Viewer/{model → models}/ModelImpl.d.ts +0 -0
- /package/src/Viewer/{model → models}/IModelImpl.ts +0 -0
- /package/src/Viewer/{model → models}/ModelImpl.ts +0 -0
|
@@ -0,0 +1,245 @@
|
|
|
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
|
+
|
|
24
|
+
import { AdditiveBlending, Color, HalfFloatType, ShaderMaterial, UniformsUtils, WebGLRenderTarget } from "three";
|
|
25
|
+
import { Pass, FullScreenQuad } from "three/examples/jsm/postprocessing/Pass.js";
|
|
26
|
+
import { CopyShader } from "three/examples/jsm/shaders/CopyShader.js";
|
|
27
|
+
|
|
28
|
+
export class SSAARenderPass extends Pass {
|
|
29
|
+
constructor(scenes, camera, clearColor = 0x000000, clearAlpha = 0) {
|
|
30
|
+
super();
|
|
31
|
+
this.scenes = Array.isArray(scenes) ? scenes : [scenes];
|
|
32
|
+
this.camera = camera;
|
|
33
|
+
this.sampleLevel = 2;
|
|
34
|
+
this.unbiased = true;
|
|
35
|
+
this.stencilBuffer = false;
|
|
36
|
+
this.clearColor = clearColor;
|
|
37
|
+
this.clearAlpha = clearAlpha;
|
|
38
|
+
|
|
39
|
+
this._sampleRenderTarget = null;
|
|
40
|
+
this._oldClearColor = new Color();
|
|
41
|
+
this._copyUniforms = UniformsUtils.clone(CopyShader.uniforms);
|
|
42
|
+
|
|
43
|
+
this._copyMaterial = new ShaderMaterial({
|
|
44
|
+
uniforms: this._copyUniforms,
|
|
45
|
+
vertexShader: CopyShader.vertexShader,
|
|
46
|
+
fragmentShader: CopyShader.fragmentShader,
|
|
47
|
+
transparent: true,
|
|
48
|
+
depthTest: false,
|
|
49
|
+
depthWrite: false,
|
|
50
|
+
premultipliedAlpha: true,
|
|
51
|
+
blending: AdditiveBlending,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
this._fsQuad = new FullScreenQuad(this._copyMaterial);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
dispose() {
|
|
58
|
+
if (this._sampleRenderTarget) {
|
|
59
|
+
this._sampleRenderTarget.dispose();
|
|
60
|
+
this._sampleRenderTarget = null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this._copyMaterial.dispose();
|
|
64
|
+
|
|
65
|
+
this._fsQuad.dispose();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setSize(width, height) {
|
|
69
|
+
if (this._sampleRenderTarget) this._sampleRenderTarget.setSize(width, height);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
render(renderer, writeBuffer, readBuffer, deltaTime, maskActive) {
|
|
73
|
+
if (!this._sampleRenderTarget) {
|
|
74
|
+
this._sampleRenderTarget = new WebGLRenderTarget(readBuffer.width, readBuffer.height, {
|
|
75
|
+
type: HalfFloatType,
|
|
76
|
+
stencilBuffer: this.stencilBuffer,
|
|
77
|
+
});
|
|
78
|
+
this._sampleRenderTarget.texture.name = "SSAAMultiRenderPass.sample";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const jitterOffsets = _JitterVectors[Math.max(0, Math.min(this.sampleLevel, 5))];
|
|
82
|
+
|
|
83
|
+
const autoClear = renderer.autoClear;
|
|
84
|
+
renderer.autoClear = false;
|
|
85
|
+
|
|
86
|
+
renderer.getClearColor(this._oldClearColor);
|
|
87
|
+
const oldClearAlpha = renderer.getClearAlpha();
|
|
88
|
+
|
|
89
|
+
const baseSampleWeight = 1.0 / jitterOffsets.length;
|
|
90
|
+
const roundingRange = 1 / 32;
|
|
91
|
+
this._copyUniforms["tDiffuse"].value = this._sampleRenderTarget.texture;
|
|
92
|
+
|
|
93
|
+
const viewOffset = {
|
|
94
|
+
fullWidth: readBuffer.width,
|
|
95
|
+
fullHeight: readBuffer.height,
|
|
96
|
+
offsetX: 0,
|
|
97
|
+
offsetY: 0,
|
|
98
|
+
width: readBuffer.width,
|
|
99
|
+
height: readBuffer.height,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const originalViewOffset = Object.assign({}, this.camera.view);
|
|
103
|
+
|
|
104
|
+
if (originalViewOffset.enabled) Object.assign(viewOffset, originalViewOffset);
|
|
105
|
+
|
|
106
|
+
for (let i = 0; i < jitterOffsets.length; i++) {
|
|
107
|
+
const jitterOffset = jitterOffsets[i];
|
|
108
|
+
|
|
109
|
+
if (this.camera.setViewOffset) {
|
|
110
|
+
this.camera.setViewOffset(
|
|
111
|
+
viewOffset.fullWidth,
|
|
112
|
+
viewOffset.fullHeight,
|
|
113
|
+
|
|
114
|
+
viewOffset.offsetX + jitterOffset[0] * 0.0625,
|
|
115
|
+
viewOffset.offsetY + jitterOffset[1] * 0.0625, // 0.0625 = 1 / 16
|
|
116
|
+
|
|
117
|
+
viewOffset.width,
|
|
118
|
+
viewOffset.height
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let sampleWeight = baseSampleWeight;
|
|
123
|
+
|
|
124
|
+
if (this.unbiased) {
|
|
125
|
+
const uniformCenteredDistribution = -0.5 + (i + 0.5) / jitterOffsets.length;
|
|
126
|
+
sampleWeight += roundingRange * uniformCenteredDistribution;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
this._copyUniforms["opacity"].value = sampleWeight;
|
|
130
|
+
renderer.setClearColor(this.clearColor, this.clearAlpha);
|
|
131
|
+
renderer.setRenderTarget(this._sampleRenderTarget);
|
|
132
|
+
renderer.clear();
|
|
133
|
+
|
|
134
|
+
this.scenes.forEach((scene) => renderer.render(scene, this.camera));
|
|
135
|
+
|
|
136
|
+
renderer.setRenderTarget(this.renderToScreen ? null : writeBuffer);
|
|
137
|
+
|
|
138
|
+
if (i === 0) {
|
|
139
|
+
renderer.setClearColor(0x000000, 0.0);
|
|
140
|
+
renderer.clear();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this._fsQuad.render(renderer);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (this.camera.setViewOffset && originalViewOffset.enabled) {
|
|
147
|
+
this.camera.setViewOffset(
|
|
148
|
+
originalViewOffset.fullWidth,
|
|
149
|
+
originalViewOffset.fullHeight,
|
|
150
|
+
|
|
151
|
+
originalViewOffset.offsetX,
|
|
152
|
+
originalViewOffset.offsetY,
|
|
153
|
+
|
|
154
|
+
originalViewOffset.width,
|
|
155
|
+
originalViewOffset.height
|
|
156
|
+
);
|
|
157
|
+
} else if (this.camera.clearViewOffset) {
|
|
158
|
+
this.camera.clearViewOffset();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
renderer.autoClear = autoClear;
|
|
162
|
+
renderer.setClearColor(this._oldClearColor, oldClearAlpha);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// These jitter vectors are specified in integers because it is easier.
|
|
167
|
+
// I am assuming a [-8,8) integer grid, but it needs to be mapped onto [-0.5,0.5)
|
|
168
|
+
// before being used, thus these integers need to be scaled by 1/16.
|
|
169
|
+
//
|
|
170
|
+
// Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
|
|
171
|
+
const _JitterVectors = [
|
|
172
|
+
[[0, 0]],
|
|
173
|
+
[
|
|
174
|
+
[4, 4],
|
|
175
|
+
[-4, -4],
|
|
176
|
+
],
|
|
177
|
+
[
|
|
178
|
+
[-2, -6],
|
|
179
|
+
[6, -2],
|
|
180
|
+
[-6, 2],
|
|
181
|
+
[2, 6],
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
[1, -3],
|
|
185
|
+
[-1, 3],
|
|
186
|
+
[5, 1],
|
|
187
|
+
[-3, -5],
|
|
188
|
+
[-5, 5],
|
|
189
|
+
[-7, -1],
|
|
190
|
+
[3, 7],
|
|
191
|
+
[7, -7],
|
|
192
|
+
],
|
|
193
|
+
[
|
|
194
|
+
[1, 1],
|
|
195
|
+
[-1, -3],
|
|
196
|
+
[-3, 2],
|
|
197
|
+
[4, -1],
|
|
198
|
+
[-5, -2],
|
|
199
|
+
[2, 5],
|
|
200
|
+
[5, 3],
|
|
201
|
+
[3, -5],
|
|
202
|
+
[-2, 6],
|
|
203
|
+
[0, -7],
|
|
204
|
+
[-4, -6],
|
|
205
|
+
[-6, 4],
|
|
206
|
+
[-8, 0],
|
|
207
|
+
[7, -4],
|
|
208
|
+
[6, 7],
|
|
209
|
+
[-7, -8],
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
[-4, -7],
|
|
213
|
+
[-7, -5],
|
|
214
|
+
[-3, -5],
|
|
215
|
+
[-5, -4],
|
|
216
|
+
[-1, -4],
|
|
217
|
+
[-2, -2],
|
|
218
|
+
[-6, -1],
|
|
219
|
+
[-4, 0],
|
|
220
|
+
[-7, 1],
|
|
221
|
+
[-1, 2],
|
|
222
|
+
[-6, 3],
|
|
223
|
+
[-3, 3],
|
|
224
|
+
[-7, 6],
|
|
225
|
+
[-3, 6],
|
|
226
|
+
[-5, 7],
|
|
227
|
+
[-1, 7],
|
|
228
|
+
[5, -7],
|
|
229
|
+
[1, -6],
|
|
230
|
+
[6, -5],
|
|
231
|
+
[4, -4],
|
|
232
|
+
[2, -3],
|
|
233
|
+
[7, -2],
|
|
234
|
+
[1, -1],
|
|
235
|
+
[4, -1],
|
|
236
|
+
[2, 1],
|
|
237
|
+
[6, 2],
|
|
238
|
+
[0, 4],
|
|
239
|
+
[4, 4],
|
|
240
|
+
[2, 5],
|
|
241
|
+
[7, 5],
|
|
242
|
+
[5, 6],
|
|
243
|
+
[3, 7],
|
|
244
|
+
],
|
|
245
|
+
];
|
|
@@ -21,5 +21,22 @@
|
|
|
21
21
|
// acknowledge and accept the above terms.
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
import { Scene, WebGLRenderer } from "three";
|
|
25
|
+
|
|
26
|
+
export class Helpers extends Scene {
|
|
27
|
+
private oldAutoClear = false;
|
|
28
|
+
private oldClippingPlanes = [];
|
|
29
|
+
|
|
30
|
+
override onBeforeRender(renderer: WebGLRenderer): void {
|
|
31
|
+
this.oldAutoClear = renderer.autoClear;
|
|
32
|
+
this.oldClippingPlanes = renderer.clippingPlanes;
|
|
33
|
+
|
|
34
|
+
renderer.autoClear = false;
|
|
35
|
+
renderer.clippingPlanes = [];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override onAfterRender(renderer: WebGLRenderer): void {
|
|
39
|
+
renderer.clippingPlanes = this.oldClippingPlanes;
|
|
40
|
+
renderer.autoClear = this.oldAutoClear;
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -26,7 +26,8 @@ export * from "./Viewer/commands";
|
|
|
26
26
|
export * from "./Viewer/components";
|
|
27
27
|
export * from "./Viewer/loaders";
|
|
28
28
|
export * from "./Viewer/loaders/GLTFLoadingManager";
|
|
29
|
-
export * from "./Viewer/
|
|
29
|
+
export * from "./Viewer/models/IModelImpl";
|
|
30
|
+
export * from "./Viewer/models/ModelImpl";
|
|
30
31
|
export * from "./Viewer/Viewer";
|
|
31
32
|
|
|
32
33
|
// the lines below are required for typedoc to include the viewer core and markups documentation
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|