I'm creating multiple point sprites per draw, for example: 1000 point sprite per draw.
I can set all the point sprites size by setting D3DRS_POINTSIZE in device->SetRenderState()
How do I set different size for EACH point sprite?
I'm creating multiple point sprites per draw, for example: 1000 point sprite per draw.
I can set all the point sprites size by setting D3DRS_POINTSIZE in device->SetRenderState()
How do I set different size for EACH point sprite?
You can output a float from your vertex shader with the PSIZE semantic. This will override what you specify for D3DRS_POINTSIZE.
Why? There's no performance advantage to using fixed-function, since it's just going to be emulated in a shader (which may well be slower than a vertex shader that you've authored).
Anyway if you really don't want to use a vertex shader, I think you can use PSIZE as a vertex element.
The reason is that I'm creating Particle Editor and I will be setting this value in the emitter properties.
How can I change the following to add PSIZE?
struct CUSTOM_PARTICLE_VERTEX
{
D3DXVECTOR3 p;
D3DCOLOR color;
};
Also, what FVF should I use for rendering?
What does a value being in the emitter properties have to do with using shaders?
I'm going to be blunt here: fixed function is a waste of time. All available hardware supports shaders, and uses shaders under the hood to implement the fixed-function feature set from DX9 and earlier. There's absolutely no reason to learn it, and there's no reason to use it in any new project. Anything you can do in fixed-function can be done in shaders, and probably more efficiently since you can tailor it to your exact needs.
FVF codes are outdated cruft from the pre-DX9 era. If you're set on using DX9 then you should at least use vertex declarations. They completely replace FVF codes, and offer functionality that can't be used with FVF codes (for instance, the aforementioned PSIZE). In your case you would add an additional float to your struct for storing the point size, and then you would specify a D3DVERTEXELEMENT9 with D3DDECLUSAGE_PSIZE