three-cad-viewer 4.3.0 → 4.3.2
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/rendering/texture-cache.d.ts +3 -0
- package/dist/three-cad-viewer.esm.js +15 -10
- package/dist/three-cad-viewer.esm.js.map +1 -1
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +15 -10
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/rendering/material-factory.ts +10 -8
- package/src/rendering/texture-cache.ts +5 -0
- /package/{Readme.md → README.md} +0 -0
package/package.json
CHANGED
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version: string = "4.3.
|
|
1
|
+
export const version: string = "4.3.2";
|
|
@@ -478,12 +478,10 @@ class MaterialFactory {
|
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
// --- Anisotropy (brushed metal) ---
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
material.anisotropyRotation = def.anisotropyRotation;
|
|
486
|
-
}
|
|
481
|
+
// Skipped: anisotropic reflections require tangent vectors on the mesh.
|
|
482
|
+
// CAD tessellation never provides tangents, so Three.js falls back to
|
|
483
|
+
// screen-space derivative tangents which produce visible diamond-shaped
|
|
484
|
+
// facet artifacts on coarse meshes.
|
|
487
485
|
|
|
488
486
|
// --- Textures ---
|
|
489
487
|
// Resolve all texture references via TextureCache.
|
|
@@ -536,6 +534,9 @@ class MaterialFactory {
|
|
|
536
534
|
// Skip displacement properties (not supported, would waste GPU memory)
|
|
537
535
|
if (key === "displacement" || key === "displacementScale" || key === "displacementBias") continue;
|
|
538
536
|
|
|
537
|
+
// Skip anisotropy — requires tangent vectors that CAD meshes don't have
|
|
538
|
+
if (key === "anisotropy" || key === "anisotropyRotation") continue;
|
|
539
|
+
|
|
539
540
|
// Color arrays → THREE.Color (already linear, no sRGB conversion)
|
|
540
541
|
if (COLOR_ARRAY_KEYS.has(key) && Array.isArray(prop.value)) {
|
|
541
542
|
const [r, g, b] = prop.value as number[];
|
|
@@ -718,8 +719,9 @@ class MaterialFactory {
|
|
|
718
719
|
const sheenRoughnessTex = await resolve(def.sheenRoughnessMap, "sheenRoughnessTexture");
|
|
719
720
|
if (sheenRoughnessTex) material.sheenRoughnessMap = sheenRoughnessTex;
|
|
720
721
|
|
|
721
|
-
|
|
722
|
-
|
|
722
|
+
// Anisotropy texture skipped — CAD meshes lack tangent vectors.
|
|
723
|
+
// const anisotropyTex = await resolve(def.anisotropyMap, "anisotropyTexture");
|
|
724
|
+
// if (anisotropyTex) material.anisotropyMap = anisotropyTex;
|
|
723
725
|
}
|
|
724
726
|
|
|
725
727
|
/**
|
|
@@ -68,6 +68,10 @@ class TextureCache {
|
|
|
68
68
|
/** Whether this cache has been fully disposed */
|
|
69
69
|
private _disposed = false;
|
|
70
70
|
|
|
71
|
+
/** Max anisotropic filtering level.
|
|
72
|
+
* Default 16 covers most GPUs; clamped by the driver if unsupported. */
|
|
73
|
+
maxAnisotropy = 16;
|
|
74
|
+
|
|
71
75
|
// ---------------------------------------------------------------------------
|
|
72
76
|
// Public API
|
|
73
77
|
// ---------------------------------------------------------------------------
|
|
@@ -272,6 +276,7 @@ class TextureCache {
|
|
|
272
276
|
texture.colorSpace = colorSpace;
|
|
273
277
|
texture.wrapS = THREE.RepeatWrapping;
|
|
274
278
|
texture.wrapT = THREE.RepeatWrapping;
|
|
279
|
+
texture.anisotropy = this.maxAnisotropy;
|
|
275
280
|
resolve(texture);
|
|
276
281
|
},
|
|
277
282
|
undefined, // onProgress (not used)
|
/package/{Readme.md → README.md}
RENAMED
|
File without changes
|