Author: Infernal <no>     Reply to Message
Date: 3/21/2004 11:42:13 AM
Subject: RE: the code

the drawflarearray2 looked promising.
try this:
project your flare origin to it's screen coordinate.
use your screen resolution to pick the center point on the screen. or if your using a layer of abstraction, half the height and width.
now that you have these 2 points on the 2d surface of the near clip plane of your frustum, connect them with a 2d vector (x,y). you don't need to do linear interpolation between the points.

vec_subt(end, start, result) so you want a vector from flare to center of screen:
vec_subt(center, flarescreencoord, result);
get this vector's length.
normalize the vector.
to render the lens flare points:
q3flare screen coords + (result * length * multiplier)

use multiplier of 1 and you get flare drawn at center of screen. use 2, you get flare at same distance on other side of screen center as the flare is. use 0, get lens flare rendered at the q3 flare's screen coordinate. because of the single vector used, you should get a straight line.

your incremental for loop troubles me because you are not travelling in a vector's direction when you simply add/subtract identical values from the x and y of the vector. what you really are doing is adding/subtracting a scalar multiple of (1,1), which is not typically your vector except the one instance when it manages to fall there.

use multipliers on the vector to get a traight line for the lens flares.


lastly, the code isn't that bad. but for your own sake and others who help, add some comments as you go. and here I thought I was a person who used too few comments in the code.
_