2002-11-16 07:36:02 +00:00
|
|
|
#ifndef RAGE_TEXTURE_MANAGER_H
|
|
|
|
|
#define RAGE_TEXTURE_MANAGER_H
|
|
|
|
|
|
2001-11-04 19:34:28 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-05-19 01:59:48 +00:00
|
|
|
Class: RageTextureManager
|
2001-11-04 19:34:28 +00:00
|
|
|
|
|
|
|
|
Desc: Interface for loading and releasing textures.
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
2001-11-04 19:34:28 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
2001-11-03 10:52:42 +00:00
|
|
|
#include "RageTexture.h"
|
|
|
|
|
|
2002-09-07 08:20:10 +00:00
|
|
|
#include <map>
|
2001-11-03 10:52:42 +00:00
|
|
|
|
|
|
|
|
class RageTextureManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
2003-04-18 23:55:20 +00:00
|
|
|
RageTextureManager();
|
2003-02-14 06:50:39 +00:00
|
|
|
void Update( float fDeltaTime );
|
2001-11-03 10:52:42 +00:00
|
|
|
~RageTextureManager();
|
|
|
|
|
|
2002-12-30 02:43:52 +00:00
|
|
|
RageTexture* LoadTexture( RageTextureID ID );
|
2003-06-04 22:32:48 +00:00
|
|
|
bool IsTextureRegistered( RageTextureID ID ) const;
|
|
|
|
|
void RegisterTexture( RageTextureID ID, RageTexture *p );
|
2003-04-18 23:55:20 +00:00
|
|
|
void CacheTexture( RageTextureID ID );
|
2003-06-10 19:24:00 +00:00
|
|
|
void VolatileTexture( RageTextureID ID );
|
2002-12-30 02:43:52 +00:00
|
|
|
void UnloadTexture( RageTexture *t );
|
2002-04-28 20:42:32 +00:00
|
|
|
void ReloadAll();
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2003-07-09 02:28:56 +00:00
|
|
|
bool SetPrefs( int iTextureColorDepth, int iMovieColorDepth, bool bDelayedDelete, int iMaxTextureResolution );
|
2002-09-18 20:42:33 +00:00
|
|
|
int GetTextureColorDepth() { return m_iTextureColorDepth; };
|
2003-07-09 02:28:56 +00:00
|
|
|
int GetMovieColorDepth() { return m_iMovieColorDepth; };
|
2003-04-18 23:55:20 +00:00
|
|
|
bool GetDelayedDelete() { return m_bDelayedDelete; };
|
2003-01-11 20:15:00 +00:00
|
|
|
int GetMaxTextureResolution() { return m_iMaxTextureResolution; };
|
2002-03-30 20:00:13 +00:00
|
|
|
|
2003-04-18 23:55:20 +00:00
|
|
|
// call this between Screens
|
2003-06-10 19:24:00 +00:00
|
|
|
void DeleteCachedTextures() { GarbageCollect(screen_changed); }
|
2003-04-18 23:55:20 +00:00
|
|
|
|
|
|
|
|
// call this on switch theme
|
|
|
|
|
void DoDelayedDelete() { GarbageCollect(delayed_delete); }
|
|
|
|
|
|
2002-11-12 09:21:44 +00:00
|
|
|
void InvalidateTextures();
|
2003-06-04 22:32:48 +00:00
|
|
|
|
|
|
|
|
void AdjustTextureID(RageTextureID &ID) const;
|
|
|
|
|
void DiagnosticOutput() const;
|
2003-04-24 19:51:27 +00:00
|
|
|
|
2003-07-09 20:24:17 +00:00
|
|
|
void DisableOddDimensionWarning() { m_iNoWarnAboutOddDimensions++; }
|
|
|
|
|
void EnableOddDimensionWarning() { m_iNoWarnAboutOddDimensions--; }
|
|
|
|
|
bool GetOddDimensionWarning() const { return m_iNoWarnAboutOddDimensions == 0; }
|
|
|
|
|
|
2001-11-03 10:52:42 +00:00
|
|
|
protected:
|
2003-04-18 23:55:20 +00:00
|
|
|
void DeleteTexture( RageTexture *t );
|
2003-06-10 19:24:00 +00:00
|
|
|
enum GCType { screen_changed, delayed_delete };
|
2003-04-18 23:55:20 +00:00
|
|
|
void GarbageCollect( GCType type );
|
2002-03-30 20:00:13 +00:00
|
|
|
|
2002-09-18 20:42:33 +00:00
|
|
|
int m_iTextureColorDepth;
|
2003-07-09 02:28:56 +00:00
|
|
|
int m_iMovieColorDepth;
|
2003-04-18 23:55:20 +00:00
|
|
|
bool m_bDelayedDelete;
|
2003-01-11 20:15:00 +00:00
|
|
|
int m_iMaxTextureResolution;
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2003-06-10 19:24:00 +00:00
|
|
|
RageTexture* LoadTextureInternal( RageTextureID ID );
|
|
|
|
|
|
2002-12-30 02:43:52 +00:00
|
|
|
std::map<RageTextureID, RageTexture*> m_mapPathToTexture;
|
2003-07-09 20:24:17 +00:00
|
|
|
int m_iNoWarnAboutOddDimensions;
|
2001-11-03 10:52:42 +00:00
|
|
|
};
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
extern RageTextureManager* TEXTUREMAN; // global and accessable from anywhere in our program
|
2002-11-16 07:36:02 +00:00
|
|
|
|
|
|
|
|
#endif
|