Method: OpenXR::System#initialize

Defined in:
lib/openxr/system.rb

#initialize(instance, id) ⇒ System

Returns a new instance of System.

Parameters:

Raises:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/openxr/system.rb', line 59

def initialize(instance, id)
  @instance = instance
  @id = id.to_i

  response = XrSystemProperties.new

  # https://www.khronos.org/registry/OpenXR/specs/1.0/man/html/openxr.html#_xrgetsystemproperties3
  case result = xrGetSystemProperties(@instance.handle, @id, response)
    when XR_SUCCESS
      @name = response[:systemName].to_s
      @vendor_id = response[:vendorId]
      @graphics_properties = {
        :max_swapchain_image_height => response[:graphicsProperties][:maxSwapchainImageHeight],
        :max_swapchain_image_width => response[:graphicsProperties][:maxSwapchainImageWidth],
        :max_layer_count => response[:graphicsProperties][:maxLayerCount],
      }
      @tracking_properties = {
        :orientation_tracking => response[:trackingProperties][:orientationTracking] == XR_TRUE,
        :position_tracking    => response[:trackingProperties][:positionTracking] == XR_TRUE,
      }
    else raise OpenXR::Result.for(result).new(:xrGetSystemProperties)
  end
end