I am trying to update my particle engine to use point sprite sizes within the vertices themselves so they can change size over time. My Particle struct looks like this:
private struct ParticleVertex {
public Vector3 v;
public float size;
public int color;
public static readonly VertexFormats Format = VertexFormats.Position | VertexFormats.Diffuse | VertexFormats.PointSize;
};
When I render the particles as usual they are tiny 1 pixel things and the number I store for the size actually ends up changing their colors. Can anyone tell me what I am missing?
--------------------------------------------------------------------------
The meaning of life is to live, and there's only one way to do it wrong...
Michael Schuld - March 25, 2004
[edited by - mikeschuld on April 14, 2004 8:02:03 PM]
DX9 PointSprite Size problems
My experince is that DXPointSprites is only for very small sprites, just a few pixels. So if your texture is 64*64 then it won''t work.
Okay, from my experience your problem lies in the fact that you declare it as having diffuse | size and you have first the float for size and only then the int for color.
If you swap either the diffuse | color OR swap the order of the float size with the int color, your done. Something like this:
private struct ParticleVertex {
public Vector3 v;
public int color; <- Swapped
public float size; <- Swapped
public static readonly VertexFormats Format = VertexFormats.Position | VertexFormats.Diffuse | VertexFormats.PointSize;
};
It actually puzzled me to no avail how could the compiler know what variable meant what in the vertex declaration, until i read somewhere order was important.
Hope this helps.
As for what the AP said, it is not true. I believe it is dependent on the hardware. You should check the device caps.
Joao Correia
If you swap either the diffuse | color OR swap the order of the float size with the int color, your done. Something like this:
private struct ParticleVertex {
public Vector3 v;
public int color; <- Swapped
public float size; <- Swapped
public static readonly VertexFormats Format = VertexFormats.Position | VertexFormats.Diffuse | VertexFormats.PointSize;
};
It actually puzzled me to no avail how could the compiler know what variable meant what in the vertex declaration, until i read somewhere order was important.
Hope this helps.
As for what the AP said, it is not true. I believe it is dependent on the hardware. You should check the device caps.
Joao Correia
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement