three-cad-viewer 4.3.0 → 4.3.1

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.
@@ -82607,6 +82607,9 @@ void main() {
82607
82607
  this._textureLoader = null;
82608
82608
  /** Whether this cache has been fully disposed */
82609
82609
  this._disposed = false;
82610
+ /** Max anisotropic filtering level.
82611
+ * Default 16 covers most GPUs; clamped by the driver if unsupported. */
82612
+ this.maxAnisotropy = 16;
82610
82613
  }
82611
82614
  // ---------------------------------------------------------------------------
82612
82615
  // Public API
@@ -82768,6 +82771,7 @@ void main() {
82768
82771
  texture.colorSpace = colorSpace;
82769
82772
  texture.wrapS = RepeatWrapping;
82770
82773
  texture.wrapT = RepeatWrapping;
82774
+ texture.anisotropy = this.maxAnisotropy;
82771
82775
  resolve(texture);
82772
82776
  }, undefined, // onProgress (not used)
82773
82777
  (error) => {
@@ -83123,12 +83127,10 @@ void main() {
83123
83127
  }
83124
83128
  }
83125
83129
  // --- Anisotropy (brushed metal) ---
83126
- if (def.anisotropy !== undefined) {
83127
- material.anisotropy = def.anisotropy;
83128
- }
83129
- if (def.anisotropyRotation !== undefined) {
83130
- material.anisotropyRotation = def.anisotropyRotation;
83131
- }
83130
+ // Skipped: anisotropic reflections require tangent vectors on the mesh.
83131
+ // CAD tessellation never provides tangents, so Three.js falls back to
83132
+ // screen-space derivative tangents which produce visible diamond-shaped
83133
+ // facet artifacts on coarse meshes.
83132
83134
  // --- Textures ---
83133
83135
  // Resolve all texture references via TextureCache.
83134
83136
  // The TextureCache determines colorSpace internally from the texture role name.
@@ -83171,6 +83173,9 @@ void main() {
83171
83173
  // Skip displacement properties (not supported, would waste GPU memory)
83172
83174
  if (key === "displacement" || key === "displacementScale" || key === "displacementBias")
83173
83175
  continue;
83176
+ // Skip anisotropy — requires tangent vectors that CAD meshes don't have
83177
+ if (key === "anisotropy" || key === "anisotropyRotation")
83178
+ continue;
83174
83179
  // Color arrays → THREE.Color (already linear, no sRGB conversion)
83175
83180
  if (COLOR_ARRAY_KEYS.has(key) && Array.isArray(prop.value)) {
83176
83181
  const [r, g, b] = prop.value;
@@ -83341,9 +83346,9 @@ void main() {
83341
83346
  const sheenRoughnessTex = await resolve(def.sheenRoughnessMap, "sheenRoughnessTexture");
83342
83347
  if (sheenRoughnessTex)
83343
83348
  material.sheenRoughnessMap = sheenRoughnessTex;
83344
- const anisotropyTex = await resolve(def.anisotropyMap, "anisotropyTexture");
83345
- if (anisotropyTex)
83346
- material.anisotropyMap = anisotropyTex;
83349
+ // Anisotropy texture skipped — CAD meshes lack tangent vectors.
83350
+ // const anisotropyTex = await resolve(def.anisotropyMap, "anisotropyTexture");
83351
+ // if (anisotropyTex) material.anisotropyMap = anisotropyTex;
83347
83352
  }
83348
83353
  /**
83349
83354
  * Update global settings.
@@ -94285,7 +94290,7 @@ float metalnessFactor = metalness;
94285
94290
  }
94286
94291
  }
94287
94292
 
94288
- const version = "4.3.0";
94293
+ const version = "4.3.1";
94289
94294
 
94290
94295
  /**
94291
94296
  * Clean room environment for Studio mode PMREM generation.