|
![](/i/fill.gif) |
In article <3a9d4d12@news.povray.org>, "Rune" <run### [at] iname com>
wrote:
> > In this case, they could be a very useful memory enhancement,
> > since not all particles will use the same amount of memory.
> And why would types be the best solution to this problem?
If you are aware of a better way, say so!
It should be possible to store only position, velocity, other basic
information common to all particles, a bit field to define which
features are used, and an array that has a different length depending on
these features, handling all the memory myself...but that would be very
difficult, bug-prone, and difficult to maintain, as well as possibly
platform-dependant and difficult and time-consuming to code in the first
place, with little benefit. Having specialized types of particles is the
easiest and most flexible optimization.
> > particles used for different purposes use a different set of
> > features, and so a type of particle that only uses a subset
> > of those won't waste memory on the unused parameters.
>
> Make it possible to enable/disable the individual features. That's more
> flexible than using types.
You *can* enable/disable individual features. There are just specialized
types of particles available with specific feature sets.
> Oh, so 3 of the types are just specific optimisations. That's sounds
> better. But still, why can't the user just disable all features that
> he doesn't need and save memory that way?
Because some memory still has to be allocated for storage of data for
those features.
Anyway, I may never add the additional types, things will just be set up
so they can be added if necessary later. I will be developing the
features in the "generic" type first, and specialize when memory usage
becomes a problem or a radically different behavior is added.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |