Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Search] PartcicleSystem  (Read 3503 times)

0 Members and 1 Guest are viewing this topic.

Ptlomej

  • Newbie
  • *
  • Posts: 48
    • ICQ Messenger - 353167418
    • View Profile
    • Local
[Search] PartcicleSystem
« on: March 05, 2012, 06:46:24 pm »
Hey, community I search a ParticleSyste, for SFML 2
it must be a good System like spark but i need a little tutorial how to use it. thank you.

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
[Search] PartcicleSystem
« Reply #1 on: March 05, 2012, 06:48:54 pm »
Why like SPARK but not SPARK?! :)

Ptlomej

  • Newbie
  • *
  • Posts: 48
    • ICQ Messenger - 353167418
    • View Profile
    • Local
[Search] PartcicleSystem
« Reply #2 on: March 05, 2012, 06:53:34 pm »
I dont know how to integrate it into sfml2 :S

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
[Search] PartcicleSystem
« Reply #3 on: March 05, 2012, 09:23:28 pm »
Its as simple as it gets!

If you know how to link the library etc, using it is piece of cake!

You just need to create a system, then update it and render it, there you go.

Tuning the system to what you want is just a matter of playing with it a little. That can be hard to get right, but particle systems always require some understanding or they are way too simple :)

Ptlomej

  • Newbie
  • *
  • Posts: 48
    • ICQ Messenger - 353167418
    • View Profile
    • Local
[Search] PartcicleSystem
« Reply #4 on: March 05, 2012, 09:45:40 pm »
Linking and compiling of SPARK 2 is very simple.
but how to integrate was the question ? ;) code samples ?

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
[Search] PartcicleSystem
« Reply #5 on: March 06, 2012, 12:01:17 am »
Some working code to look at.

Code: [Select]

        SPK::System::setClampStep(true,0.1f); // clamp the step to 100 ms
SPK::System::useAdaptiveStep(0.001f,0.01f);
SPK::Ref<SPK::System> sparkSystem = SPK::System::create(true);

renderer = SPK::GL::GLQuadRenderer::create(5,5);

SPK::Ref<SPK::Group> effectgroup = sparkSystem->createGroup(4000);

effectgroup->setName("Cool");
//effectgroup->setRenderer(SPK::GL::GLPointRenderer::create(10));
effectgroup->setRenderer(SPK::GL::GLLineRenderer::create(10, 5));

mySphere = SPK::Sphere::create(SPK::Vector3D(300.f,300.f,0.f),4.0f);

//effectgroup->setRenderer(renderer);
effectgroup->setLifeTime(0.3,0.7);
effectgroup->setColorInterpolator(SPK::ColorRandomInterpolator::create(SPK::Color(0,0,0,255),SPK::Color(0,15,0,255),SPK::Color(0,30,40,255),SPK::Color(50,0,0,255)));
effectgroup->addEmitter(SPK::SphericEmitter::create(SPK::Vector3D(1.0f,0.0f,0.0f),0.0f,2*3.14159f,mySphere,true,-1,3000.0f,10.2f,15.5f));

effectgroup->addModifier(SPK::Gravity::create(SPK::Vector3D(0.0f, -1,0.0f)));


Render code, i absolutely recommend to call ResetGLStates() after rendering your particles.

   
Code: [Select]
SPK::GL::GLRenderer::saveGLStates();
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
sparkSystem->renderParticles();
SPK::GL::GLRenderer::restoreGLStates();


Updating the system

Code: [Select]
sparkSystem->updateParticles(DeltaTime);

Can you guide yourself through it? :)

Ptlomej

  • Newbie
  • *
  • Posts: 48
    • ICQ Messenger - 353167418
    • View Profile
    • Local
[Search] PartcicleSystem
« Reply #6 on: March 06, 2012, 08:03:11 am »
i will test and look at it if i get home im at work ;)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[Search] PartcicleSystem
« Reply #7 on: March 06, 2012, 09:17:10 pm »
You could also try my Thor particle system :P
API Documentation
Tutorial
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Ptlomej

  • Newbie
  • *
  • Posts: 48
    • ICQ Messenger - 353167418
    • View Profile
    • Local
[Search] PartcicleSystem
« Reply #8 on: March 06, 2012, 09:30:55 pm »
Tutorial and api are the same ?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[Search] PartcicleSystem
« Reply #9 on: March 07, 2012, 08:52:40 pm »
No, sorry, I fixed the mistake.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Ptlomej

  • Newbie
  • *
  • Posts: 48
    • ICQ Messenger - 353167418
    • View Profile
    • Local
[Search] PartcicleSystem
« Reply #10 on: March 07, 2012, 10:25:27 pm »
Can i use it seperate to sfml2 or musst i use the complete engine oô ?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
[Search] PartcicleSystem
« Reply #11 on: March 08, 2012, 05:40:25 pm »
I'm not sure if I understand your question. Thor is no engine, you can use only the Particles module in addition to SFML.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: