Allen Bierbaum wrote:
>
> Can you explain the "overwrite the last one if there isn't" a little
> more? I would like to document this in the class and I don't fully
> understand this behavior.
There are two 'cases' for chunks, you either have more than one slot or
you don't. 99% of the chunks only have one slot, only few (light,
texture come to mind) have more than one.
Given that I wanted one code path to support both kinds of chunks, the
behavior had to work for both cases. If you only have one slot, you want
a newly set chunk to overwrite the old one. For multiple slots, since
the ChunkMaterial used to not store a slot id, you need to fill up the
slots one by one, so that e.g. adding two textures to the ChunkMat fills
slots 1 and 2. The problem with that was that you couldn't set a slot id
explicitly, e.g. guarantee that a certain texture ends up in unit 3.
That's why I added an explicit slot id.
> My understanding of slots is that they are really the index so to speak
> of the chunk in the case that there are multiple chunks of the same type
> associated with the ChunkMaterial.
Yes.
> So, in what case would you end up
> overwriting anything?
Whenever you set a slot that's already used you overwrite what's already
in there. Or when you add more chunks of a type than there are slots.
If you remove a chunk from a chunkmaterial how do
> the slots get renumbered or is it valid to have "empty" slots?
It is valid to have empty slots (e.g. bound texture 1 and 3, but not 2).
You just can't get that behavior by only calling addChunk(chunk);.
Honestly now that we have explicit slot ids everywhere, we probably
don't need the auto behavior any more. I would keep it in the OSG_1
compat path, but we can remove it for 2. Most people who add stuff know
where they want it to go anyway.
Dirk
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core