2022-09-18 15:37:21 +00:00
|
|
|
#if !defined(vrcommon_h)
|
|
|
|
#define vrcommon_h
|
|
|
|
|
|
|
|
#include <VrApi_Input.h>
|
|
|
|
|
|
|
|
#include <android/log.h>
|
|
|
|
|
2022-09-19 21:46:47 +00:00
|
|
|
#include "../qcommon/q_shared.h"
|
|
|
|
#include "../qcommon/qcommon.h"
|
|
|
|
|
2022-09-18 15:37:21 +00:00
|
|
|
#include "VrClientInfo.h"
|
|
|
|
|
|
|
|
#define LOG_TAG "JKVR"
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
#define DEBUG 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define ALOGE(...) __android_log_print( ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__ )
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
#define ALOGV(...) __android_log_print( ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__ )
|
|
|
|
#else
|
|
|
|
#define ALOGV(...)
|
|
|
|
#endif
|
|
|
|
|
2022-09-29 19:18:23 +00:00
|
|
|
|
|
|
|
typedef enum control_scheme {
|
|
|
|
RIGHT_HANDED_DEFAULT = 0,
|
|
|
|
LEFT_HANDED_DEFAULT = 10,
|
|
|
|
WEAPON_ALIGN = 99
|
|
|
|
} control_scheme_t;
|
|
|
|
|
2022-09-29 22:38:22 +00:00
|
|
|
extern bool openjk_initialised;
|
2022-09-20 22:15:52 +00:00
|
|
|
extern long long global_time;
|
|
|
|
extern ovrTracking2 tracking;
|
|
|
|
extern int ducked;
|
|
|
|
extern vr_client_info_t vr;
|
2022-09-18 15:37:21 +00:00
|
|
|
|
|
|
|
#define DUCK_NOTDUCKED 0
|
|
|
|
#define DUCK_BUTTON 1
|
|
|
|
#define DUCK_CROUCHED 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float radians(float deg);
|
|
|
|
float degrees(float rad);
|
2022-09-19 21:46:47 +00:00
|
|
|
bool isMultiplayer();
|
2022-09-18 15:37:21 +00:00
|
|
|
double GetTimeInMilliSeconds();
|
|
|
|
float length(float x, float y);
|
|
|
|
float nonLinearFilter(float in);
|
2022-09-19 21:46:47 +00:00
|
|
|
bool between(float min, float val, float max);
|
2022-09-18 15:37:21 +00:00
|
|
|
void rotateAboutOrigin(float v1, float v2, float rotation, vec2_t out);
|
|
|
|
void QuatToYawPitchRoll(ovrQuatf q, vec3_t rotation, vec3_t out);
|
|
|
|
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
|
2022-09-19 21:46:47 +00:00
|
|
|
void interactWithTouchScreen(bool reset, ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemote *oldState);
|
2022-09-18 15:37:21 +00:00
|
|
|
int GetRefresh();
|
|
|
|
|
|
|
|
//Called from engine code
|
2022-09-19 21:46:47 +00:00
|
|
|
bool JKVR_useScreenLayer();
|
2022-09-18 15:37:21 +00:00
|
|
|
void JKVR_GetScreenRes(int *width, int *height);
|
|
|
|
void JKVR_Vibrate(int duration, int channel, float intensity );
|
|
|
|
void JKVR_Haptic(int duration, int channel, float intensity, char *description, float yaw, float height);
|
|
|
|
void JKVR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight );
|
|
|
|
void JKVR_HapticUpdateEvent(const char* event, int intensity, float angle );
|
|
|
|
void JKVR_HapticEndFrame();
|
|
|
|
void JKVR_HapticStopEvent(const char* event);
|
|
|
|
void JKVR_HapticEnable();
|
|
|
|
void JKVR_HapticDisable();
|
2022-09-22 22:23:00 +00:00
|
|
|
void JKVR_processMessageQueue();
|
2022-09-18 15:37:21 +00:00
|
|
|
void JKVR_FrameSetup();
|
2022-09-19 21:46:47 +00:00
|
|
|
void JKVR_setUseScreenLayer(bool use);
|
2022-09-18 15:37:21 +00:00
|
|
|
void JKVR_processHaptics();
|
|
|
|
void JKVR_getHMDOrientation();
|
|
|
|
void JKVR_getTrackedRemotesOrientation();
|
|
|
|
void JKVR_incrementFrameIndex();
|
|
|
|
|
2022-09-27 22:19:12 +00:00
|
|
|
bool JKVR_useScreenLayer();
|
2022-09-18 15:37:21 +00:00
|
|
|
void JKVR_prepareEyeBuffer(int eye );
|
|
|
|
void JKVR_finishEyeBuffer(int eye );
|
|
|
|
void JKVR_submitFrame();
|
|
|
|
|
|
|
|
void GPUDropSync();
|
|
|
|
void GPUWaitSync();
|
|
|
|
|
|
|
|
#endif //vrcommon_h
|