Chris,

The approach I took in my particle code (checked into j3d.org) was to *not*
dynamically create new particles. This is fairly standard, even with C/C++
particle systems. You can create N particle systems, you can disable/enable
them entirely - but you cannot add/remove particles dynamically. This
ensures that you don't have to do lots of memory /geometry allocation while
the particle system is running. The particles can however be marked as
"dead" so that they are (optionally) recycled or not rendered.

The general use case (for me anyway!) is that we want to have a fixed number
of particle effects and we need to trade-off accuracy and performance. So on
"high" detail we might create 1000 particles for smoke, 500 particles for
"mist", 500 particles for "water" etc. etc. You can spawn a new particle
system dynamically - when a "rocket" particle collides with a wall you spawn
an "explosion" system at the point of collision.

Sincerely,

Daniel Selman

Author - "Java 3D Programming"
http://www.manning.com/selman

-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Chris Forrester
Sent: Thursday, April 04, 2002 6:20 AM
To: [EMAIL PROTECTED]
Subject: Best way to go about a resizable TriangleStripArray...


Hey all. Foolish me forgot to check the bug parade so I've spent the last
day rewriting my particle system to find out why the setValidVertexCount is
now only increasing the size of a QuadArray's vertex count, and not
decreasing. Seems this is a bug in j3d1.3beta.

Anyhow - I'm wondering on the best way to implement this using
TriangleFanArray.. setStripVertexCounts requires me to do a
(int[])Array.newInstance(int.class, numParticles) and fill for each
addition/removal of a particle (though these are batched so
creation/deletion of a large number of particles in a single frame only
needs to do this once).
I'm thinking that a better way to do this would be to simply have the strip
index list constantly as large as the initial max number of verticies / 3
(for worse case scenario). Then a setValidStripCount(int numStrips) would be
the equivilent of the setValidVertexCount that non-stripped geometry uses.
Setting the number of verticies in a given strip then would be provided with
get/setStripVertexCountAtIndex(int index)

Or is this too complicated and the array newInstance'ing/filling isn't much
of a hit at all?


------------------------

Chris Forrester

http://www.geocities.com/Psionic81


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to