139 std::pair<TextureMap::iterator, bool> result =
_textures.insert(std::make_pair(name, managedTexture.
get()));
144 TextureMap::iterator textureIterator = result.first;
158 TextureMap::iterator texture =
_textures.find(name);
160 std::pair<TextureMap::iterator, bool> result;
167 result =
_textures.insert(std::make_pair(name, managedTexture));
169 texture = result.first;
184 TextureMap::iterator texture =
_textures.find(name);
214 texture.
_it->second->referenceCount++;
221 if (--texture.
_it->second->referenceCount == 0) {
222 delete texture.
_it->second;
236 for (TextureMap::iterator texture =
_textures.begin(); texture !=
_textures.end(); ++texture) {
238 texture->second->texture->reload();
252 glDisable(GL_TEXTURE_2D);
253 glDisable(GL_TEXTURE_CUBE_MAP);
255 glDisable(GL_TEXTURE_GEN_S);
256 glDisable(GL_TEXTURE_GEN_T);
257 glDisable(GL_TEXTURE_GEN_R);
261 glEnable(GL_TEXTURE_2D);
262 glBindTexture(GL_TEXTURE_2D, 0);
266 glBindTexture(GL_TEXTURE_2D, 0);
268 glEnable(GL_TEXTURE_2D);
269 glDisable(GL_TEXTURE_CUBE_MAP);
271 glDisable(GL_TEXTURE_GEN_S);
272 glDisable(GL_TEXTURE_GEN_T);
273 glDisable(GL_TEXTURE_GEN_R);
277 if (handle.
empty()) {
284 warning(
"Empty texture ID for texture \"%s\"", handle.
_it->first.c_str());
286 if (handle.
_it->second->texture->getImage().isCubeMap()) {
287 glBindTexture(GL_TEXTURE_CUBE_MAP,
id);
289 glDisable(GL_TEXTURE_2D);
290 glEnable(GL_TEXTURE_CUBE_MAP);
292 glBindTexture(GL_TEXTURE_2D,
id);
294 glDisable(GL_TEXTURE_CUBE_MAP);
295 glEnable(GL_TEXTURE_2D);
300 if (handle.
_it->second->texture->getImage().isCubeMap()) {
301 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
302 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
303 glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
305 glEnable(GL_TEXTURE_GEN_S);
306 glEnable(GL_TEXTURE_GEN_T);
307 glEnable(GL_TEXTURE_GEN_R);
309 glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
310 glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
312 glEnable(GL_TEXTURE_GEN_S);
313 glEnable(GL_TEXTURE_GEN_T);
320 glDisable(GL_TEXTURE_GEN_S);
321 glDisable(GL_TEXTURE_GEN_T);
322 glDisable(GL_TEXTURE_GEN_R);
TextureHandle getIfExist(const Common::UString &name)
Retrieve this named texture, returning an empty handle if it's not managed.
void assign(TextureHandle &texture, const TextureHandle &from)
Generic image decoder interface.
Inter-thread request events.
The global graphics manager.
bool hasTexture(const Common::UString &name)
Does this named managed texture exist?
A class holding an UTF-8 string.
A standard diffuse texture.
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
static GLenum kTextureUnit[]
The global Aurora texture manager.
void release(TextureHandle &texture)
A reflective environment map.
static Texture * create(const Common::UString &name, bool deswizzle=false)
Create a texture from this image resource.
The Aurora texture manager.
Utility functions for generating unique IDs.
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
void startRecordNewTextures()
Start recording all names of newly created textures.
A simple scoped smart pointer template.
void exceptionDispatcherWarning(const char *s,...)
Exception dispatcher that prints the exception as a warning, and adds another reason on top...
void clear()
Remove and delete all managed textures.
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
std::set< Common::UString > _bogusTextures
Utility templates and functions.
void setDeswizzleSBM(bool deswizzle)
Do we need to deswizzle SBM images?
TextureHandle get(Common::UString name)
Retrieve this named texture, loading it if it's not yet managed.
static const size_t kTextureUnitCount
#define DECLARE_SINGLETON(T)
Note that you need to use this macro from the global namespace.
friend class TextureHandle
bool empty() const
Is the string empty?
A managed texture, storing how often it's referenced.
void reset()
Completely reset the texture rendering.
A scoped plain pointer, allowing pointer-y access and normal deletion.
void warning(const char *s,...)
TextureMode
The mode/usage of a specific texture.
TextureHandle add(Texture *texture, Common::UString name="")
Add this texture to the TextureManager.
Convenience class that locks a mutex on creation and unlocks it on destruction.
virtual bool isDynamic() const
Is this a dynamic texture, or a shared static one?
PointerType get() const
Returns the plain pointer value.
A texture as used in the Aurora engines.
void addBogusTexture(const Common::UString &name)
Add the name of a texture that doesn't really exist.
std::list< Common::UString > _newTextureNames
void set()
Reset the current texture unit to an empty texture.
#define RequestMan
Shortcut for accessing the request manager.
void activeTexture(size_t n)
Set this texture unit as the current one.
UString generateIDRandomString()
void stopRecordNewTextures(std::list< Common::UString > &newTextures)
Stop the recording of texture names, and return a list of previously recorded names.
#define GfxMan
Shortcut for accessing the graphics manager.
void reloadAll()
Reload and rebuild all managed textures, if possible.