Package org.lwjgl.ovr

Class OVRLayerEyeMatrix

  • All Implemented Interfaces:
    java.lang.AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer


    public class OVRLayerEyeMatrix
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.NativeResource
    Describes a layer that specifies a monoscopic or stereoscopic view.

    This uses a direct 3x4 matrix to map from view space to the UV coordinates. It is essentially the same thing as OVRLayerEyeFov but using a much lower level. This is mainly to provide compatibility with specific apps. Unless the application really requires this flexibility, it is usually better to use ovrLayerEyeFov.

    Three options exist with respect to mono/stereo texture usage:

    • ColorTexture[0] and ColorTexture[1] contain the left and right stereo renderings, respectively. Viewport[0] and Viewport[1] refer to ColorTexture[0] and ColorTexture[1], respectively.
    • ColorTexture[0] contains both the left and right renderings, ColorTexture[1] is NULL, and Viewport[0] and Viewport[1] refer to sub-rects with ColorTexture[0].
    • ColorTexture[0] contains a single monoscopic rendering, and Viewport[0] and Viewport[1] both refer to that rendering.

    Member documentation

    • HeaderHeader.Type must be LayerType_EyeMatrix
    • ColorTextureovrTextureSwapChains for the left and right eye respectively. The second one of which can be NULL for cases described above.
    • Viewport – specifies the ColorTexture sub-rect UV coordinates. Both Viewport[0] and Viewport[1] must be valid.
    • RenderPose – specifies the position and orientation of each eye view, with the position specified in meters. RenderPose will typically be the value returned from _CalcEyePoses, but can be different in special cases if a different head pose is used for rendering.
    • Matrix – specifies the mapping from a view-space vector to a UV coordinate on the textures given above.
       P = (x,y,z,1)*Matrix
       TexU  = P.x/P.z
       TexV  = P.y/P.z
    • SensorSampleTime – specifies the timestamp when the source ovrPosef (used in calculating RenderPose) was sampled from the SDK. Typically retrieved by calling GetTimeInSeconds around the instant the application calls GetTrackingState The main purpose for this is to accurately track app tracking latency.

    Layout

     struct ovrLayerEyeMatrix {
         ovrLayerHeader Header;
         ovrTextureSwapChain ColorTexture[ovrEye_Count];
         ovrRecti Viewport[ovrEye_Count];
         ovrPosef RenderPose[ovrEye_Count];
         ovrMatrix4f Matrix[ovrEye_Count];
         double SensorSampleTime;
     }
    • Field Detail

      • SIZEOF

        public static final int SIZEOF
        The struct size in bytes.
    • Constructor Detail

      • OVRLayerEyeMatrix

        public OVRLayerEyeMatrix(java.nio.ByteBuffer container)
        Creates a OVRLayerEyeMatrix instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Specified by:
        sizeof in class org.lwjgl.system.Struct
      • ColorTexture

        public org.lwjgl.PointerBuffer ColorTexture()
        Returns a PointerBuffer view of the ColorTexture field.
      • ColorTexture

        public long ColorTexture(int index)
        Returns the value at the specified index of the ColorTexture field.
      • Viewport

        public OVRRecti Viewport(int index)
        Returns a OVRRecti view of the struct at the specified index of the Viewport field.
      • RenderPose

        public OVRPosef RenderPose(int index)
        Returns a OVRPosef view of the struct at the specified index of the RenderPose field.
      • Matrix

        public OVRMatrix4f Matrix(int index)
        Returns a OVRMatrix4f view of the struct at the specified index of the Matrix field.
      • SensorSampleTime

        public double SensorSampleTime()
        Returns the value of the SensorSampleTime field.
      • ColorTexture

        public OVRLayerEyeMatrix ColorTexture(org.lwjgl.PointerBuffer value)
        Copies the specified PointerBuffer to the ColorTexture field.
      • ColorTexture

        public OVRLayerEyeMatrix ColorTexture(int index,
                                              long value)
        Sets the specified value at the specified index of the ColorTexture field.
      • SensorSampleTime

        public OVRLayerEyeMatrix SensorSampleTime(double value)
        Sets the specified value to the SensorSampleTime field.
      • createSafe

        @Nullable
        public static OVRLayerEyeMatrix createSafe(long address)
        Like create, but returns null if address is NULL.
      • createSafe

        @Nullable
        public static OVRLayerEyeMatrix.Buffer createSafe(long address,
                                                          int capacity)
        Like create, but returns null if address is NULL.
      • callocStack

        public static OVRLayerEyeMatrix callocStack()
        Returns a new OVRLayerEyeMatrix instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static OVRLayerEyeMatrix mallocStack(org.lwjgl.system.MemoryStack stack)
        Returns a new OVRLayerEyeMatrix instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static OVRLayerEyeMatrix callocStack(org.lwjgl.system.MemoryStack stack)
        Returns a new OVRLayerEyeMatrix instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static OVRLayerEyeMatrix.Buffer callocStack(int capacity)
        Returns a new OVRLayerEyeMatrix.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

        public static OVRLayerEyeMatrix.Buffer mallocStack(int capacity,
                                                           org.lwjgl.system.MemoryStack stack)
        Returns a new OVRLayerEyeMatrix.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • callocStack

        public static OVRLayerEyeMatrix.Buffer callocStack(int capacity,
                                                           org.lwjgl.system.MemoryStack stack)
        Returns a new OVRLayerEyeMatrix.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • validate

        public static void validate(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate(long array,
                                    int count)
        Calls OVRLayerEyeMatrix.validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array