2022-08-27 17:33:37 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-08-31 11:41:34 +02:00
|
|
|
#include <cstddef>
|
|
|
|
|
|
2023-03-29 12:03:03 +02:00
|
|
|
struct AxisInput;
|
|
|
|
|
struct TouchInput;
|
|
|
|
|
struct KeyInput;
|
2022-08-27 17:33:37 +02:00
|
|
|
|
2022-09-12 23:01:44 +02:00
|
|
|
enum VRCompatFlag {
|
2022-09-08 18:25:10 +02:00
|
|
|
//compatibility tweaks
|
|
|
|
|
VR_COMPAT_SKYPLANE,
|
|
|
|
|
|
|
|
|
|
//render state
|
2022-09-24 16:32:55 +02:00
|
|
|
VR_COMPAT_FBO_CLEAR,
|
2022-09-08 18:25:10 +02:00
|
|
|
|
|
|
|
|
//uniforms
|
|
|
|
|
VR_COMPAT_FOG_COLOR,
|
|
|
|
|
|
|
|
|
|
//end
|
|
|
|
|
VR_COMPAT_MAX
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-17 12:19:17 +01:00
|
|
|
enum VRAppMode {
|
2022-11-17 19:13:04 +01:00
|
|
|
VR_CONTROLLER_MAPPING_MODE,
|
2022-11-17 15:25:35 +01:00
|
|
|
VR_DIALOG_MODE,
|
2022-11-17 12:19:17 +01:00
|
|
|
VR_GAME_MODE,
|
|
|
|
|
VR_MENU_MODE,
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-27 17:33:37 +02:00
|
|
|
// VR app flow integration
|
2022-11-06 14:36:51 +01:00
|
|
|
bool IsVREnabled();
|
2022-11-06 09:44:06 +01:00
|
|
|
void InitVROnAndroid(void* vm, void* activity, const char* system, int version, const char* name);
|
2022-09-14 19:53:55 +02:00
|
|
|
void EnterVR(bool firstStart, void* vulkanContext);
|
2022-08-27 17:33:37 +02:00
|
|
|
void GetVRResolutionPerEye(int* width, int* height);
|
2023-08-31 11:41:34 +02:00
|
|
|
void SetVRCallbacks(void(*axis)(const AxisInput *axis, size_t count), bool(*key)(const KeyInput &key), void(*touch)(const TouchInput &touch));
|
2022-11-17 12:19:17 +01:00
|
|
|
|
|
|
|
|
// VR input integration
|
|
|
|
|
void SetVRAppMode(VRAppMode mode);
|
2022-12-10 21:31:39 +01:00
|
|
|
void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale);
|
2022-11-17 10:22:01 +01:00
|
|
|
bool UpdateVRAxis(const AxisInput &axis);
|
|
|
|
|
bool UpdateVRKeys(const KeyInput &key);
|
2022-08-27 17:33:37 +02:00
|
|
|
|
2022-09-07 15:52:50 +02:00
|
|
|
// VR games compatibility
|
2022-09-24 16:32:55 +02:00
|
|
|
void PreprocessStepVR(void* step);
|
2022-09-12 23:01:44 +02:00
|
|
|
void SetVRCompat(VRCompatFlag flag, long value);
|
2022-09-07 15:52:50 +02:00
|
|
|
|
2022-08-27 17:33:37 +02:00
|
|
|
// VR rendering integration
|
2022-10-12 16:21:54 +02:00
|
|
|
void* BindVRFramebuffer();
|
2022-09-15 00:03:41 +02:00
|
|
|
bool StartVRRender();
|
|
|
|
|
void FinishVRRender();
|
2022-09-04 12:36:52 +02:00
|
|
|
void PreVRFrameRender(int fboIndex);
|
|
|
|
|
void PostVRFrameRender();
|
|
|
|
|
int GetVRFBOIndex();
|
2022-10-17 19:07:27 +02:00
|
|
|
int GetVRPassesCount();
|
2022-08-28 14:49:27 +02:00
|
|
|
bool IsMultiviewSupported();
|
2023-06-17 16:33:21 +02:00
|
|
|
bool IsPassthroughSupported();
|
2022-11-22 21:49:52 +01:00
|
|
|
bool IsFlatVRGame();
|
2022-08-27 17:33:37 +02:00
|
|
|
bool IsFlatVRScene();
|
2022-11-22 21:49:52 +01:00
|
|
|
bool IsGameVRScene();
|
2022-08-27 17:33:37 +02:00
|
|
|
bool Is2DVRObject(float* projMatrix, bool ortho);
|
2023-07-02 20:29:59 +02:00
|
|
|
void UpdateVRParams(float* projMatrix);
|
2022-08-27 17:33:37 +02:00
|
|
|
void UpdateVRProjection(float* projMatrix, float* leftEye, float* rightEye);
|
2022-09-12 18:46:04 +02:00
|
|
|
void UpdateVRView(float* leftEye, float* rightEye);
|
2023-06-27 18:54:38 +02:00
|
|
|
void UpdateVRViewMatrices();
|