@flighthq/mesh 0.1.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.
Files changed (55) hide show
  1. package/dist/index.d.ts +11 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +11 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/meshGeometry.d.ts +15 -0
  6. package/dist/meshGeometry.d.ts.map +1 -0
  7. package/dist/meshGeometry.js +128 -0
  8. package/dist/meshGeometry.js.map +1 -0
  9. package/dist/meshGeometryAttributes.d.ts +28 -0
  10. package/dist/meshGeometryAttributes.d.ts.map +1 -0
  11. package/dist/meshGeometryAttributes.js +144 -0
  12. package/dist/meshGeometryAttributes.js.map +1 -0
  13. package/dist/meshGeometryBuilders.d.ts +19 -0
  14. package/dist/meshGeometryBuilders.d.ts.map +1 -0
  15. package/dist/meshGeometryBuilders.js +772 -0
  16. package/dist/meshGeometryBuilders.js.map +1 -0
  17. package/dist/meshGeometryCompute.d.ts +7 -0
  18. package/dist/meshGeometryCompute.d.ts.map +1 -0
  19. package/dist/meshGeometryCompute.js +299 -0
  20. package/dist/meshGeometryCompute.js.map +1 -0
  21. package/dist/meshGeometryIndex.d.ts +4 -0
  22. package/dist/meshGeometryIndex.d.ts.map +1 -0
  23. package/dist/meshGeometryIndex.js +70 -0
  24. package/dist/meshGeometryIndex.js.map +1 -0
  25. package/dist/meshGeometryLayout.d.ts +4 -0
  26. package/dist/meshGeometryLayout.d.ts.map +1 -0
  27. package/dist/meshGeometryLayout.js +83 -0
  28. package/dist/meshGeometryLayout.js.map +1 -0
  29. package/dist/meshGeometryOperations.d.ts +12 -0
  30. package/dist/meshGeometryOperations.d.ts.map +1 -0
  31. package/dist/meshGeometryOperations.js +209 -0
  32. package/dist/meshGeometryOperations.js.map +1 -0
  33. package/dist/meshGeometrySubset.d.ts +5 -0
  34. package/dist/meshGeometrySubset.d.ts.map +1 -0
  35. package/dist/meshGeometrySubset.js +40 -0
  36. package/dist/meshGeometrySubset.js.map +1 -0
  37. package/dist/meshGeometryTransforms.d.ts +7 -0
  38. package/dist/meshGeometryTransforms.d.ts.map +1 -0
  39. package/dist/meshGeometryTransforms.js +235 -0
  40. package/dist/meshGeometryTransforms.js.map +1 -0
  41. package/dist/meshGeometryUvs.d.ts +5 -0
  42. package/dist/meshGeometryUvs.d.ts.map +1 -0
  43. package/dist/meshGeometryUvs.js +58 -0
  44. package/dist/meshGeometryUvs.js.map +1 -0
  45. package/package.json +39 -0
  46. package/src/meshGeometry.test.ts +155 -0
  47. package/src/meshGeometryAttributes.test.ts +195 -0
  48. package/src/meshGeometryBuilders.test.ts +220 -0
  49. package/src/meshGeometryCompute.test.ts +218 -0
  50. package/src/meshGeometryIndex.test.ts +84 -0
  51. package/src/meshGeometryLayout.test.ts +132 -0
  52. package/src/meshGeometryOperations.test.ts +154 -0
  53. package/src/meshGeometrySubset.test.ts +75 -0
  54. package/src/meshGeometryTransforms.test.ts +169 -0
  55. package/src/meshGeometryUvs.test.ts +128 -0
