-
-
Notifications
You must be signed in to change notification settings - Fork 21
Visor lifecycle
Visor supports 3 play modes. Each mode controls whether the VR session is initialized and when VR is rendered
-
Behavior
- VR session is initialized on startup, and is playable from main menu
- Require VR runtime & hardware
-
Behavior
- VR session is initialized same as VR_ENABLED, but is playable only in world
- Require VR runtime & hardware
-
Behavior
- VR session never ininitialize
- Does not require VR runtime & hardware
- Modifies only rendering of remote VR players (if connected to server supporting Visor through mod or plugin)
Three Boolean flags control runtime behavior:
| Flag |
true means… |
false means… |
|---|---|---|
VR_INITIALIZED |
VR session has been successfully created and is ready for rendering | No VR session is available; VR cannot render |
VR_ACTIVE |
VR is rendering | Rendering falls back to vanilla |
VR_FOCUSED |
VR is fully functional | In-game menu overlay is shown and non-essential VR visuals are disabled to save performance. |
State is updated at the beginning of mc game loop
-
Initialization
-
On startup, after mc resources are loaded, attempt to initialize VR.
-
If successful, set
VR_INITIALIZED = true. -
If in
VR_DISABLEDplay mode, never initializes
-
-
Activation
-
When
VR_INITIALIZED == trueand HMD has been put on, prepares game for VR and setVR_ACTIVE = true. -
If HMD has been taken off while on server not supporting vanilla, the VR_ACTIVE stays true
-
If in
VR_WORLD_ONLYplay mode, activates only in world
-
-
Focus
- When
VR_ACTIVE == trueand VR session is focused, set `VR_FOCUSED = true'
- When
-
When VR has thrown an error
-
If the player is in-world, leaves it
-
VR session is destroyed, set
VR_INITIALIZED = false -
VR Play Mode changes to
VR_DISABLED -
Shows VR error screen
-
You should avoid any modifications of Visor Lifecycle to not risk the instability and issues with other addons
Make sure your addon check whether VR is currently active/focused to run your logic if you are doing something outside of extendable Visor elements scope.
It is especially important when you use mixin to modify minecraft for VR or your mod initially is created for vanilla minecraft and you want to add support for VR.
For extendable Visor elements, you won't need that mostly. Unless you want to have your logic active when VR_FOCUSED true