Author Topic: Particle Editor  (Read 7877 times)

MrTAToad

  • Guest
Particle Editor
« on: 2012-May-20 »
This is Matt Bennett's Particle particle editor (http://www.matibee.co.uk/wpsite/code/mbm-framework/downloads) converted to GLBasic by yours truly :)

It does run somewhat faster than the original of course - I may put it a proper frame rate limiting system rather than calculating the differences between two GETTIMERALL calls (like in the original).  Everything in the original is included.

By the way, once you've chosen a background, it can't currently be removed  :whistle:

The following instructions are from the original instruction file :

Point weight
The “weight” of each particle. Negative values will cause the particles
to rise. Positive values will cause them to fall.

Point scale Min / Point scale Max
The range for the scale of each individual particle when it is spawned.

Scale factor
The factor by which the particle scale changes every second.

Rotation factor
The factor (in degrees) by which the particle rotation changes every second.

Emitter Cone
The angular range of the emitter. An explosion might use a full 360° whereas a booster rocket might use just 20°.

Emit Min Distance/ Emit Max Distance
The distance range a particle will spawn from the actual emitter position (in pixels).

Velocity Min / Velocity Max
The velocity range for each particle as it's spawned.

Red / Red Factor, Green / Green Factor, Blue / Blue Factor
Each color channel (RGBA) has an initial value and a factor by which  it can change over one second.
To start with full alpha, Alpha = 1.0, to fade alpha over 2 seconds,  Alpha Factor = 0.5
Particles “die” when their alpha value or scale drops to zero.

Burst Count
The number of particles emitted per “Burst”. Bursts are usually restricted to 20 per second to ensure frame rates do not affect the
particle emitter results.

X Handle / Y Handle
The handle position for the image. Important if the particles rotate.
Note that the GLBasic value usage is slightly different to the original, whereby this is value is now an offset from the centre of the image, rather than from the top-left of the image

Alpha Blend
This is another difference - the sign of this value is used to define how alpha bending is used.  For values > 0, additive alpha blending is used, for < 0, Interpolated alpha blending  is used whilst with 0, no alpha blending is used

Image file
The bitmap file used to create the particles.  Only PNG files can be used

All the original example files are included.

Click on "SAVE" to save your settings in the Particles directory, "LOAD" to load them in, "IMAGE" to select a graphic (this will overwrite the current one), "UPDATE" to update any modified values (this is needed after changing anything) and "BACKGROUND" to select a background...

I'll release the code in a day or so...

The program can be downloaded from http://dl.dropbox.com/u/25216439/TestParticleEmitter.app.rar


[attachment deleted by admin]

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3340
  • Integrated Brain
    • View Profile
Re: Particle Editor
« Reply #1 on: 2012-May-20 »
I comment in another Post... I think it´s a very impressive tool, but I think it´s more friendly can change the values whit Sliders or another method, than put manually... like in the 3D soft, in most cases in some plugins or some parts they put sliders.... and well... if you permet if was mine the application I add something, like AUTO-UPDATE or NOT...

Very cool,cool tool!!!...

PS: Only a question MRTAtoad, what´s it´s alpha Factor (perhaps an internal multiplier for Alpha?¿).

MrTAToad

  • Guest
Re: Particle Editor
« Reply #2 on: 2012-May-20 »
I had though about using sliders when I started the conversion process, but as you can see, it allows values with up to 9 DP, which would mean it would be rather tricky getting that accuracy with a slider - and a very small value does make a lot of difference!

The Alpha factor is the speed at which the alpha value is updated.

Auto updating could be done, but then I would need to check for a keypress for all the text boxes...

Glad you like it!
« Last Edit: 2012-May-20 by MrTAToad »

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3340
  • Integrated Brain
    • View Profile
Re: Particle Editor
« Reply #3 on: 2012-May-20 »
Ok , Mrtatoad, perhaps for the Sliders if you put some buttons whit multipliers, for works in combination¿?...

Only a one suggention more, you can make the sprites appears whitout have to put the mouse over the black area... whit this mode it´s more quickly change and show the changes...


MrTAToad

  • Guest
Re: Particle Editor
« Reply #4 on: 2012-May-20 »
Good idea - would be worth doing!

MrTAToad

  • Guest
Re: Particle Editor
« Reply #5 on: 2012-May-20 »
I've started to change some of the input boxes to sliders to start with.

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3340
  • Integrated Brain
    • View Profile
Re: Particle Editor
« Reply #6 on: 2012-May-20 »
Waiting for look...  :nw:

MrTAToad

  • Guest
Re: Particle Editor
« Reply #7 on: 2012-May-20 »
Okay - give this one a go.

I would have liked a few more sliders, but I found out that when using DDGui sliders, a MINVAL of < 0 can't be used :)

Link : http://dl.dropbox.com/u/25216439/TestParticleEmitter.app.rar

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3340
  • Integrated Brain
    • View Profile
Re: Particle Editor
« Reply #8 on: 2012-May-21 »
Hi MrTatoad, it´s  very nice things... you program can do...

I a few seconds I do this... and I like me...

The Sliders, it´s very usefull whit the automatic update, you can see perfectly what are you doing... I think make Sliders in all, can be fabolous...






[attachment deleted by admin]

MrTAToad

  • Guest
Re: Particle Editor
« Reply #9 on: 2012-May-21 »
Glad you like it!

I'm putting in some more sliders and will hopefully upgrade the buttons to icons

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4133
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Particle Editor
« Reply #10 on: 2012-May-21 »
Sliders - that's how we roll! :P

<a href="http://www.youtube.com/watch?v=CjY0mbh8fxU" target="_blank">http://www.youtube.com/watch?v=CjY0mbh8fxU</a>
I came. I saw. I played.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2558
    • View Profile
Re: Particle Editor
« Reply #11 on: 2012-May-21 »
Good stuff, well done!  :good:

Strangely enough I had been in the process of converting the exact same lib, I got as far as the particle system but not the MaxGUI util.

This should save me that that job, that's a nice surprise!  :)
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

MrTAToad

  • Guest
Re: Particle Editor
« Reply #12 on: 2012-May-21 »
Even better Sliders :

<a href="http://www.youtube.com/watch?v=X0XEO7SSc7E" target="_blank">http://www.youtube.com/watch?v=X0XEO7SSc7E</a>

MrTAToad

  • Guest
Re: Particle Editor
« Reply #13 on: 2012-May-21 »
Hopefully this is the last main update - let me know if there are any problems.

Link : http://dl.dropbox.com/u/25216439/TestParticleEmitter.app.rar

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 929
  • KodeSource
    • View Profile
    • KodeSource
Re: Particle Editor
« Reply #14 on: 2012-May-22 »
Looks amazing!  :good:

You could have both sliders and text boxes.
When sliding, show its current value in the text box.
And when entered directly into a text box, update its corresponding slider.

And, if you want to allow negative values, just set and scale the slider properly.
If you want between -10 and +10 (that's 21 unique values), just set the slider from 0 to 20.
Then to calculate the actual value, subtract 10.

Can't wait to play with this.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]