![]() |
|
Let's have a (virtual) fireworks competition! |
LennyLen
Member #5,313
December 2004
![]() |
Can someone check some maths for me? Consider the following diagram: {"name":"600114","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b8e1af488d6542be9c84565ec0c63194.png","w":800,"h":600,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b8e1af488d6542be9c84565ec0c63194"} If V and A are known, and you want to calculate X and Y, they can be calculated as follows, yes? X = V * cos(A) And if the angle is in degrees, then to pass it to the math.h functions, which are in radians (iirc), you should then do: X = V * cos(A * PI / 180) So, have I got all that right?
|
OnlineCop
Member #7,919
October 2006
![]() |
If "A" is your theta, you are correct that For the next part, you may find it easier to precalculate your values for either PI / 180 or 180 / PI: static const double RAD2DEG = 180.0 / M_PI; static const double DEG2RAD = M_PI / 180.0;
Looks like you have it correct.
|
type568
Member #8,381
March 2007
![]() |
blargmob said: What exactly happened? Did it say anything? You'll need XNA GS 3.1 and .NET 3.5 in order to build it. And I think you just need .NET 3.5 to run it. Can't, just crashed. What I have out of these platforms- no clue. Just Win7 x64.. P.S. Append:
|
ixilom
Member #7,167
April 2006
![]() |
Still got a few days to go Progress has been slow though, a friend is visiting = no coding ___________________________________________ |
Mark Oates
Member #1,146
March 2001
![]() |
Dustin Dettmer said: Hey look someone already posted my image on google image search! Ahahaha! -- |
ixilom
Member #7,167
April 2006
![]() |
LennyLen
Member #5,313
December 2004
![]() |
Here's what I threw together: ( The source code is attached. I didn't really attempt to regulate speed or optimize the code, so it may not run so well on slower computers. EDIT: I forgot to mention, The reason I asked about the maths earlier was that there were certain areas that were never being drawn to, and I thought I had my equations wrong. It turned out is was just due to the crappiness of rand(). When I switched to using a Mersenne Twister algorithm instead, the particle distribution became even.
|
Jonatan Hedborg
Member #4,886
July 2004
![]() |
ixilom: Wow. Really awesome. Here is my first version, I might update it a bit if I feel like it I did some experimentation with function pointers, void*'s etc... There are plenty of hacks in the source, so don't go there unless you really want to. It kinda started out with just plain C, but moved slightly over to C++ because I started to use OpenLayer and figured "meh, what the hell"... Fun exercise though! {"name":"600129","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/7\/d77c039cd81df6ea716f4c7009b7a804.jpg","w":800,"h":603,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/d\/7\/d77c039cd81df6ea716f4c7009b7a804"}
|
Trent Gamblin
Member #261
April 2000
![]() |
I updated my original entry (and the link to the app in my post). Here it is again: link. Edit: Oops, seems I messed it up. Wasn't working right on my faster computer. Updated again.
|
Jonatan Hedborg
Member #4,886
July 2004
![]() |
Anyone know if it's possible/easy to add some motion blur in openlayer? I would guess through direct OpenGL access, which is fine.
|
ImLeftFooted
Member #3,935
October 2003
![]() |
Doubt it. |
Trent Gamblin
Member #261
April 2000
![]() |
Yes, the easiest way to do motion blur is when you have a solid colored background. Fireworks are on black so it's easy. Render your frames to a buffer, never erase the buffer and after drawing a frame draw a translucent black rectangle over the whole scene. It'll gradually fade everything out like a motion blur.
|
ImLeftFooted
Member #3,935
October 2003
![]() |
Hm. You could also just draw the particle 10 times with varying alpha tint. |
Trent Gamblin
Member #261
April 2000
![]() |
BAF
Member #2,981
December 2002
![]() |
Neat effect. |
type568
Member #8,381
March 2007
![]() |
Jonatan Hedborg said: Here is my first version, I might update it a bit if I feel like it It was nice before it crashed, with no info on the crash(
|
Jonatan Hedborg
Member #4,886
July 2004
![]() |
type568 said: It was nice before it crashed
Hmm. Strange. At what point did it crash? (ie, what happened on the screen) Also with motion blur! EDIT: Trent Gamblin said: Yes, the easiest way to do motion blur is when you have a solid colored background. Fireworks are on black so it's easy. Render your frames to a buffer, never erase the buffer and after drawing a frame draw a translucent black rectangle over the whole scene. It'll gradually fade everything out like a motion blur.
Oh yeah, of course!
|
FMC
Member #4,431
March 2004
![]() |
nm [FMC Studios] - [Caries Field] - [Ctris] - [Pman] - [Chess for allegroites] |
type568
Member #8,381
March 2007
![]() |
Jonatan Hedborg said: See if this version works better (attached). Awesome, works fine.
|
Vanneto
Member #8,643
May 2007
|
In Allegro 5, which is faster, having a ALLEGRO_BITMAP represent the particle, or just drawing pixels? I am getting some slowdowns with over 1000 particles in the scene, so I'm just wondering. In capitalist America bank robs you. |
Trent Gamblin
Member #261
April 2000
![]() |
If they're single pixels use an array of ALLEGRO_VERTEX (primitives addon) and al_draw_prim with the ALLEGRO_PRIM_POINT type.
|
Vanneto
Member #8,643
May 2007
|
This will be faster than using ALLEGRO_BITMAP's? Well, I'm going to try it, thanks for the tip. In capitalist America bank robs you. |
Trent Gamblin
Member #261
April 2000
![]() |
Yes, it should be the fastest way to draw single pixels.
|
Vanneto
Member #8,643
May 2007
|
Well, while I brought this up, I noticed that the ALLEGRO_OPENGL driver is significantly slower at drawing many textures (1000) than the DIRECT3D driver... I updated my drivers to make sure they aren't to blame and the problem persists. Is this just how OpenGL works? In capitalist America bank robs you. |
GullRaDriel
Member #3,861
September 2003
![]() |
It's also a matter of which OS you're using along OpenGL. "Code is like shit - it only smells if it is not yours" |
|
|