Package org.lwjgl.ovr

Class OVRLayerCylinder

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

    public class OVRLayerCylinder
    extends Struct
    implements NativeResource
    Describes a layer of type LayerType_Cylinder which is a single cylinder relative to the recentered origin. This type of layer represents a single object placed in the world and not a stereo view of the world itself.
                    -Z                                       +Y
             U=0  +--+--+  U=1
              +---+  |  +---+            +-----------------+  - V=0
           +--+ \    |    / +--+         |                 |  |
         +-+     \       /     +-+       |                 |  |
        ++        \  A  /        ++      |                 |  |
       ++          \---/          ++     |                 |  |
       |            \ /            |     |              +X |  |
       +-------------C------R------+ +X  +--------C--------+  | <--- Height
           (+Y is out of screen)         |                 |  |
                                         |                 |  |
       R = Radius                        |                 |  |
       A = Angle (0,2*Pi)                |                 |  |
       C = CylinderPoseCenter            |                 |  |
       U/V = UV Coordinates              +-----------------+  - V=1

    An identity CylinderPoseCenter places the center of the cylinder at the recentered origin unless the headlocked flag is set.

    Does not utilize HmdSpaceToWorldScaleInMeters. If necessary, adjust translation and radius.


    Only the interior surface of the cylinder is visible. Use cylinder layers when the user cannot leave the extents of the cylinder. Artifacts may appear when viewing the cylinder's exterior surface. Additionally, while the interface supports an Angle that ranges from [0,2*Pi] the angle should remain less than 1.9*PI to avoid artifacts where the cylinder edges converge.

    Member documentation

    • HeaderHeader.Type must be LayerType_Cylinder
    • ColorTexture – contains a single image, never with any stereo view
    • Viewport – specifies the ColorTexture sub-rect UV coordinates
    • CylinderPoseCenter – specifies the orientation and position of the center point of a cylinder layer type. The position is in real-world meters not the application's virtual world, but the physical world the user is in. It is relative to the "zero" position set by RecenterTrackingOrigin unless the LayerFlag_HeadLocked flag is used.
    • CylinderRadius – radius of the cylinder in meters
    • CylinderAngle – angle in radians. Range is from 0 to 2*Pi exclusive covering the entire cylinder (see diagram and note above).
    • CylinderAspectRatio – custom aspect ratio presumably set based on Viewport. Used to calculate the height of the cylinder based on the arc-length (CylinderAngle) and radius (CylinderRadius) given above. The height of the cylinder is given by: height = (CylinderRadius * CylinderAngle) / CylinderAspectRatio. Aspect ratio is width / height.


     struct ovrLayerCylinder {
         ovrLayerHeader Header;
         ovrTextureSwapChain ColorTexture;
         ovrRecti Viewport;
         ovrPosef CylinderPoseCenter;
         float CylinderRadius;
         float CylinderAngle;
         float CylinderAspectRatio;
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.

        The struct member offsets.
    • Constructor Detail

      • OVRLayerCylinder

        public OVRLayerCylinder​(java.nio.ByteBuffer container)
        Creates a OVRLayerCylinder 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()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • ColorTexture

        public long ColorTexture()
        Returns the value of the ColorTexture field.
      • Viewport

        public OVRRecti Viewport()
        Returns a OVRRecti view of the Viewport field.
      • CylinderPoseCenter

        public OVRPosef CylinderPoseCenter()
        Returns a OVRPosef view of the CylinderPoseCenter field.
      • CylinderRadius

        public float CylinderRadius()
        Returns the value of the CylinderRadius field.
      • CylinderAngle

        public float CylinderAngle()
        Returns the value of the CylinderAngle field.
      • CylinderAspectRatio

        public float CylinderAspectRatio()
        Returns the value of the CylinderAspectRatio field.
      • Header

        public OVRLayerCylinder Header​(java.util.function.Consumer<OVRLayerHeader> consumer)
        Passes the Header field to the specified Consumer.
      • ColorTexture

        public OVRLayerCylinder ColorTexture​(long value)
        Sets the specified value to the ColorTexture field.
      • Viewport

        public OVRLayerCylinder Viewport​(java.util.function.Consumer<OVRRecti> consumer)
        Passes the Viewport field to the specified Consumer.
      • CylinderPoseCenter

        public OVRLayerCylinder CylinderPoseCenter​(java.util.function.Consumer<OVRPosef> consumer)
        Passes the CylinderPoseCenter field to the specified Consumer.
      • CylinderRadius

        public OVRLayerCylinder CylinderRadius​(float value)
        Sets the specified value to the CylinderRadius field.
      • CylinderAngle

        public OVRLayerCylinder CylinderAngle​(float value)
        Sets the specified value to the CylinderAngle field.
      • CylinderAspectRatio

        public OVRLayerCylinder CylinderAspectRatio​(float value)
        Sets the specified value to the CylinderAspectRatio field.
      • set

        public OVRLayerCylinder set​(OVRLayerHeader Header,
                                    long ColorTexture,
                                    OVRRecti Viewport,
                                    OVRPosef CylinderPoseCenter,
                                    float CylinderRadius,
                                    float CylinderAngle,
                                    float CylinderAspectRatio)
        Initializes this struct with the specified values.
      • set

        public OVRLayerCylinder set​(OVRLayerCylinder src)
        Copies the specified struct data to this struct.
        src - the source struct
        this struct
      • malloc

        public static OVRLayerCylinder malloc()
        Returns a new OVRLayerCylinder instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static OVRLayerCylinder calloc()
        Returns a new OVRLayerCylinder instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static OVRLayerCylinder create​(long address)
        Returns a new OVRLayerCylinder instance for the specified memory address.
      • createSafe

        public static OVRLayerCylinder createSafe​(long address)
        Like create, but returns null if address is NULL.
      • createSafe

        public static OVRLayerCylinder.Buffer createSafe​(long address,
                                                         int capacity)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static OVRLayerCylinder mallocStack()
        Returns a new OVRLayerCylinder instance allocated on the thread-local MemoryStack.
      • callocStack

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

        public static OVRLayerCylinder mallocStack​(MemoryStack stack)
        Returns a new OVRLayerCylinder instance allocated on the specified MemoryStack.
        stack - the stack from which to allocate
      • callocStack

        public static OVRLayerCylinder callocStack​(MemoryStack stack)
        Returns a new OVRLayerCylinder instance allocated on the specified MemoryStack and initializes all its bits to zero.
        stack - the stack from which to allocate
      • nColorTexture

        public static long nColorTexture​(long struct)
        Unsafe version of ColorTexture().
      • nViewport

        public static OVRRecti nViewport​(long struct)
        Unsafe version of Viewport().
      • nCylinderRadius

        public static float nCylinderRadius​(long struct)
        Unsafe version of CylinderRadius().
      • nCylinderAngle

        public static float nCylinderAngle​(long struct)
        Unsafe version of CylinderAngle().
      • nCylinderAspectRatio

        public static float nCylinderAspectRatio​(long struct)
        Unsafe version of CylinderAspectRatio().
      • nHeader

        public static void nHeader​(long struct,
                                   OVRLayerHeader value)
        Unsafe version of Header.
      • nColorTexture

        public static void nColorTexture​(long struct,
                                         long value)
        Unsafe version of ColorTexture.
      • nViewport

        public static void nViewport​(long struct,
                                     OVRRecti value)
        Unsafe version of Viewport.
      • nCylinderPoseCenter

        public static void nCylinderPoseCenter​(long struct,
                                               OVRPosef value)
        Unsafe version of CylinderPoseCenter.
      • nCylinderRadius

        public static void nCylinderRadius​(long struct,
                                           float value)
        Unsafe version of CylinderRadius.
      • nCylinderAngle

        public static void nCylinderAngle​(long struct,
                                          float value)
        Unsafe version of CylinderAngle.
      • nCylinderAspectRatio

        public static void nCylinderAspectRatio​(long struct,
                                                float value)
        Unsafe version of CylinderAspectRatio.
      • validate

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

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