three-text 0.2.12 → 0.2.14

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.
@@ -1,7 +1,7 @@
1
1
  // WebGPU adapter - lightweight utility to create GPU buffers from core geometry
2
2
  function createWebGPUBuffers(device, textGeometry) {
3
3
  const { vertices, normals, indices, colors } = textGeometry;
4
- const vertexCount = indices.length;
4
+ const indexCount = indices.length;
5
5
  // Interleave position and normal data for better cache coherency
6
6
  // Layout: [px, py, pz, nx, ny, nz, px, py, pz, nx, ny, nz, ...]
7
7
  const interleavedData = new Float32Array((vertices.length / 3) * 6);
@@ -25,7 +25,7 @@ function createWebGPUBuffers(device, textGeometry) {
25
25
  });
26
26
  new Float32Array(vertexBuffer.getMappedRange()).set(interleavedData);
27
27
  vertexBuffer.unmap();
28
- // Create index buffer (NO FLIP - pass through)
28
+ // Create index buffer
29
29
  const indexBuffer = device.createBuffer({
30
30
  size: indices.byteLength,
31
31
  usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST,
@@ -83,8 +83,7 @@ function createWebGPUBuffers(device, textGeometry) {
83
83
  return {
84
84
  buffers,
85
85
  layout,
86
- indexFormat: 'uint32',
87
- vertexCount,
86
+ indexCount,
88
87
  dispose() {
89
88
  vertexBuffer.destroy();
90
89
  indexBuffer.destroy();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-text",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "3D font rendering and text layout engine for the web",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -1,50 +0,0 @@
1
- import { Vec3 } from '../vectors';
2
- import { ProcessedGeometry } from '../types';
3
- export interface GlyphData {
4
- geometry: ProcessedGeometry;
5
- vertices: Float32Array;
6
- normals: Float32Array;
7
- indices: Uint16Array | Uint32Array;
8
- bounds: {
9
- min: Vec3;
10
- max: Vec3;
11
- };
12
- useCount: number;
13
- }
14
- export interface GlyphInstance {
15
- glyphId: number;
16
- position: Vec3;
17
- scale: number;
18
- textIndex: number;
19
- lineIndex: number;
20
- }
21
- export interface GlyphCacheStats {
22
- hits: number;
23
- misses: number;
24
- totalGlyphs: number;
25
- uniqueGlyphs: number;
26
- cacheSize: number;
27
- saved: number;
28
- memoryUsage: number;
29
- }
30
- export declare class GlyphCache {
31
- private cache;
32
- private head;
33
- private tail;
34
- private stats;
35
- private maxCacheSize?;
36
- constructor(maxCacheSizeMB?: number);
37
- private getCacheKey;
38
- has(fontId: string, glyphId: number, depth: number, removeOverlaps: boolean): boolean;
39
- get(fontId: string, glyphId: number, depth: number, removeOverlaps: boolean): GlyphData | undefined;
40
- set(fontId: string, glyphId: number, depth: number, removeOverlaps: boolean, glyph: GlyphData): void;
41
- private calculateMemoryUsage;
42
- private evictLRU;
43
- private addToHead;
44
- private removeNode;
45
- private removeTail;
46
- private moveToHead;
47
- clear(): void;
48
- getStats(): GlyphCacheStats;
49
- }
50
- export declare const globalGlyphCache: GlyphCache;