Sign in to follow this  

Wu particles not working right

This topic is 4765 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Heres the deal. I have been trying out some old-school graphics programming using TinyPTC (Check it out here). I am trying to just get some basic stuff working, right now I am trying to get wu particles working (as well as my initials spelled with dots waving in a sine wave). Information on this is hard to find, I am using this site pretty much. I am using the algorithm directly with less than optimal results. The exe can be found here zipped It is actually supposed to be my initials, though it just looks like a moving mass of dots. Anyway, the top half looks great, but the bottom dots looks pretty messed up and I have no idea why.
void plotwu(float wx, float wy, int wb)
{
	int x, y;
 	float fx, fy;
	int btl, btr, bbl, bbr;
	
	x = int(wx);
	y = int(wy);
	fx = wx - x;
	fy = wy - y;

	btl = (1-fx) * (1-fy) * wb;
	btr =  (fx)  * (1-fy) * wb;
	bbl = (1-fx) *  (fy)  * wb;
	bbr =  (fx)  *  (fy)  * wb;
	
	plot(x,   y  ,rgb(btl,btl,btl));
	plot(x+1, y  ,rgb(btr,btr,btr));
	plot(x,   y+1,rgb(bbl,bbl,bbl));
	plot(x+1, y+1,rgb(bbr,bbr,bbr));
}






This is the function, and if you want me to post more code, feel free. (I'm sure this is a stupid mistake, but I will never be able to find it)

Share this post


Link to post
Share on other sites
I have been trying out different things, and I figured out it has nothing to do with negative numbers (I thought maybe the algorithm could only deal with positive screen coords). However, the problem fails to present itself when the text is stationary, so the problem must be with the movement.

ypos = 54;
//stuff
for(y = 0; y < 9; ++y)
{
ypos -= 4;
xpos = x_offset;
for(x = 0; x < 22; ++x)
{
if(text[y][x] == 1)
plotwu(xpos, ypos, 255);
xpos += 6;
}
}
//later in the code
x_offset += 100*frame_time;
if(x_offset > 160)
x_offset = -182



anyway, my method of doing movement is probably a bad way, but I don't see how it would mess up the plotwu function. I think the problem would have to lie somewhere in the code I posted.

Share this post


Link to post
Share on other sites

This topic is 4765 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this