Code: Select all
d = DotProduct (r_refdef.vieworg, mirror_plane->normal) - mirror_plane->dist;
VectorMA (r_refdef.vieworg, -2*d, mirror_plane->normal, r_refdef.vieworg);
d = DotProduct (vpn, mirror_plane->normal);
VectorMA (vpn, -2*d, mirror_plane->normal, vpn);
r_refdef.viewangles[0] = -asin (vpn[2])/M_PI*180;
r_refdef.viewangles[1] = atan2 (vpn[1], vpn[0])/M_PI*180;
r_refdef.viewangles[2] = -r_refdef.viewangles[2];
One method that comes to mind is solving for the ray of player pov (v_forward) and mirror player pov (mirror v_forward) and getting intersection, but I worry about floating point precision foiling me) and this seems too complex, like I am missing something obvious. Like maybe something to do with VectorMA (vpn, -2*d, mirror_plane->normal, vpn); but I'm lacking the 3D math creativity at the moment ...
2) Then I need that point 1 unit out from the mirror plane. (Probably just a VectorMA on that point using mirror_plane->normal )
I'm trying to add server side vis for the point of the mirror and add it a given player's vis --- if he can see the mirror.
Thanks in advance for any help and outside chance I'll self-solve and post solution if that happens.