Now we started playing with DirectX 11:
This image is the ParticleGS sample from DirectX SDK, ported to Irrlicht. This sample uses the stream output funcionality to process and draw particles entirely in GPU, instead of CPU animation.
For this, I added the method to IVideoDriver:
- Code: Select all
virtual void drawAuto(IHardwareBuffer* vertices, E_VERTEX_TYPE vType = EVT_STANDARD,
scene::E_PRIMITIVE_TYPE pType = scene::EPT_TRIANGLES) = 0;
And this method to IMaterialRendererServices:
- Code: Select all
virtual bool setStreamOutputBuffer(IHardwareBuffer* buffer) = 0;
With this, we can create particle systems passing a material ID and affectors that will be just like shader callbacks.
As usual for this project, this feature is only implemented for DirectX 11 driver, but is possible to implement for OpenGL 3. With more effort, can be implemented for DirectX 9, using ATI R2VB or texture fetches on vertex buffer.
I wait your comments.