mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
ref: gl: implement rotation for 2D
This commit is contained in:
@@ -365,11 +365,8 @@ static void GAME_EXPORT R_SetupSky( int *skyboxTextures )
|
||||
static qboolean R_SetDisplayTransform( ref_screen_rotation_t rotate, int offset_x, int offset_y, float scale_x, float scale_y )
|
||||
{
|
||||
qboolean ret = true;
|
||||
if( rotate > 0 )
|
||||
{
|
||||
gEngfuncs.Con_Printf("rotation transform not supported\n");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
tr.rotation = rotate;
|
||||
|
||||
if( offset_x || offset_y )
|
||||
{
|
||||
|
||||
@@ -215,10 +215,27 @@ void R_Set2DMode( qboolean enable )
|
||||
return;
|
||||
|
||||
// set 2D virtual screen size
|
||||
pglViewport( 0, 0, gpGlobals->width, gpGlobals->height );
|
||||
switch( tr.rotation )
|
||||
{
|
||||
case REF_ROTATE_CW:
|
||||
pglViewport( 0, 0, gpGlobals->height, gpGlobals->width );
|
||||
Matrix4x4_CreateOrtho( projection_matrix, 0, gpGlobals->height, gpGlobals->width, 0, -99999, 99999 );
|
||||
Matrix4x4_ConcatRotate( projection_matrix, 90, 0, 0, 1 );
|
||||
Matrix4x4_ConcatTranslate( projection_matrix, 0, -gpGlobals->height, 0 );
|
||||
break;
|
||||
case REF_ROTATE_CCW:
|
||||
pglViewport( 0, 0, gpGlobals->height, gpGlobals->width );
|
||||
Matrix4x4_CreateOrtho( projection_matrix, 0, gpGlobals->height, gpGlobals->width, 0, -99999, 99999 );
|
||||
Matrix4x4_ConcatRotate( projection_matrix, -90, 0, 0, 1 );
|
||||
Matrix4x4_ConcatTranslate( projection_matrix, -gpGlobals->width, 0, 0 );
|
||||
break;
|
||||
default:
|
||||
pglViewport( 0, 0, gpGlobals->width, gpGlobals->height );
|
||||
Matrix4x4_CreateOrtho( projection_matrix, 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 );
|
||||
break;
|
||||
}
|
||||
|
||||
pglMatrixMode( GL_PROJECTION );
|
||||
Matrix4x4_CreateOrtho( projection_matrix, 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 );
|
||||
GL_LoadMatrix( projection_matrix );
|
||||
|
||||
pglMatrixMode( GL_MODELVIEW );
|
||||
|
||||
@@ -263,6 +263,8 @@ typedef struct
|
||||
uint *screengammatable;
|
||||
|
||||
uint max_entities;
|
||||
|
||||
ref_screen_rotation_t rotation;
|
||||
} gl_globals_t;
|
||||
|
||||
typedef struct
|
||||
|
||||
Reference in New Issue
Block a user