13 #include <osg/Referenced>
14 #include <osg/Texture>
32 unsigned int wrap_s : 4;
33 unsigned int wrap_t : 4;
42 TextureList::iterator i = myTextures.begin();
43 TextureList::iterator e = myTextures.end();
46 if (i->second->referenceCount() > 1)
48 replacementList.push_back(*i);
51 if (replacementList.size() != myTextures.size())
53 myTextures.swap(replacementList);
55 return myTextures.size() == 0;
58 void releaseGLObjects(osg::State * state)
60 TextureList::iterator i = myTextures.begin();
61 TextureList::iterator e = myTextures.end();
64 i->second->releaseGLObjects(state);
68 bool findTexture(
unsigned int minFilter,
unsigned int magFilter,
69 unsigned int wrapS,
unsigned wrapT, osg::ref_ptr<osg::Texture>& texture)
72 k.
min = ((minFilter ^ 0x2600) & 0x3) + ((minFilter ^ 0x2600) >> 7);
73 k.
max = ((magFilter ^ 0x2600) & 0x3) + ((magFilter ^ 0x2600) >> 7);
74 k.
wrap_s = (wrapS & 0x0F) | ((wrapS & 0x10) >> 3);
75 k.
wrap_t = (wrapT & 0x0F) | ((wrapT & 0x10) >> 3);
77 TextureList::iterator i = myTextures.begin();
78 TextureList::iterator e = myTextures.end();
81 if (i->first.key == k.
key)
94 pair.first.min = ((texture->getFilter(osg::Texture::MIN_FILTER) ^ 0x2600) & 0x3) +
95 ((texture->getFilter(osg::Texture::MIN_FILTER) ^ 0x2600) >> 7);
97 pair.first.max = ((texture->getFilter(osg::Texture::MAG_FILTER) ^ 0x2600) & 0x3) +
98 ((texture->getFilter(osg::Texture::MAG_FILTER) ^ 0x2600) >> 7);
100 pair.first.wrap_s = (texture->getWrap(osg::Texture::WRAP_S) & 0x0F) |
101 ((texture->getWrap(osg::Texture::WRAP_S) & 0x10) >> 3);
103 pair.first.wrap_t = (texture->getWrap(osg::Texture::WRAP_T) & 0x0F) |
104 ((texture->getWrap(osg::Texture::WRAP_T) & 0x10) >> 3);
105 pair.second = texture;
106 myTextures.push_back(pair);