@margoengine/loaders 0.0.0-stage → 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 (184) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +1198 -3
  4. package/dist/3dm.d.ts +161 -0
  5. package/dist/3dm.js +289 -0
  6. package/dist/3ds.d.ts +124 -0
  7. package/dist/3ds.js +392 -0
  8. package/dist/acclaim.d.ts +90 -0
  9. package/dist/acclaim.js +312 -0
  10. package/dist/amf.d.ts +45 -0
  11. package/dist/amf.js +256 -0
  12. package/dist/babylon.d.ts +197 -0
  13. package/dist/babylon.js +701 -0
  14. package/dist/common.d.ts +7 -0
  15. package/dist/common.js +6 -0
  16. package/dist/dae-animation.d.ts +66 -0
  17. package/dist/dae-animation.js +266 -0
  18. package/dist/dae-common.d.ts +95 -0
  19. package/dist/dae-common.js +226 -0
  20. package/dist/dae-controllers.d.ts +57 -0
  21. package/dist/dae-controllers.js +164 -0
  22. package/dist/dae-pose.d.ts +131 -0
  23. package/dist/dae-pose.js +381 -0
  24. package/dist/dae-scene.d.ts +203 -0
  25. package/dist/dae-scene.js +279 -0
  26. package/dist/dae.d.ts +161 -0
  27. package/dist/dae.js +633 -0
  28. package/dist/detect.d.ts +20 -0
  29. package/dist/detect.js +72 -0
  30. package/dist/dxf.d.ts +81 -0
  31. package/dist/dxf.js +774 -0
  32. package/dist/engine.d.ts +36 -0
  33. package/dist/engine.js +117 -0
  34. package/dist/font-opentype.d.ts +14 -0
  35. package/dist/font-opentype.js +33 -0
  36. package/dist/font-woff.d.ts +23 -0
  37. package/dist/font-woff.js +293 -0
  38. package/dist/font.d.ts +41 -0
  39. package/dist/font.js +26 -0
  40. package/dist/gcode.d.ts +55 -0
  41. package/dist/gcode.js +278 -0
  42. package/dist/geo-model.d.ts +84 -0
  43. package/dist/geo-model.js +220 -0
  44. package/dist/geo-mvt.d.ts +15 -0
  45. package/dist/geo-mvt.js +302 -0
  46. package/dist/geo-shp.d.ts +15 -0
  47. package/dist/geo-shp.js +234 -0
  48. package/dist/geo-xml.d.ts +6 -0
  49. package/dist/geo-xml.js +165 -0
  50. package/dist/geo.d.ts +8 -0
  51. package/dist/geo.js +59 -0
  52. package/dist/geometry.d.ts +60 -0
  53. package/dist/geometry.js +273 -0
  54. package/dist/index.d.ts +54 -0
  55. package/dist/index.js +28 -0
  56. package/dist/kmz.d.ts +78 -0
  57. package/dist/kmz.js +173 -0
  58. package/dist/las.d.ts +92 -0
  59. package/dist/las.js +110 -0
  60. package/dist/ldraw.d.ts +118 -0
  61. package/dist/ldraw.js +474 -0
  62. package/dist/load.d.ts +72 -0
  63. package/dist/load.js +205 -0
  64. package/dist/lottie.d.ts +154 -0
  65. package/dist/lottie.js +893 -0
  66. package/dist/lwo.d.ts +81 -0
  67. package/dist/lwo.js +454 -0
  68. package/dist/lzf.d.ts +13 -0
  69. package/dist/lzf.js +56 -0
  70. package/dist/materialx.d.ts +120 -0
  71. package/dist/materialx.js +563 -0
  72. package/dist/md2.d.ts +52 -0
  73. package/dist/md2.js +112 -0
  74. package/dist/mmcif.d.ts +14 -0
  75. package/dist/mmcif.js +246 -0
  76. package/dist/mmd.d.ts +244 -0
  77. package/dist/mmd.js +958 -0
  78. package/dist/mocap.d.ts +71 -0
  79. package/dist/mocap.js +178 -0
  80. package/dist/molecule-common.d.ts +4 -0
  81. package/dist/molecule-common.js +54 -0
  82. package/dist/mtl.d.ts +120 -0
  83. package/dist/mtl.js +469 -0
  84. package/dist/normals.d.ts +7 -0
  85. package/dist/normals.js +31 -0
  86. package/dist/nrrd.d.ts +63 -0
  87. package/dist/nrrd.js +743 -0
  88. package/dist/nurbs.d.ts +118 -0
  89. package/dist/nurbs.js +265 -0
  90. package/dist/obj.d.ts +143 -0
  91. package/dist/obj.js +456 -0
  92. package/dist/off.d.ts +10 -0
  93. package/dist/off.js +155 -0
  94. package/dist/outline-font.d.ts +87 -0
  95. package/dist/outline-font.js +110 -0
  96. package/dist/outline.d.ts +20 -0
  97. package/dist/outline.js +215 -0
  98. package/dist/pcd.d.ts +34 -0
  99. package/dist/pcd.js +258 -0
  100. package/dist/pdb.d.ts +67 -0
  101. package/dist/pdb.js +126 -0
  102. package/dist/ply.d.ts +35 -0
  103. package/dist/ply.js +392 -0
  104. package/dist/polygon.d.ts +9 -0
  105. package/dist/polygon.js +49 -0
  106. package/dist/prwm.d.ts +24 -0
  107. package/dist/prwm.js +114 -0
  108. package/dist/render.d.ts +27 -0
  109. package/dist/render.js +153 -0
  110. package/dist/sfnt-cff.d.ts +37 -0
  111. package/dist/sfnt-cff.js +749 -0
  112. package/dist/sfnt-layout.d.ts +24 -0
  113. package/dist/sfnt-layout.js +266 -0
  114. package/dist/sfnt-reader.d.ts +28 -0
  115. package/dist/sfnt-reader.js +87 -0
  116. package/dist/sfnt-variation.d.ts +40 -0
  117. package/dist/sfnt-variation.js +318 -0
  118. package/dist/shared/asset-url.js +82 -0
  119. package/dist/shared/crc32.d.ts +2 -0
  120. package/dist/shared/crc32.js +47 -0
  121. package/dist/shared/errors.js +36 -0
  122. package/dist/shared/inflate.js +284 -0
  123. package/dist/shared/normals.js +26 -0
  124. package/dist/shared/scene-scope.js +56 -0
  125. package/dist/shared/trailing-data.js +42 -0
  126. package/dist/stl.d.ts +64 -0
  127. package/dist/stl.js +309 -0
  128. package/dist/svg.d.ts +90 -0
  129. package/dist/svg.js +1007 -0
  130. package/dist/tds.d.ts +2 -0
  131. package/dist/tds.js +2 -0
  132. package/dist/textures.d.ts +42 -0
  133. package/dist/textures.js +53 -0
  134. package/dist/threemf-lattice.d.ts +139 -0
  135. package/dist/threemf-lattice.js +514 -0
  136. package/dist/threemf-materials.d.ts +75 -0
  137. package/dist/threemf-materials.js +314 -0
  138. package/dist/threemf-mesh.d.ts +60 -0
  139. package/dist/threemf-mesh.js +201 -0
  140. package/dist/threemf.d.ts +101 -0
  141. package/dist/threemf.js +415 -0
  142. package/dist/tilt.d.ts +62 -0
  143. package/dist/tilt.js +186 -0
  144. package/dist/tmx.d.ts +151 -0
  145. package/dist/tmx.js +394 -0
  146. package/dist/ttf.d.ts +78 -0
  147. package/dist/ttf.js +568 -0
  148. package/dist/types.d.ts +90 -0
  149. package/dist/types.js +35 -0
  150. package/dist/usd.d.ts +2 -0
  151. package/dist/usd.js +2 -0
  152. package/dist/usd.worker.d.ts +1 -0
  153. package/dist/usdz.d.ts +50 -0
  154. package/dist/usdz.js +646 -0
  155. package/dist/util.d.ts +75 -0
  156. package/dist/util.js +241 -0
  157. package/dist/vdb.d.ts +111 -0
  158. package/dist/vdb.js +663 -0
  159. package/dist/vrml.d.ts +53 -0
  160. package/dist/vrml.js +532 -0
  161. package/dist/vtk-cells.d.ts +29 -0
  162. package/dist/vtk-cells.js +211 -0
  163. package/dist/vtk-legacy.d.ts +57 -0
  164. package/dist/vtk-legacy.js +439 -0
  165. package/dist/vtk-reader.d.ts +19 -0
  166. package/dist/vtk-reader.js +134 -0
  167. package/dist/vtk-xml.d.ts +96 -0
  168. package/dist/vtk-xml.js +578 -0
  169. package/dist/vtk.d.ts +13 -0
  170. package/dist/vtk.js +234 -0
  171. package/dist/woff-glyf.d.ts +17 -0
  172. package/dist/woff-glyf.js +215 -0
  173. package/dist/worker.d.ts +10 -0
  174. package/dist/worker.js +93 -0
  175. package/dist/workers/usd.js +3 -0
  176. package/dist/xfile.d.ts +99 -0
  177. package/dist/xfile.js +706 -0
  178. package/dist/xml.d.ts +107 -0
  179. package/dist/xml.js +843 -0
  180. package/dist/xyz.d.ts +16 -0
  181. package/dist/xyz.js +110 -0
  182. package/dist/zip.d.ts +38 -0
  183. package/dist/zip.js +150 -0
  184. package/package.json +246 -6
