Interface InfiniteEngineViewType

When using InfiniteEngineInterface.setView, a specific rendering type may be called :

  • undefined : defaults to webgl2 is available, else webgl1
  • webgl1 : webgl1 is used even if webgl2 is available
  • webxr : (WebXR) a webxr session is started.
/** 
* Sample to illustrate using a webxr session.
*/
import {
InfiniteEngineInterface, InfiniteEngineInterfaceSignal, InfiniteEvent, InfiniteXRSession,
CameraManagerInterfaceSignal, InfiniteXRReferenceSpace
} from 'generated_files/documentation/appinfiniteapi';

// We try to make a screenshot when all data is loaded

// created previously the 3D engine
let lInfiniteEngine: InfiniteEngineInterface;
// the webXR session
let lCurSession : InfiniteXRSession;

// store the XRSession when ready
lInfiniteEngine.addEventListener(
InfiniteEngineInterfaceSignal.XRSessionReady,
(pEvent: InfiniteEvent) : void =>
{
lCurSession = pEvent.attachments;
}
);

// make some fancy things on camera changes
// we may have used InfiniteEngineInterfaceSignal.DisplayDone
// to be called each frame
lInfiniteEngine.getCameraManager().addEventListener(
CameraManagerInterfaceSignal.CameraLocationChanged,
(_pEvent: InfiniteEvent) : void =>
{
if (!lCurSession)
{
return;
}
const lXRRefSpace : InfiniteXRReferenceSpace | undefined = lInfiniteEngine.getCameraManager().getXRReferenceFrame();
if (!lXRRefSpace)
{
return;
}
// make some computations with XRSession inputs
console.log(lCurSession.inputSources.length);
}
);

// bind the 3D rendering to the div (should have been done earlier :) )
lInfiniteEngine.setView(undefined, { type: 'webxr', options: {} });

The WebXR api should be used with specific hardware. Please refer to https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Fundamentals.
3D Rendering

interface InfiniteEngineViewType {
    options?: {
        useHardwareInstancing?: boolean;
        useVertexArrayObjects?: boolean;
    };
    type?: "default" | "webxr" | "forcewebgl1";
}

Properties

Properties

options?: {
    useHardwareInstancing?: boolean;
    useVertexArrayObjects?: boolean;
}

Added options.

Type declaration

  • Optional useHardwareInstancing?: boolean

    Instancing rendering is enabled by default, but you may want to disable it explicitly.

  • Optional useVertexArrayObjects?: boolean

    Vertex Array Object usage is enabled by default on webgl 2, but you may want to disable it explicitly.

type?: "default" | "webxr" | "forcewebgl1"

The requested type of engine :

  • 'forcewebgl1' : webgl1 is used even if webgl2 is available
  • 'webxr' : a webxr session is started.
  • 'default' : a webgl2 rendering will be tested, and back to webgl1 if unavailable.