three-text 0.3.0 → 0.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/README.md CHANGED
@@ -348,19 +348,12 @@ The library converts bezier curves into line segments by recursively subdividing
348
348
  In general, this step helps more with time to first render than ongoing interactions in the scene
349
349
 
350
350
  ```javascript
351
- // Using the default configuration
352
- const text = await Text.create({
353
- text: 'Sample text',
354
- font: '/fonts/Font.ttf',
355
- size: 72,
356
- });
357
-
358
351
  const text = await Text.create({
359
352
  text: 'Sample text',
360
353
  font: '/fonts/Font.ttf',
361
354
  curveFidelity: {
362
- distanceTolerance: 0.2, // Tighter tolerance for smoother curves
363
- angleTolerance: 0.1, // Sharper angle preservation
355
+ distanceTolerance: 0.2,
356
+ angleTolerance: 0.1,
364
357
  },
365
358
  });
366
359
  ```
@@ -714,7 +707,7 @@ mesh.geometry.dispose();
714
707
  mesh.geometry = updated.geometry;
715
708
  ```
716
709
 
717
- The method preserves custom cache instances if `maxCacheSizeMB` was specified. For most use cases, this is primarily an API convenience
710
+ For most use cases, this is primarily an API convenience over calling `create()` again
718
711
 
719
712
  Options merge at the top level - to remove a nested property like `layout.width`, pass `{ layout: { width: undefined } }`
720
713
 
@@ -765,7 +758,6 @@ interface TextOptions {
765
758
  removeOverlaps?: boolean; // Override default overlap removal (auto-enabled for VF only)
766
759
  perGlyphAttributes?: boolean; // Keep per-glyph identity and add per-glyph shader attributes
767
760
  color?: [number, number, number] | ColorOptions; // Text coloring (simple or complex)
768
- // Configuration for geometry generation and layout
769
761
  curveFidelity?: CurveFidelityConfig;
770
762
  geometryOptimization?: GeometryOptimizationOptions;
771
763
  layout?: LayoutOptions;
@@ -902,30 +894,9 @@ interface TextRange {
902
894
 
903
895
  ## Memory management
904
896
 
905
- `three-text` manages memory in two ways: a shared glyph cache for all text, and instance-specific resources for each piece of text you create
906
-
907
- The shared cache is handled automatically through an LRU (Least Recently Used) policy. The default cache size is 250MB, but you can configure it per text instance. Tessellated glyphs are cached to avoid expensive recomputation when the same characters (or clusters of overlapping characters) appear multiple times
908
-
909
- ```javascript
910
- const text = await Text.create({
911
- text: 'Hello world',
912
- font: '/fonts/font.ttf',
913
- size: 72,
914
- maxCacheSizeMB: 1024, // Custom cache size in MB
915
- });
916
-
917
- // Check cache performance
918
- const stats = text.getCacheStatistics();
919
- console.log('Cache Statistics:', {
920
- hitRate: stats.hitRate, // Cache hit percentage
921
- memoryUsageMB: stats.memoryUsageMB, // Memory used in MB
922
- size: stats.size, // Entries in cache
923
- hits: stats.hits, // Cache hits
924
- misses: stats.misses // Cache misses
925
- });
926
- ```
897
+ Tessellated glyphs are cached in a shared global cache to avoid recomputation when the same characters appear multiple times. Fonts are also cached and persist for the application lifetime
927
898
 
928
- Fonts are cached internally and persist for the application lifetime. The glyph geometry cache uses an LRU eviction policy, so memory usage is bounded by `maxCacheSizeMB`. When a text mesh is no longer needed, dispose of its geometry as you would any Three.js `BufferGeometry`:
899
+ When a text mesh is no longer needed, dispose of its geometry as you would any Three.js `BufferGeometry`:
929
900
 
930
901
  ```javascript
931
902
  textMesh.geometry.dispose();