d3d_set_projection(xfrom,yfrom,zfrom,xto,yto,zto,xup,yup,zup)
Jump to navigation
Jump to search
Description
Sets the 3D projection used when rendering. When drawing 3D objects you must determine where you are at, and what you are looking at, that is the purpose of setting the 3D projection before rendering any objects. To make a camera swivel and rotate on it's side you would manipulate the directional up vector and calculate it using the geometric sin/cos math functions. This function is basically an overload for the d3d set projection ext function using the default 45 degrees, 4:3 aspect ratio, znear of 1, and a zfar of 32000.
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 |
Return Values
void: This function does not return anything.
Example Call
// Demonstrates the use of setting a 3D projection from (20, 20, 20), looking at (0, 0, 0), using (0, 0, 1) as the directional up vector, and then rendering a cube using that projection.
d3d_set_projection(20, 20, 20, 0, 0, 0, 0, 0, 1);
d3d_draw_block(-10, -10, -10, 10, 10, 10, background_get_texture(bg_example), 1, 1);