Skip to content

@tmrw-realityos/charmDocs


@tmrw-realityos/charm / LowlevelEngine

Class: LowlevelEngine

Extends

  • RendererInterface

Constructors

new LowlevelEngine()

new LowlevelEngine(): LowlevelEngine

Returns

LowlevelEngine

Overrides

RendererInterface.constructor

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:86

Properties

basePath

basePath: string = ""

Inherited from

RendererInterface.basePath

Defined in

packages/charm/src/graphics/rendererInterface.ts:49


cameraRP?

optional cameraRP: NativeCameraRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:70


canvas?

optional canvas: HTMLCanvasElement

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:73


defaultEmissiveTexture?

optional defaultEmissiveTexture: NativeTextureRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:78


draw?

optional draw: DrawInterface

Inherited from

RendererInterface.draw

Defined in

packages/charm/src/graphics/rendererInterface.ts:53


entityRegistry

entityRegistry: Map<string, nativeEntityRP>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:77


frameIndex

frameIndex: number = 0

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:84


loadedGLTFs

loadedGLTFs: Map<string, GLTFInfo>

Inherited from

RendererInterface.loadedGLTFs

Defined in

packages/charm/src/graphics/rendererInterface.ts:56


loadingGLTFs

loadingGLTFs: Map<string, LoadedGLTFCallback[]>

Inherited from

RendererInterface.loadingGLTFs

Defined in

packages/charm/src/graphics/rendererInterface.ts:57


matBundle

matBundle: URL

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:82


materialInstanceRegistry

materialInstanceRegistry: Map<number, NativeMaterialInstanceRP>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:74


materialProvider?

optional materialProvider: NativeMaterialProviderRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:75


nativeEngineRP?

optional nativeEngineRP: NativeEngineRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:67


plane?

optional plane: Mesh

Inherited from

RendererInterface.plane

Defined in

packages/charm/src/graphics/rendererInterface.ts:50


planeXY?

optional planeXY: Mesh

Inherited from

RendererInterface.planeXY

Defined in

packages/charm/src/graphics/rendererInterface.ts:51


rendererRP?

optional rendererRP: NativeRendererRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:69


sceneRP?

optional sceneRP: NativeSceneRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:71


texturesCache

texturesCache: Map<string, NativeTexture>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:76


tinyGltf?

optional tinyGltf: TinyGltf

Inherited from

RendererInterface.tinyGltf

Defined in

packages/charm/src/graphics/rendererInterface.ts:55


tmrwRooms?

optional tmrwRooms: MainModule

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:72


viewRP?

optional viewRP: NativeViewRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:68

Methods

buildTestMesh()

buildTestMesh(): Promise<void>

Returns

Promise<void>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:199


clearScene()

clearScene(): void

Returns

void

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:651


createMaterialProvider()

createMaterialProvider(matBundle): Promise<NativeMaterialProviderRP>

Create material provider from matz bundle

Parameters

matBundle: string | URL

path to matz file

Returns

Promise<NativeMaterialProviderRP>

new material provider

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:149


createNativeMesh()

createNativeMesh(mesh, material, transform): nativeEntityRP

currently it creates Entities, no meshes

Parameters

mesh: NativeMesh

material: Material

transform: mat4 = ...

Returns

nativeEntityRP

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:397


createTexture()

createTexture(name, data): Texture

Parameters

name: string

data: TextureContent

Returns

Texture

Overrides

RendererInterface.createTexture

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:756


createTextureFromKTX()

createTextureFromKTX(_name, _data, _callback?): undefined | Texture

Parameters

_name: string

_data: ArrayBuffer

_callback?

Returns

undefined | Texture

Overrides

RendererInterface.createTextureFromKTX

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:810


destroy()

destroy(): void

Destroy all allocated resources

Returns

void

Overrides

RendererInterface.destroy

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:90


getPlaneMesh()

getPlaneMesh(): Mesh

static mesh

Returns

Mesh

Inherited from

RendererInterface.getPlaneMesh

Defined in

packages/charm/src/graphics/rendererInterface.ts:158


getTexture()

getTexture(name): undefined | Texture

Parameters

name: string

Returns

undefined | Texture

