D3d_set_perspective - hpgDesigns/hpgdesigns-dev.io GitHub Wiki
Notation
Description
Sets whether to enable perspective projections, which when enabled renders objects smaller the further they are from the camera. Turning it off is used generally to achieve an Isometric graphics style. Setting a projection by default enables the use of a perspective projection, except for an orthographic projection.
Parameters
- enable, whether or not to enable use of a perspective projection
Return Values
No values are returned from the function.
Example Call
The following is a demonstration of the difference between a perspective and non perspective projection.
// This shows using a perspective projection to draw two blocks, in this case the one on the right should appear to
// be "farther" away.
d3d_set_projection_perspective(0, 0, view_wview[0], view_hview[0], 0);
d3d_set_perspective(true);
d3d_draw_block(150, 50, -50, 200, 100, 50, background_get_texture(bg_example), 1, 1);
d3d_draw_block(150, 50, -100, 200, 100, -50, background_get_texture(bg_example), 1, 1);
// This shows using a non perspective projection to do the former, in this case even though the right block is drawn
// farther away, both blocks should appear at equal distances.
d3d_set_projection(0, 0, view_wview[0], view_hview[0], 0);
d3d_set_perspective(false);
d3d_draw_block(150, 50, -50, 200, 100, 50, background_get_texture(bg_example), 1, 1);
d3d_draw_block(150, 50, -100, 200, 100, -50, background_get_texture(bg_example), 1, 1);
NOTE: Orthographic projections use a non perspective camera by default, and perspective ones do the opposite. NOTOC