Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/core/renderer/utilities/AFManager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class AFManager {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets call this FrameScheduler for now.


constructor() {

// XR session
this.xrsession = null;

}

// Set active XR session
setXRSession( xrsession ) {

this.xrsession = xrsession;

}

removeXRSession() {

this.xrsession = null;

}

// Request animation frame (defer to XR session if present)
requestAnimationFrame( cb ) {

if ( ! this.xrsession ) return window.requestAnimationFrame( cb );

return this.xrsession.requestAnimationFrame( cb );

};

Check warning on line 30 in src/core/renderer/utilities/AFManager.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unnecessary semicolon

// Cancel animation frame via handle (defer to XR session if present)
cancelAnimationFrame( handle ) {

if ( ! this.xrsession ) window.cancelAnimationFrame( handle );

else this.xrsession.cancelAnimationFrame( handle );

}

}

export { AFManager };
Loading