I actually have this kind of view implemented to some extent in the lesson 10 code of the "neheGX" examples. Specifically, this section will be relevant:
Code: Select all
f32 lookupdown; // Vertical angle, 0 is straight ahead
if (lookupdown > 90) lookupdown = 90.0F;
if (lookupdown < -90) lookupdown = -90.0F;
Kind of simple, but it works. If you instead want the camera to flip around when the user goes past these two "ends", you can simply add/subtract 180 on each of the angles to get the camera to quickly spin around, but the user might find this disorienting.
EDIT: Someone on IRC suggests:
Code: Select all
cam[2].x = cam[0].x + cos(yaw)cos(pitch);
cam[2].y = cam[0].y + sin(pitch);
cam[2].z = cam[0].z + sin(yaw)cos(pitch);
Said someone also adds: "...pitch also modifies x and z, not just y."
Use whichever works best for you.