OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4TexMgr Class Reference

#include <C4Surface.h>

Public Member Functions

 C4TexMgr ()
 
 ~C4TexMgr ()
 
void RegTex (C4TexRef *pTex)
 
void UnregTex (C4TexRef *pTex)
 
void IntLock ()
 
void IntUnlock ()
 

Public Attributes

std::list< C4TexRef * > Textures
 

Detailed Description

Definition at line 184 of file C4Surface.h.

Constructor & Destructor Documentation

C4TexMgr::C4TexMgr ( )

Definition at line 824 of file C4Surface.cpp.

References Textures.

825 {
826  // clear textures
827  Textures.clear();
828 }
std::list< C4TexRef * > Textures
Definition: C4Surface.h:187
C4TexMgr::~C4TexMgr ( )

Definition at line 830 of file C4Surface.cpp.

References IntUnlock().

831 {
832  // unlock all textures
833  IntUnlock();
834 }
void IntUnlock()
Definition: C4Surface.cpp:874

Here is the call graph for this function:

Member Function Documentation

void C4TexMgr::IntLock ( )

Definition at line 850 of file C4Surface.cpp.

References C4TexRef::fIntLock, C4TexRef::Lock(), _LOCKED_RECT::pBits, pGL, C4TexRef::texLock, C4TexRef::texName, and Textures.

851 {
852  // lock all textures
853  int j=Textures.size();
854  for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
855  {
856  C4TexRef *pRef = *i;
857  if (pRef->Lock() && pRef->texLock.pBits)
858  {
859  pRef->fIntLock = true;
860 #ifndef USE_CONSOLE
861  // Release the underlying texture with GL and recreate
862  // it on unlock, so that the texture survives
863  // context recreation.
864  if(pGL)
865  {
866  glDeleteTextures(1, &pRef->texName);
867  pRef->texName = 0;
868  }
869 #endif
870  }
871  }
872 }
bool Lock()
Definition: C4Surface.cpp:738
unsigned char * pBits
Definition: C4Surface.h:148
bool fIntLock
Definition: C4Surface.h:161
LOCKED_RECT texLock
Definition: C4Surface.h:155
unsigned int texName
Definition: C4Surface.h:157
CStdGL * pGL
Definition: C4DrawGL.cpp:914
std::list< C4TexRef * > Textures
Definition: C4Surface.h:187

Here is the call graph for this function:

void C4TexMgr::IntUnlock ( )

Definition at line 874 of file C4Surface.cpp.

References C4TexRef::fIntLock, Textures, and C4TexRef::Unlock().

Referenced by ~C4TexMgr().

875 {
876  // unlock all internally locked textures
877  int j=Textures.size();
878  for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
879  {
880  C4TexRef *pRef = *i;
881  if (pRef->fIntLock)
882  {
883  pRef->fIntLock = false;
884  pRef->CreateTexture();
885  pRef->Unlock();
886  }
887  }
888 }
bool fIntLock
Definition: C4Surface.h:161
std::list< C4TexRef * > Textures
Definition: C4Surface.h:187
void Unlock()
Definition: C4Surface.cpp:764

Here is the call graph for this function:

Here is the caller graph for this function:

void C4TexMgr::RegTex ( C4TexRef pTex)

Definition at line 836 of file C4Surface.cpp.

References Textures.

Referenced by C4TexRef::C4TexRef().

837 {
838  // add texture to list
839  Textures.push_front(pTex);
840 }
std::list< C4TexRef * > Textures
Definition: C4Surface.h:187

Here is the caller graph for this function:

void C4TexMgr::UnregTex ( C4TexRef pTex)

Definition at line 842 of file C4Surface.cpp.

References pTexMgr, and Textures.

Referenced by C4TexRef::~C4TexRef().

843 {
844  // remove texture from list
845  Textures.remove(pTex);
846  // if list is empty, remove self
847  if (Textures.empty()) { delete this; pTexMgr=nullptr; }
848 }
C4TexMgr * pTexMgr
Definition: C4Surface.cpp:890
std::list< C4TexRef * > Textures
Definition: C4Surface.h:187

Here is the caller graph for this function:

Member Data Documentation

std::list<C4TexRef *> C4TexMgr::Textures

Definition at line 187 of file C4Surface.h.

Referenced by C4TexMgr(), IntLock(), IntUnlock(), RegTex(), and UnregTex().


The documentation for this class was generated from the following files: