create-ifc-lite 1.14.7 → 1.14.8
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/templates/threejs.js +13 -2
- package/package.json +1 -1
|
@@ -49,6 +49,11 @@ export function createThreejsTemplate(targetDir, projectName) {
|
|
|
49
49
|
writeFileSync(join(targetDir, 'vite.config.ts'), `import { defineConfig } from 'vite';
|
|
50
50
|
|
|
51
51
|
export default defineConfig({
|
|
52
|
+
// @ifc-lite ships ES-module geometry workers; emit them as ESM so a
|
|
53
|
+
// production build never trips over Rollup's IIFE worker default.
|
|
54
|
+
worker: {
|
|
55
|
+
format: 'es',
|
|
56
|
+
},
|
|
52
57
|
optimizeDeps: {
|
|
53
58
|
exclude: ['@ifc-lite/wasm'],
|
|
54
59
|
},
|
|
@@ -132,7 +137,10 @@ export function meshDataToThree(mesh: MeshData): THREE.Mesh {
|
|
|
132
137
|
color: new THREE.Color(r, g, b),
|
|
133
138
|
transparent: a < 1,
|
|
134
139
|
opacity: a,
|
|
135
|
-
|
|
140
|
+
// DoubleSide even for opaque: IFC triangle winding isn't reliably outward,
|
|
141
|
+
// and culling one side of two coincident coplanar walls (a facing wall flush
|
|
142
|
+
// on a thicker one) leaves the survivors z-fighting into a comb along the seam.
|
|
143
|
+
side: THREE.DoubleSide,
|
|
136
144
|
depthWrite: a >= 1,
|
|
137
145
|
});
|
|
138
146
|
|
|
@@ -155,7 +163,10 @@ if (!canvas || !fileInput || !status) {
|
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
// Three.js setup
|
|
158
|
-
|
|
166
|
+
// logarithmicDepthBuffer spreads depth precision across the scene so the
|
|
167
|
+
// near-coplanar surfaces common in IFC (a roof slab on a gable wall, stacked
|
|
168
|
+
// wall layers) far from the origin don't z-fight into stair-stepped seams.
|
|
169
|
+
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, logarithmicDepthBuffer: true });
|
|
159
170
|
renderer.setPixelRatio(window.devicePixelRatio);
|
|
160
171
|
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
161
172
|
|