Line 27:
Line 27:
{{regsimple | GX_XF_VIEWPORT_X0 | addr=0x101A | bits=32 | access = R/W}}
{{regsimple | GX_XF_VIEWPORT_X0 | addr=0x101A | bits=32 | access = R/W}}
−
* 0x101A: This register defines the X0 coordinate of the viewport.
+
* This register defines the X0 coordinate of the viewport.
{{regsimple | GX_XF_VIEWPORT_Y0 | addr=0x101B | bits=32 | access = R/W}}
{{regsimple | GX_XF_VIEWPORT_Y0 | addr=0x101B | bits=32 | access = R/W}}
−
* 0x101B: This register defines the Y0 coordinate of the viewport.
+
* This register defines the Y0 coordinate of the viewport.
{{regsimple | GX_XF_VIEWPORT_Z | addr=0x101C | bits=32 | access = R/W}}
{{regsimple | GX_XF_VIEWPORT_Z | addr=0x101C | bits=32 | access = R/W}}
−
* 0x101C: This register defines the depth (far plane - near plane) of the viewport.
+
* This register defines the depth (far plane - near plane) of the viewport.
{{regsimple | GX_XF_VIEWPORT_X1 | addr=0x101D | bits=32 | access = R/W}}
{{regsimple | GX_XF_VIEWPORT_X1 | addr=0x101D | bits=32 | access = R/W}}
−
* 0x101D: This register defines the X1 coordinate of the viewport.
+
* This register defines the X1 coordinate of the viewport.
{{regsimple | GX_XF_VIEWPORT_Y1 | addr=0x101E | bits=32 | access = R/W}}
{{regsimple | GX_XF_VIEWPORT_Y1 | addr=0x101E | bits=32 | access = R/W}}
−
* 0x101E: This register defines the Y1 coordinate of the viewport.
+
* This register defines the Y1 coordinate of the viewport.
{{regsimple | GX_XF_VIEWPORT_FP | addr=0x101F | bits=32 | access = R/W}}
{{regsimple | GX_XF_VIEWPORT_FP | addr=0x101F | bits=32 | access = R/W}}
−
* 0x101F: This register defines the far plane of the viewport.
+
* This register defines the far plane of the viewport.
Line 63:
Line 63:
All the other viewport registers are 32-bit floating-point values.
All the other viewport registers are 32-bit floating-point values.
+
+
===XF projection registers===
+
+
These registers define the projection matrix.
+
Actually, there are 7 registers, so they don't really define a matrix, but rather parts of it.
+
+
+
{{regsimple | GX_XF_PROJ_0 | addr=0x1020 | bits=32 | access = R/W}}
+
{{regsimple | GX_XF_PROJ_1 | addr=0x1021 | bits=32 | access = R/W}}
+
{{regsimple | GX_XF_PROJ_2 | addr=0x1022 | bits=32 | access = R/W}}
+
{{regsimple | GX_XF_PROJ_3 | addr=0x1023 | bits=32 | access = R/W}}
+
{{regsimple | GX_XF_PROJ_4 | addr=0x1024 | bits=32 | access = R/W}}
+
{{regsimple | GX_XF_PROJ_5 | addr=0x1025 | bits=32 | access = R/W}}
+
* These registers define 6 projection values.
+
+
+
{{regsimple | GX_XF_PROJ_MODE | addr=0x1026 | bits=32 | access = R/W}}
+
* This register defines how the projection values will be translated.
+
+
+
Depending on GX_XF_PROJ_MODE, you must assign different parts of your 4x4 projection matrix to the projection values:
+
* GX_XF_PROJ_MODE = 0 (perspective):
+
** GX_XF_PROJ_0 = matrix[0][0]
+
** GX_XF_PROJ_1 = matrix[0][2]
+
** GX_XF_PROJ_2 = matrix[1][1]
+
** GX_XF_PROJ_3 = matrix[1][2]
+
** GX_XF_PROJ_4 = matrix[2][2]
+
** GX_XF_PROJ_5 = matrix[2][3]
+
* GX_XF_PROJ_MODE = 1 (orthographic):
+
** GX_XF_PROJ_0 = matrix[0][0]
+
** GX_XF_PROJ_1 = matrix[0][3]
+
** GX_XF_PROJ_2 = matrix[1][1]
+
** GX_XF_PROJ_3 = matrix[1][3]
+
** GX_XF_PROJ_4 = matrix[2][2]
+
** GX_XF_PROJ_5 = matrix[2][3]
+
''Note: these assignments are taken from the libogc function GX_LoadProjectionMtx().''