Created
April 25, 2023 12:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'xatlas.js' { | |
export const xatlas: XAtlas; | |
interface XAtlas { | |
create(): XAtlasInstance; | |
addMesh(instance: XAtlasInstance, positions: Float32Array, indices: Uint32Array): void; | |
generate(instance: XAtlasInstance, options?: Partial<GenerateOptions>): void; | |
destroy(instance: XAtlasInstance): void; | |
} | |
interface XAtlasInstance { | |
meshes: Mesh[]; | |
} | |
interface Mesh { | |
charts: Chart[]; | |
vertices: Float32Array; | |
} | |
interface Chart { | |
faces: Face[]; | |
} | |
interface Face { | |
indices: number[]; | |
} | |
interface GenerateOptions { | |
resolution: number; | |
padding: number; | |
maxChartSize: number; | |
progressCallback(progress: number): void; | |
cancelCallback(): boolean; | |
} | |
// Define the CalculateColorCallback type | |
type CalculateColorCallback = (lerpedVertexData: LerpedVertexData) => Color; | |
interface LerpedVertexData { | |
position: Vector3; | |
} | |
interface Vector3 { | |
x: number; | |
y: number; | |
z: number; | |
} | |
interface Color { | |
r: number; | |
g: number; | |
b: number; | |
a: number; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment