if(mtop > 0) mtop--;
}
-static const int32_t id[] = {
+static int32_t id[] = {
0x10000, 0, 0, 0,
0, 0x10000, 0, 0,
0, 0, 0x10000, 0,
void xgl_load_identity(void)
{
- xgl_load_matrix(id);
+ memcpy(mat[mtop], id, sizeof mat[0]);
}
void xgl_load_matrix(const int32_t *m)
memcpy(mat[mtop], m, sizeof mat[0]);
}
+void xgl_get_matrix(int32_t *m)
+{
+ memcpy(m, mat[mtop], sizeof mat[0]);
+}
+
#define M(i,j) (((i) << 2) + (j))
#define XMUL(a, b) (((a) >> 8) * ((b) >> 8))
void xgl_mult_matrix(const int32_t *m2)
}
}
+void xgl_transform(const struct xvertex *vin, int *x, int *y)
+{
+ struct xvertex v;
+ xform(&v, vin, mat[mtop]);
+
+ v.x = (v.x << 1) / (v.z >> 8); /* assume aspect: ~2 */
+ v.y = (v.y << 2) / (v.z >> 8); /* the shift is * PROJ_D */
+ /* projection result is 24.8 */
+ /* viewport */
+ *x = ((((v.x + 0x100) >> 1) * vp[2]) >> 8) + vp[0];
+ *y = ((((0x100 - v.y) >> 1) * vp[3]) >> 8) + vp[1];
+}
+
static void draw_ptlines(int prim, const struct xvertex *varr, int vcount)
{
int i;