AssetLoaderContext provides configuration for the AssetLoader load() and parse() operations.

Use it to configure how (and if) dependencies are loaded, or to map dependency URLs to embedded data.


Can be created with method new:

Lib.Away3D.Loaders.Misc.AssetLoaderContext.new(includeDependencies, dependencyBaseUrl)

Creates AssetLoaderContext object

includeDependencies - Defines whether dependencies (all files except the one at the URL given to the load() or parseData() operations) should be automatically loaded. Defaults to true.

dependencyBaseUrl - A base URL that will be prepended to all relative dependency URLs found in a loaded resource.

Absolute paths will not be affected by the value of this property. String (default nil)


Created object has properties:

includeDependencies

true/false Defines whether dependencies (all files except the one at the URL given to the load() or parseData() operations) should be automatically loaded. Defaults to true.

dependencyBaseUrl

A base URL that will be prepended to all relative dependency URLs found in a loaded resource.

Absolute paths will not be affected by the value of this property. String (default nil)

materialMode

MaterialMode defines, if the Parser should create SinglePass or MultiPass Materials

Options:

0 (Default / undefined) - All Parsers will create SinglePassMaterials, but the parser will create Materials as they are defined in the file

1 (Force SinglePass) - All Parsers create SinglePassMaterials

2 (Force MultiPass) - All Parsers will create MultiPassMaterials

overrideAbsolutePaths

true/false Defines whether absolute paths (defined as paths that begin with a "/") should be overridden with the dependencyBaseUrl defined in this context. If this is true, and the base path is "base", /path/to/asset.jpg will be resolved as base/path/to/asset.jpg.

overrideFullURLs

true/false Defines whether "full" URLs (defined as a URL that includes a scheme, e.g. http://) should be overridden with the dependencyBaseUrl defined in this context. If this is true, and the base path is "base", http://example.com/path/to/asset.jpg will be resolved as base/path/to/asset.jpg.


Methods:

mapUrl(originalUrl, newUrl)

Map a URL to another URL, so that files that are referred to by the original URL will instead be loaded from the new URL. Use this when your file structure does not match the one that is expected by the loaded file.

originalUrl - The original URL which is referenced in the loaded resource.

newUrl - The URL from which Away3D should load the resource instead.

mapUrlToData(originalUrl, data)

Map a URL to embedded data, so that instead of trying to load a dependency from the URL at which it's referenced, the dependency data will be retrieved straight from the memory instead.

originalUrl - The original URL which is referenced in the loaded resource.

data - The embedded data. Can be ByteArray.

hasDataForUrl(url)

Defines whether embedded data has been mapped to a particular URL.

url - String, URL

getDataForUrl(url)

Returns embedded data for a particular URL.

url - String, URL

hasMappingForUrl(url)

Defines whether a replacement URL has been mapped to a particular URL.

url - String, URL

getRemappedUrl(originalUrl)

Returns new (replacement) URL for a particular original URL.

originalUrl - The original URL which is referenced in the loaded resource.




Created with the Personal Edition of HelpNDoc: Full-featured EBook editor