Boost key value flyweight?(multiple keys)

Started by
1 comment, last by lephyrius 14 years, 11 months ago
I got this keyvalue flyweight for my textures:

boost::flyweight<boost::flyweights::key_value<String,Texture> >** textures;

The problem is that I now got this constructor:

Texture(const String& filename , bool toAlpha = false);

Where I got a bool that tells if a greyscale image should be mapped to alpha channel or Luminance. So how do I create that flyweight?
Advertisement
Whatever the Texture constructor takes as parameters, you still have Texture instances to feed key_value<String,Texture>; if you use the same image data for both a luminance and an alpha texture (unlikely) you can just give the two separate textures different names.

If you are directly using file names for keys, the only possible cause of perplexity that I can imagine, stop now. The names used to refer to textures in your code and what files they are loaded from are two different things.

Omae Wa Mou Shindeiru

Quote:Original post by LorenzoGatti
Whatever the Texture constructor takes as parameters, you still have Texture instances to feed key_value<String,Texture>; if you use the same image data for both a luminance and an alpha texture (unlikely) you can just give the two separate textures different names.

If you are directly using file names for keys, the only possible cause of perplexity that I can imagine, stop now. The names used to refer to textures in your code and what files they are loaded from are two different things.


Oki, So you mean I should have a list of textures and their parameters associated with "Fancy Helmet guy texture" or "Cool zombie dragon texture". It sound cool to me. That is a flexible solution.

This topic is closed to new replies.

Advertisement