git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3891 fc73d0e0-1445-4013-8a0c-d673dee63da5

This commit is contained in:
Spoike 2011-07-31 11:18:49 +00:00
parent 729d6181c2
commit 604576ae18
5 changed files with 31 additions and 12 deletions

View File

@ -887,3 +887,13 @@ void Sys_Sleep (double seconds)
nanosleep(&ts, NULL);
}
qboolean Sys_RandomBytes(qbyte *string, int len)
{
qboolean res;
int fd = open("/dev/urandom", 0);
res = (read(fd, string, len) == len);
close(fd);
return res;
}

View File

@ -166,6 +166,7 @@ float *Matrix4x4_CM_NewTranslation(float x, float y, float z);
//projection matricies of different types... gesh
void Matrix4x4_CM_Orthographic (float *proj, float xmin, float xmax, float ymax, float ymin, float znear, float zfar);
void Matrix4x4_CM_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, float ymin, float znear, float zfar);
void Matrix4x4_CM_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard);
void Matrix4x4_CM_Projection2 (float *proj, float fovx, float fovy, float neard);
void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float neard);

View File

@ -1983,10 +1983,10 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
/*FIXME: no bob*/
float iv[16];
Matrix4_Invert(r_refdef.m_view, iv);
Matrix4_NewRotation(90, 1, 0, 0);
Matrix4x4_CM_NewRotation(90, 1, 0, 0);
Matrix4_Multiply(iv, m, mv);
Matrix4_Multiply(mv, Matrix4_NewRotation(-90, 1, 0, 0), iv);
Matrix4_Multiply(iv, Matrix4_NewRotation(90, 0, 0, 1), mv);
Matrix4_Multiply(mv, Matrix4x4_CM_NewRotation(-90, 1, 0, 0), iv);
Matrix4_Multiply(iv, Matrix4x4_CM_NewRotation(90, 0, 0, 1), mv);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)mv);
}
@ -2285,7 +2285,7 @@ static void R_DrawPortal(batch_t *batch, batch_t **blist)
TransformDir(vright, paxis, vaxis, vright);
TransformDir(vup, paxis, vaxis, vup);
}
Matrix4_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
VectorAngles(vpn, vup, r_refdef.viewangles);
VectorCopy(r_refdef.vieworg, r_origin);

View File

@ -850,8 +850,6 @@ static void (D3D9_VID_SetWindowCaption) (char *msg)
SetWindowText(mainwindow, msg);
}
void Matrix4_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, float ymin,
float znear, float zfar);
void d3dx_ortho(float *m);
void D3D9_Set2D (void)
@ -860,13 +858,13 @@ void D3D9_Set2D (void)
D3DVIEWPORT9 vport;
// IDirect3DDevice9_EndScene(pD3DDev9);
Matrix4_OrthographicD3D(m, 0 + (0.5*vid.width/vid.pixelwidth), vid.width + (0.5*vid.width/vid.pixelwidth), 0 + (0.5*vid.height/vid.pixelheight), vid.height + (0.5*vid.height/vid.pixelheight), 0, 100);
Matrix4x4_CM_OrthographicD3D(m, 0 + (0.5*vid.width/vid.pixelwidth), vid.width + (0.5*vid.width/vid.pixelwidth), 0 + (0.5*vid.height/vid.pixelheight), vid.height + (0.5*vid.height/vid.pixelheight), 0, 100);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)m);
Matrix4_Identity(m);
Matrix4x4_Identity(m);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_WORLD, (D3DMATRIX*)m);
Matrix4_Identity(m);
Matrix4x4_Identity(m);
IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_VIEW, (D3DMATRIX*)m);
vport.X = 0;
@ -1165,14 +1163,14 @@ static void D3D9_SetupViewPort(void)
screenaspect = (float)r_refdef.vrect.width/r_refdef.vrect.height;
/*view matrix*/
Matrix4_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
d3d9error(IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_VIEW, (D3DMATRIX*)r_refdef.m_view));
/*d3d projection matricies scale depth to 0 to 1*/
Matrix4_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value/2);
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value/2);
d3d9error(IDirect3DDevice9_SetTransform(pD3DDev9, D3DTS_PROJECTION, (D3DMATRIX*)r_refdef.m_projection));
/*ogl projection matricies scale depth to -1 to 1, and I would rather my code used consistant culling*/
Matrix4_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value);
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value);
}
static void (D3D9_R_RenderView) (void)

View File

@ -1062,3 +1062,13 @@ void Sys_Sleep (double seconds)
nanosleep(&ts, NULL);
}
qboolean Sys_RandomBytes(qbyte *string, int len)
{
qboolean res;
int fd = open("/dev/urandom", 0);
res = (read(fd, string, len) == len);
close(fd);
return res;
}