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
|
@@ -33,6 +33,9 @@ declare class TextureCache {
|
|
|
33
33
|
private _textureLoader;
|
|
34
34
|
/** Whether this cache has been fully disposed */
|
|
35
35
|
private _disposed;
|
|
36
|
+
/** Max anisotropic filtering level.
|
|
37
|
+
* Default 16 covers most GPUs; clamped by the driver if unsupported. */
|
|
38
|
+
maxAnisotropy: number;
|
|
36
39
|
/**
|
|
37
40
|
* Resolve a texture reference string and return a cached or newly loaded
|
|
38
41
|
* THREE.Texture with the correct colorSpace set.
|
|
@@ -82601,6 +82601,9 @@ class TextureCache {
|
|
|
82601
82601
|
this._textureLoader = null;
|
|
82602
82602
|
/** Whether this cache has been fully disposed */
|
|
82603
82603
|
this._disposed = false;
|
|
82604
|
+
/** Max anisotropic filtering level.
|
|
82605
|
+
* Default 16 covers most GPUs; clamped by the driver if unsupported. */
|
|
82606
|
+
this.maxAnisotropy = 16;
|
|
82604
82607
|
}
|
|
82605
82608
|
// ---------------------------------------------------------------------------
|
|
82606
82609
|
// Public API
|
|
@@ -82762,6 +82765,7 @@ class TextureCache {
|
|
|
82762
82765
|
texture.colorSpace = colorSpace;
|
|
82763
82766
|
texture.wrapS = RepeatWrapping;
|
|
82764
82767
|
texture.wrapT = RepeatWrapping;
|
|
82768
|
+
texture.anisotropy = this.maxAnisotropy;
|
|
82765
82769
|
resolve(texture);
|
|
82766
82770
|
}, undefined, // onProgress (not used)
|
|
82767
82771
|
(error) => {
|
|
@@ -83117,12 +83121,10 @@ class MaterialFactory {
|
|
|
83117
83121
|
}
|
|
83118
83122
|
}
|
|
83119
83123
|
// --- Anisotropy (brushed metal) ---
|
|
83120
|
-
|
|
83121
|
-
|
|
83122
|
-
|
|
83123
|
-
|
|
83124
|
-
material.anisotropyRotation = def.anisotropyRotation;
|
|
83125
|
-
}
|
|
83124
|
+
// Skipped: anisotropic reflections require tangent vectors on the mesh.
|
|
83125
|
+
// CAD tessellation never provides tangents, so Three.js falls back to
|
|
83126
|
+
// screen-space derivative tangents which produce visible diamond-shaped
|
|
83127
|
+
// facet artifacts on coarse meshes.
|
|
83126
83128
|
// --- Textures ---
|
|
83127
83129
|
// Resolve all texture references via TextureCache.
|
|
83128
83130
|
// The TextureCache determines colorSpace internally from the texture role name.
|
|
@@ -83165,6 +83167,9 @@ class MaterialFactory {
|
|
|
83165
83167
|
// Skip displacement properties (not supported, would waste GPU memory)
|
|
83166
83168
|
if (key === "displacement" || key === "displacementScale" || key === "displacementBias")
|
|
83167
83169
|
continue;
|
|
83170
|
+
// Skip anisotropy — requires tangent vectors that CAD meshes don't have
|
|
83171
|
+
if (key === "anisotropy" || key === "anisotropyRotation")
|
|
83172
|
+
continue;
|
|
83168
83173
|
// Color arrays → THREE.Color (already linear, no sRGB conversion)
|
|
83169
83174
|
if (COLOR_ARRAY_KEYS.has(key) && Array.isArray(prop.value)) {
|
|
83170
83175
|
const [r, g, b] = prop.value;
|
|
@@ -83335,9 +83340,9 @@ class MaterialFactory {
|
|
|
83335
83340
|
const sheenRoughnessTex = await resolve(def.sheenRoughnessMap, "sheenRoughnessTexture");
|
|
83336
83341
|
if (sheenRoughnessTex)
|
|
83337
83342
|
material.sheenRoughnessMap = sheenRoughnessTex;
|
|
83338
|
-
|
|
83339
|
-
|
|
83340
|
-
|
|
83343
|
+
// Anisotropy texture skipped — CAD meshes lack tangent vectors.
|
|
83344
|
+
// const anisotropyTex = await resolve(def.anisotropyMap, "anisotropyTexture");
|
|
83345
|
+
// if (anisotropyTex) material.anisotropyMap = anisotropyTex;
|
|
83341
83346
|
}
|
|
83342
83347
|
/**
|
|
83343
83348
|
* Update global settings.
|
|
@@ -94279,7 +94284,7 @@ class Tools {
|
|
|
94279
94284
|
}
|
|
94280
94285
|
}
|
|
94281
94286
|
|
|
94282
|
-
const version = "4.3.
|
|
94287
|
+
const version = "4.3.2";
|
|
94283
94288
|
|
|
94284
94289
|
/**
|
|
94285
94290
|
* Clean room environment for Studio mode PMREM generation.
|