d3d_set_perspective(enable)

From ENIGMA
Revision as of 13:37, 29 June 2013 by RobertBColton (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.
NOTE: Orthographic projections use a non perspective camera by default, and perspective ones do the opposite.

Parameters

Parameter Data Type Description
enable boolean whether or not to enable use of a perspective projection

Return Values

void: This function does not return anything.

Example Call

// 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);