D3d_set_projection - hpgDesigns/hpgdesigns-dev.io GitHub Wiki

NOTOC {{-}}

Notation

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

  • xfrom (xfrom,yfrom,zfrom) is the coordinate in 3D the camera is looking from
  • yfrom
  • zfrom
  • xto (xto,yto,zto) is the coordinate the camera is looking at in 3D space
  • yto
  • zto
  • xup (xup,yup,zup) create a directional "up" vector, or the direction pointing up from where the camera is
  • yup
  • zup

Return Values

No values are returned from the function.

Example Call

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

Deomnstrates 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.