rel_to_screen (VECTOR* vector, VIEW* view);

Converts a vector to a screen position, like vec_to_screen. However the vector is a position relative to the view, and not to the world - the angle and origin of the view is not considered. Used for calculating the screen positions of view entities, like lens flares.

Parameters:

VECTOR* vector to be converted
VIEW* View pointer to be used for the conversion

Returns:

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

Modifies:

VECTOR*

Speed:

Fast

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 sun camera   position
}

See also:

vec_to screen, vec_for_screen, rel_for_screen ► latest version online