//this is to create the verts
CustomVertex.PositionColored[] verts = (CustomVertex.PositionColored[])vb.Lock(0,0);
for(int i = 0; i<number;i++)
{
float x = (start.camera2.LookAtPoint.X - start.camera2.EyeLocation.X) +- (Convert.ToSingle(random.NextDouble()));
float y = (start.camera2.LookAtPoint.Y - start.camera2.EyeLocation.Y) +- (Convert.ToSingle(random.NextDouble()));
float z = (start.camera2.LookAtPoint.X - start.camera2.EyeLocation.Z) +- (Convert.ToSingle(random.NextDouble()));
verts.X = x;
verts.Y = y;
verts.Z = z;
verts.Color = System.Drawing.Color.Red.ToArgb();
}
vb.Unlock();
//this is to draw
device.RenderState.PointSize = size;
device.RenderState.ZBufferEnable = true;
device.SetStreamSource(0, vb, 0);
device.VertexFormat = CustomVertex.PositionColored.Format;
device.DrawPrimitives(PrimitiveType.PointList, 0, number);
weird problem with particles
im making a game that is using directX 9 C# and the sampleFramework that ships with DirectX.
my problem is im using the first person camera and having a few problems
1st problem
im just using normal CustomVertexto create my verts this code is placed in my onframemove function, then my DrawPrimitives call is placed in my rendering loop. my fps are way to low around and I cant seem to get the math right to put the particles in front of the camera, here is the code
problem 2
when the player shoots a object(a mesh) by pressing the mouse key the particles dissapear and then follow the object until the object is removed from the screen
any help would be great
EDIT: changed 'code' tags to 'source' so they dont break the forum layout, and corrected typo in subject line...
[Edited by - jollyjeffers on May 1, 2006 9:32:14 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement