d3d_set_projection_ext(xfrom,yfrom,zfrom,xto,yto,zto,xup,yup,zup,angle,aspect,znear,zfar)

From ENIGMA
Jump to navigation Jump to search

Description

Sets an extended 3D projection by appending 4 extra parameters to d3d set projection, allowing you to change the default field of view, aspect ratio, and near and far clipping planes.

Parameters

Parameter Data Type Description
xfrom double x coordinate of the vector the camera is looking from
yfrom double y coordinate of the vector
zfrom double z coordinate of the vector
xto double x coordinate the camera is looking at in 3D space
yto double y coordinate
zto double z coordinate
xup double x coordinate of the up normal, or the direction pointing up from where the camera is
yup double y coordinate
zup double z coordinate
angle double is the angle of the camera view in degrees, the human perception is about 60 degrees, some animals such as some fish can see 180 degrees, this is where the term "fisheye" originates, default is 45 degrees
aspect double is the aspect ratio of the screen, usualy set to the width of your drawing area devided by the height, eg. view_wview[0]/view_hview[0], default is 4:3
znear double the near plane of the projection or the depth after which pixels are allowed to copy to the screen, usually set to larger than or equal to 1 to avoid screwing up hidden surface removal
zfar double the far plane of the projection or the depth after which pixels are no longer allowed to copy to the screen, default is 32000 meaning no pixel with a depth larger than then 32000 will be drawn

Return Values

void: This function does not return anything.

Example Call

// Demonstrates drawing a cube with an extended projection that will clip off half of the cube from being rendered.
d3d_set_projection_ext();
d3d_draw_block(-10, -10, -10, 10, 10, 10, background_get_texture(bg_example), 1, 1);