mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
OpenXR - Cursor aspect ratio
This commit is contained in:
parent
c7bcfe9fe9
commit
c9d1da28fc
@ -411,14 +411,14 @@ void ovrRenderer_Destroy(ovrRenderer* renderer) {
|
||||
}
|
||||
}
|
||||
|
||||
void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int size) {
|
||||
void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int sx, int sy) {
|
||||
if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) {
|
||||
//TODO:implement
|
||||
} else {
|
||||
#if XR_USE_GRAPHICS_API_OPENGL_ES || XR_USE_GRAPHICS_API_OPENGL
|
||||
GL(glEnable(GL_SCISSOR_TEST));
|
||||
GL(glScissor(x, y, size, size));
|
||||
GL(glViewport(x, y, size, size));
|
||||
GL(glScissor(x, y, sx, sy));
|
||||
GL(glViewport(x, y, sx, sy));
|
||||
GL(glClearColor(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
GL(glClear(GL_COLOR_BUFFER_BIT));
|
||||
GL(glDisable(GL_SCISSOR_TEST));
|
||||
|
@ -12,4 +12,4 @@ void* ovrFramebuffer_SetCurrent(ovrFramebuffer* frameBuffer);
|
||||
|
||||
void ovrRenderer_Create(XrSession session, ovrRenderer* renderer, int width, int height, bool multiview, void* vulkanContext);
|
||||
void ovrRenderer_Destroy(ovrRenderer* renderer);
|
||||
void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int size);
|
||||
void ovrRenderer_MouseCursor(ovrRenderer* renderer, int x, int y, int sx, int sy);
|
||||
|
@ -311,13 +311,14 @@ void VR_EndFrame( engine_t* engine ) {
|
||||
VR_BindFramebuffer(engine);
|
||||
|
||||
// Show mouse cursor
|
||||
int size = vrConfig[VR_CONFIG_MOUSE_SIZE];
|
||||
int vrMode = vrConfig[VR_CONFIG_MODE];
|
||||
bool screenMode = (vrMode == VR_MODE_MONO_SCREEN) || (vrMode == VR_MODE_STEREO_SCREEN);
|
||||
if (screenMode && (size > 0)) {
|
||||
if (screenMode && (vrConfig[VR_CONFIG_MOUSE_SIZE] > 0)) {
|
||||
int x = vrConfig[VR_CONFIG_MOUSE_X];
|
||||
int y = vrConfig[VR_CONFIG_MOUSE_Y];
|
||||
ovrRenderer_MouseCursor(&engine->appState.Renderer, x, y, size);
|
||||
int sx = vrConfig[VR_CONFIG_MOUSE_SIZE];
|
||||
int sy = sx * VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT);
|
||||
ovrRenderer_MouseCursor(&engine->appState.Renderer, x, y, sx, sy);
|
||||
}
|
||||
|
||||
ovrFramebuffer_Release(&engine->appState.Renderer.FrameBuffer[fboIndex]);
|
||||
|
Loading…
Reference in New Issue
Block a user