Skip to main content

onUpdate()

onUpdate: ({ framework, frameStartResult, processGpuResult, processCpuResult })

Description

onUpdate() is called to update the scene before render. Called with { framework, frameStartResult, processGpuResult, processCpuResult }. Data returned by modules in onProcessGpu and onProcessCpu will be present as processGpu.modulename and processCpu.modulename where the name is given by module.name = "modulename".

Parameters

ParameterDescription
frameworkThe framework bindings for this module for dispatching events.
frameStartResultThe data that was provided at the beginning of a frame.
processGpuResultData returned by all installed modules during onProcessGpu.
processCpuResultData returned by all installed modules during onProcessCpu.

Example

XR8.addCameraPipelineModule({
name: 'mycamerapipelinemodule',
onUpdate: ({ frameStartResult, processGpuResult, processCpuResult }) => {
if (!processCpuResult.reality) {
return
}
const {rotation, position, intrinsics} = processCpuResult.reality
const {cpuDataA, cpuDataB} = processCpuResult.mycamerapipelinemodule
// ...
},
})