@@ -0,0 +1,99 @@
1
+ import { type LoadedGeometry, type ParseLimits } from './types.js';
2
+ import { type BinaryInput } from './util.js';
3
+ /** Options of {@link parseX}: the shared size limits plus the handedness and nesting bounds below. */
4
+ export interface XOptions extends ParseLimits {
5
+ /** Mirror the format's left-handed Z into the engine's right-handed space and keep the winding. Default true. */
6
+ rightHanded?: boolean;
7
+ /** Deepest nesting of data objects. Default 128. */
8
+ maxDepth?: number;
9
+ /** Most frames and meshes together. Default 100,000. */
10
+ maxNodes?: number;
11
+ }
12
+ /** A Material data object. Colours are as the file stores them (sRGB-like, 0 to 1). */
13
+ export interface XMaterial {
14
+ name: string;
15
+ /** Diffuse rgba (`faceColor`). */
16
+ color: [number, number, number, number];
17
+ specularPower: number;
18
+ specular: [number, number, number];
19
+ emissive: [number, number, number];
20
+ /** TextureFilename, when the material has one. */
21
+ texture?: string;
22
+ }
23
+ /** One bone of a skin: the frame that moves it and its inverse bind matrix (16 values, column-major, engine space). */
24
+ export interface XBone {
25
+ /** Name of the frame (`transformNodeName`). */
26
+ name: string;
27
+ /** Index into {@link LoadedX.frames}, or -1 when the file names no such frame. */
28
+ frame: number;
29
+ inverseBind: number[];
30
+ }
31
+ /** A Mesh data object, as triangles with one vertex per distinct (position, normal) pair. */
32
+ export interface XMesh {
33
+ name: string;
34
+ /** `groups[i].properties.materialIndex` is a position in `materials`; `attributes.sourceVertex` maps each vertex to the file's own index. */
35
+ geometry: LoadedGeometry;
36
+ /** The mesh's materials, in the file's order (a MeshMaterialList), or empty. */
37
+ materials: XMaterial[];
38
+ /** Four bone indices per vertex (into `bones`) and their weights; `joints1` and `weights1` hold influences five to eight. */
39
+ joints?: Uint16Array;
40
+ weights?: Float32Array;
41
+ joints1?: Uint16Array;
42
+ weights1?: Float32Array;
43
+ bones: XBone[];
44
+ }
45
+ /** A Frame: a named node of the hierarchy. */
46
+ export interface XFrame {
47
+ name: string;
48
+ /** -1 for a root. Parents come before children. */
49
+ parent: number;
50
+ /** FrameTransformMatrix: 16 values, column-major, relative to the parent, in engine space (identity when absent). */
51
+ matrix: number[];
52
+ /** `matrix` times every parent's: the frame's place in the scene. */
53
+ world: number[];
54
+ /** Indices into {@link LoadedX.meshes} of the meshes this frame holds. */
55
+ meshes: number[];
56
+ }
57
+ /** One channel of an Animation: keys at `times` seconds, `values` flat (rotation x, y, z, w; scale and position xyz; matrix 16). */
58
+ export interface XTrack {
59
+ times: Float64Array;
60
+ values: Float32Array;
61
+ }
62
+ /** An Animation: the tracks that drive one frame. */
63
+ export interface XAnimation {
64
+ /** Name of the animated frame. */
65
+ frame: string;
66
+ rotation?: XTrack;
67
+ scale?: XTrack;
68
+ position?: XTrack;
69
+ /** Whole-matrix keys (key types 3 and 4), column-major in engine space. */
70
+ matrix?: XTrack;
71
+ }
72
+ /** An AnimationSet: the animations that play together under one name. */
73
+ export interface XAnimationSet {
74
+ name: string;
75
+ animations: XAnimation[];
76
+ /** Seconds to the last key. */
77
+ duration: number;
78
+ }
79
+ /** What {@link parseX} returns. */
80
+ export interface LoadedX {
81
+ /** `'text'` or `'binary'`. */
82
+ format: 'text' | 'binary';
83
+ frames: XFrame[];
84
+ meshes: XMesh[];
85
+ /** Every Material at the top of the file or inside a mesh, in order. */
86
+ materials: XMaterial[];
87
+ animationSets: XAnimationSet[];
88
+ /** AnimTicksPerSecond, or 4800 when the file has none. */
89
+ ticksPerSecond: number;
90
+ warnings: string[];
91
+ }
92
+ /**
93
+ * Parses a DirectX `.x` file, text (`txt `) or binary (`bin `), 32 or 64-bit floats. Compressed files (`tzip`, `bzip`)
94
+ * throw `'unsupported'`. Returns the frame hierarchy, meshes (as triangles; polygons are fanned; normals indexed apart
95
+ * from positions split the vertices), materials, skin weights as per-vertex joints and weights, and animation sets with
96
+ * keys in seconds. Counts that claim more data than the file holds, bad indices, runaway nesting and files past the
97
+ * limits throw a `LoaderError`; nothing is allocated from a count before it is checked against the data present.
98
+ */
99
+ export declare function parseX(input: BinaryInput | string, options?: XOptions): LoadedX;