Skip to content

Documentation / @sw-file-lib/three / createVehicleAssetResolver

Function: createVehicleAssetResolver() ​

ts
function createVehicleAssetResolver(getComponentDefinitionFile: (componentId: string) => 
  | string
  | Uint8Array<ArrayBuffer>
  | Promise<string | Uint8Array<ArrayBuffer> | undefined>
  | undefined, getMeshFile: (meshPath: string) => 
  | BinaryReaderInput
  | Promise<BinaryReaderInput | undefined>
  | undefined): VehicleAssetResolver;

Defined in: vehicleAssembler/assetResolver.ts:50

Creates a VehicleAssetResolver from raw asset providers.

The returned resolver automatically parses XML component definitions, converts Stormworks mesh files into THREE.BufferGeometry, and caches the results so each asset is loaded and parsed at most once.

This is the recommended way to construct a resolver for VehicleBodyAssembler.

Parameters ​

ParameterTypeDescription
getComponentDefinitionFile(componentId: string) => | string | Uint8Array<ArrayBuffer> | Promise<string | Uint8Array<ArrayBuffer> | undefined> | undefinedReturns the XML source of a component definition.
getMeshFile(meshPath: string) => | BinaryReaderInput | Promise<BinaryReaderInput | undefined> | undefinedReturns the binary contents of a Stormworks mesh file.

Returns ​

VehicleAssetResolver

A cached asset resolver.