Skip to content

@orillusion/core


Class: PrefabParser

Defined in: src/loader/parser/prefab/PrefabParser.ts:33

Top-level parser for the Orillusion prefab (.prefab) binary format. It drives the sub-parsers in order (textures, avatars, meshes, materials, node tree) and reconstructs the prefab as a hierarchy of Object3D nodes with their attached components.

Constructors

Constructor

new PrefabParser(): PrefabParser

Returns

PrefabParser

Inherited from

ParserBase.constructor

Properties

baseUrl

baseUrl: string

Defined in: src/loader/parser/ParserBase.ts:12

Inherited from

ParserBase.baseUrl


initUrl

initUrl: string

Defined in: src/loader/parser/ParserBase.ts:13

Inherited from

ParserBase.initUrl


useWebp

static useWebp: boolean = true

Defined in: src/loader/parser/prefab/PrefabParser.ts:37

When true, texture URLs are rewritten to the webp variant before loading.


format

static format: ParserFormat = ParserFormat.BIN

Defined in: src/loader/parser/prefab/PrefabParser.ts:38

Overrides

ParserBase.format


loaderFunctions?

optional loaderFunctions?: LoaderFunctions

Defined in: src/loader/parser/ParserBase.ts:14

Inherited from

ParserBase.loaderFunctions


userData?

optional userData?: any

Defined in: src/loader/parser/ParserBase.ts:15

Inherited from

ParserBase.userData


data

data: any

Defined in: src/loader/parser/ParserBase.ts:16

Inherited from

ParserBase.data


ctx?

optional ctx?: Context3D

Defined in: src/loader/parser/ParserBase.ts:20

Context3D this parser is operating under. Populated by FileLoader so default-texture lookups (Engine3D.resFor(this.ctx)) resolve against the owning engine's device rather than the global shim.

Inherited from

ParserBase.ctx


avatarDic

avatarDic: object

Defined in: src/loader/parser/prefab/PrefabParser.ts:42

Map of decoded avatar (skeleton) data keyed by avatar name.

Index Signature

[name: string]: PrefabAvatarData


nodeData

nodeData: PrefabNode

Defined in: src/loader/parser/prefab/PrefabParser.ts:46

Root node of the decoded prefab hierarchy.

Methods

parseString()

parseString(str): void

Defined in: src/loader/parser/ParserBase.ts:22

Parameters

str

string

Returns

void

Inherited from

ParserBase.parseString


parseJson()

parseJson(obj): void

Defined in: src/loader/parser/ParserBase.ts:24

Parameters

obj

object

Returns

void

Inherited from

ParserBase.parseJson


parseTexture()

parseTexture(buffer): Texture

Defined in: src/loader/parser/ParserBase.ts:28

Parameters

buffer

ArrayBuffer

Returns

Texture

Inherited from

ParserBase.parseTexture


parse()

parse(data): void

Defined in: src/loader/parser/ParserBase.ts:32

Parameters

data

any

Returns

void

Inherited from

ParserBase.parse


parseBuffer()

parseBuffer(buffer): Promise<void>

Defined in: src/loader/parser/prefab/PrefabParser.ts:52

Decode the prefab buffer: parse textures, avatars, meshes, materials and the node tree, then build the resulting Object3D hierarchy into data.

Parameters

buffer

ArrayBuffer

the raw prefab binary buffer.

Returns

Promise<void>

Overrides

ParserBase.parseBuffer


verification()

verification(): boolean

Defined in: src/loader/parser/prefab/PrefabParser.ts:121

Verify that parsing produced valid data.

Returns

boolean

true when data is present; throws otherwise.

Overrides

ParserBase.verification

Released under the MIT License