rel_for_screen (VECTOR*, VIEW*);

Convert the vector's screen coordinates into xyz-coordinates of the given view. Contrary to vec_for_screen, the view angle and positions is not used in this calculation. Thus the resulting coordinates can be directly used for positioning a view entity. If the result is invalid - outside the screen - the command returns 0, otherwise a nonzero value.

Parameters:

VECTOR* screen position to be converted to 3D.
VIEW* view used for the conversion, must be SHOW.

Returns:

NULL - Result is outside the view cone.
VECTOR* - Result is inside the view cone.

Modifies:

VECTOR*

Speed:

Medium

Example:

vec_set(temp,sun_pos);
if (vec_to_screen(temp,camera) != NULL) // if sun position visible at screen
{
  lens_flare.SHOW = ON; 
  set(lens_flare,SHOW); // defined entity
  temp.z = 200; // temp contains the sun screen position, give 200 quants depth
  vec_set(lens_flare.x,temp);
  rel_for_screen(lens_flare.x,camera); // now the lens flare is at the sun position
}

See also:

vec_to screen, vec_for_screen, rel_to_screen ► latest version online