three-text 0.2.19 → 0.3.0
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 +6 -2
- package/dist/index.cjs +185 -332
- package/dist/index.d.ts +10 -38
- package/dist/index.js +185 -332
- package/dist/index.min.cjs +704 -723
- package/dist/index.min.js +705 -724
- package/dist/index.umd.js +185 -332
- package/dist/index.umd.min.js +710 -729
- package/dist/three/index.cjs +3 -1
- package/dist/three/index.d.ts +1 -12
- package/dist/three/index.js +3 -1
- package/dist/three/react.d.ts +5 -13
- package/dist/types/core/Text.d.ts +1 -4
- package/dist/types/core/cache/GlyphGeometryBuilder.d.ts +4 -7
- package/dist/types/core/cache/sharedCaches.d.ts +6 -7
- package/dist/types/core/geometry/Extruder.d.ts +0 -1
- package/dist/types/core/shaping/TextShaper.d.ts +1 -4
- package/dist/types/core/types.d.ts +5 -6
- package/dist/types/index.d.ts +1 -1
- package/dist/types/three/index.d.ts +1 -5
- package/dist/types/utils/Cache.d.ts +14 -0
- package/dist/types/webgl/index.d.ts +12 -0
- package/dist/types/webgpu/index.d.ts +10 -0
- package/dist/webgl/index.cjs +18 -0
- package/dist/webgl/index.d.ts +12 -0
- package/dist/webgl/index.js +18 -0
- package/dist/webgpu/index.cjs +80 -1
- package/dist/webgpu/index.d.ts +10 -0
- package/dist/webgpu/index.js +80 -1
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -562,13 +562,15 @@ For shader-based animations and interactive effects, the library can generate pe
|
|
|
562
562
|
const text = await Text.create({
|
|
563
563
|
text: 'Sample text',
|
|
564
564
|
font: '/fonts/Font.ttf',
|
|
565
|
-
|
|
565
|
+
perGlyphAttributes: true,
|
|
566
566
|
});
|
|
567
567
|
|
|
568
568
|
// Geometry includes these vertex attributes:
|
|
569
569
|
// - glyphCenter (vec3): center point of each glyph
|
|
570
570
|
// - glyphIndex (float): sequential glyph index
|
|
571
571
|
// - glyphLineIndex (float): line number
|
|
572
|
+
// - glyphProgress (float): normalized position (0..1) along text run
|
|
573
|
+
// - glyphBaselineY (float): Y coordinate of glyph baseline
|
|
572
574
|
```
|
|
573
575
|
|
|
574
576
|
This option bypasses overlap-based clustering and adds vertex attributes suitable for per-character manipulation in vertex shaders. Each unique glyph is still tessellated only once and cached for reuse. The tradeoff is potential visual artifacts where glyphs actually overlap (tight kerning, cursive scripts)
|
|
@@ -761,7 +763,7 @@ interface TextOptions {
|
|
|
761
763
|
fontVariations?: { [key: string]: number }; // Variable font axis settings
|
|
762
764
|
fontFeatures?: { [tag: string]: boolean | number }; // OpenType feature settings
|
|
763
765
|
removeOverlaps?: boolean; // Override default overlap removal (auto-enabled for VF only)
|
|
764
|
-
|
|
766
|
+
perGlyphAttributes?: boolean; // Keep per-glyph identity and add per-glyph shader attributes
|
|
765
767
|
color?: [number, number, number] | ColorOptions; // Text coloring (simple or complex)
|
|
766
768
|
// Configuration for geometry generation and layout
|
|
767
769
|
curveFidelity?: CurveFidelityConfig;
|
|
@@ -842,6 +844,8 @@ interface TextGeometryInfo {
|
|
|
842
844
|
glyphCenter: Float32Array;
|
|
843
845
|
glyphIndex: Float32Array;
|
|
844
846
|
glyphLineIndex: Float32Array;
|
|
847
|
+
glyphProgress: Float32Array;
|
|
848
|
+
glyphBaselineY: Float32Array;
|
|
845
849
|
};
|
|
846
850
|
glyphs: GlyphGeometryInfo[];
|
|
847
851
|
planeBounds: {
|