mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-31 00:09:19 +01:00
Add viewport support
This commit is contained in:
parent
2209b71789
commit
0b45529e24
@ -732,22 +732,29 @@ SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd, SDL_bool s
|
|||||||
a = cmd->data.draw.a;
|
a = cmd->data.draw.a;
|
||||||
|
|
||||||
if (data->drawstate.viewport_dirty) {
|
if (data->drawstate.viewport_dirty) {
|
||||||
// TODO: this isn't right
|
|
||||||
/*
|
|
||||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||||
|
|
||||||
float x_scale = (int)(viewport->w) >> 1;
|
|
||||||
float x_off = viewport->x + x_scale;
|
|
||||||
float y_scale = -((int)(viewport->h) >> 1);
|
|
||||||
float y_off = -1.0 * (viewport->y + y_scale);
|
|
||||||
|
|
||||||
sceGxmSetViewport(data->gxm_context, x_off, x_scale, y_off, y_scale, 0.f, 1.f);
|
float sw = viewport->w / 2.;
|
||||||
|
float sh = viewport->h / 2.;
|
||||||
|
|
||||||
|
float x_scale = sw;
|
||||||
|
float x_off = viewport->x + sw;
|
||||||
|
float y_scale = -(sh);
|
||||||
|
float y_off = viewport->y + sh;
|
||||||
|
|
||||||
|
sceGxmSetViewport(data->gxm_context, x_off, x_scale, y_off, y_scale, -0.5f, 0.5f);
|
||||||
|
|
||||||
if (viewport->w && viewport->h) {
|
if (viewport->w && viewport->h) {
|
||||||
init_orthographic_matrix(data->ortho_matrix, viewport->x, viewport->x + viewport->w, viewport->y + viewport->h, viewport->y, 0.0f, 1.0f);
|
init_orthographic_matrix(data->ortho_matrix,
|
||||||
|
(float) 0,
|
||||||
|
(float) viewport->w,
|
||||||
|
(float) viewport->h,
|
||||||
|
(float) 0,
|
||||||
|
0.0f, 1.0f);
|
||||||
matrix_updated = SDL_TRUE;
|
matrix_updated = SDL_TRUE;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
data->drawstate.viewport_dirty = SDL_FALSE;
|
data->drawstate.viewport_dirty = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user