Start a new topic

mgInsertTexture - is there a less scattergun way of doing this?

Original Post by: chrisell Wed Jul 18 15:48:10 2012

I need to populate existing FLT files with a bunch of new textures, but using mgInsertTexture starts with the last free entry in palette 0 and spams everything from there. What I really need is some way of getting all the new textures in using mgInsertTexture, but starting in palette 5, or 7 (for example). ie. I like the way mgInsertTexture allocates a palette entry and fills it in, but is there a way to determine where it starts?

Original Post by: ChrisRogers Wed Jul 18 16:01:21 2012

There is also mgReadTexture... This function takes a few extra parameters compared to mgInsertTexture. It allows you to specify what index to assign to the texture palette entry as well as the x and y pixel location of the texture in the palette. The difficult part of this function is determining where to place the textures. You can be very sophisticated and calculate a nice packing, or you can just place them all at 0,0 so they overlap. If it were me, I would read them all in at location 0,0, then just use the Creator Script command to pack all texture palettes, or just pack the current texture palette. You also might want to check to make sure the index is not already in use.

Good Luck!

Original Post by: chrisell Wed Jul 18 16:29:32 2012

Ah good point. I don't know why I'd overlooked that. I can do an mgGetNextTexture to find the last palette entry then round up to start at the next one.


Original Post by: ChrisRogers Wed Jul 18 16:40:58 2012

No problem!

Login to post a comment