UNPKG

@spatialwalk/avatarkit

Version:

SPAvatar SDK - 3D Gaussian Splatting Avatar Rendering SDK

95 lines 3.07 kB
import { CharacterMeta, PreloadCameraSettings } from '../types/character'; import { CharacterSettings } from '../types/character-settings'; interface ProgressInfo { stage: string; filename: string; loaded: number; total: number; progress: number; } type ProgressCallback = (info: ProgressInfo) => void; interface TemplateResources { [key: string]: ArrayBuffer; } interface FlameResources { flameModel?: { remote?: string; }; flameTemplate?: { remote?: string; }; teethPb?: { remote?: string; }; teethNpz?: { remote?: string; }; } interface CharacterDataResult { shape: ArrayBuffer; pointCloud: ArrayBuffer; idleAnimation?: ArrayBuffer; monoAnimation?: ArrayBuffer; monoAudioUrl?: string; } export interface PreloadResult { templateResources: TemplateResources; characterData: CharacterDataResult; preloadCameraSettings?: PreloadCameraSettings; characterSettings?: CharacterSettings; } export declare class AvatarDownloader { private baseAssetsPath; private characterAssets; constructor(baseAssetsPath?: string); /** * Load template resources from CharacterMeta flame CDN URLs * Falls back to global CDN config if not provided by API */ loadTemplateResources(flameResources?: FlameResources, progressCallback?: ProgressCallback | null): Promise<TemplateResources>; /** * Load global FLAME template resources from CDN * Uses centralized FLAME CDN config (shared across all characters) */ private loadGlobalFlameResources; /** * Load camera settings from CharacterMeta (optional) */ loadCameraSettings(characterMeta: CharacterMeta): Promise<PreloadCameraSettings | undefined>; /** * Load character data from CharacterMeta (iOS compatible) */ loadCharacterData(characterMeta: CharacterMeta, options?: { loadMonologue?: boolean; progressCallback?: ProgressCallback | null; }): Promise<CharacterDataResult>; /** * Preload all resources (template + character data + camera info + settings) */ preloadResources(characterMeta: CharacterMeta, options?: { loadMonologue?: boolean; progressCallback?: ProgressCallback | null; }): Promise<PreloadResult>; /** * Get loaded character asset by key */ getCharacterAsset(key: string): ArrayBuffer | undefined; /** * Clear cached assets */ clear(): void; /** * Get SPAvatarKit SDK API Client (api.spatialwalk.top) * Used for: character details and resource URLs (public endpoints, no auth required) */ private getSdkApiClient; /** * Get single character by ID from SPAvatarKit SDK API (v2, iOS compatible) * Domain: api.spatialwalk.top * Auth: Public endpoint, no authentication required * Returns CharacterMeta with nested resource structure */ getCharacterById(characterId: string): Promise<CharacterMeta>; } export {}; //# sourceMappingURL=AvatarDownloader.d.ts.map