Skip to content

Instantly share code, notes, and snippets.

@hakanai
Created October 11, 2019 05:09
Show Gist options
  • Save hakanai/d71dd998f780ce840c35035ce7654a9f to your computer and use it in GitHub Desktop.
Save hakanai/d71dd998f780ce840c35035ce7654a9f to your computer and use it in GitHub Desktop.
Stashing this for safekeeping
bool isVR() {
// USING_STEREO_MATRICES
#if UNITY_SINGLE_PASS_STEREO
return true;
#else
return false;
#endif
}
bool isVRHandCamera() {
return !isVR() && abs(UNITY_MATRIX_V[0].y) > 0.0000005;
}
bool isDesktop() {
return !isVRHandCamera();
}
bool isVRHandCameraPreview() {
return isVRHandCamera() && _ScreenParams.y == 720;
}
bool isVRHandCameraPicture() {
return isVRHandCamera() && _ScreenParams.y == 1080;
}
bool isPanorama() {
// Crude method
// FOV=90=camproj=[1][1]
return unity_CameraProjection[1][1] == 1 && _ScreenParams.x == 1075 && _ScreenParams.y == 1025;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment