HmdViewController
open class HmdViewController : UIViewController
The VC that supports all the display and OpenGl composition of the “HMD” view. You can subclass this ViewController in order to implement a HMD feature
-
enum to specify the camera source.
See moreDeclaration
Swift
public enum VideoOrigin
-
Can enable / disable CockpitGlasses VR rendering. Can be used during development to display the undistorted HMD screen. (
true
disables the distortion)Declaration
Swift
public var debugDistortionOff: Bool { get set }
-
HMD Object that displays a video stream.
Declaration
Swift
public var offScreenStreamRender: OffScreenStreamRender?
-
Specifies the camera source.
Declaration
Swift
public var videoOrigin: HmdViewController.VideoOrigin { get set }
-
Phone’s camera size (pixels) (read-only)
Declaration
Swift
public var phoneCameraSize: CGSize? { get }
-
Phone’s camera Field Of View (read-only)
Declaration
Swift
public var phoneCameraFov: Double { get }
-
Custom rendering vertical offset (in mm)
Declaration
Swift
public var verticalOffset: Double { get set }
-
Undocumented
Declaration
Swift
public var refreshUpdate: (() -> Void)?
-
Set true in this property will force the hud layer to be always render in low res
Note: If the hud view uses the
fallBackMinRefreshRateHz
parameter (seesetViewForHud()
), the lowres rendering should be automatically activated in the case of a bad framerate.Declaration
Swift
public var hudForceLowRes: Bool { get set }
-
Zoom factor to apply to the Hud view. By default, the HUD view is displayed in “fit” mode. A factor of 1. is the default. For example, to reduce the view in half, the zoom factor to use would be 0.5
Declaration
Swift
public var hudCustomZoom: CGFloat { get set }
-
Undocumented
Declaration
Swift
override open func viewDidLoad()
-
Undocumented
Declaration
Swift
open override func viewDidAppear(_ animated: Bool)
-
Undocumented
Declaration
Swift
open override func viewWillDisappear(_ animated: Bool)
-
Set the cockpit ressources file.
Declaration
Swift
public func setupCockpitRessources(fileURL: URL)
Parameters
fileURL
URL for the cockpitGlasses file.
-
Gel all available cockpit models. Models are defined in a cockpitGlasses file (see
setupCockpitRessources(fileURL: URL)
)Declaration
Swift
public func allCockpitModels() -> [String]?
Return Value
all available models. See
setCockpitModel(model: String)
-
Set or update the Cockit Model. Call this function during initialization (viewDidLoad() is a good place). Subsequently, it is possible to dynamically update the model used.
Declaration
Swift
public func setCockpitModel(model: String)
Parameters
model
Cockpit Model.
-
Set a view as Hud template
Note: in order to render a spéecific view in
view.subviews
, you can mark the view to render using the ClassDrawableView
. If no view is a DrawableView in the hierarchy, theview
is used for rendering.Declaration
Swift
public func setViewForHud(view: UIView?, refreshRateHz: Double, fallBackMinRefreshRateHz: Double? = nil)
Parameters
view
the view used to draw the Hud (For better optimization / representation of the view, design a view with a ratio of 1: 1). Use ‘nil’ to deactivate the hud rendering.
refreshRateHz
refresh Rate in Hertz. (> 0)
fallBackMinRefreshRateHz
if this parameter is defined, an automatic framerate reduction mechanism is used in case of poor performance
-
Adds a sprite that will be drawn in the phone’s camera overlay.
Declaration
Swift
@discardableResult public func addCameraSprite(sprite: HmdSprite) -> Bool
Parameters
sprite
Sprite to render in the Phone’s Camera Overlay
Return Value
true or false if the sprite is added or not.
-
Adds a sprite that will be drawn in the drone’s stream overlay.
Declaration
Swift
@discardableResult public func addStreamSprite(sprite: HmdSprite) -> Bool
Parameters
sprite
Sprite to render in the stream Overlay
Return Value
true or false if the sprite is added or not.
-
Remove a sprite previously inserted in the camera overlay.
Declaration
Swift
public func removeCameraSprite(_ sprite: HmdSprite)
Parameters
sprite
Existing sprite in the camera Overlay
-
Remove a sprite previously inserted in the drone’s stream overlay.
Declaration
Swift
public func removeStreamSprite(_ sprite: HmdSprite)
Parameters
sprite
Existing sprite in the stream Overlay
-
The call to this function indicates that the camera overlay has been modified and must be refreshed.
Declaration
Swift
public func cameraOverlayNeedsRefresh()
-
The call to this function indicates that the stream overlay has been modified and must be refreshed.
Declaration
Swift
public func streamOverlayNeedsRefresh()