Model loading · class
BlendData
A parsed file: its blocks, its catalogue, and the maps from an address to a block.
Explained in Importing models.
class BlendDataimport { BlendData } from '@driftengine/assets';Constructor
new
constructor(bytes: Uint8Array)| Parameter | Type | Description |
|---|---|---|
bytes | Uint8Array |
Properties
| Name | Type | Description |
|---|---|---|
headerreadonly | BlendHeader | |
bytesreadonly | Uint8Array | |
viewreadonly | DataView | |
blocksreadonly | readonly BlendBlock[] | |
structsreadonly | readonly DnaStruct[] |
Methods
struct
struct(type: string): DnaStruct | undefinedThe catalogue entry for a struct type, or undefined where this file's Blender had none.
| Parameter | Type | Description |
|---|---|---|
type | string |
scopeOf
scopeOf(block: number): numberThe datablock a block's data belongs to, which is what scopes every pointer inside it.
| Parameter | Type | Description |
|---|---|---|
block | number |
find
find(address: bigint, scope: number): { block: number; offset: number; } | nullThe block an address falls in, and how far into it, as seen from inside datablock scope.
| Parameter | Type | Description |
|---|---|---|
address | bigint | |
scope | number |
More
The datablock's own data first, then the datablocks themselves, which is the order Blender's reader resolves in. Null for an address nothing holds.
idsOf
idsOf(code: string): BlendStruct[]Every datablock of a two-letter code — OB, ME, MA — as views of their own struct.
| Parameter | Type | Description |
|---|---|---|
code | string |
at
at(address: bigint, scope: number, type?: string): BlendStruct | nullA view of the struct at an address, typed by the block that holds it or by type.
| Parameter | Type | Description |
|---|---|---|
address | bigint | |
scope | number | |
type? | string |
array
array(address: bigint, scope: number, type: string, count?: number): BlendStruct[]The structs of an array a pointer names, indexed inside its block.
| Parameter | Type | Description |
|---|---|---|
address | bigint | |
scope | number | |
type | string | |
count? | number |
More
Never by adding to the address. From 5.0 an address is a placeholder rather than a
location, so base + 24 is not the second element and can be exactly the address of some
unrelated block.
raw
raw(address: bigint, scope: number): Uint8Array | nullThe raw bytes a pointer names, through the end of its block.
| Parameter | Type | Description |
|---|---|---|
address | bigint | |
scope | number |
text
text(address: bigint, scope: number): stringA zero-terminated string a char * names.
| Parameter | Type | Description |
|---|---|---|
address | bigint | |
scope | number |
blockOf
blockOf(address: bigint, scope: number): BlendBlock | nullThe block a pointer names, for its count and its catalogue type.
| Parameter | Type | Description |
|---|---|---|
address | bigint | |
scope | number |
pointer
pointer(at: number): bigint| Parameter | Type | Description |
|---|---|---|
at | number |