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 182 of file C4Surface.h.

Constructor & Destructor Documentation

C4TexMgr::C4TexMgr ( )

Definition at line 814 of file C4Surface.cpp.

References Textures.

815 {
816  // clear textures
817  Textures.clear();
818 }
std::list< C4TexRef * > Textures
Definition: C4Surface.h:185
C4TexMgr::~C4TexMgr ( )

Definition at line 820 of file C4Surface.cpp.

References IntUnlock().

821 {
822  // unlock all textures
823  IntUnlock();
824 }
void IntUnlock()
Definition: C4Surface.cpp:864

Here is the call graph for this function:

Member Function Documentation

void C4TexMgr::IntLock ( )

Definition at line 840 of file C4Surface.cpp.

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

841 {
842  // lock all textures
843  int j=Textures.size();
844  for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
845  {
846  C4TexRef *pRef = *i;
847  if (pRef->Lock() && pRef->texLock.pBits)
848  {
849  pRef->fIntLock = true;
850 #ifndef USE_CONSOLE
851  // Release the underlying texture with GL and recreate
852  // it on unlock, so that the texture survives
853  // context recreation.
854  if(pGL)
855  {
856  glDeleteTextures(1, &pRef->texName);
857  pRef->texName = 0;
858  }
859 #endif
860  }
861  }
862 }
bool Lock()
Definition: C4Surface.cpp:728
unsigned char * pBits
Definition: C4Surface.h:146
bool fIntLock
Definition: C4Surface.h:159
LOCKED_RECT texLock
Definition: C4Surface.h:153
unsigned int texName
Definition: C4Surface.h:155
CStdGL * pGL
Definition: C4DrawGL.cpp:905
std::list< C4TexRef * > Textures
Definition: C4Surface.h:185

Here is the call graph for this function:

void C4TexMgr::IntUnlock ( )

Definition at line 864 of file C4Surface.cpp.

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

Referenced by ~C4TexMgr().

865 {
866  // unlock all internally locked textures
867  int j=Textures.size();
868  for (std::list<C4TexRef *>::iterator i=Textures.begin(); j--; ++i)
869  {
870  C4TexRef *pRef = *i;
871  if (pRef->fIntLock)
872  {
873  pRef->fIntLock = false;
874  pRef->CreateTexture();
875  pRef->Unlock();
876  }
877  }
878 }
bool fIntLock
Definition: C4Surface.h:159
std::list< C4TexRef * > Textures
Definition: C4Surface.h:185
void Unlock()
Definition: C4Surface.cpp:754

Here is the call graph for this function:

Here is the caller graph for this function:

void C4TexMgr::RegTex ( C4TexRef pTex)

Definition at line 826 of file C4Surface.cpp.

References Textures.

Referenced by C4TexRef::C4TexRef().

827 {
828  // add texture to list
829  Textures.push_front(pTex);
830 }
std::list< C4TexRef * > Textures
Definition: C4Surface.h:185

Here is the caller graph for this function:

void C4TexMgr::UnregTex ( C4TexRef pTex)

Definition at line 832 of file C4Surface.cpp.

References pTexMgr, and Textures.

Referenced by C4TexRef::~C4TexRef().

833 {
834  // remove texture from list
835  Textures.remove(pTex);
836  // if list is empty, remove self
837  if (Textures.empty()) { delete this; pTexMgr=nullptr; }
838 }
C4TexMgr * pTexMgr
Definition: C4Surface.cpp:880
std::list< C4TexRef * > Textures
Definition: C4Surface.h:185

Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 185 of file C4Surface.h.

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


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