Overrides

RendererInterface.getTexture

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:824


init()

init(nativeCanvas): Promise<void>

Parameters

nativeCanvas: HTMLCanvasElement

Returns

Promise<void>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:103


internalLoadGLTF()

internalLoadGLTF(_url, _gltf, _options?): undefined | GLTFInfo

Parameters

_url: string

_gltf: GlTf

_options?: GLTFLoadingOptions

Returns

undefined | GLTFInfo

Inherited from

RendererInterface.internalLoadGLTF

Defined in

packages/charm/src/graphics/rendererInterface.ts:117


loadEnvironment()

loadEnvironment(env): Promise<void>

Parameters

env: Environment

Returns

Promise<void>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:592


loadGLTF()

loadGLTF(url, _options?, _force?): Promise<undefined | GLTFInfo>

Parameters

url: string

_options?: GLTFLoadingOptions

_force?: boolean

Returns

Promise<undefined | GLTFInfo>

See

RendererInterface

Overrides

RendererInterface.loadGLTF

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:1192


loadGLTFFromBinary()

loadGLTFFromBinary(data, options?, url?): Promise<undefined | GLTFInfo>

Loads a GLTF from a Binary array, in case it was dragged from hard drive

Parameters

data: ArrayBuffer

options?: GLTFLoadingOptions

url?: string = "none"

Returns

Promise<undefined | GLTFInfo>

Inherited from

RendererInterface.loadGLTFFromBinary

Defined in

packages/charm/src/graphics/rendererInterface.ts:105


loadGLTFLoadersGL()

loadGLTFLoadersGL(url, root?, animations?): Promise<undefined | Node>

Load a gltf from url using loaders.gl. In contrast to tinygltf, this loader extracts buffer attributes to typed arrays which can be used to populate mesh.positions, mesh.normals, etc.

Parameters

url: string

gltf/glb url

root?: Node

node to append processed scene to

animations?: Animation[]

existing set of animations. gltf animations will be appended.

Returns

Promise<undefined | Node>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:872


loadImage()

loadImage(path): Promise<HTMLImageElement>

Helper to async load an image

Parameters

path: string

image path

Returns

Promise<HTMLImageElement>

promise

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:850


loadScene()

loadScene(scene): Promise<void>

Parameters

scene: Scene

Returns

Promise<void>

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:181


newMesh()

newMesh(): Mesh

Returns

Mesh

Overrides

RendererInterface.newMesh

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:193


packTangentFrame()

packTangentFrame(tangent, normal): quat

Parameters

tangent: vec3

normal: vec3

Returns

quat

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:221


parseAnimation()

parseAnimation(index, json): Animation

TODO: Common code should be shared with WebGPUGltfToNodes

Parameters

index: number

json: GLTFPostprocessed

Returns

Animation

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:1119


preloadTexture()

preloadTexture(_url, _name?): void

Parameters

_url: string

_name?: string

Returns

void

Overrides

RendererInterface.preloadTexture

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:822


render()

render(scene, camera): void

Renders a scene from a point of view

Parameters

scene: Scene

camera: Camera

Returns

void

Overrides

RendererInterface.render

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:732


setEnvironment()

setEnvironment(env): void

Parameters

env: HDREnvironment

Returns

void

Overrides

RendererInterface.setEnvironment

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:1210


setFx()

setFx(): void

Returns

void

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:164


updateNativeMesh()

updateNativeMesh(mesh, requireTangents): void

Parameters

mesh: NativeMesh

requireTangents: boolean

Returns

void

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:242


updateRenderables()

updateRenderables(node, camera): void

Frustum cull renderables and update transform and material

Parameters

node: Node

camera: Camera

Returns

void

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:661


updateTexture()

updateTexture(name, data): void

Parameters

name: string

data: TextureContent

Returns

void

Overrides

RendererInterface.updateTexture

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:828


updateTextureFromKTX()

updateTextureFromKTX(_name, _data, _callback): void

Parameters

_name: string

_data: ArrayBuffer

_callback

Returns

void

Overrides

RendererInterface.updateTextureFromKTX

Defined in

packages/charm/src/graphics/lowlevelEngine.ts:834