@@ -0,0 +1,11 @@
1
+ export * from './meshGeometry';
2
+ export * from './meshGeometryAttributes';
3
+ export * from './meshGeometryBuilders';
4
+ export * from './meshGeometryCompute';
5
+ export * from './meshGeometryIndex';
6
+ export * from './meshGeometryLayout';
7
+ export * from './meshGeometryOperations';
8
+ export * from './meshGeometrySubset';
9
+ export * from './meshGeometryTransforms';
10
+ export * from './meshGeometryUvs';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ export * from './meshGeometry';
2
+ export * from './meshGeometryAttributes';
3
+ export * from './meshGeometryBuilders';
4
+ export * from './meshGeometryCompute';
5
+ export * from './meshGeometryIndex';
6
+ export * from './meshGeometryLayout';
7
+ export * from './meshGeometryOperations';
8
+ export * from './meshGeometrySubset';
9
+ export * from './meshGeometryTransforms';
10
+ export * from './meshGeometryUvs';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { MeshGeometry, MeshSubset, PrimitiveTopology, VertexAttributeLayout } from '@flighthq/types';
2
+ export interface MeshGeometryOptions {
3
+ indices?: Readonly<Uint16Array<ArrayBuffer>> | Readonly<Uint32Array<ArrayBuffer>> | null;
4
+ layout: VertexAttributeLayout;
5
+ subsets?: readonly MeshSubset[];
6
+ topology?: PrimitiveTopology;
7
+ vertices: Float32Array<ArrayBuffer>;
8
+ }
9
+ export declare function cloneMeshGeometry(source: Readonly<MeshGeometry>): MeshGeometry;
10
+ export declare function createMeshGeometry(options: Readonly<MeshGeometryOptions>): MeshGeometry;
11
+ export declare function destroyMeshGeometryGlData(geometry: Readonly<MeshGeometry>): void;
12
+ export declare function destroyMeshGeometryWgpuData(geometry: Readonly<MeshGeometry>): void;
13
+ export declare function getMeshGeometryIndexCount(geometry: Readonly<MeshGeometry>): number;
14
+ export declare function getMeshGeometryVertexCount(geometry: Readonly<MeshGeometry>): number;
15
+ //# sourceMappingURL=meshGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshGeometry.d.ts","sourceRoot":"","sources":["../src/meshGeometry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EAEZ,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAQzB,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC;IACzF,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;CACrC;AAKD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,YAAY,CAkC9E;AAOD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,YAAY,CAwBvF;AAMD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI,CAGhF;AAMD,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI,CAGlF;AAGD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,MAAM,CAElF;AAID,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,MAAM,CAEnF"}
@@ -0,0 +1,128 @@
1
+ import { createEntity } from '@flighthq/entity';
2
+ import { createAabb } from '@flighthq/geometry';
3
+ import { EntityRuntimeKey } from '@flighthq/types';
4
+ // Deep-copies a MeshGeometry: fresh vertex/index typed arrays, a cloned bounds (or null), and a
5
+ // fresh single subset list mirroring the source. The clone carries its own runtime, so GPU
6
+ // upload slots are not shared with the source. `version` resets to 0 (a fresh upload target).
7
+ export function cloneMeshGeometry(source) {
8
+ const vertices = new Float32Array(source.vertices.length);
9
+ vertices.set(source.vertices);
10
+ let indices = null;
11
+ if (source.indices) {
12
+ if (source.indices instanceof Uint32Array) {
13
+ indices = new Uint32Array(source.indices.length);
14
+ }
15
+ else {
16
+ indices = new Uint16Array(source.indices.length);
17
+ }
18
+ indices.set(source.indices);
19
+ }
20
+ const subsets = [];
21
+ for (let i = 0; i < source.subsets.length; i++) {
22
+ subsets.push({ indexCount: source.subsets[i].indexCount, indexOffset: source.subsets[i].indexOffset });
23
+ }
24
+ let bounds = null;
25
+ if (source.bounds) {
26
+ const b = source.bounds;
27
+ bounds = createAabb(b.min.x, b.min.y, b.min.z, b.max.x, b.max.y, b.max.z);
28
+ }
29
+ return createMeshGeometryRuntime({
30
+ bounds: bounds,
31
+ indices: indices,
32
+ layout: source.layout,
33
+ subsets: subsets,
34
+ topology: source.topology,
35
+ version: 0,
36
+ vertices: vertices,
37
+ });
38
+ }
39
+ // Allocates a MeshGeometry from CPU vertex/index data plus a layout. The vertices are taken by
40
+ // reference (the caller hands off ownership of the interleaved record stream). Indices, when
41
+ // present, are promoted to Uint32 automatically if any vertex index could exceed 65535 — that
42
+ // is, when the vertex count derived from the layout stride passes the Uint16 ceiling — so a
43
+ // 16-bit index buffer is never silently truncated.
44
+ export function createMeshGeometry(options) {
45
+ const vertices = options.vertices;
46
+ const vertexCount = getVertexCountFromLayout(vertices, options.layout);
47
+ let indices = null;
48
+ if (options.indices) {
49
+ indices = promoteIndices(options.indices, vertexCount);
50
+ }
51
+ let subsets = options.subsets;
52
+ if (!subsets) {
53
+ const count = indices ? indices.length : vertexCount;
54
+ subsets = [{ indexCount: count, indexOffset: 0 }];
55
+ }
56
+ return createMeshGeometryRuntime({
57
+ bounds: null,
58
+ indices: indices,
59
+ layout: options.layout,
60
+ subsets: subsets,
61
+ topology: options.topology ?? 'triangle-list',
62
+ version: 0,
63
+ vertices: vertices,
64
+ });
65
+ }
66
+ // Releases the Gl2 GPU upload slot on a geometry's runtime back to null. The actual GL
67
+ // objects (VAO/buffers) are owned and freed by scene-gl through the branded concrete shape;
68
+ // this clears the named slot so the next draw re-uploads. Frees a non-GC GPU resource, hence
69
+ // destroy*, not dispose*.
70
+ export function destroyMeshGeometryGlData(geometry) {
71
+ const runtime = geometry[EntityRuntimeKey];
72
+ if (runtime)
73
+ runtime.webglData = null;
74
+ }
75
+ // Releases the Wgpu GPU upload slot on a geometry's runtime back to null. The vertex/index
76
+ // GPUBuffers are owned and freed by scene-wgpu through the branded concrete shape; this
77
+ // clears the named slot so the next draw re-uploads. Frees a non-GC GPU resource, hence
78
+ // destroy*, not dispose*.
79
+ export function destroyMeshGeometryWgpuData(geometry) {
80
+ const runtime = geometry[EntityRuntimeKey];
81
+ if (runtime)
82
+ runtime.webgpuData = null;
83
+ }
84
+ // Returns the number of indices in the geometry's index buffer, or 0 for non-indexed geometry.
85
+ export function getMeshGeometryIndexCount(geometry) {
86
+ return geometry.indices ? geometry.indices.length : 0;
87
+ }
88
+ // Returns the number of vertices, derived from the interleaved vertex stream and the layout
89
+ // stride (stride is in bytes; a Float32 is 4 bytes).
90
+ export function getMeshGeometryVertexCount(geometry) {
91
+ return getVertexCountFromLayout(geometry.vertices, geometry.layout);
92
+ }
93
+ // Allocates a MeshGeometry entity with a runtime carrying empty (null) GPU upload slots. This is
94
+ // the single construction point so every MeshGeometry shares the same runtime shape.
95
+ function createMeshGeometryRuntime(fields) {
96
+ const geometry = createEntity({
97
+ bounds: fields.bounds,
98
+ indices: fields.indices,
99
+ layout: fields.layout,
100
+ subsets: fields.subsets,
101
+ topology: fields.topology,
102
+ version: fields.version,
103
+ vertices: fields.vertices,
104
+ });
105
+ const runtime = { binding: null, webglData: null, webgpuData: null };
106
+ geometry[EntityRuntimeKey] = runtime;
107
+ return geometry;
108
+ }
109
+ function getVertexCountFromLayout(vertices, layout) {
110
+ const floatsPerVertex = layout.stride / 4;
111
+ if (floatsPerVertex <= 0)
112
+ return 0;
113
+ return Math.floor(vertices.length / floatsPerVertex);
114
+ }
115
+ // Copies an index source into the narrowest typed array that addresses `vertexCount` vertices,
116
+ // promoting to Uint32 once the count exceeds the Uint16 ceiling so high indices never truncate.
117
+ function promoteIndices(source, vertexCount) {
118
+ if (vertexCount > UINT16_INDEX_CEILING || source instanceof Uint32Array) {
119
+ const out = new Uint32Array(source.length);
120
+ out.set(source);
121
+ return out;
122
+ }
123
+ const out = new Uint16Array(source.length);
124
+ out.set(source);
125
+ return out;
126
+ }
127
+ const UINT16_INDEX_CEILING = 65535;
128
+ //# sourceMappingURL=meshGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshGeometry.js","sourceRoot":"","sources":["../src/meshGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAenD,gGAAgG;AAChG,2FAA2F;AAC3F,8FAA8F;AAC9F,MAAM,UAAU,iBAAiB,CAAC,MAA8B;IAC9D,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1D,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE9B,IAAI,OAAO,GAA+D,IAAI,CAAC;IAC/E,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,IAAI,MAAM,CAAC,OAAO,YAAY,WAAW,EAAE,CAAC;YAC1C,OAAO,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnD,C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,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,eAAe,CAAC,CAAC;AACvD,CAAC;AAED,+FAA+F;AAC/F,gGAAgG;AAChG,SAAS,cAAc,CACrB,MAA+E,EAC/E,WAAmB;IAEnB,IAAI,WAAW,GAAG,oBAAoB,IAAI,MAAM,YAAY,WAAW,EAAE,CAAC;QACxE,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChB,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,oBAAoB,GAAG,KAAK,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { MeshGeometry, VertexAttribute, VertexAttributeLayout, VertexSemantic } from '@flighthq/types';
2
+ export declare function getMeshGeometryVertexNormal(out: {
3
+ x: number;
4
+ y: number;
5
+ z: number;
6
+ }, geometry: Readonly<MeshGeometry>, vertexIndex: number): boolean;
7
+ export declare function getMeshGeometryVertexPosition(out: {
8
+ x: number;
9
+ y: number;
10
+ z: number;
11
+ }, geometry: Readonly<MeshGeometry>, vertexIndex: number): boolean;
12
+ export declare function getMeshGeometryVertexTangent(out: {
13
+ w: number;
14
+ x: number;
15
+ y: number;
16
+ z: number;
17
+ }, geometry: Readonly<MeshGeometry>, vertexIndex: number): boolean;
18
+ export declare function getMeshGeometryVertexUv0(out: {
19
+ x: number;
20
+ y: number;
21
+ }, geometry: Readonly<MeshGeometry>, vertexIndex: number): boolean;
22
+ export declare function getVertexAttribute(layout: Readonly<VertexAttributeLayout>, semantic: VertexSemantic): VertexAttribute | null;
23
+ export declare function getVertexAttributeFloatOffset(layout: Readonly<VertexAttributeLayout>, semantic: VertexSemantic): number;
24
+ export declare function setMeshGeometryVertexNormal(geometry: MeshGeometry, vertexIndex: number, x: number, y: number, z: number): boolean;
25
+ export declare function setMeshGeometryVertexPosition(geometry: MeshGeometry, vertexIndex: number, x: number, y: number, z: number): boolean;
26
+ export declare function setMeshGeometryVertexTangent(geometry: MeshGeometry, vertexIndex: number, x: number, y: number, z: number, w: number): boolean;
27
+ export declare function setMeshGeometryVertexUv0(geometry: MeshGeometry, vertexIndex: number, u: number, v: number): boolean;
28
+ //# sourceMappingURL=meshGeometryAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshGeometryAttributes.d.ts","sourceRoot":"","sources":["../src/meshGeometryAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAS5G,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACxC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,EAChC,WAAW,EAAE,MAAM,GAClB,OAAO,CAET;AAID,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACxC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,EAChC,WAAW,EAAE,MAAM,GAClB,OAAO,CAET;AAID,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACnD,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,EAChC,WAAW,EAAE,MAAM,GAClB,OAAO,CAYT;AAID,wBAAgB,wBAAwB,CACtC,GAAG,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAC7B,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,EAChC,WAAW,EAAE,MAAM,GAClB,OAAO,CAUT;AAGD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACvC,QAAQ,EAAE,cAAc,GACvB,eAAe,GAAG,IAAI,CAMxB;AAKD,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,QAAQ,CAAC,qBAAqB,CAAC,EACvC,QAAQ,EAAE,cAAc,GACvB,MAAM,CAUR;AAID,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,OAAO,CAET;AAID,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,OAAO,CAET;AAID,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,OAAO,CAaT;AAID,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAWnH"}
@@ -0,0 +1,144 @@
1
+ // Attribute introspection and typed per-vertex read/write accessors for interleaved mesh geometry.
2
+ // Every accessor resolves float offsets through getVertexAttributeFloatOffset, so they work on any
3
+ // layout — not just the canonical PBR record. set* functions bump geometry.version so backends
4
+ // know to re-upload.
5
+ // Reads the position (x, y, z) of vertex `vertexIndex` into `out`. Returns false when the
6
+ // layout has no position semantic or vertexIndex is out of range; out is unchanged.
7
+ export function getMeshGeometryVertexNormal(out, geometry, vertexIndex) {
8
+ return getFloat3Attribute(out, geometry, vertexIndex, 'normal');
9
+ }
10
+ // Reads the position (x, y, z) of vertex `vertexIndex` into `out`. Returns false when the
11
+ // layout has no position semantic or vertexIndex is out of range; out is unchanged.
12
+ export function getMeshGeometryVertexPosition(out, geometry, vertexIndex) {
13
+ return getFloat3Attribute(out, geometry, vertexIndex, 'position');
14
+ }
15
+ // Reads the tangent (x, y, z, w) of vertex `vertexIndex` into `out`. Returns false when the
16
+ // layout has no tangent semantic or vertexIndex is out of range; out is unchanged.
17
+ export function getMeshGeometryVertexTangent(out, geometry, vertexIndex) {
18
+ const floatOffset = getVertexAttributeFloatOffset(geometry.layout, 'tangent');
19
+ if (floatOffset < 0)
20
+ return false;
21
+ const floatsPerVertex = geometry.layout.stride / 4;
22
+ const vertexCount = floatsPerVertex > 0 ? Math.floor(geometry.vertices.length / floatsPerVertex) : 0;
23
+ if (vertexIndex < 0 || vertexIndex >= vertexCount)
24
+ return false;
25
+ const base = vertexIndex * floatsPerVertex + floatOffset;
26
+ out.x = geometry.vertices[base];
27
+ out.y = geometry.vertices[base + 1];
28
+ out.z = geometry.vertices[base + 2];
29
+ out.w = geometry.vertices[base + 3];
30
+ return true;
31
+ }
32
+ // Reads the uv0 (u, v) of vertex `vertexIndex` into `out`. Returns false when the layout has
33
+ // no uv0 semantic or vertexIndex is out of range; out is unchanged.
34
+ export function getMeshGeometryVertexUv0(out, geometry, vertexIndex) {
35
+ const floatOffset = getVertexAttributeFloatOffset(geometry.layout, 'uv0');
36
+ if (floatOffset < 0)
37
+ return false;
38
+ const floatsPerVertex = geometry.layout.stride / 4;
39
+ const vertexCount = floatsPerVertex > 0 ? Math.floor(geometry.vertices.length / floatsPerVertex) : 0;
40
+ if (vertexIndex < 0 || vertexIndex >= vertexCount)
41
+ return false;
42
+ const base = vertexIndex * floatsPerVertex + floatOffset;
43
+ out.x = geometry.vertices[base];
44
+ out.y = geometry.vertices[base + 1];
45
+ return true;
46
+ }
47
+ // Returns the VertexAttribute for the given semantic from the layout, or null if absent.
48
+ export function getVertexAttribute(layout, semantic) {
49
+ const attrs = layout.attributes;
50
+ for (let i = 0; i < attrs.length; i++) {
51
+ if (attrs[i].semantic === semantic)
52
+ return attrs[i];
53
+ }
54
+ return null;
55
+ }
56
+ // Returns the float index (byteOffset / 4) within one vertex record for the given semantic, or
57
+ // -1 when the semantic is absent from the layout or has a non-float format. Only float32*
58
+ // formats (which are 4-byte aligned) are supported by the typed accessors.
59
+ export function getVertexAttributeFloatOffset(layout, semantic) {
60
+ const attrs = layout.attributes;
61
+ for (let i = 0; i < attrs.length; i++) {
62
+ const attr = attrs[i];
63
+ if (attr.semantic === semantic) {
64
+ if (!attr.format.startsWith('float32'))
65
+ return -1;
66
+ return attr.byteOffset / 4;
67
+ }
68
+ }
69
+ return -1;
70
+ }
71
+ // Writes the normal (x, y, z) for vertex `vertexIndex`. Bumps geometry.version. Returns false
72
+ // when the layout has no normal semantic or vertexIndex is out of range; geometry is unchanged.
73
+ export function setMeshGeometryVertexNormal(geometry, vertexIndex, x, y, z) {
74
+ return setFloat3Attribute(geometry, vertexIndex, 'normal', x, y, z);
75
+ }
76
+ // Writes the position (x, y, z) for vertex `vertexIndex`. Bumps geometry.version. Returns false
77
+ // when the layout has no position semantic or vertexIndex is out of range; geometry is unchanged.
78
+ export function setMeshGeometryVertexPosition(geometry, vertexIndex, x, y, z) {
79
+ return setFloat3Attribute(geometry, vertexIndex, 'position', x, y, z);
80
+ }
81
+ // Writes the tangent (x, y, z, w) for vertex `vertexIndex`. Bumps geometry.version. Returns
82
+ // false when the layout has no tangent semantic or vertexIndex is out of range.
83
+ export function setMeshGeometryVertexTangent(geometry, vertexIndex, x, y, z, w) {
84
+ const floatOffset = getVertexAttributeFloatOffset(geometry.layout, 'tangent');
85
+ if (floatOffset < 0)
86
+ return false;
87
+ const floatsPerVertex = geometry.layout.stride / 4;
88
+ const vertexCount = floatsPerVertex > 0 ? Math.floor(geometry.vertices.length / floatsPerVertex) : 0;
89
+ if (vertexIndex < 0 || vertexIndex >= vertexCount)
90
+ return false;
91
+ const base = vertexIndex * floatsPerVertex + floatOffset;
92
+ geometry.vertices[base] = x;
93
+ geometry.vertices[base + 1] = y;
94
+ geometry.vertices[base + 2] = z;
95
+ geometry.vertices[base + 3] = w;
96
+ geometry.version++;
97
+ return true;
98
+ }
99
+ // Writes the uv0 (u, v) for vertex `vertexIndex`. Bumps geometry.version. Returns false when
100
+ // the layout has no uv0 semantic or vertexIndex is out of range.
101
+ export function setMeshGeometryVertexUv0(geometry, vertexIndex, u, v) {
102
+ const floatOffset = getVertexAttributeFloatOffset(geometry.layout, 'uv0');
103
+ if (floatOffset < 0)
104
+ return false;
105
+ const floatsPerVertex = geometry.layout.stride / 4;
106
+ const vertexCount = floatsPerVertex > 0 ? Math.floor(geometry.vertices.length / floatsPerVertex) : 0;
107
+ if (vertexIndex < 0 || vertexIndex >= vertexCount)
108
+ return false;
109
+ const base = vertexIndex * floatsPerVertex + floatOffset;
110
+ geometry.vertices[base] = u;
111
+ geometry.vertices[base + 1] = v;
112
+ geometry.version++;
113
+ return true;
114
+ }
115
+ function getFloat3Attribute(out, geometry, vertexIndex, semantic) {
116
+ const floatOffset = getVertexAttributeFloatOffset(geometry.layout, semantic);
117
+ if (floatOffset < 0)
118
+ return false;
119
+ const floatsPerVertex = geometry.layout.stride / 4;
120
+ const vertexCount = floatsPerVertex > 0 ? Math.floor(geometry.vertices.length / floatsPerVertex) : 0;
121
+ if (vertexIndex < 0 || vertexIndex >= vertexCount)
122
+ return false;
123
+ const base = vertexIndex * floatsPerVertex + floatOffset;
124
+ out.x = geometry.vertices[base];
125
+ out.y = geometry.vertices[base + 1];
126
+ out.z = geometry.vertices[base + 2];
127
+ return true;
128
+ }
129
+ function setFloat3Attribute(geometry, vertexIndex, semantic, x, y, z) {
130
+ const floatOffset = getVertexAttributeFloatOffset(geometry.layout, semantic);
131
+ if (floatOffset < 0)
132
+ return false;
133
+ const floatsPerVertex = geometry.layout.stride / 4;
134
+ const vertexCount = floatsPerVertex > 0 ? Math.floor(geometry.vertices.length / floatsPerVertex) : 0;
135
+ if (vertexIndex < 0 || vertexIndex >= vertexCount)
136
+ return false;
137
+ const base = vertexIndex * floatsPerVertex + floatOffset;
138
+ geometry.vertices[base] = x;
139
+ geometry.vertices[base + 1] = y;
140
+ geometry.vertices[base + 2] = z;
141
+ geometry.version++;
142
+ return true;
143
+ }
144
+ //# sourceMappingURL=meshGeometryAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshGeometryAttributes.js","sourceRoot":"","sources":["../src/meshGeometryAttributes.ts"],"names":[],"mappings":"AAEA,mGAAmG;AACnG,mGAAmG;AACnG,+FAA+F;AAC/F,qBAAqB;AAErB,0FAA0F;AAC1F,oFAAoF;AACpF,MAAM,UAAU,2BAA2B,CACzC,GAAwC,EACxC,QAAgC,EAChC,WAAmB;IAEnB,OAAO,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED,0FAA0F;AAC1F,oFAAoF;AACpF,MAAM,UAAU,6BAA6B,CAC3C,GAAwC,EACxC,QAAgC,EAChC,WAAmB;IAEnB,OAAO,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AACpE,CAAC;AAED,4FAA4F;AAC5F,mFAAmF;AACnF,MAAM,UAAU,4BAA4B,CAC1C,GAAmD,EACnD,QAAgC,EAChC,WAAmB;IAEnB,MAAM,WAAW,GAAG,6BAA6B,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC9E,IAAI,WAAW,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAClC,MAAM,eAAe,GAAG,QA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OAAO,KAAK,CAAC;IAChE,MAAM,IAAI,GAAG,WAAW,GAAG,eAAe,GAAG,WAAW,CAAC;IACzD,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnB,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { MeshGeometry } from '@flighthq/types';
2
+ export declare function createBoxMeshGeometry(width?: number, height?: number, depth?: number): MeshGeometry;
3
+ export declare function createCapsuleMeshGeometry(radius?: number, height?: number, radialSegments?: number, capSegments?: number): MeshGeometry;
4
+ export declare function createCircleMeshGeometry(radius?: number, segments?: number): MeshGeometry;
5
+ export declare function createConeMeshGeometry(radius?: number, height?: number, radialSegments?: number, capped?: boolean): MeshGeometry;
6
+ export declare function createCylinderMeshGeometry(topRadius?: number, bottomRadius?: number, height?: number, radialSegments?: number, capped?: boolean): MeshGeometry;
7
+ export declare function createDodecahedronMeshGeometry(radius?: number, detail?: number): MeshGeometry;
8
+ export declare function createIcosahedronMeshGeometry(radius?: number, detail?: number): MeshGeometry;
9
+ export declare function createIcosphereMeshGeometry(radius?: number, subdivisions?: number): MeshGeometry;
10
+ export declare function createOctahedronMeshGeometry(radius?: number, detail?: number): MeshGeometry;
11
+ export declare function createPlaneMeshGeometry(width?: number, depth?: number, widthSegments?: number, depthSegments?: number): MeshGeometry;
12
+ export declare function createPolyhedronMeshGeometry(vertexPositions: readonly (readonly [number, number, number])[], faceIndices: readonly (readonly [number, number, number])[], radius?: number, detail?: number): MeshGeometry;
13
+ export declare function createQuadMeshGeometry(width?: number, height?: number): MeshGeometry;
14
+ export declare function createRingMeshGeometry(innerRadius?: number, outerRadius?: number, segments?: number): MeshGeometry;
15
+ export declare function createSphereMeshGeometry(radius?: number, widthSegments?: number, heightSegments?: number): MeshGeometry;
16
+ export declare function createTetrahedronMeshGeometry(radius?: number, detail?: number): MeshGeometry;
17
+ export declare function createTorusKnotMeshGeometry(radius?: number, tube?: number, tubularSegments?: number, radialSegments?: number, p?: number, q?: number): MeshGeometry;
18
+ export declare function createTorusMeshGeometry(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number): MeshGeometry;
19
+ //# sourceMappingURL=meshGeometryBuilders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meshGeometryBuilders.d.ts","sourceRoot":"","sources":["../src/meshGeometryBuilders.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAyB,MAAM,iBAAiB,CAAC;AAe3E,wBAAgB,qBAAqB,CAAC,KAAK,GAAE,MAAU,EAAE,MAAM,GAAE,MAAU,EAAE,KAAK,GAAE,MAAU,GAAG,YAAY,CA6C5G;AAMD,wBAAgB,yBAAyB,CACvC,MAAM,GAAE,MAAY,EACpB,MAAM,GAAE,MAAU,EAClB,cAAc,GAAE,MAAW,EAC3B,WAAW,GAAE,MAAU,GACtB,YAAY,CA6Dd;AAMD,wBAAgB,wBAAwB,CAAC,MAAM,GAAE,MAAY,EAAE,QAAQ,GAAE,MAAW,GAAG,YAAY,CAQlG;AAKD,wBAAgB,sBAAsB,CACpC,MAAM,GAAE,MAAY,EACpB,MAAM,GAAE,MAAU,EAClB,cAAc,GAAE,MAAW,EAC3B,MAAM,GAAE,OAAc,GACrB,YAAY,CAEd;AAMD,wBAAgB,0BAA0B,CACxC,SAAS,GAAE,MAAY,EACvB,YAAY,GAAE,MAAY,EAC1B,MAAM,GAAE,MAAU,EAClB,cAAc,GAAE,MAAW,EAC3B,MAAM,GAAE,OAAc,GACrB,YAAY,CAiDd;AAGD,wBAAgB,8BAA8B,CAAC,MAAM,GAAE,MAAY,EAAE,MAAM,GAAE,MAAU,GAAG,YAAY,CAErG;AAID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