gun turrent test to do world relative yaw to remove any roll and limit the rotation to be 360 in yaw and 0 to +90 in pitch (so the half sphere above the ship)
put ship under weapons turret
do proper clip of triangles that are part in front and behind camera

Code for clipping triangles to frustrum taken from:
http://simonstechblog.blogspot.com/2012/04/software-rasterizer-part-2.html
converted from javascript to c and included here with the express permission
of the original author, Simon Yeung (simon.yeunglm@gmail.com)
allow turret control via mouse
allow firing lasers with mouse