X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgaw%2Fgawswtnl.c;h=c307f8a53415e819168e2b6d810e08a34087e8f0;hb=3bf187fe037df34459f04bf4e625f38afb80fcf8;hp=5e556217d93e4438abf0ae37693acd1b6f20e801;hpb=5f50ec3c542ea29211591d4865bdaf1368f8c649;p=retroray diff --git a/src/gaw/gawswtnl.c b/src/gaw/gawswtnl.c index 5e55621..c307f8a 100644 --- a/src/gaw/gawswtnl.c +++ b/src/gaw/gawswtnl.c @@ -100,6 +100,11 @@ void gaw_viewport(int x, int y, int w, int h) st.vport[3] = h; } +void gaw_get_viewport(int *vp) +{ + memcpy(vp, st.vport, sizeof st.vport); +} + void gaw_matrix_mode(int mode) { st.mmode = mode; @@ -182,7 +187,7 @@ void gaw_rotate(float deg, float x, float y, float z) { static float m[16]; - float angle = M_PI * deg / 180.0f; + float angle = CGM_PI * deg / 180.0f; float sina = sin(angle); float cosa = cos(angle); float one_minus_cosa = 1.0f - cosa; @@ -261,7 +266,7 @@ void gaw_perspective(float vfov_deg, float aspect, float znear, float zfar) { static float m[16]; - float vfov = M_PI * vfov_deg / 180.0f; + float vfov = CGM_PI * vfov_deg / 180.0f; float s = 1.0f / tan(vfov * 0.5f); float range = znear - zfar; @@ -316,6 +321,11 @@ void gaw_alpha_func(int func, float ref) /* TODO */ } +void gaw_zoffset(float offs) +{ + st.zoffs = offs * 0.1; +} + #define CLAMP(x, a, b) ((x) < (a) ? (a) : ((x) > (b) ? (b) : (x))) void gaw_clear_color(float r, float g, float b, float a) @@ -535,6 +545,9 @@ void gaw_draw_indexed(int prim, const unsigned int *idxarr, int nidx) float oow = 1.0f / v[i].w; v[i].x *= oow; v[i].y *= oow; + if(st.opt & (1 << GAW_POLYGON_OFFSET)) { + v[i].z += st.zoffs; + } if(st.opt & (1 << GAW_DEPTH_TEST)) { v[i].z *= oow; }