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
| Parameter | Type | Description |
|---|---|---|
getComponentDefinitionFile | (componentId: string) => | string | Uint8Array<ArrayBuffer> | Promise<string | Uint8Array<ArrayBuffer> | undefined> | undefined | Returns the XML source of a component definition. |
getMeshFile | (meshPath: string) => | BinaryReaderInput | Promise<BinaryReaderInput | undefined> | undefined | Returns the binary contents of a Stormworks mesh file. |
Returns
A cached asset resolver.