Made Matrix4_UnProject a bit more intuitive/reliable.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3713 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
ebac5d8046
commit
253ef7b817
2 changed files with 10 additions and 10 deletions
|
@ -756,17 +756,13 @@ void CL_UpdatePrydonCursor(usercmd_t *from, float cursor_screen[2], vec3_t curso
|
||||||
|
|
||||||
VectorCopy(r_origin, cursor_start);
|
VectorCopy(r_origin, cursor_start);
|
||||||
Matrix4_UnProject(temp, cursor_end, cl.viewangles[0], cursor_start, r_refdef.fov_x, r_refdef.fov_y);
|
Matrix4_UnProject(temp, cursor_end, cl.viewangles[0], cursor_start, r_refdef.fov_x, r_refdef.fov_y);
|
||||||
VectorScale(cursor_end, 100000, cursor_end);
|
|
||||||
|
|
||||||
CL_SetSolidEntities();
|
CL_SetSolidEntities();
|
||||||
//don't bother with players, they don't exist in NQ...
|
//don't bother with players, they don't exist in NQ...
|
||||||
|
|
||||||
TraceLineN(cursor_start, cursor_end, cursor_impact, cursor_impact_normal);
|
TraceLineN(cursor_start, cursor_end, cursor_impact, cursor_impact_normal);
|
||||||
// CL_SelectTraceLine(cursor_start, cursor_end, cursor_impact, entnum);
|
|
||||||
// makes sparks where cursor is
|
// P_RunParticleEffect(cursor_impact, vec3_origin, 15, 16);
|
||||||
//CL_SparkShower(cl.cmd.cursor_impact, cl.cmd.cursor_normal, 5, 0);
|
|
||||||
// P_RunParticleEffectType(cursor_impact, vec3_origin, 1, pt_gunshot);
|
|
||||||
//P_ParticleTrail(cursor_start, cursor_impact, 0, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NQPROT
|
#ifdef NQPROT
|
||||||
|
|
|
@ -1583,14 +1583,18 @@ void Matrix4_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, con
|
||||||
float v[4], tempv[4];
|
float v[4], tempv[4];
|
||||||
v[0] = in[0]*2-1;
|
v[0] = in[0]*2-1;
|
||||||
v[1] = in[1]*2-1;
|
v[1] = in[1]*2-1;
|
||||||
v[2] = in[2]*2-1;
|
v[2] = in[2];
|
||||||
v[3] = 1;
|
v[3] = 1;
|
||||||
|
|
||||||
|
//don't use 1, because the far clip plane really is an infinite distance away
|
||||||
|
if (v[2] >= 1)
|
||||||
|
v[2] = 0.999999;
|
||||||
|
|
||||||
Matrix4_Transform4(proj, v, tempv);
|
Matrix4_Transform4(proj, v, tempv);
|
||||||
|
|
||||||
out[0] = tempv[0];
|
out[0] = tempv[0]/tempv[3];
|
||||||
out[1] = tempv[1];
|
out[1] = tempv[1]/tempv[3];
|
||||||
out[2] = tempv[2];
|
out[2] = tempv[2]/tempv[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue