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;
{
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;
{
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;
/* 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)
if(!vnum) continue;
for(i=0; i<vnum; i++) {
- if(v[i].w != 0.0f) {
- v[i].x /= v[i].w;
- v[i].y /= v[i].w;
- if(st.opt & (1 << GAW_DEPTH_TEST)) {
- v[i].z /= v[i].w;
- }
+ 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;
}
}
void gaw_begin(int prim)
{
st.imm_prim = prim;
- st.imm_pcount = prim;
+ st.imm_pcount = prim_vcount[st.imm_prim];
st.imm_numv = 0;
}
void gaw_vertex3f(float x, float y, float z)
{
gaw_vertex4f(x, y, z, 1);
+}
void gaw_vertex4f(float x, float y, float z, float w)
{