Functions | |
void | Set_Camera_Projection (const char *type) |
void Set_Camera_Projection | ( | const char * | type | ) |
Lets you control how your 3-dimensional scene is to be converted to 2 dimensions for viewing.
type | - Special constant --either "Perspective", "Orthographic", or "Stretched". Can be uppercase, lowercase, or any mixture. You may also use an "oblique" form (see below). |
In either perspective or orthographic mode, the system scales what the camera sees (your "camera field" or "camera volume") so that the entire view will fit into the screen window, and so that it will fit without distortion. In a "stretched" view, on the other hand, first an orthographic projection is made, and then that view is "stretched" to fit exactly into the available screen window. This is often used when creating menus, to make the menu buttons and widgets completely fill their windows no matter what the exact window dimensions happen to be.
Finally, any of the above can be made "oblique" to specify a skew in the traditional style of mechanical drafting. Specifically, you can specify "oblique perspective", "oblique orthographic", or "oblique stretched", followed immediately by "= y-skew" or "= (y-skew, x-skew)". The "y-skew" and "x-skew" are floating-point constants, which are the angle in degrees to skew around the Y axis and around the X axis. Or, equivalently, the angle to move the viewing point off the axis of the projection plane. If "x-skew" is omitted it is taken to be zero.
Specifically, just before the X coordinates are sent to the screen they will be adjusted by z tan "y-skew". Y values will be adjusted by z tan "x-skew". The net result, for "oblique orthographic=(30.0, 30.0)", for example, is that points in the plane of the camera target will stay just where they would have been in a regular view, while anything farther away will be displaced linearly to the right and up, and anything nearer the camera will be to the left and down. This example might be suitable for mechanical drawing.
As another example, to do a red or green stereo projection you would set up two cameras. One camera position would be displaced slightly left and one slightly right, to indicate the nominal positions of each eye relative to the object. The one camera would also have a small negative y-skew and the other a positive y-skew, to indicate that the line of sight of each eye is not exactly perpendicular to the projection plane, i.e., to the screen.
If all you want to do is to switch to orthographic, and stay there, Set_Camera_By_Volume() makes that switch and sets up the camera in a way that might be useful to you.
While orthographic or "stretched" projection is enabled, no "clipping" away of the region behind the camera is done. In other words, the whole range of - to + along the viewing axis will be visible on the screen.
Note that for historical reasons the words for the regular projections may be abbreviated. The oblique projections may not be abbreviated.