2929#include <ogc/gx.h>
3030#include <ogc/video.h>
3131
32- typedef struct tagcamera {
33- guVector pos ;
34- guVector up ;
35- guVector view ;
36- } camera ;
37-
38- static camera cam = {
39- { 0.0F , 0.0F , 0.0F },
40- { 0.0F , -0.5F , 0.0F },
41- { 0.0F , 0.0F , 0.5F }
42- };
43-
4432static const f32 tex_pos [] __attribute__((aligned (32 ))) = {
4533 0.0 ,
4634 0.0 ,
@@ -52,30 +40,28 @@ static const f32 tex_pos[] __attribute__((aligned(32))) = {
5240 1.0 ,
5341};
5442
55- void OGC_set_viewport (int x , int y , int w , int h , float h_aspect , float v_aspect )
43+ void OGC_set_viewport (int x , int y , int w , int h )
5644{
57- Mtx m , mv , view ;
5845 Mtx44 proj ;
5946
6047 GX_SetViewport (x , y , w , h , 0 , 1 );
6148 GX_SetScissor (x , y , w , h );
6249
63- memset (& view , 0 , sizeof (Mtx ));
64- guLookAt (view , & cam .pos , & cam .up , & cam .view );
65- guMtxIdentity (m );
66- guMtxTransApply (m , m , 0.5 + (- w / 2.0 ), 0.5 + (- h / 2.0 ), 1000 );
67- guMtxConcat (view , m , mv );
68- GX_LoadPosMtxImm (mv , GX_PNMTX0 );
69-
7050 // matrix, t, b, l, r, n, f
71- guOrtho (proj , v_aspect , - v_aspect , - h_aspect , h_aspect , 100 , 1000 );
51+ guOrtho (proj , 0 , h , 0 , w , 0 , 1 );
7252 GX_LoadProjectionMtx (proj , GX_ORTHOGRAPHIC );
7353}
7454
75- void OGC_draw_init (int w , int h , int h_aspect , int v_aspect )
55+ void OGC_draw_init (int w , int h )
7656{
57+ Mtx mv ;
58+
7759 SDL_LogDebug (SDL_LOG_CATEGORY_VIDEO , "OGC_draw_init called with %d, %d" , w , h );
7860
61+ guMtxIdentity (mv );
62+ guMtxTransApply (mv , mv , 0.5 , 0.5 , 0 );
63+ GX_LoadPosMtxImm (mv , GX_PNMTX0 );
64+
7965 GX_ClearVtxDesc ();
8066 GX_SetVtxDesc (GX_VA_POS , GX_DIRECT );
8167 GX_SetVtxDesc (GX_VA_TEX0 , GX_INDEX8 );
@@ -94,7 +80,7 @@ void OGC_draw_init(int w, int h, int h_aspect, int v_aspect)
9480 GX_SetTevOp (GX_TEVSTAGE0 , GX_REPLACE );
9581 GX_SetTevOrder (GX_TEVSTAGE0 , GX_TEXCOORD0 , GX_TEXMAP0 , GX_COLOR0A0 );
9682
97- OGC_set_viewport (0 , 0 , w , h , h_aspect , v_aspect );
83+ OGC_set_viewport (0 , 0 , w , h );
9884
9985 GX_InvVtxCache (); // update vertex cache
10086}
0 commit comments