Fove SDK
v0.18.0
|
Class that manages accesses to the compositor. More...
Public Member Functions | |
def | __init__ (self, headset) |
Defines a compositor that can be created from a headset. More... | |
def | __enter__ (self) |
Creates a compositor interface to the given headset. More... | |
def | __exit__ (self, _e_type, _e_val, _traceback) |
Frees resources used by the compositor object, including memory and sockets. More... | |
def | createLayer (self, layerInfo) |
Create a layer for this client. More... | |
def | getAdapterId (self) |
Returns the ID of the GPU currently attached to the headset. More... | |
def | getLastRenderPose (self) |
Gets the last cached pose for rendering purposes, without waiting for a new frame to arrive. More... | |
def | isReady (self) |
Checks whether we are connected to a running compositor and ready to submit frames for composing. More... | |
def | submit (self, submitInfo, layerCount) |
Submit a frame to the compositor. More... | |
def | waitForRenderPose (self) |
Wait for the most recent pose for rendering purposes. More... | |
Class that manages accesses to the compositor.
All Compositor-related API requests will be done through an instance of this class.
The class provides Compositor.__enter__
and Compositor.__exit__
methods that do relevant resource managements, and the Headset
instance has a factory method that creates a compositor.
It is fine to create multiple compositors from the same headset. It is also fine for the compositor to outlive the headset passed in.
A typical use of this class would be as follows:
def fove.headset.Compositor.__init__ | ( | self, | |
headset | |||
) |
Defines a compositor that can be created from a headset.
Normally, this method is invoked through Headset.createCompositor. But unlike in the C API, the user has to call Compositor.__enter__ on the result of Compositor.__init__ or Headset.createCompositor to actually connect to a compositor.
headset | An instance of capi.Headset from which this compositor will be created. (Note that it is not an instance of the Headset class defined in this module.) |
def fove.headset.Compositor.__enter__ | ( | self | ) |
Creates a compositor interface to the given headset.
Each call to this function creates and stores a new compositor object, which should be destroyed by calling Compositor.__exit__ on self, which is also retuned from this function.
def fove.headset.Compositor.__exit__ | ( | self, | |
_e_type, | |||
_e_val, | |||
_traceback | |||
) |
Frees resources used by the compositor object, including memory and sockets.
Upon return, this instance for the compositor should no longer be used.
def fove.headset.Compositor.createLayer | ( | self, | |
layerInfo | |||
) |
Create a layer for this client.
This function creates a layer upon which frames may be submitted to the compositor by this client.
A connection to the compositor must exist for this to pass. This means you need to wait for Compositor.isReady before calling this function. However, if connection to the compositor is lost and regained, this layer will persist. For this reason, you should not recreate your layers upon reconnection, simply create them once.
There is no way to delete a layer once created, other than to destroy the Compositor object. This is a feature we would like to add in the future.
layerInfo | The settings for the layer to be created |
def fove.headset.Compositor.submit | ( | self, | |
submitInfo, | |||
layerCount | |||
) |
Submit a frame to the compositor.
This function takes the feed from your game engine to the compositor for output.
submitInfo | An array of layerCount capi.CompositorLayerSubmitInfo structs, each of which provides texture data for a unique layer |
layerCount | The number of layers you are submitting |
def fove.headset.Compositor.waitForRenderPose | ( | self | ) |
Wait for the most recent pose for rendering purposes.
All compositor clients should use this function as the sole means of limiting their frame rate. This allows the client to render at the correct frame rate for the HMD display. Upon this function returning, the client should proceed directly to rendering, to reduce the chance of missing the frame. This function will return the latest pose (valid if not None) as a conveience to the caller.
In general, a client's main loop should look like:
def fove.headset.Compositor.getLastRenderPose | ( | self | ) |
Gets the last cached pose for rendering purposes, without waiting for a new frame to arrive.
def fove.headset.Compositor.isReady | ( | self | ) |
Checks whether we are connected to a running compositor and ready to submit frames for composing.
def fove.headset.Compositor.getAdapterId | ( | self | ) |
Returns the ID of the GPU currently attached to the headset.
For systems with multiple GPUs, submitted textures to the compositor must come from the same GPU that the compositor is using.