Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

TexWnd.cpp File Reference

#include "stdafx.h"
#include <assert.h>
#include "Radiant.h"
#include "TexWnd.h"
#include "qe3.h"
#include "io.h"
#include "PrefsDlg.h"
#include "shaderinfo.h"
#include "pakstuff.h"
#include "str.h"

Include dependency graph for TexWnd.cpp:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  SkinInfo

Defines

#define FONT_HEIGHT   10
#define MAX_TEXTUREDIRS   128
#define TYP_MIPTEX   68

Functions

 BEGIN_MESSAGE_MAP (CTexWnd, CWnd) ON_WM_CREATE() ON_WM_SIZE() ON_WM_PARENTNOTIFY() ON_WM_TIMER() ON_WM_KEYDOWN() ON_WM_KEYUP() ON_WM_PAINT() ON_WM_VSCROLL() ON_COMMAND(ID_TEXTURES_FLUSH
void Delay (float fSeconds)
void DemandLoadShaderTexture (qtexture_t *q, CShaderInfo *pShader)
bool DoesFileExist (const char *pBuff, long &lSize)
void FillTextureMenu (CStringArray *pArray)
HWND FindEditWindow ()
void FreeShaders ()
const char * GetTextureExtension (int nIndex)
int GetTextureExtensionCount ()
CShaderInfohasShader (const char *pName)
int imax (int iFloor, int i)
 IMPLEMENT_DYNCREATE (CTexWnd, CWnd)
void LoadShader (char *pFilename, qtexture_t *q)
void LoadShaders ()
void LoadShadersFromDir (const char *pPath)
OnTexturesFlush ON_BN_CLICKED (1200, OnShaderClick) END_MESSAGE_MAP() LONG WINAPI TexWndProc(HWND hWnd
void R_MipMap (byte *in, int &width, int &height)
void ReloadShaders ()
void ReplaceQTexture (qtexture_t *pOld, qtexture_t *pNew, brush_t *pList)
void SelectTexture (int mx, int my, bool bShift, bool bFitScale=false)
CShaderInfoSetNameShaderInfo (qtexture_t *q, const char *pPath, const char *pName)
void SetTexParameters (void)
bool ShaderQTextureExists (const char *pName)
void SortTextures (void)
void Texture_Cleanup (CStringList *pList)
void Texture_ClearInuse (void)
qtexture_tTexture_CreateSolid (const char *name)
void Texture_Draw2 (int width, int height)
void Texture_Flush (bool bReload)
void Texture_FlushUnused ()
qtexture_tTexture_ForName (const char *name, bool bReplace, bool bShader, bool bNoAlpha, bool bReload, bool makeShader)
qtexture_tTexture_ForNamePath (char *name, char *pFullPath)
void Texture_Init (bool bHardInit)
void Texture_InitPalette (byte *pal)
void Texture_LoadFromPlugIn (LPVOID vp)
int WINAPI Texture_LoadSkin (char *pName, int *pnWidth, int *pnHeight)
qtexture_tTexture_LoadTexture (miptex_t *qtex)
qtexture_tTexture_LoadTGATexture (unsigned char *pPixels, int nWidth, int nHeight, char *pPath)
qtexture_tTexture_LoadTGATexture (unsigned char *pPixels, int nWidth, int nHeight, char *pPath, int nFlags, int nContents, int nValue)
qtexture_tTexture_MakeDefault (void)
qtexture_tTexture_MakeNoshadertexture (const char *name)
void Texture_MakeNotexture (void)
void Texture_MouseDown (int x, int y, int buttons)
void Texture_MouseMoved (int x, int y, int buttons)
void Texture_MouseUp (int x, int y, int buttons)
qtexture_tTexture_NextPos (int *x, int *y)
void Texture_Remove (qtexture_t *q)
void Texture_ResetPosition ()
void Texture_SetInuse (void)
void Texture_SetMode (int iMenu)
void Texture_SetTexture (texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef *pTexdef, bool bSetSelection)
void Texture_ShowAll ()
void Texture_ShowDirectory (char *pPath, bool bLinked)
void Texture_ShowDirectory (int menunum, bool bLinked)
void Texture_ShowInuse (void)
void Texture_StartPos (void)
void ViewShader (const char *pFile, const char *pName)

Variables

int current_row
qtexture_tcurrent_texture = NULL
int current_x
int current_y
bool g_bFilterEnabled = false
char g_cLastChar
qboolean g_dontuse = true
CPtrArray g_lstShaders
CPtrArray g_lstSkinCache
int g_nCurrentTextureMenuName
int g_nTextureOffset = 0
int g_nTimerHandle = -1
qtexture_tg_pluginTexture = NULL
CString g_strFilter
HFONT ghFont = NULL
Str m_gStr
qboolean nomips = false
qtexture_tnotexture = NULL
HDC s_hdcTexture = NULL
HGLRC s_hglrcTexture = NULL
unsigned tex_palette [256]
char texture_directory [128]
int texture_extension_number = 1
char texture_menunames [MAX_TEXTUREDIRS][128]
int texture_mode = GL_LINEAR_MIPMAP_LINEAR
int texture_nummenus
qboolean texture_showinuse
int textures_cursorx
int textures_cursory
OnTexturesFlush UINT uMsg
OnTexturesFlush UINT WPARAM wParam


Define Documentation

#define FONT_HEIGHT   10
 

Definition at line 54 of file TexWnd.cpp.

Referenced by Texture_Draw2(), Texture_NextPos(), and Texture_SetTexture().

#define MAX_TEXTUREDIRS   128
 

Definition at line 84 of file TexWnd.cpp.

#define TYP_MIPTEX   68
 

Definition at line 46 of file TexWnd.cpp.


Function Documentation

BEGIN_MESSAGE_MAP CTexWnd  ,
CWnd 
 

void Delay float  fSeconds  ) 
 

Definition at line 2148 of file TexWnd.cpp.

References DWORD.

Referenced by ViewShader().

02149 {
02150   DWORD dw = ::GetTickCount();
02151   DWORD dwTil = dw + (fSeconds * 1000);
02152   while (::GetTickCount() < dwTil)
02153   {
02154     MSG msg;
02155     if (::PeekMessage( &msg, NULL, 0, 0, PM_REMOVE )) 
02156     { 
02157       TranslateMessage(&msg);
02158       DispatchMessage(&msg);
02159     }
02160   }
02161 }

void DemandLoadShaderTexture qtexture_t q,
CShaderInfo pShader
 

Definition at line 816 of file TexWnd.cpp.

References qtexture_s::bFromShader, QEGlobals_t::d_project_entity, qtexture_s::fTrans, g_qeglobals, CShaderInfo::m_fTransValue, CShaderInfo::m_nFlags, CShaderInfo::m_pQTexture, CShaderInfo::m_strName, CShaderInfo::m_strShaderName, CShaderInfo::m_strTextureName, qtexture_s::name, qtexture_s::nShaderFlags, NULL, q, qtexture_t, qtexture_s::shadername, sprintf(), strcpy(), StripExtension(), Sys_Printf(), Texture_ForName(), Texture_ForNamePath(), and ValueForKey().

Referenced by LoadShader(), LoadShadersFromDir(), and Texture_ForName().

00817 {
00818   char cWork[1024];
00819   char cWork2[1024];
00820   strcpy(cWork, (pShader->m_strTextureName.GetLength() > 0) ? pShader->m_strTextureName  : pShader->m_strName);
00821   StripExtension(cWork);
00822   // TTimo: if the shader has a m_fTransValue != 1.0f, ignore the alpha channel when loading the texture
00823   // in some cases (common/weapclip) the 32bit .tga has an empty alpha channel,
00824   // causing a display bug in the camera view (brush does not seemed drawn since alpha==0 for the texture)
00825   // NOTE: the workaround is not perfect, the same texture may have been loaded earlier with it's alpha channel
00826   q = Texture_ForName (cWork, false, true, pShader->m_fTransValue != 1.0f, true, false);
00827 
00828   if (q == NULL || q == notexture) {
00829     sprintf(cWork2, "%s/%s",ValueForKey(g_qeglobals.d_project_entity, "basepath"), cWork);
00830     q = Texture_ForNamePath( cWork, cWork2);
00831 
00832     if (q == NULL || q == notexture) {
00833       q = Texture_ForName (cWork, false, true, pShader->m_fTransValue != 1.0f, true, true);
00834     }
00835   }
00836 
00837   if (q != NULL && q != notexture)
00838   {
00839     pShader->m_pQTexture = q;
00840     strcpy(q->shadername, pShader->m_strShaderName);
00841     q->bFromShader = true;
00842     q->fTrans = pShader->m_fTransValue;
00843     q->nShaderFlags = pShader->m_nFlags;
00844     strcpy(q->name, pShader->m_strName );
00845   }
00846   else
00847   {
00848     Sys_Printf("Could not load shader editor image %s\n", cWork);
00849   }
00850 }

Here is the call graph for this function:

bool DoesFileExist const char *  pBuff,
long &  lSize
 

Definition at line 78 of file QE3.CPP.

References file.

Referenced by Map_Snapshot().

00079 {
00080   CFile file;
00081   if (file.Open(pBuff, CFile::modeRead | CFile::shareDenyNone))
00082   {
00083     lSize += file.GetLength();
00084     file.Close();
00085     return true;
00086   }
00087   return false;
00088 }

void FillTextureMenu CStringArray *  pArray  ) 
 

Definition at line 1485 of file TexWnd.cpp.

References AddToDirListAlphabetized(), ClearDirList(), CMD_TEXTUREWAD, QEGlobals_t::d_hwndMain, QEGlobals_t::d_project_entity, DIRLIST, FROMDISK, g_pParentWnd, g_qeglobals, GetPackTextureDirs(), CMainFrame::GetPlugInMgr(), CPlugInManager::GetTextureInfo(), i, _QERTextureInfo::m_bWadStyle, MENU_TEXTURE, DirListStruct::next, sprintf(), strcat(), strcpy(), texture_menunames, texture_nummenus, and ValueForKey().

Referenced by CDialogTextures::OnInitDialog(), QE_LoadProject(), and CMainFrame::SetButtonMenuStates().

01486 {
01487     HMENU   hmenu;
01488     int     i;
01489     struct _finddata_t fileinfo;
01490     int     handle;
01491     char    dirstring[1024];
01492     char    *path;
01493     DIRLIST *list = NULL, *temp;
01494 
01495   if (g_pParentWnd->GetPlugInMgr().GetTextureInfo() != NULL)
01496   {
01497     if (g_pParentWnd->GetPlugInMgr().GetTextureInfo()->m_bWadStyle)
01498       return;
01499   }
01500 
01501     hmenu = GetSubMenu (GetMenu(g_qeglobals.d_hwndMain), MENU_TEXTURE);
01502 
01503     // delete everything
01504     for (i=0 ; i<texture_nummenus ; i++)
01505         DeleteMenu (hmenu, CMD_TEXTUREWAD+i, MF_BYCOMMAND);
01506 
01507   texture_nummenus = 0;
01508 
01509     // add everything
01510   if (g_qeglobals.d_project_entity)
01511   {
01512     //--if (g_PrefsDlg.m_bUseShaders)
01513     //--{
01514       //--  path = ValueForKey (g_qeglobals.d_project_entity, "basepath");
01515       //--  sprintf (dirstring, "%s/scripts/*.shader", path);
01516     //--
01517     //--}
01518     //--else
01519     //--{
01520         path = ValueForKey (g_qeglobals.d_project_entity, "texturepath");
01521         sprintf (dirstring, "%s/*.*", path);
01522     //--}
01523 
01524       handle = _findfirst (dirstring, &fileinfo);
01525       if (handle != -1)
01526     {
01527         do
01528         {
01529         //--if (g_PrefsDlg.m_bUseShaders)
01530         //--{
01531             //--  if ((fileinfo.attrib & _A_SUBDIR))
01532         //--    continue;
01533         //--}
01534         //--else
01535         //--{
01536               if (!(fileinfo.attrib & _A_SUBDIR))
01537                 continue;
01538               if (fileinfo.name[0] == '.')
01539                 continue;
01540         //--}
01541         // add this directory to the menu
01542           AddToDirListAlphabetized(&list, fileinfo.name, FROMDISK);
01543         } while (_findnext( handle, &fileinfo ) != -1);
01544 
01545         _findclose (handle);
01546     }
01547 
01548     //--if (!g_PrefsDlg.m_bUseShaders)
01549     //--{
01550       GetPackTextureDirs(&list);
01551     //--}
01552 
01553       for(temp = list; temp; temp = temp->next)
01554       {
01555           AppendMenu (hmenu, MF_ENABLED|MF_STRING, CMD_TEXTUREWAD+texture_nummenus, (LPCTSTR)temp->dirname);
01556           strcpy (texture_menunames[texture_nummenus], temp->dirname);
01557       //--if (!g_PrefsDlg.m_bUseShaders)
01558       //--{
01559             strcat (texture_menunames[texture_nummenus], "/");
01560       //--}
01561       if (pArray)
01562         pArray->Add(temp->dirname);
01563           if (++texture_nummenus == MAX_TEXTUREDIRS)
01564            break;
01565       }
01566 
01567       ClearDirList(&list);
01568   }
01569 
01570 
01571 }

Here is the call graph for this function:

HWND FindEditWindow  ) 
 

Definition at line 2133 of file TexWnd.cpp.

References NULL.

Referenced by ViewShader().

02134 {
02135   HWND hwnd = FindWindow("TEditPadForm", NULL);
02136   HWND hwndEdit = NULL;
02137   if (hwnd != NULL)
02138   {
02139     HWND hwndTab = FindWindowEx(hwnd, NULL, "TTabControl", NULL);
02140     if (hwndTab != NULL)
02141     {
02142       hwndEdit = FindWindowEx(hwndTab, NULL, "TRicherEdit", NULL);
02143     }
02144   }
02145   return hwndEdit;
02146 }

void FreeShaders  ) 
 

Definition at line 3085 of file TexWnd.cpp.

References g_lstShaders, and i.

Referenced by CMainFrame::OnDestroy(), and ReloadShaders().

03086 {
03087   int nSize = g_lstShaders.GetSize();
03088   for (int i = 0; i < nSize; i++)
03089   {
03090     CShaderInfo *pInfo = reinterpret_cast<CShaderInfo*>(g_lstShaders.ElementAt(i));
03091     delete pInfo;
03092   }
03093 
03094   g_lstShaders.RemoveAll();
03095 }

const char* GetTextureExtension int  nIndex  ) 
 

Definition at line 152 of file TexWnd.cpp.

References g_pParentWnd, g_PrefsDlg, CMainFrame::GetPlugInMgr(), CPlugInManager::GetTextureInfo(), CPrefsDlg::m_bHiColorTextures, and _QERTextureInfo::m_TextureExtension.

Referenced by Texture_ForName(), and Texture_ShowDirectory().

00153 {
00154   if ( nIndex == 0)
00155   {
00156     _QERTextureInfo *pInfo = g_pParentWnd->GetPlugInMgr().GetTextureInfo();
00157     const char *pTex = (pInfo != NULL) ? pInfo->m_TextureExtension : NULL;
00158     return (pTex == NULL) ? (g_PrefsDlg.m_bHiColorTextures == FALSE) ? "wal" : "tga" : pTex;
00159   }
00160   // return jpg for 2nd extension
00161   return "jpg";
00162 }

Here is the call graph for this function:

int GetTextureExtensionCount  ) 
 

Definition at line 147 of file TexWnd.cpp.

Referenced by Texture_ShowDirectory().

00148 {
00149   return 2;
00150 }

CShaderInfo* hasShader const char *  pName  ) 
 

Definition at line 126 of file TexWnd.cpp.

References g_lstShaders, i, and CShaderInfo::m_strName.

Referenced by QERApp_HasShader(), SetNameShaderInfo(), and Texture_ForName().

00127 {
00128   int nSize = g_lstShaders.GetSize();
00129   for (int i = 0; i < nSize; i++)
00130   {
00131     CShaderInfo *pInfo = reinterpret_cast<CShaderInfo*>(g_lstShaders.ElementAt(i));
00132     if (pInfo != NULL)
00133     {
00134       if (pInfo->m_strName.CompareNoCase(pName) == 0)
00135       {
00136         return pInfo;
00137       }
00138     }
00139   }
00140   return NULL;
00141 }

int imax int  iFloor,
int  i
 

Definition at line 2355 of file TexWnd.cpp.

References i.

02355 { if (i>iFloor) return iFloor; return i; }

IMPLEMENT_DYNCREATE CTexWnd  ,
CWnd 
 

void LoadShader char *  pFilename,
qtexture_t q
 

Definition at line 853 of file TexWnd.cpp.

References atof(), copystring(), DemandLoadShaderTexture(), FindReplace(), free(), g_lstShaders, g_PrefsDlg, GetToken(), LoadFile(), CShaderInfo::m_fTransValue, CShaderInfo::m_nFlags, CPrefsDlg::m_nShader, CShaderInfo::m_strName, CShaderInfo::m_strShaderName, CShaderInfo::m_strTextureName, n, PakLoadAnyFile(), q, QE_ConvertDOSToUnixName(), qtexture_t, CShaderInfo::setName(), ShaderQTextureExists(), StartTokenParsing(), strcmp(), strstr(), and Sys_Printf().

Referenced by LoadShaders().

00854 {
00855   char* pBuff = NULL;
00856   CString strTexture;
00857   int nSize = LoadFile(pFilename, reinterpret_cast<void**>(&pBuff));
00858   if (nSize == -1)
00859   {
00860     nSize = PakLoadAnyFile(pFilename, reinterpret_cast<void**>(&pBuff));
00861   }
00862   if (nSize > 0)
00863   {
00864     StartTokenParsing(pBuff);
00865     while (GetToken(true))
00866     {
00867       // first token should be the path + name.. (from base)
00868       CShaderInfo *pShader = new CShaderInfo();
00869       pShader->setName(token);
00870       pShader->m_strShaderName = pFilename;
00871       strTexture = token;
00872       bool bGood = true;
00873       float fTrans = 1.0;
00874       GetToken(true);
00875       if (strcmp(token, "{"))
00876       {
00877         bGood = false;
00878         break;
00879       }
00880       else
00881       {
00882         // we need to read until we hit a balanced }
00883         int nMatch = 1;
00884         while (nMatch > 0 && GetToken(true))
00885         {
00886           if (strcmp(token, "{") == 0)
00887           {
00888             nMatch++;
00889           }
00890           else if (strcmp(token, "}") == 0)
00891           {
00892             nMatch--;
00893           }
00894           else if (strcmpi(token, "qer_nocarve") == 0)
00895           {
00896             pShader->m_nFlags |= QER_NOCARVE;
00897           }
00898           else if (strcmpi(token, "qer_trans") == 0)
00899           {
00900             if (GetToken(true))
00901             {
00902               fTrans = atof(token);
00903             }
00904             pShader->m_nFlags |= QER_TRANS;
00905           }
00906           else if (strcmpi(token, "qer_editorimage") == 0)
00907           {
00908             if (GetToken(true))
00909             {
00910               char* pTex = copystring(token);
00911                 QE_ConvertDOSToUnixName( pTex, pTex );
00912               CString str = pTex;
00913               free (pTex);
00914               FindReplace(str, "textures/", "");
00915               FindReplace(str, ".tga", "");
00916               int nPos = str.Find('/');
00917               if (nPos == -1)
00918               {
00919                 nPos = str.Find('\\');
00920               }
00921               if (nPos >= 0)
00922               {
00923                 pShader->m_strTextureName = str;
00924                               pShader->m_strTextureName.MakeLower();    //avoid problems with case
00925 /*
00926                 else
00927                 {
00928                   CString strPath = str.Left(nPos+1);
00929                   DeferredShaderLoad *deferred = new DeferredShaderLoad(str, pShader->m_strName, strPath); 
00930                   g_lstDeferred.Add(deferred);
00931                 }
00932 */
00933               }
00934             }
00935           }
00936           else if (strcmpi(token, "surfaceparm") == 0)
00937           {
00938             //--while (GetToken(false))
00939             //--{
00940             //--
00941             //--}
00942             if (GetToken(true))
00943             {
00944               // next token should be a surface parm
00945               //--if (strcmpi(token, "trans") == 0)
00946               //--{
00947               //--  fTrans = 0.33;
00948               //--}
00949               if (strcmpi(token, "fog") == 0)
00950               {
00951                 if (fTrans == 1.0) // has not been explicitly set by qer_trans
00952                 {
00953                   fTrans = 0.35;
00954                 }
00955               }
00956             }
00957           }
00958         }
00959         if (nMatch != 0)
00960         {
00961           bGood = false;
00962           break;
00963         }
00964       }
00965       //--if (bGood && q)
00966       if (bGood)
00967       {
00968         pShader->m_fTransValue = fTrans;
00969         g_lstShaders.Add(pShader);
00970 
00971         int n = g_PrefsDlg.m_nShader;
00972         if (g_PrefsDlg.m_nShader == CPrefsDlg::SHADER_ALL || (g_PrefsDlg.m_nShader == CPrefsDlg::SHADER_COMMON && strstr(pShader->m_strName, "common" )))
00973         {
00974 // new 
00975           if (pShader->m_strTextureName.GetLength() > 0)
00976           {
00977             if (!ShaderQTextureExists(pShader->m_strName))
00978             {
00979               DemandLoadShaderTexture(q, pShader);
00980             }
00981           }
00982         }
00983 // end new 
00984         //--q->bFromShader = true;
00985         //--q->fTrans = fTrans;
00986 
00987         //--// good texture here
00988         //--//Sys_Printf("Test load texture %s\n", strTexture);
00989         //--// FIXME.. this is a load of crap
00990         //--strcpy(dirstring, strTexture);
00991         //--QE_ConvertDOSToUnixName(dirstring, dirstring);
00992         //--strTexture = dirstring;
00993         //--FindReplace(strTexture, "textures/", "");
00994             //--qtexture_t *q = Texture_ForName (strTexture.GetBuffer(0));
00995         //--if (q != NULL)
00996         //--{
00997         //--  q->bFromShader = true;
00998         //--  q->fTrans = fTrans;
00999         //--}
01000       }
01001       else
01002       {
01003         Sys_Printf("Error parsing shader at texture %s\n", strTexture);
01004       }
01005 
01006     }
01007     free (pBuff);
01008   }
01009   else
01010   {
01011     Sys_Printf("Unabled to read shader %s\n", pFilename);
01012   }
01013 }

Here is the call graph for this function:

void LoadShaders  ) 
 

Definition at line 3028 of file TexWnd.cpp.

References QEGlobals_t::d_project_entity, free(), g_qeglobals, GetToken(), LoadFile(), LoadShader(), PakLoadAnyFile(), POSITION, sprintf(), StartTokenParsing(), Sys_Printf(), and ValueForKey().

Referenced by ReloadShaders(), and Texture_Init().

03029 {
03030     char    dirstring[1024];
03031     char    *path;
03032     //struct _finddata_t fileinfo;
03033     //int       handle;
03034   path = ValueForKey (g_qeglobals.d_project_entity, "basepath");
03035   sprintf (dirstring, "%s/scripts/shaderlist.txt", path);
03036   char *pBuff = NULL;
03037   
03038   int nLen = LoadFile(dirstring, reinterpret_cast<void**>(&pBuff));
03039   if (nLen == -1)
03040   {
03041     nLen = PakLoadAnyFile(dirstring, reinterpret_cast<void**>(&pBuff));
03042   }
03043   if (nLen > 0)
03044   {
03045     CStringList lst;
03046     StartTokenParsing(pBuff);
03047     nLen = 0;
03048     while (GetToken(true))
03049     {
03050       // each token should be a shader filename
03051       sprintf(dirstring, "%s/scripts/%s.shader", path, token);
03052       lst.AddTail(dirstring);
03053       nLen++;
03054     }
03055     POSITION pos = lst.GetHeadPosition();
03056     while (pos != NULL)
03057     {
03058       LoadShader(lst.GetAt(pos).GetBuffer(0), NULL);
03059       lst.GetNext(pos);
03060     }
03061     free(pBuff);
03062   }
03063   else
03064   {
03065     Sys_Printf("Unable to load shaderlist.txt, shaders not loaded!");
03066   }
03067 
03068 /*
03069   handle = _findfirst (dirstring, &fileinfo);
03070   if (handle != -1)
03071   {
03072     do
03073     {
03074       if ((fileinfo.attrib & _A_SUBDIR))
03075         continue;
03076       sprintf(dirstring, "%s/scripts/%s", path, fileinfo.name);
03077       LoadShader(dirstring, NULL);
03078       } while (_findnext( handle, &fileinfo ) != -1);
03079 
03080       _findclose (handle);
03081   }
03082 */
03083 }

Here is the call graph for this function:

void LoadShadersFromDir const char *  pPath  ) 
 

Definition at line 1594 of file TexWnd.cpp.

References DemandLoadShaderTexture(), g_lstShaders, i, CShaderInfo::m_pQTexture, CShaderInfo::m_strName, NULL, q, qtexture_t, and strstr().

Referenced by Texture_ShowDirectory().

01595 {
01596   int nSize = g_lstShaders.GetSize();
01597   for (int i = 0; i < nSize; i++)
01598   {
01599     CShaderInfo *pInfo = reinterpret_cast<CShaderInfo*>(g_lstShaders.ElementAt(i));
01600     if (pInfo != NULL)
01601     {
01602       if (strstr(pInfo->m_strName, pPath) && pInfo->m_pQTexture == NULL && strstr(pInfo->m_strName, "models/player") == NULL)
01603       {
01604         qtexture_t *q = NULL;
01605         DemandLoadShaderTexture(q, pInfo);
01606       }
01607     }
01608   }
01609 }

Here is the call graph for this function:

OnTexturesFlush ON_BN_CLICKED 1200  ,
OnShaderClick 
 

void R_MipMap byte in,
int &  width,
int &  height
 

Definition at line 404 of file TexWnd.cpp.

References byte, height, i, in, j, and width.

Referenced by Texture_LoadSkin(), Texture_LoadTexture(), Texture_LoadTGATexture(), and Upload32().

00405 {
00406     int     i, j;
00407     byte    *out;
00408     int     row;
00409     
00410     row = width * 4;
00411     width >>= 1;
00412     height >>= 1;
00413     out = in;
00414     for (i=0 ; i<height ; i++, in+=row)
00415     {
00416         for (j=0 ; j<width ; j++, out+=4, in+=8)
00417         {
00418             out[0] = (in[0] + in[4] + in[row+0] + in[row+4])>>2;
00419             out[1] = (in[1] + in[5] + in[row+1] + in[row+5])>>2;
00420             out[2] = (in[2] + in[6] + in[row+2] + in[row+6])>>2;
00421             out[3] = (in[3] + in[7] + in[row+3] + in[row+7])>>2;
00422         }
00423     }
00424 }

void ReloadShaders  ) 
 

Definition at line 3097 of file TexWnd.cpp.

References QEGlobals_t::d_qtextures, FreeShaders(), g_qeglobals, LoadShaders(), qtexture_s::name, qtexture_s::next, NULL, qtexture_t, and SetNameShaderInfo().

Referenced by CMainFrame::OnTexturesReloadshaders().

03098 {
03099   FreeShaders();
03100   LoadShaders();
03101   qtexture_t* pTex = g_qeglobals.d_qtextures;
03102   while (pTex != NULL)
03103   {
03104     SetNameShaderInfo(pTex, NULL, pTex->name);
03105     pTex = pTex->next;
03106   }
03107 
03108 }

Here is the call graph for this function:

void ReplaceQTexture qtexture_t pOld,
qtexture_t pNew,
brush_t pList
 

Definition at line 1036 of file TexWnd.cpp.

References brush_s::brush_faces, brush_t, face_s::d_texture, face_t, face_s::next, brush_s::next, Patch_ReplaceQTexture(), brush_s::patchBrush, brush_s::pTerrain, qtexture_t, Terrain_ReplaceQTexture(), and brush_s::terrainBrush.

Referenced by Texture_ForName().

01037 { 
01038     for (brush_t* pBrush = pList->next ; pBrush != pList; pBrush = pBrush->next)
01039     {
01040         if (pBrush->patchBrush)
01041         {
01042             Patch_ReplaceQTexture(pBrush, pOld, pNew);
01043         }
01044         if (pBrush->terrainBrush)
01045         {
01046             Terrain_ReplaceQTexture(pBrush->pTerrain, pOld, pNew);
01047         }
01048 
01049         for (face_t* pFace = pBrush->brush_faces; pFace; pFace = pFace->next)
01050         {
01051             if (pFace->d_texture == pOld)
01052             {
01053             pFace->d_texture = pNew;
01054             }
01055         }
01056         
01057         //Brush_Build(pBrush);
01058     }
01059 }

Here is the call graph for this function:

void SelectTexture int  mx,
int  my,
bool  bShift,
bool  bFitScale = false
 

Definition at line 2218 of file TexWnd.cpp.

References bFitScale, brushprimit_texdef_t, qtexture_s::contents, QEGlobals_t::d_texturewin, qtexture_s::flags, g_pParentWnd, g_PrefsDlg, g_qeglobals, GETPLUGINTEXDEF, qtexture_s::height, texturewin_t::height, QEGlobals_t::m_bBrushPrimitMode, CPrefsDlg::m_bHiColorTextures, CPrefsDlg::m_nTextureScale, memset(), qtexture_s::name, texturewin_t::originy, q, qtexture_t, CMainFrame::SetStatusText(), qtexture_s::shadername, Sys_Status(), Texture_NextPos(), Texture_SetTexture(), Texture_StartPos(), qtexture_s::value, ViewShader(), qtexture_s::width, x, and y.

Referenced by Texture_MouseDown(), Texture_ResetPosition(), Texture_ShowDirectory(), and Texture_ShowInuse().

02219 {
02220     int     x, y;
02221     qtexture_t  *q;
02222     texdef_t    tex;
02223     brushprimit_texdef_t brushprimit_tex;
02224 
02225     my += g_qeglobals.d_texturewin.originy-g_qeglobals.d_texturewin.height;
02226     
02227     Texture_StartPos ();
02228     while (1)
02229     {
02230         q = Texture_NextPos (&x, &y);
02231         if (!q)
02232             break;
02233         int nWidth = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->width * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->width;
02234         int nHeight = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->height * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->height;
02235         if (mx > x && mx - x < nWidth
02236             && my < y && y - my < nHeight + FONT_HEIGHT)
02237         {
02238             if (bShift)
02239             {
02240                 if (g_PrefsDlg.m_bHiColorTextures && q->shadername[0] != 0)
02241                 {
02242                     //CString s = "notepad ";
02243                     //s += q->shadername;
02244                     //WinExec(s, SW_SHOWNORMAL);    
02245     
02246                     ViewShader(q->shadername, q->name);             
02247 
02248                 }
02249             }
02250             memset (&tex, 0, sizeof(tex));
02251             memset (&brushprimit_tex, 0, sizeof(brushprimit_tex));
02252             if (g_qeglobals.m_bBrushPrimitMode)
02253             {
02254                 // brushprimit fitted to a 2x2 texture
02255                 brushprimit_tex.coords[0][0] = 1.0f;
02256                 brushprimit_tex.coords[1][1] = 1.0f;
02257             }
02258             else
02259             {
02260                 tex.scale[0] = (g_PrefsDlg.m_bHiColorTextures) ? 0.5 : 1;
02261                 tex.scale[1] = (g_PrefsDlg.m_bHiColorTextures) ? 0.5 : 1;
02262             }
02263             tex.flags = q->flags;
02264             tex.value = q->value;
02265             tex.contents = q->contents;
02266             //strcpy (tex.name, q->name);
02267             tex.SetName(q->name);
02268             Texture_SetTexture ( &tex, &brushprimit_tex, bFitScale, GETPLUGINTEXDEF(q));
02269             CString strTex;
02270             CString strName = q->name;
02271             //int nPos = strName.Find('\\');
02272             //if (nPos == -1)
02273             //  nPos = strName.Find('/');
02274             //if (nPos >= 0)
02275             //  strName = strName.Right(strName.GetLength() - nPos - 1);
02276             strTex.Format("%s W: %i H: %i", strName.GetBuffer(0), q->width, q->height);
02277             g_pParentWnd->SetStatusText(3, strTex);
02278             return;
02279         }
02280     }
02281 
02282     Sys_Status("Did not select a texture\n", 0);
02283 }

Here is the call graph for this function:

CShaderInfo* SetNameShaderInfo qtexture_t q,
const char *  pPath,
const char *  pName
 

Definition at line 1017 of file TexWnd.cpp.

References qtexture_s::bFromShader, qtexture_s::fTrans, hasShader(), CShaderInfo::m_fTransValue, CShaderInfo::m_nFlags, CShaderInfo::m_strShaderName, qtexture_s::name, qtexture_s::nShaderFlags, q, qtexture_t, qtexture_s::shadername, strcpy(), StripExtension(), and strncpy().

Referenced by QERApp_TryTextureForName(), ReloadShaders(), and Texture_ForName().

01018 {
01019   CShaderInfo *pInfo = hasShader(pName);
01020   if (pInfo)
01021   {
01022     strcpy(q->shadername, pInfo->m_strShaderName);
01023     q->bFromShader = true;
01024     q->fTrans = pInfo->m_fTransValue;
01025     q->nShaderFlags = pInfo->m_nFlags;
01026   }
01027   else
01028   {
01029     q->shadername[0] = 0;
01030   }
01031   strncpy (q->name, pName, sizeof(q->name) - 1);
01032     StripExtension (q->name);
01033   return pInfo;
01034 }

Here is the call graph for this function:

void SetTexParameters void   ) 
 

Definition at line 269 of file TexWnd.cpp.

References qglTexParameteri, and texture_mode.

Referenced by Texture_CreateSolid(), Texture_LoadSkin(), Texture_LoadTexture(), Texture_LoadTGATexture(), Texture_MakeDefault(), Texture_MakeNoshadertexture(), and Texture_SetMode().

00270 {
00271     qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texture_mode );
00272     
00273     switch ( texture_mode )
00274     {
00275     case GL_NEAREST:
00276     case GL_NEAREST_MIPMAP_NEAREST:
00277     case GL_NEAREST_MIPMAP_LINEAR:
00278         qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
00279         break;
00280     case GL_LINEAR:
00281     case GL_LINEAR_MIPMAP_NEAREST:
00282     case GL_LINEAR_MIPMAP_LINEAR:
00283         qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
00284         break;
00285     }
00286 }

bool ShaderQTextureExists const char *  pName  ) 
 

Definition at line 113 of file TexWnd.cpp.

References QEGlobals_t::d_qtextures, g_qeglobals, qtexture_s::name, qtexture_s::next, q, qtexture_t, and strcmp().

Referenced by LoadShader().

00114 {
00115   for (qtexture_t *q=g_qeglobals.d_qtextures ; q ; q=q->next)
00116   {
00117     if (!strcmp(q->name,  pName))
00118     {
00119       return true;
00120     }
00121   }
00122   return false;
00123 
00124 }

Here is the call graph for this function:

void SortTextures void   ) 
 

Definition at line 164 of file TexWnd.cpp.

References QEGlobals_t::d_qtextures, g_qeglobals, qtexture_s::name, qtexture_s::next, q, qtexture_t, and strcmp().

Referenced by Texture_ShowDirectory(), Texture_ShowInuse(), and CTexWnd::UpdateFilter().

00165 {   
00166     qtexture_t  *q, *qtemp, *qhead, *qcur, *qprev;
00167 
00168     // standard insertion sort
00169     // Take the first texture from the list and
00170     // add it to our new list
00171     if ( g_qeglobals.d_qtextures == NULL)
00172         return; 
00173 
00174     qhead = g_qeglobals.d_qtextures;
00175     q = g_qeglobals.d_qtextures->next;
00176     qhead->next = NULL;
00177     
00178     // while there are still things on the old
00179     // list, keep adding them to the new list
00180     while (q)
00181     {
00182         qtemp = q;
00183         q = q->next;
00184         
00185         qprev = NULL;
00186         qcur = qhead;
00187 
00188         while (qcur)
00189         {
00190             // Insert it here?
00191             if (strcmp(qtemp->name, qcur->name) < 0)
00192             {
00193                 qtemp->next = qcur;
00194                 if (qprev)
00195                     qprev->next = qtemp;
00196                 else
00197                     qhead = qtemp;
00198                 break;
00199             }
00200             
00201             // Move on
00202 
00203             qprev = qcur;
00204             qcur = qcur->next;
00205 
00206 
00207             // is this one at the end?
00208 
00209             if (qcur == NULL)
00210             {
00211                 qprev->next = qtemp;
00212                 qtemp->next = NULL;
00213             }
00214         }
00215 
00216 
00217     }
00218 
00219     g_qeglobals.d_qtextures = qhead;
00220 }

Here is the call graph for this function:

void Texture_Cleanup CStringList *  pList  ) 
 

Definition at line 2575 of file TexWnd.cpp.

References QEGlobals_t::bSurfacePropertiesPlugin, QEGlobals_t::d_qtextures, free(), g_lstSkinCache, g_qeglobals, GETPLUGINTEXDEF, i, qtexture_s::name, qtexture_s::next, NULL, qtexture_s::pData, qtexture_t, and Sys_Printf().

Referenced by CMainFrame::OnDestroy(), and Texture_Flush().

02576 {
02577   if (g_qeglobals.d_qtextures)
02578   {
02579       qtexture_t* pTex = g_qeglobals.d_qtextures->next;
02580     while (pTex != NULL && pTex != g_qeglobals.d_qtextures)
02581     {
02582       qtexture_t* pNextTex = pTex->next;
02583       if (pList)
02584       {
02585         if (pTex->name[0] != '(')
02586         {
02587           pList->AddTail(pTex->name);
02588         }
02589       }
02590 
02591       if (g_qeglobals.bSurfacePropertiesPlugin)
02592         {
02593             // Timo
02594             // Surface properties plugin
02595 #ifdef _DEBUG
02596           if ( !pTex->pData )
02597               Sys_Printf("WARNING: found a qtexture_t* with no IPluginQTexture\n");
02598 #endif
02599           if ( pTex->pData )
02600               GETPLUGINTEXDEF(pTex)->DecRef();
02601       }
02602         free(pTex);
02603       pTex = pNextTex;
02604     }
02605   }
02606 
02607   int nSize = g_lstSkinCache.GetSize();
02608   for (int i = 0; i < nSize; i++)
02609   {
02610     SkinInfo *pInfo = reinterpret_cast<SkinInfo*>(g_lstSkinCache.GetAt(i));
02611     delete pInfo;
02612   }
02613 
02614 }

Here is the call graph for this function:

void Texture_ClearInuse void   ) 
 

Definition at line 1581 of file TexWnd.cpp.

References QEGlobals_t::d_qtextures, g_qeglobals, qtexture_s::inuse, qtexture_s::next, q, and qtexture_t.

Referenced by Map_Free(), Texture_ShowDirectory(), and Texture_ShowInuse().

01582 {
01583     qtexture_t  *q;
01584 
01585     for (q=g_qeglobals.d_qtextures ; q ; q=q->next)
01586     {
01587         q->inuse = false;
01588     }
01589 }

qtexture_t* Texture_CreateSolid const char *  name  ) 
 

Definition at line 705 of file TexWnd.cpp.

References QEGlobals_t::bSurfacePropertiesPlugin, byte, data, g_PrefsDlg, g_qeglobals, g_SurfaceTable, GETPLUGINTEXDEF, CPrefsDlg::m_bSGIOpenGL, _QERPlugSurfaceTable::m_pfnQTextureAlloc, name, qtexture_s::pData, q, qglBindTexture, qglTexImage2D, qmalloc(), qtexture_t, SetTexParameters(), sscanf(), and texture_extension_number.

Referenced by Texture_ForName(), and Texture_ForNamePath().

00706 {
00707     byte    data[4];
00708     qtexture_t  *q;
00709 
00710   q = (qtexture_t*)qmalloc(sizeof(*q));
00711 
00712   if (g_qeglobals.bSurfacePropertiesPlugin)
00713   {
00714       // Timo
00715       // Surface properties plugins can store their own data in an IPluginQTexture
00716       q->pData = g_SurfaceTable.m_pfnQTextureAlloc( q );
00717       GETPLUGINTEXDEF(q)->SetDefaultTexdef();
00718   }
00719     
00720     sscanf (name, "(%f %f %f)", &q->color[0], &q->color[1], &q->color[2]);
00721 
00722     data[0] = q->color[0]*255;
00723     data[1] = q->color[1]*255;
00724     data[2] = q->color[2]*255;
00725     data[3] = 255;
00726 
00727     q->width = q->height = 1;
00728     //q->width = q->height = 2;
00729   q->texture_number = texture_extension_number++;
00730     qglBindTexture( GL_TEXTURE_2D, q->texture_number );
00731     SetTexParameters ();
00732 
00733   if (g_PrefsDlg.m_bSGIOpenGL)
00734   {
00735         qglTexImage2D(GL_TEXTURE_2D, 0, 3, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
00736   }
00737   else
00738   {
00739       if (nomips)
00740           qglTexImage2D(GL_TEXTURE_2D, 0, 3, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
00741       else
00742           qgluBuild2DMipmaps(GL_TEXTURE_2D, 3, 1, 1,GL_RGBA, GL_UNSIGNED_BYTE, data);
00743   }
00744     qglBindTexture( GL_TEXTURE_2D, 0 );
00745 
00746     return q;
00747 }

Here is the call graph for this function:

void Texture_Draw2 int  width,
int  height
 

Definition at line 2363 of file TexWnd.cpp.

References abs(), qtexture_s::bFromShader, COLOR_TEXTUREBACK, SavedInfo_t::colors, QEGlobals_t::d_savedinfo, QEGlobals_t::d_texturewin, FONT_HEIGHT, g_PrefsDlg, g_qeglobals, qtexture_s::height, texturewin_t::height, height, qtexture_s::inuse, CPrefsDlg::m_bHiColorTextures, CPrefsDlg::m_nTextureScale, texturewin_t::m_nTotalHeight, name, qtexture_s::name, texdef_t::name, texturewin_t::originy, q, QE_CheckOpenGLForErrors(), qglBegin, qglBindTexture, qglCallLists, qglClear, qglClearColor, qglColor3f, qglDisable, qglEnable, qglEnd, qglFinish, qglLineWidth, qglLoadIdentity, qglMatrixMode, qglOrtho, qglPolygonMode, qglRasterPos2f, qglTexCoord2f, qglVertex2f, qglViewport, qtexture_t, s, qtexture_s::shadername, strlen(), texturewin_t::texdef, Texture_NextPos(), qtexture_s::texture_number, Texture_StartPos(), qtexture_s::width, texturewin_t::width, width, x, and y.

Referenced by CTexWnd::OnPaint().

02364 {
02365     qtexture_t  *q;
02366     int         x, y;
02367     char        *name;
02368 
02369     qglClearColor (
02370         g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][0],
02371         g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][1],
02372         g_qeglobals.d_savedinfo.colors[COLOR_TEXTUREBACK][2],
02373         0);
02374     qglViewport (0,0,width,height);
02375     qglMatrixMode(GL_PROJECTION);
02376     qglLoadIdentity ();
02377 
02378     qglClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
02379     qglDisable (GL_DEPTH_TEST);
02380     qglDisable(GL_BLEND);
02381     qglOrtho (0, width, g_qeglobals.d_texturewin.originy-height, g_qeglobals.d_texturewin.originy, -100, 100);
02382     qglEnable (GL_TEXTURE_2D);
02383 
02384     qglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
02385     g_qeglobals.d_texturewin.width = width;
02386     g_qeglobals.d_texturewin.height = height;
02387     Texture_StartPos ();
02388 
02389     while (1)
02390     {
02391         q = Texture_NextPos (&x, &y);
02392         if (!q)
02393             break;
02394 
02395     int nWidth = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->width * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->width;
02396     int nHeight = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->height * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->height;
02397         // Is this texture visible?
02398         if ( (y-nHeight-FONT_HEIGHT < g_qeglobals.d_texturewin.originy)
02399             && (y > g_qeglobals.d_texturewin.originy - height) )
02400         {
02401 
02402             // if in use, draw a background
02403             if ((q->inuse && !texture_showinuse) || q->bFromShader)
02404             {
02405                 qglLineWidth (1);
02406 
02407         if (q->bFromShader)
02408         {
02409                   qglColor3f (1,1,1);
02410         }
02411         else
02412         {
02413                   qglColor3f (0.5,1,0.5);
02414         }
02415                 qglDisable (GL_TEXTURE_2D);
02416 
02417                 qglBegin (GL_LINE_LOOP);
02418                 qglVertex2f (x-1,y+1-FONT_HEIGHT);
02419                 qglVertex2f (x-1,y-nHeight-1-FONT_HEIGHT);
02420                 qglVertex2f (x+1+nWidth,y-nHeight-1-FONT_HEIGHT);
02421                 qglVertex2f (x+1+nWidth,y+1-FONT_HEIGHT);
02422                 qglEnd ();
02423 
02424                 qglEnable (GL_TEXTURE_2D);
02425             }
02426 
02427             // Draw the texture
02428       float fScale = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? ((float)g_PrefsDlg.m_nTextureScale / 100) : 1.0;
02429 
02430             qglBindTexture( GL_TEXTURE_2D, q->texture_number );
02431       QE_CheckOpenGLForErrors();
02432             qglColor3f (1,1,1);
02433             qglBegin (GL_QUADS);
02434             qglTexCoord2f (0,0);
02435             qglVertex2f (x,y-FONT_HEIGHT);
02436             qglTexCoord2f (1,0);
02437             qglVertex2f (x+nWidth,y-FONT_HEIGHT);
02438             qglTexCoord2f (1,1);
02439             qglVertex2f (x+nWidth,y-FONT_HEIGHT-nHeight);
02440             qglTexCoord2f (0,1);
02441             qglVertex2f (x,y-FONT_HEIGHT-nHeight);
02442             qglEnd ();
02443 
02444             // draw the selection border
02445             if (!strcmpi(g_qeglobals.d_texturewin.texdef.name, q->name))
02446             {
02447                 qglLineWidth (3);
02448                 qglColor3f (1,0,0);
02449                 qglDisable (GL_TEXTURE_2D);
02450 
02451                 qglBegin (GL_LINE_LOOP);
02452                 qglVertex2f (x-4,y-FONT_HEIGHT+4);
02453                 qglVertex2f (x-4,y-FONT_HEIGHT-nHeight-4);
02454                 qglVertex2f (x+4+nWidth,y-FONT_HEIGHT-nHeight-4);
02455                 qglVertex2f (x+4+nWidth,y-FONT_HEIGHT+4);
02456                 qglEnd ();
02457 
02458                 qglEnable (GL_TEXTURE_2D);
02459                 qglLineWidth (1);
02460             }
02461 
02462             // draw the texture name
02463       qglColor3f (0,0,0);
02464             
02465       qglRasterPos2f (x, y-FONT_HEIGHT+2);
02466 
02467             // don't draw the directory name
02468             for (name = q->name ; *name && *name != '/' && *name != '\\' ; name++)
02469                 ;
02470             if (!*name)
02471                 name = q->name;
02472             else
02473                 name++;
02474 
02475       if (g_PrefsDlg.m_bHiColorTextures && q->shadername[0] != 0)
02476       {
02477         // slow as shit
02478         CString s = "[";
02479         s += name;
02480         s += "]";
02481               qglCallLists (s.GetLength(), GL_UNSIGNED_BYTE, s.GetBuffer(0));
02482       }
02483       else
02484       {
02485               qglCallLists (strlen(name), GL_UNSIGNED_BYTE, name);
02486       }
02487         }
02488     }
02489 
02490     g_qeglobals.d_texturewin.m_nTotalHeight = abs(y) + 100;
02491     // reset the current texture
02492     qglBindTexture( GL_TEXTURE_2D, 0 );
02493     qglFinish();
02494 }

Here is the call graph for this function:

void Texture_Flush bool  bReload  ) 
 

Definition at line 2621 of file TexWnd.cpp.

References ConfirmModified(), QEGlobals_t::d_qtextures, g_qeglobals, GLuint(), Map_New(), POSITION, QE_CheckOpenGLForErrors(), qglDeleteTextures, qglGenTextures, Texture_Cleanup(), texture_extension_number, Texture_ForName(), and Texture_Init().

Referenced by CMainFrame::OnTexturesFlush().

02622 {
02623   if (!ConfirmModified())
02624     return;
02625 
02626   Map_New ();
02627 
02628   CWaitCursor cursor;
02629   CStringList strList;
02630   Texture_Init(false);
02631   Texture_Cleanup(&strList);
02632 
02633   GLuint* pGln = new GLuint[texture_extension_number-1];
02634   qglGenTextures(texture_extension_number-1, pGln);
02635   QE_CheckOpenGLForErrors();
02636   qglDeleteTextures(texture_extension_number-1, pGln);
02637   QE_CheckOpenGLForErrors();
02638   delete []pGln;
02639   texture_extension_number = 1;
02640     g_qeglobals.d_qtextures = NULL;
02641 
02642   if (bReload)
02643   {
02644     POSITION pos = strList.GetHeadPosition();
02645     while (pos)
02646     {
02647       CString strTex = strList.GetNext(pos);
02648           Texture_ForName (strTex.GetBuffer(0));
02649     }
02650   }
02651 
02652 }

Here is the call graph for this function:

void Texture_FlushUnused  ) 
 

Definition at line 2536 of file TexWnd.cpp.

References QEGlobals_t::bSurfacePropertiesPlugin, QEGlobals_t::d_qtextures, free(), g_qeglobals, GETPLUGINTEXDEF, qtexture_s::inuse, qtexture_s::next, NULL, qtexture_s::pData, qglDeleteTextures, qtexture_t, Sys_Printf(), qtexture_s::texture_number, and Texture_ShowInuse().

Referenced by CMainFrame::OnTexturesFlushUnused().

02537 {
02538   CWaitCursor cursor;
02539   Texture_ShowInuse();
02540   if (g_qeglobals.d_qtextures)
02541   {
02542       qtexture_t* pTex = g_qeglobals.d_qtextures->next;
02543     qtexture_t *pPrev = g_qeglobals.d_qtextures;
02544     while (pTex != NULL && pTex != g_qeglobals.d_qtextures)
02545     {
02546       qtexture_t* pNextTex = pTex->next;
02547       if (g_qeglobals.bSurfacePropertiesPlugin)
02548         {
02549             // Timo
02550             // Surface properties plugin
02551 #ifdef _DEBUG
02552           if ( !pTex->pData )
02553               Sys_Printf("WARNING: found a qtexture_t* with no IPluginQTexture\n");
02554 #endif
02555           if ( pTex->pData && pTex->inuse )
02556               GETPLUGINTEXDEF(pTex)->DecRef();
02557       }
02558 
02559       if (!pTex->inuse)
02560       {
02561         unsigned int nTexture = pTex->texture_number;
02562         qglDeleteTextures(1, &nTexture);
02563         pPrev->next = pNextTex;
02564           free(pTex);
02565       }
02566       else
02567       {
02568         pPrev = pTex;
02569       }
02570       pTex = pNextTex;
02571     }
02572   }
02573 }

Here is the call graph for this function:

qtexture_t* Texture_ForName const char *  name,
bool  bReplace,
bool  bShader,
bool  bNoAlpha,
bool  bReload,
bool  makeShader
 

Definition at line 1154 of file TexWnd.cpp.

References active_brushes, byte, QEGlobals_t::d_hdcBase, QEGlobals_t::d_hglrcBase, QEGlobals_t::d_project_entity, QEGlobals_t::d_qtextures, DemandLoadShaderTexture(), qtexture_s::filename, filtered_brushes, free(), g_pParentWnd, g_PrefsDlg, g_qeglobals, CMainFrame::GetPlugInMgr(), GetTextureExtension(), CPlugInManager::GetTextureInfo(), hasShader(), HDC(), HGLRC, qtexture_s::inuse, LoadFile(), LoadImage(), CPlugInManager::LoadTexture(), CPrefsDlg::m_bHiColorTextures, CPrefsDlg::m_bSGIOpenGL, _QERTextureInfo::m_bWadStyle, CShaderInfo::m_pQTexture, miptex_t, qtexture_s::name, name, qtexture_s::next, NULL, PakLoadFile(), q, QE_ConvertDOSToUnixName(), qtexture_t, ReplaceQTexture(), SetNameShaderInfo(), sprintf(), strcmp(), strcpy(), StripExtension(), strlen(), strncpy(), Sys_Printf(), Texture_CreateSolid(), Texture_LoadTexture(), Texture_LoadTGATexture(), Texture_MakeDefault(), Texture_MakeNoshadertexture(), Texture_Remove(), and ValueForKey().

Referenced by Brush_BuildWindings(), Brush_Parse(), CPlugInManager::CommitPatchHandleToMap(), DemandLoadShaderTexture(), Drag_Begin(), Face_FullClone(), FindReplaceTextures(), Patch_FindReplaceTexture(), Patch_FromTriangle(), Patch_GenericMesh(), Patch_Parse(), Patch_SetTexture(), QERApp_Texture_ForName(), SetFaceTexdef(), SetTerrainTexdef(), Terrain_AddMovePoint(), Terrain_FindReplaceTexture(), Terrain_ParseFace(), Terrain_SetTexture(), Texture_Flush(), Texture_ShowDirectory(), Texture_ShowInuse(), and Z_Draw().

01155 {
01156   byte    *lump;
01157     qtexture_t  *q = NULL;
01158     char    filename[1024];
01159     
01160   if (name == NULL || strlen(name) == 0)
01161         return notexture;
01162     
01163     qtexture_t *pRemove = NULL;
01164     
01165     if (!bReload)
01166     {
01167         for (q=g_qeglobals.d_qtextures ; q ; q=q->next)
01168         {
01169             if (!strcmp(name,  q->name))
01170             {
01171                 if (bReplace)
01172                 {
01173                     pRemove = q;
01174                     //Texture_Remove(q);
01175                     break;
01176                 }
01177                 else
01178                 {
01179 #ifdef _DEBUG
01180                     // if the texture is already in memory, then the bNoAlpha flag doesn't have any influence
01181                     if (bNoAlpha)
01182                         Sys_Printf("WARNING: bNoAlpha flag on an already loaded texture\n");
01183 #endif
01184                     if (!g_dontuse)
01185                     {
01186                         q->inuse = true;
01187                     }
01188                     return q;
01189                 }
01190             }
01191         }
01192     }
01193 
01194   // did not find it in the standard list
01195   // skip entity names (
01196   if (!bShader && name[0] != '(')
01197   {
01198     CShaderInfo* pShader = hasShader(name);
01199     if (pShader)
01200     {
01201       if (pShader->m_pQTexture == NULL)
01202       {
01203         DemandLoadShaderTexture(q, pShader);
01204       }
01205       q = pShader->m_pQTexture;
01206       //Sys_Printf ("used Shader %s.\n", pShader->m_strName);
01207     }
01208     if ( q != NULL)
01209     {
01210       return q;
01211     }
01212   }
01213 
01214     
01215     if (name[0] == '(')
01216     {
01217         q = Texture_CreateSolid (name);
01218         strncpy (q->name, name, sizeof(q->name)-1);
01219     }
01220     else
01221     {
01222         // FIXME: this is a mess.. need to move consolidate stuff
01223         // down to a single routine.. 
01224         // 
01225         // if plugins have a texture loader
01226         // {
01227         //   
01228         // }
01229         // else
01230         // 
01231         if (g_pParentWnd->GetPlugInMgr().GetTextureInfo() != NULL)
01232         {
01233             // rad: 12/19/98
01234             // if the plugin is not a wad style then we need to treat it normally
01235             // otherwise return without trying to explicitly load the texture
01236             // as it should have been loaded by the wad style plugin at init time
01237             CString strTex = GetTextureExtension(0);
01238             sprintf (filename, "%s\\%s.%s", ValueForKey (g_qeglobals.d_project_entity, "texturepath"), name, strTex);
01239             if (!g_pParentWnd->GetPlugInMgr().GetTextureInfo()->m_bWadStyle)
01240       {   
01241                 g_pParentWnd->GetPlugInMgr().LoadTexture(filename);        
01242                 if (g_pluginTexture)
01243                     q = g_pluginTexture;
01244             }
01245             else
01246             {
01247                 return notexture;
01248                 // wadstyle.. if we get here then we do not have it
01249             }
01250         }
01251         else
01252       // we need to try several formats here, or would it be better if we are given a complete name
01253             if (g_PrefsDlg.m_bHiColorTextures == TRUE)
01254             {
01255             char cWork[1024];
01256             sprintf (filename, "%s/%s.tga", ValueForKey (g_qeglobals.d_project_entity, "texturepath"), name);
01257             QE_ConvertDOSToUnixName( cWork, filename );
01258             strcpy(filename, cWork);
01259                 Sys_Printf ("Loading %s...", name);
01260                 unsigned char* pPixels = NULL;
01261                 int nWidth;
01262                 int nHeight;
01263                 LoadImage(filename, &pPixels, &nWidth, &nHeight);
01264         if (pPixels == NULL)
01265         {
01266           // try jpg
01267           // blatant assumption of .tga should be fine since we sprintf'd it above
01268           int nLen = strlen(filename);
01269           filename[nLen-3] = 'j';
01270           filename[nLen-2] = 'p';
01271           filename[nLen-1] = 'g';
01272                   LoadImage(filename, &pPixels, &nWidth, &nHeight);
01273         }
01274                 if (pPixels)
01275                 {
01276                     // if we were asked to ignore alpha channel, do it now (.TGA is the only supported file type with alpha channel)
01277                     //if (bNoAlpha)
01278                     if (TRUE)
01279                     {
01280                         unsigned char* iPix = pPixels;
01281                         int nCount = nWidth * nHeight;
01282                         for(iPix=pPixels+3; iPix-pPixels < nCount*4; iPix+=4)
01283                             *iPix = 255;
01284                     }
01285           // we'll be binding the GL texture now
01286           // need to check we are using a right GL context
01287           // with GL plugins that have their own window, the GL context may be the plugin's, in which case loading textures will bug
01288             HDC currentHDC = qwglGetCurrentDC();
01289             HGLRC currentHGLRC = qwglGetCurrentContext();
01290           //++timo FIXME: this may duplicate with qtexture_t* WINAPI QERApp_Texture_ForName (const char *name)
01291           //++timo FIXME: we need a list of lawfull GL contexts or something?
01292           // I'd rather always use the same GL context for binding...
01293           if (currentHDC != g_qeglobals.d_hdcBase || currentHGLRC != g_qeglobals.d_hglrcBase)
01294               qwglMakeCurrent( g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase );
01295                     q = Texture_LoadTGATexture(pPixels, nWidth, nHeight, NULL, 0, 0, 0);
01296           //++timo I don't set back the GL context .. I don't know how safe it is
01297           //qwglMakeCurrent( currentHDC, currentHGLRC );
01298         //++timo storing the filename .. will be removed by shader code cleanup
01299         // this is dirty, and we sure miss some places were we should fill the filename info
01300         strcpy( q->filename, name );
01301                     SetNameShaderInfo(q, filename, name);
01302                     Sys_Printf ("done.\n", name);
01303                     free(pPixels);
01304                 }
01305             }
01306             else
01307             {
01308                 // load the file
01309                 sprintf (filename, "%s/%s.wal", ValueForKey (g_qeglobals.d_project_entity, "texturepath"),  name);
01310                 Sys_Printf ("Loading %s...", name);
01311                 if (LoadFile (filename, (void**)&lump) == -1)
01312                 {
01313                     sprintf (filename, "%s.wal", name);
01314                     Sys_Printf("failed.. trying pak0.pak..");
01315                     if(!PakLoadFile(filename, (void**)&lump))
01316                     {
01317                         Sys_Printf (" load failed!\n");
01318                         return notexture;
01319                     }
01320                 }
01321                 Sys_Printf("successful.\n");
01322                 q = Texture_LoadTexture ((miptex_t *)lump);
01323                 free (lump);
01324                 strncpy (q->name, name, sizeof(q->name)-1);
01325                 StripExtension (q->name);
01326             }
01327             
01328             if (g_PrefsDlg.m_bSGIOpenGL)
01329             {
01330                 if(!q)
01331                     return notexture;
01332             }
01333             
01334     }// name[0] != '('
01335     
01336     if(!q)  // safety
01337   {
01338     if (bShader && !makeShader) {
01339       return q;
01340     }
01341   
01342     if (bShader)
01343     {
01344       q = Texture_MakeNoshadertexture( name );
01345         Sys_Printf("failed, using default shader\n");
01346     }
01347     else
01348     {
01349       q = Texture_MakeDefault();
01350         Sys_Printf("failed, using default\n");
01351     }
01352   }
01353     
01354   strncpy (q->name, name, sizeof(q->name)-1);
01355   if (name[0] != '(')
01356   {
01357     StripExtension (q->name);
01358   }
01359 
01360     if (!g_dontuse)
01361         q->inuse = true;
01362     q->next = g_qeglobals.d_qtextures;
01363     g_qeglobals.d_qtextures = q;
01364     
01365     if (pRemove != NULL)
01366     {
01367         ReplaceQTexture(pRemove, q, &active_brushes);
01368         ReplaceQTexture(pRemove, q, &filtered_brushes);
01369         Texture_Remove(pRemove);
01370     }
01371     
01372     return q;
01373 }

Here is the call graph for this function:

qtexture_t * Texture_ForNamePath char *  name,
char *  pFullPath
 

Definition at line 1380 of file TexWnd.cpp.

References byte, QEGlobals_t::d_qtextures, qtexture_s::filename, free(), g_PrefsDlg, g_qeglobals, qtexture_s::inuse, LoadFile(), LoadImage(), CPrefsDlg::m_bHiColorTextures, CPrefsDlg::m_bSGIOpenGL, miptex_t, qtexture_s::name, name, qtexture_s::next, NULL, q, QE_ConvertDOSToUnixName(), qtexture_t, sprintf(), strcmp(), strcpy(), StripExtension(), strlen(), strncpy(), strstr(), Sys_Printf(), Texture_CreateSolid(), Texture_LoadTexture(), and Texture_LoadTGATexture().

Referenced by DemandLoadShaderTexture().

01381 {
01382   byte    *lump;
01383     qtexture_t  *q;
01384     char    filename[1024];
01385 
01386   if (strlen(name) == 0)
01387     return notexture;
01388 
01389     for (q=g_qeglobals.d_qtextures ; q ; q=q->next)
01390   {
01391       if (!strcmp(name,  q->name))
01392         {
01393             if (!g_dontuse)
01394                 q->inuse = true;
01395             return q;
01396         }
01397   }
01398 
01399     if (name[0] == '(')
01400     {
01401         q = Texture_CreateSolid (name);
01402         strncpy (q->name, name, sizeof(q->name)-1);
01403     }
01404     else
01405     {
01406         // load the file
01407     if (g_PrefsDlg.m_bHiColorTextures == TRUE)
01408     {
01409       char cWork[1024];
01410       if (strstr(pFullPath, ".tga") == NULL) {
01411         sprintf(filename, "%s%s", pFullPath, ".tga");
01412       } else {
01413         strcpy(filename, pFullPath);
01414       }
01415         QE_ConvertDOSToUnixName( cWork, filename );
01416         strcpy(filename, cWork);
01417           Sys_Printf ("Loading %s...", name);
01418       unsigned char* pPixels = NULL;
01419       int nWidth;
01420       int nHeight;
01421       LoadImage(filename, &pPixels, &nWidth, &nHeight);
01422       if (!pPixels)
01423       {
01424         // try jpg
01425         // blatant assumption of .tga should be fine since we sprintf'd it above
01426         int nLen = strlen(filename);
01427         filename[nLen-3] = 'j';
01428         filename[nLen-2] = 'p';
01429         filename[nLen-1] = 'g';
01430                 LoadImage(filename, &pPixels, &nWidth, &nHeight);
01431       }
01432       if (pPixels)
01433       {
01434         q = Texture_LoadTGATexture(pPixels, nWidth, nHeight, NULL, 0, 0, 0);
01435         //++timo storing the filename .. will be removed by shader code cleanup
01436         // this is dirty, and we sure miss some places were we should fill the filename info
01437         // NOTE: we store relative path, need to extract it
01438         strcpy( q->filename, name );
01439 
01440       }
01441       else
01442       {
01443         return notexture;
01444       }
01445       free(pPixels);
01446     }
01447     else
01448     {
01449       sprintf(filename, "%s%s", pFullPath, ".wal");
01450           Sys_Printf ("Loading %s...", name);
01451           if (LoadFile (filename, (void**)&lump) == -1)
01452       {
01453               Sys_Printf (" load failed!\n");
01454               return notexture;
01455       }
01456       Sys_Printf("successful.\n");
01457           q = Texture_LoadTexture ((miptex_t *)lump);
01458           free (lump);
01459     }
01460     if (g_PrefsDlg.m_bSGIOpenGL)
01461     {
01462           if(!q)
01463               return notexture;
01464     }
01465         strncpy (q->name, name, sizeof(q->name)-1);
01466         StripExtension (q->name);
01467     }
01468 
01469     if (!g_dontuse)
01470         q->inuse = true;
01471     q->next = g_qeglobals.d_qtextures;
01472     g_qeglobals.d_qtextures = q;
01473 
01474   return q;
01475 }

Here is the call graph for this function:

void Texture_Init bool  bHardInit  ) 
 

Definition at line 2497 of file TexWnd.cpp.

References AddSlash(), byte, QEGlobals_t::d_project_entity, QEGlobals_t::d_qtextures, free(), g_PrefsDlg, g_qeglobals, Load256Image(), LoadShaders(), CPrefsDlg::m_bHiColorTextures, name, NULL, sprintf(), Sys_Printf(), Texture_InitPalette(), Texture_MakeNotexture(), and ValueForKey().

02498 {
02499     char    name[1024];
02500     byte    *pal = NULL;
02501 
02502   if (g_PrefsDlg.m_bHiColorTextures == FALSE)
02503   {
02504       // load the palette
02505       sprintf (name, "%s/pics/colormap.pcx", ValueForKey (g_qeglobals.d_project_entity, "basepath"));
02506 
02507       Load256Image (name, NULL, &pal, NULL, NULL);
02508       if (!pal)
02509     {
02510       // before dropping out, try to load it from the QERadiant directory
02511       CString strFile = g_strAppPath;
02512       AddSlash(strFile);
02513       strFile += "colormap.pcx";
02514         Load256Image (strFile.GetBuffer(0), NULL, &pal, NULL, NULL);
02515         if (!pal)
02516             Sys_Printf ("Couldn't load %s or %s", name, strFile);
02517     }
02518     else
02519     {
02520         Texture_InitPalette (pal);
02521         free (pal);
02522     }
02523   }
02524 
02525     // create the fallback texture
02526 
02527   if (bHardInit)
02528   {
02529       Texture_MakeNotexture();
02530       g_qeglobals.d_qtextures = NULL;
02531   }
02532   LoadShaders();
02533 
02534 }

Here is the call graph for this function:

void Texture_InitPalette byte pal  ) 
 

Definition at line 227 of file TexWnd.cpp.

References b, BigLong(), byte, QEGlobals_t::d_savedinfo, SavedInfo_t::fGamma, g(), g_qeglobals, i, pow(), r, tex_palette, and v.

Referenced by Texture_Init().

00228 {
00229     int     r,g,b,v;
00230     int     i;
00231     int     inf;
00232     byte    gammatable[256];
00233     float   gamma;
00234 
00235     gamma = g_qeglobals.d_savedinfo.fGamma;
00236 
00237     if (gamma == 1.0)
00238     {
00239         for (i=0 ; i<256 ; i++)
00240             gammatable[i] = i;
00241     }
00242     else
00243     {
00244         for (i=0 ; i<256 ; i++)
00245         {
00246             inf = 255 * pow ( (float)( (i+0.5)/255.5 ), gamma ) + 0.5;
00247             if (inf < 0)
00248                 inf = 0;
00249             if (inf > 255)
00250                 inf = 255;
00251             gammatable[i] = inf;
00252         }
00253     }
00254 
00255     for (i=0 ; i<256 ; i++)
00256     {
00257           r = gammatable[pal[0]];
00258           g = gammatable[pal[1]];
00259           b = gammatable[pal[2]];
00260           pal += 3;
00261         
00262           v = (r<<24) + (g<<16) + (b<<8) + 255;
00263           v = BigLong (v);
00264         
00265           tex_palette[i] = v;
00266     }
00267 }

Here is the call graph for this function:

void Texture_LoadFromPlugIn LPVOID  vp  ) 
 

Definition at line 675 of file TexWnd.cpp.

References g_pluginTexture, _QERTextureLoad::m_nContents, _QERTextureLoad::m_nFlags, _QERTextureLoad::m_nHeight, _QERTextureLoad::m_nValue, _QERTextureLoad::m_nWidth, _QERTextureLoad::m_pRGBA, NULL, q, qtexture_t, and Texture_LoadTGATexture().

Referenced by QERApp_LoadTextureRGBA().

00676 {
00677   g_pluginTexture = notexture;
00678   _QERTextureLoad *pLoad = reinterpret_cast<_QERTextureLoad*>(vp);
00679   if (pLoad != NULL)
00680   {
00681       qtexture_t    *q;
00682     q = Texture_LoadTGATexture(pLoad->m_pRGBA, pLoad->m_nWidth, pLoad->m_nHeight, NULL, pLoad->m_nFlags, pLoad->m_nContents, pLoad->m_nValue);
00683     if (q != NULL)
00684     {
00685         // to save duplicate code (since one always ends up getting forgotten and out of sync) this is now done later by caller
00686 //        strcpy (q->name, pLoad->m_pName);
00687 //        StripExtension (q->name);
00688 //        if (!g_dontuse)
00689 //          q->inuse = true;
00690 //      q->next = g_qeglobals.d_qtextures;
00691 //      g_qeglobals.d_qtextures = q;
00692       g_pluginTexture = q;
00693     }
00694   }
00695 }

Here is the call graph for this function:

int WINAPI Texture_LoadSkin char *  pName,
int *  pnWidth,
int *  pnHeight
 

Definition at line 3110 of file TexWnd.cpp.

References byte, Error(), free(), g_lstSkinCache, g_PrefsDlg, i, LoadImage(), CPrefsDlg::m_bSGIOpenGL, SkinInfo::m_nTextureBind, CPrefsDlg::m_nTextureQuality, SkinInfo::m_strName, MAX_TEXTURE_QUALITY, QE_ConvertDOSToUnixName(), qglBindTexture, qglTexImage2D, R_MipMap(), s_hdcTexture, s_hglrcTexture, SetTexParameters(), strlwr(), and texture_extension_number.

Referenced by LoadModel().

03111 {
03112   byte *pic = NULL;
03113   byte *pic32 = NULL;
03114   int nTex = -1;
03115 
03116   strlwr(pName);
03117   QE_ConvertDOSToUnixName(pName, pName);
03118 
03119   int nSize = g_lstSkinCache.GetSize();
03120   for (int i = 0; i < nSize; i++)
03121   {
03122     SkinInfo *pInfo = reinterpret_cast<SkinInfo*>(g_lstSkinCache.GetAt(i));
03123     if (pInfo)
03124     {
03125       if (stricmp(pName, pInfo->m_strName) == 0)
03126       {
03127         return pInfo->m_nTextureBind;
03128       }
03129     }
03130   }
03131 
03132   LoadImage( pName, &pic32, pnWidth, pnHeight);
03133   if (pic32 != NULL)
03134   {
03135 
03136     nTex = texture_extension_number++;
03137     if (g_PrefsDlg.m_bSGIOpenGL)
03138     {
03139       //if (!qwglMakeCurrent(g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase))
03140       if (!qwglMakeCurrent(s_hdcTexture, s_hglrcTexture))
03141             Error ("wglMakeCurrent in LoadTexture failed");
03142     }
03143 
03144     qglBindTexture( GL_TEXTURE_2D, nTex);
03145     SetTexParameters ();
03146 
03147       int nCount = MAX_TEXTURE_QUALITY - g_PrefsDlg.m_nTextureQuality;
03148       while (nCount-- > 0)
03149       {
03150         if (*pnWidth > 16 && *pnHeight > 16)
03151         {
03152           R_MipMap(pic32, *pnWidth, *pnHeight);
03153         }
03154         else
03155         {
03156           break;
03157         }
03158       }
03159 
03160     if (g_PrefsDlg.m_bSGIOpenGL)
03161     {
03162         if (nomips)
03163       {
03164             qglTexImage2D(GL_TEXTURE_2D, 0, 3, *pnWidth, *pnHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pic32);
03165       }
03166         else
03167             qgluBuild2DMipmaps(GL_TEXTURE_2D, 3, *pnWidth, *pnHeight,GL_RGBA, GL_UNSIGNED_BYTE, pic32);
03168     }
03169     else
03170     {
03171         if (nomips)
03172             qglTexImage2D(GL_TEXTURE_2D, 0, 3, *pnWidth, *pnHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pic32);
03173         else
03174             qgluBuild2DMipmaps(GL_TEXTURE_2D, 3, *pnWidth, *pnHeight,GL_RGBA, GL_UNSIGNED_BYTE, pic32);
03175     }
03176       free (pic32);
03177       qglBindTexture( GL_TEXTURE_2D, 0 );
03178   }
03179 
03180   SkinInfo *pInfo = new SkinInfo(pName, nTex);
03181   g_lstSkinCache.Add(pInfo);
03182 
03183   return nTex;
03184 }

Here is the call graph for this function:

qtexture_t* Texture_LoadTexture miptex_t qtex  ) 
 

Definition at line 432 of file TexWnd.cpp.

References QEGlobals_t::bSurfacePropertiesPlugin, byte, miptex_s::contents, count, Error(), miptex_s::flags, qtexture_s::flags, free(), g_PrefsDlg, g_qeglobals, g_SurfaceTable, GETPLUGINTEXDEF, qtexture_s::height, miptex_s::height, height, i, LittleLong(), CPrefsDlg::m_bSGIOpenGL, CPrefsDlg::m_nTextureQuality, _QERPlugSurfaceTable::m_pfnQTextureAlloc, MAX_TEXTURE_QUALITY, miptex_t, miptex_s::offsets, q, qglBindTexture, qglTexImage2D, qmalloc(), qtexture_t, R_MipMap(), s_hdcTexture, s_hglrcTexture, SetTexParameters(), source, tex_palette, texture_extension_number, miptex_s::value, qtexture_s::width, miptex_s::width, and width.

Referenced by Texture_ForName(), and Texture_ForNamePath().

00433 {
00434   byte      *source;
00435   unsigned  char *dest;
00436   int           width, height, i, count;
00437     int         total[3];
00438   qtexture_t    *q;
00439       
00440   width = LittleLong(qtex->width);
00441   height = LittleLong(qtex->height);
00442 
00443   q = (qtexture_t*)qmalloc(sizeof(*q));
00444 
00445   q->width = width;
00446   q->height = height;
00447 
00448     q->flags = qtex->flags;
00449     q->value = qtex->value;
00450     q->contents = qtex->contents;
00451 
00452     dest = (unsigned char*)qmalloc (width*height*4);
00453 
00454   count = width*height;
00455   source = (byte *)qtex + LittleLong(qtex->offsets[0]);
00456 
00457     // The dib is upside down so we want to copy it into 
00458     // the buffer bottom up.
00459 
00460     total[0] = total[1] = total[2] = 0;
00461   for (i=0 ; i<count ; i++)
00462     {
00463         dest[i] = tex_palette[source[i]];
00464 
00465         total[0] += ((byte *)(dest+i))[0];
00466         total[1] += ((byte *)(dest+i))[1];
00467         total[2] += ((byte *)(dest+i))[2];
00468     }
00469 
00470     q->color[0] = (float)total[0]/(count*255);
00471     q->color[1] = (float)total[1]/(count*255);
00472     q->color[2] = (float)total[2]/(count*255);
00473 
00474   q->texture_number = texture_extension_number++;
00475 
00476   if (g_qeglobals.bSurfacePropertiesPlugin)
00477   {
00478       // Timo
00479       // Surface properties plugins can store their own data in an IPluginQTexture
00480       q->pData = g_SurfaceTable.m_pfnQTextureAlloc( q );
00481       GETPLUGINTEXDEF(q)->InitForMiptex( qtex );
00482   }
00483 
00484   //++timo is the m_bSGIOpenGL parameter still taken into account?
00485   if (g_PrefsDlg.m_bSGIOpenGL)
00486   {
00487     //if (!qwglMakeCurrent(g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase))
00488     if (!qwglMakeCurrent(s_hdcTexture, s_hglrcTexture))
00489           Error ("wglMakeCurrent in LoadTexture failed");
00490   }
00491 
00492   qglBindTexture( GL_TEXTURE_2D, q->texture_number );
00493 
00494   //Handle3DfxTexturing(q, width, height, dest);
00495 
00496   SetTexParameters ();
00497 
00498   int nCount = MAX_TEXTURE_QUALITY - g_PrefsDlg.m_nTextureQuality;
00499   while (nCount-- > 0)
00500   {
00501     if (width > 16 && height > 16)
00502     {
00503       R_MipMap(dest, width, height);
00504     }
00505     else
00506     {
00507       break;
00508     }
00509   }
00510 
00511   if (g_PrefsDlg.m_bSGIOpenGL)
00512   {
00513       if (nomips)
00514     {
00515           qglTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, dest);
00516     }
00517       else
00518           qgluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height,GL_RGBA, GL_UNSIGNED_BYTE, dest);
00519   }
00520   else
00521   {
00522       if (nomips)
00523           qglTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, dest);
00524       else
00525           qgluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height,GL_RGBA, GL_UNSIGNED_BYTE, dest);
00526   }
00527 
00528     free (dest);
00529 
00530     qglBindTexture( GL_TEXTURE_2D, 0 );
00531 
00532   return q;
00533 }

Here is the call graph for this function:

qtexture_t* Texture_LoadTGATexture unsigned char *  pPixels,
int  nWidth,
int  nHeight,
char *  pPath
 

Definition at line 657 of file TexWnd.cpp.

References AddSlash(), ExtractPath_and_Filename(), qtexture_t, and StripExtension().

Referenced by QERApp_TryTextureForName(), Texture_ForName(), Texture_ForNamePath(), and Texture_LoadFromPlugIn().

00658 {
00659   CString strName;
00660   CString strPath;
00661   ExtractPath_and_Filename(pPath, strPath, strName);
00662   AddSlash(strPath);
00663   strPath += "textureinfo.ini";
00664   strName.MakeLower();
00665   StripExtension (strName.GetBuffer(0));
00666   strName.ReleaseBuffer();
00667   
00668   int nFlags = GetPrivateProfileInt(strName, "Flags", 0, strPath);
00669   int nValue = GetPrivateProfileInt(strName, "Value", 0, strPath);
00670   int nContents = GetPrivateProfileInt(strName, "Contents", 0, strPath);
00671   return Texture_LoadTGATexture(pPixels, nWidth, nHeight, pPath, nFlags, nValue, nContents);
00672 }

Here is the call graph for this function:

qtexture_t* Texture_LoadTGATexture unsigned char *  pPixels,
int  nWidth,
int  nHeight,
char *  pPath,
int  nFlags,
int  nContents,
int  nValue
 

Definition at line 543 of file TexWnd.cpp.

References b, QEGlobals_t::bSurfacePropertiesPlugin, byte, QEGlobals_t::d_savedinfo, Error(), SavedInfo_t::fGamma, g_PrefsDlg, g_qeglobals, g_SurfaceTable, GETPLUGINTEXDEF, i, j, CPrefsDlg::m_bSGIOpenGL, CPrefsDlg::m_nTextureQuality, _QERPlugSurfaceTable::m_pfnQTextureAlloc, MAX_TEXTURE_QUALITY, pow(), q, qglBindTexture, qglTexImage2D, qmalloc(), qtexture_t, R_MipMap(), s_hdcTexture, s_hglrcTexture, SetTexParameters(), and texture_extension_number.

00544 {
00545   int i, j, inf;
00546     byte    gammatable[256];
00547     float fGamma = g_qeglobals.d_savedinfo.fGamma;
00548 
00549 
00550   qtexture_t* q = (qtexture_t*)qmalloc(sizeof(*q));
00551   q->width = nWidth;
00552   q->height = nHeight;
00553     q->flags = nFlags;
00554     q->value = nValue;
00555     q->contents = nContents;
00556 
00557   int nCount = nWidth * nHeight;
00558   float total[3];
00559   total[0] = total[1] = total[2] = 0.0f;
00560 
00561   //++timo FIXME: move gamma table initialization somewhere else!
00562     if (fGamma == 1.0)
00563     {
00564         for (i=0 ; i<256 ; i++)
00565             gammatable[i] = i;
00566     }
00567     else
00568     {
00569         for (i=0 ; i<256 ; i++)
00570         {
00571             inf = 255 * pow ( (float)( (i+0.5)/255.5 ), fGamma ) + 0.5;
00572             if (inf < 0)
00573                 inf = 0;
00574             if (inf > 255)
00575                 inf = 255;
00576             gammatable[i] = inf;
00577         }
00578     }
00579 
00580 
00581   // all targas are stored internally as 32bit so rgba = 4 bytes
00582   for (i = 0 ; i < (nCount * 4) ; i += 4)
00583     {
00584     for (j = 0; j < 3; j++)
00585     {
00586         total[j] += (pPixels+i)[j];
00587       byte b = (pPixels+i)[j];
00588       (pPixels+i)[j] = gammatable[b];
00589               
00590     }
00591     }
00592 
00593     q->color[0] = total[0] / (nCount * 255);
00594     q->color[1] = total[1] / (nCount * 255);
00595     q->color[2] = total[2] / (nCount * 255);
00596 
00597 
00598   q->texture_number = texture_extension_number++;
00599 
00600   if (g_qeglobals.bSurfacePropertiesPlugin)
00601   {
00602       // Timo
00603       // Surface properties plugins can store their own data in an IPluginQTexture
00604       q->pData = g_SurfaceTable.m_pfnQTextureAlloc( q );
00605       GETPLUGINTEXDEF(q)->SetDefaultTexdef();
00606   }
00607 
00608   if (g_PrefsDlg.m_bSGIOpenGL)
00609   {
00610     //if (!qwglMakeCurrent(g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase))
00611     if (!qwglMakeCurrent(s_hdcTexture, s_hglrcTexture))
00612           Error ("wglMakeCurrent in LoadTexture failed");
00613   }
00614 
00615   qglBindTexture( GL_TEXTURE_2D, q->texture_number );
00616 
00617   //Handle3DfxTexturing(q, width, height, dest);
00618 
00619   SetTexParameters();
00620 
00621   nCount = MAX_TEXTURE_QUALITY - g_PrefsDlg.m_nTextureQuality;
00622   while (nCount-- > 0)
00623   {
00624     if (nWidth > 16 && nHeight > 16)
00625     {
00626       R_MipMap(pPixels, nWidth, nHeight);
00627     }
00628     else
00629     {
00630       break;
00631     }
00632   }
00633 
00634   if (g_PrefsDlg.m_bSGIOpenGL)
00635   {
00636       if (nomips)
00637     {
00638           qglTexImage2D(GL_TEXTURE_2D, 0, 4, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pPixels);
00639     }
00640       else
00641           qgluBuild2DMipmaps(GL_TEXTURE_2D, 4, nWidth, nHeight,GL_RGBA, GL_UNSIGNED_BYTE, pPixels);
00642   }
00643   else
00644   {
00645       if (nomips)
00646           qglTexImage2D(GL_TEXTURE_2D, 0, 4, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pPixels);
00647       else
00648           qgluBuild2DMipmaps(GL_TEXTURE_2D, 4, nWidth, nHeight,GL_RGBA, GL_UNSIGNED_BYTE, pPixels);
00649   }
00650 
00651     qglBindTexture( GL_TEXTURE_2D, 0 );
00652 
00653   return q;
00654 }

Here is the call graph for this function:

qtexture_t* Texture_MakeDefault void   ) 
 

Definition at line 755 of file TexWnd.cpp.

References byte, qtexture_s::color, data, Error(), g_PrefsDlg, qtexture_s::height, CPrefsDlg::m_bSGIOpenGL, memset(), q, qglBindTexture, qglTexImage2D, qmalloc(), qtexture_t, s_hdcTexture, s_hglrcTexture, SetTexParameters(), strcpy(), texture_extension_number, qtexture_s::texture_number, and qtexture_s::width.

Referenced by Texture_ForName(), and Texture_MakeNotexture().

00756 {
00757   qtexture_t    *q;
00758   byte      data[4][4];
00759 
00760   if (g_PrefsDlg.m_bSGIOpenGL)
00761   {
00762     if (s_hdcTexture && s_hglrcTexture)
00763     { 
00764        //if (!qwglMakeCurrent(g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase))
00765        if (!qwglMakeCurrent(s_hdcTexture, s_hglrcTexture))
00766              Error ("wglMakeCurrent in LoadTexture failed");
00767     }
00768     else
00769       return NULL;
00770   }
00771 
00772   q = (qtexture_t*)qmalloc(sizeof(*q));
00773   
00774   strcpy (q->name, "notexture");
00775   q->width = q->height = 64;
00776   
00777   memset (data, 0, sizeof(data));
00778   data[0][2] = data[3][2] = 255;
00779   
00780   q->color[0] = 0;
00781   q->color[1] = 0;
00782   q->color[2] = 0.5;
00783 
00784   q->texture_number = texture_extension_number++;
00785   qglBindTexture( GL_TEXTURE_2D, q->texture_number );
00786   SetTexParameters ();
00787 
00788     if (nomips)
00789         qglTexImage2D(GL_TEXTURE_2D, 0, 3, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
00790     else
00791         VERIFY(qgluBuild2DMipmaps(GL_TEXTURE_2D, 3, 2, 2,GL_RGBA, GL_UNSIGNED_BYTE, data) == 0);
00792 
00793   qglBindTexture( GL_TEXTURE_2D, 0 );
00794   return q;
00795 }

Here is the call graph for this function:

qtexture_t* Texture_MakeNoshadertexture const char *  name  ) 
 

Definition at line 1109 of file TexWnd.cpp.

References byte, qtexture_s::color, data, qtexture_s::fTrans, qtexture_s::height, memset(), name, notexture, q, qglBindTexture, qglTexImage2D, qmalloc(), qtexture_t, SetTexParameters(), strcpy(), texture_extension_number, qtexture_s::texture_number, and qtexture_s::width.

Referenced by Texture_ForName().

01110 {
01111     qtexture_t  *q;
01112     byte        data[4][4];
01113 
01114     notexture = q = (qtexture_t*)qmalloc(sizeof(*q));
01115     q->width = q->height = 64;
01116     q->fTrans = 1;
01117 
01118     q = (qtexture_t*)qmalloc(sizeof(*q));
01119   strcpy (q->name, name);
01120 
01121     q->width = q->height = 64;
01122     q->fTrans = 1;
01123 
01124     memset (data, 0, sizeof(data));
01125     data[0][0] = data[3][0] = 255;
01126 
01127     q->color[0] = 0;
01128     q->color[1] = 0;
01129     q->color[2] = 0.5;
01130 
01131     q->texture_number = texture_extension_number++;
01132     qglBindTexture( GL_TEXTURE_2D, q->texture_number );
01133     SetTexParameters ();
01134 
01135     if (nomips)
01136         qglTexImage2D(GL_TEXTURE_2D, 0, 3, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
01137     else
01138         VERIFY(qgluBuild2DMipmaps(GL_TEXTURE_2D, 3, 2, 2,GL_RGBA, GL_UNSIGNED_BYTE, data) == 0);
01139 
01140     qglBindTexture( GL_TEXTURE_2D, 0 );
01141 
01142     return q;
01143 }

Here is the call graph for this function:

void Texture_MakeNotexture void   ) 
 

Definition at line 803 of file TexWnd.cpp.

References QEGlobals_t::bSurfacePropertiesPlugin, g_qeglobals, g_SurfaceTable, GETPLUGINTEXDEF, _QERPlugSurfaceTable::m_pfnQTextureAlloc, notexture, qtexture_s::pData, and Texture_MakeDefault().

Referenced by Texture_Init().

00804 {
00805   notexture = Texture_MakeDefault();
00806   // Timo
00807   // Surface properties plugins can store their own data in an IPluginQTexture
00808   if (g_qeglobals.bSurfacePropertiesPlugin)
00809   {
00810       notexture->pData = g_SurfaceTable.m_pfnQTextureAlloc( notexture );
00811       GETPLUGINTEXDEF(notexture)->SetDefaultTexdef();
00812   }
00813 }

Here is the call graph for this function:

void Texture_MouseDown int  x,
int  y,
int  buttons
 

Definition at line 2290 of file TexWnd.cpp.

References QEGlobals_t::d_texturewin, g_qeglobals, texturewin_t::height, SelectTexture(), Sys_GetCursorPos(), textures_cursorx, textures_cursory, UpdatePatchInspector(), UpdateSurfaceDialog(), x, and y.

02291 {
02292     Sys_GetCursorPos (&textures_cursorx, &textures_cursory);
02293 
02294     // lbutton = select texture
02295     if (buttons == MK_LBUTTON || buttons == (MK_LBUTTON | MK_SHIFT) || buttons == (MK_LBUTTON | MK_CONTROL))
02296     {
02297     SelectTexture (x, g_qeglobals.d_texturewin.height - 1 - y, buttons & MK_SHIFT, buttons & MK_CONTROL);
02298     UpdateSurfaceDialog();
02299     UpdatePatchInspector();
02300     }
02301 }

Here is the call graph for this function:

void Texture_MouseMoved int  x,
int  y,
int  buttons
 

Definition at line 2317 of file TexWnd.cpp.

References abs(), QEGlobals_t::d_hwndTexture, QEGlobals_t::d_texturewin, g_PrefsDlg, g_qeglobals, CPrefsDlg::m_bTextureScrollbar, NULL, texturewin_t::originy, Sys_GetCursorPos(), Sys_SetCursorPos(), textures_cursorx, textures_cursory, x, and y.

02318 {
02319     int scale = 1;
02320 
02321     if ( buttons & MK_SHIFT )
02322         scale = 4;
02323 
02324     // rbutton = drag texture origin
02325     if (buttons & MK_RBUTTON)
02326     {
02327         Sys_GetCursorPos (&x, &y);
02328         if ( y != textures_cursory)
02329         {
02330             g_qeglobals.d_texturewin.originy += ( y-textures_cursory) * scale;
02331             if (g_qeglobals.d_texturewin.originy > 0)
02332                 g_qeglobals.d_texturewin.originy = 0;
02333             Sys_SetCursorPos (textures_cursorx, textures_cursory);
02334       CWnd *pWnd = CWnd::FromHandle(g_qeglobals.d_hwndTexture);
02335       if (g_PrefsDlg.m_bTextureScrollbar && pWnd != NULL)
02336       {
02337         pWnd->SetScrollPos(SB_VERT, abs(g_qeglobals.d_texturewin.originy));
02338       }
02339           InvalidateRect(g_qeglobals.d_hwndTexture, NULL, false);
02340           UpdateWindow (g_qeglobals.d_hwndTexture);
02341         }
02342         return;
02343     }
02344 }

Here is the call graph for this function:

void Texture_MouseUp int  x,
int  y,
int  buttons
 

Definition at line 2308 of file TexWnd.cpp.

02309 {
02310 }

qtexture_t* Texture_NextPos int *  x,
int *  y
 

Definition at line 1971 of file TexWnd.cpp.

References qtexture_s::bFromShader, current_row, current_texture, current_x, current_y, QEGlobals_t::d_texturewin, FONT_HEIGHT, g_PrefsDlg, g_qeglobals, g_strFilter, qtexture_s::height, qtexture_s::inuse, CPrefsDlg::m_bHiColorTextures, CPrefsDlg::m_bShowShaders, CPrefsDlg::m_nTextureScale, qtexture_s::name, qtexture_s::next, q, qtexture_t, strlen(), texture_directory, texture_showinuse, texturewin_t::width, qtexture_s::width, x, and y.

Referenced by QERApp_GetTexture(), QERApp_TextureCount(), SelectTexture(), Texture_Draw2(), and Texture_SetTexture().

01972 {
01973     qtexture_t  *q;
01974 
01975     while (1)
01976     {
01977         q = current_texture;
01978         if (!q)
01979             return q;
01980         current_texture = current_texture->next;
01981         if (q->name[0] == '(')  // fake color texture
01982             continue;
01983 
01984     if (g_bFilterEnabled)
01985     {
01986       CString strName = q->name;
01987       int nPos = strName.Find('\\');
01988       if (nPos == -1)
01989         nPos = strName.Find('/');
01990       if (nPos >= 0)
01991         strName = strName.Right(strName.GetLength() - nPos - 1);
01992       if (strnicmp(g_strFilter.GetBuffer(0), strName, g_strFilter.GetLength()) == 0)
01993         break;
01994       else
01995         continue;
01996     }
01997 
01998     if (q->bFromShader && g_PrefsDlg.m_bShowShaders == FALSE)
01999     {
02000       continue;
02001     }
02002 
02003         if (q->inuse)
02004             break;          // always show in use
02005     
02006     if (!texture_showinuse && !strnicmp (q->name, texture_directory, strlen(texture_directory)))
02007             break;
02008         continue;
02009     }
02010 
02011   int nWidth = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->width * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->width;
02012   int nHeight = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->height * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->height;
02013     if (current_x + nWidth > g_qeglobals.d_texturewin.width-8 && current_row)
02014     {   // go to the next row unless the texture is the first on the row
02015         current_x = 8;
02016         current_y -= current_row + FONT_HEIGHT + 4;
02017         current_row = 0;
02018     }
02019 
02020     *x = current_x;
02021     *y = current_y;
02022 
02023     // Is our texture larger than the row? If so, grow the 
02024     // row height to match it
02025 
02026     if (current_row < nHeight)
02027           current_row = nHeight;
02028 
02029     // never go less than 64, or the names get all crunched up
02030     current_x += nWidth < 64 ? 64 : nWidth;
02031     current_x += 8;
02032 
02033     return q;
02034 }

Here is the call graph for this function:

void Texture_Remove qtexture_t q  ) 
 

Definition at line 1062 of file TexWnd.cpp.

References QEGlobals_t::bSurfacePropertiesPlugin, QEGlobals_t::d_qtextures, free(), g_qeglobals, GETPLUGINTEXDEF, qtexture_s::next, NULL, qtexture_s::pData, q, qglDeleteTextures, qtexture_t, Sys_Printf(), and qtexture_s::texture_number.

Referenced by Texture_ForName().

01063 {
01064   qtexture_t* pTex = g_qeglobals.d_qtextures->next;
01065   if (q == g_qeglobals.d_qtextures)   // it is the head
01066   {
01067     g_qeglobals.d_qtextures->next = q->next->next;
01068     g_qeglobals.d_qtextures = q->next;
01069   }
01070   else
01071   {
01072     qtexture_t* pLast = g_qeglobals.d_qtextures;
01073     while (pTex != NULL && pTex != g_qeglobals.d_qtextures)
01074     {
01075       if (pTex == q)
01076       {
01077         pLast->next = q->next;
01078         break;
01079       }
01080       pLast = pTex;
01081       pTex = pTex->next;
01082     }
01083   }
01084   qglDeleteTextures(1, reinterpret_cast<const unsigned int*>(&q->texture_number));
01085 
01086   if (g_qeglobals.bSurfacePropertiesPlugin)
01087   {
01088       // Timo
01089       // Surface properties plugin
01090 #ifdef _DEBUG
01091       if ( !q->pData )
01092           Sys_Printf("WARNING: found a qtexture_t* with no IPluginQTexture\n");
01093 #endif
01094       if ( q->pData )
01095           GETPLUGINTEXDEF(q)->DecRef();
01096   }
01097 
01098   free(q);
01099 
01100 }

Here is the call graph for this function:

void Texture_ResetPosition  ) 
 

Definition at line 1855 of file TexWnd.cpp.

References QEGlobals_t::d_texturewin, g_qeglobals, texturewin_t::height, texturewin_t::originy, and SelectTexture().

Referenced by CMainFrame::CheckTextureScale().

01856 {
01857   SelectTexture (16, g_qeglobals.d_texturewin.height -16 ,false);
01858   g_qeglobals.d_texturewin.originy = 0;
01859 }

Here is the call graph for this function:

void Texture_SetInuse void   ) 
 

Definition at line 1869 of file TexWnd.cpp.

References QEGlobals_t::d_qtextures, g_qeglobals, qtexture_s::inuse, qtexture_s::next, q, and qtexture_t.

Referenced by Texture_ShowAll().

01870 {
01871     qtexture_t  *q;
01872 
01873     for (q=g_qeglobals.d_qtextures ; q ; q=q->next)
01874   {
01875         q->inuse = true;
01876     }
01877 }

void Texture_SetMode int  iMenu  ) 
 

Definition at line 293 of file TexWnd.cpp.

References CCamWnd::Camera(), QEGlobals_t::d_hwndMain, QEGlobals_t::d_savedinfo, camera_t::draw_mode, Error(), g_pParentWnd, g_PrefsDlg, g_qeglobals, CMainFrame::GetCamera(), i, ID_TEXTURES_FLATSHADE, ID_TEXTURES_WIREFRAME, ID_VIEW_BILINEAR, ID_VIEW_BILINEARMIPMAP, ID_VIEW_LINEAR, ID_VIEW_NEAREST, ID_VIEW_NEARESTMIPMAP, ID_VIEW_TRILINEAR, SavedInfo_t::iTexMenu, CPrefsDlg::m_bSGIOpenGL, Map_BuildBrushData(), qboolean, qglBindTexture, qglFinish, s_hdcTexture, s_hglrcTexture, SetTexParameters(), Sys_UpdateWindows(), texture_mode, and W_ALL.

Referenced by CMainFrame::OnCreateClient(), CMainFrame::OnViewNearest(), and WCam_WndProc().

00294 {
00295     int i, iMode;
00296     HMENU hMenu;
00297     qboolean texturing = true;
00298 
00299     hMenu = GetMenu(g_qeglobals.d_hwndMain);
00300 
00301     switch(iMenu) {
00302     case ID_VIEW_NEAREST:                   
00303         iMode = GL_NEAREST;
00304         break;
00305     case ID_VIEW_NEARESTMIPMAP:
00306         iMode = GL_NEAREST_MIPMAP_NEAREST;
00307         break;
00308     case ID_VIEW_LINEAR:
00309         iMode = GL_NEAREST_MIPMAP_LINEAR;
00310         break;
00311     case ID_VIEW_BILINEAR:
00312         iMode = GL_LINEAR;
00313         break;
00314     case ID_VIEW_BILINEARMIPMAP:
00315         iMode = GL_LINEAR_MIPMAP_NEAREST;
00316         break;
00317     case ID_VIEW_TRILINEAR:
00318         iMode = GL_LINEAR_MIPMAP_LINEAR;
00319         break;
00320 
00321     case ID_TEXTURES_WIREFRAME:
00322         iMode = 0;
00323         texturing = false;
00324         break;
00325 
00326     case ID_TEXTURES_FLATSHADE:
00327         iMode = 0;
00328         texturing = false;
00329         break;
00330 
00331     }
00332 
00333     CheckMenuItem(hMenu, ID_VIEW_NEAREST, MF_BYCOMMAND | MF_UNCHECKED);
00334     CheckMenuItem(hMenu, ID_VIEW_NEARESTMIPMAP, MF_BYCOMMAND | MF_UNCHECKED);
00335     CheckMenuItem(hMenu, ID_VIEW_LINEAR, MF_BYCOMMAND | MF_UNCHECKED);
00336     CheckMenuItem(hMenu, ID_VIEW_BILINEARMIPMAP, MF_BYCOMMAND | MF_UNCHECKED);
00337     CheckMenuItem(hMenu, ID_VIEW_BILINEAR, MF_BYCOMMAND | MF_UNCHECKED);
00338     CheckMenuItem(hMenu, ID_VIEW_TRILINEAR, MF_BYCOMMAND | MF_UNCHECKED);
00339     CheckMenuItem(hMenu, ID_TEXTURES_WIREFRAME, MF_BYCOMMAND | MF_UNCHECKED);
00340     CheckMenuItem(hMenu, ID_TEXTURES_FLATSHADE, MF_BYCOMMAND | MF_UNCHECKED);
00341 
00342     CheckMenuItem(hMenu, iMenu, MF_BYCOMMAND | MF_CHECKED);
00343 
00344     g_qeglobals.d_savedinfo.iTexMenu = iMenu;
00345     texture_mode = iMode;
00346 
00347   if (g_PrefsDlg.m_bSGIOpenGL)
00348   {
00349     if (s_hdcTexture && s_hglrcTexture)
00350     {
00351       //if (!qwglMakeCurrent(g_qeglobals.d_hdcBase, g_qeglobals.d_hglrcBase))
00352       if (!qwglMakeCurrent(s_hdcTexture, s_hglrcTexture))
00353             Error ("wglMakeCurrent in LoadTexture failed");
00354     }
00355     else
00356       return;
00357   }
00358 
00359     if ( texturing )
00360         SetTexParameters ();
00361 
00362     if ( !texturing && iMenu == ID_TEXTURES_WIREFRAME)
00363     {
00364         g_pParentWnd->GetCamera()->Camera().draw_mode = cd_wire;
00365         Map_BuildBrushData();
00366         Sys_UpdateWindows (W_ALL);
00367         return;
00368 
00369     } else if ( !texturing && iMenu == ID_TEXTURES_FLATSHADE) {
00370 
00371         g_pParentWnd->GetCamera()->Camera().draw_mode = cd_solid;
00372         Map_BuildBrushData();
00373         Sys_UpdateWindows (W_ALL);
00374         return;
00375     }
00376 
00377     for (i=1 ; i<texture_extension_number ; i++)
00378     {
00379         qglBindTexture( GL_TEXTURE_2D, i );
00380         SetTexParameters ();
00381     }
00382 
00383     // select the default texture
00384     qglBindTexture( GL_TEXTURE_2D, 0 );
00385 
00386     qglFinish();
00387 
00388     if (g_pParentWnd->GetCamera()->Camera().draw_mode != cd_texture)
00389     {
00390         g_pParentWnd->GetCamera()->Camera().draw_mode = cd_texture;
00391         Map_BuildBrushData();
00392     }
00393 
00394     Sys_UpdateWindows (W_ALL);
00395 }

Here is the call graph for this function:

void Texture_SetTexture texdef_t texdef,
brushprimit_texdef_t brushprimit_texdef,
bool  bFitScale,
IPluginTexdef pTexdef,
bool  bSetSelection
 

Definition at line 2054 of file TexWnd.cpp.

References bFitScale, texturewin_t::brushprimit_texdef, brushprimit_texdef, brushprimit_texdef_t, QEGlobals_t::bSurfacePropertiesPlugin, texdef_t::contents, IPluginTexdef::Copy(), QEGlobals_t::d_texturewin, DispatchRadiantMsg(), texdef_t::flags, FONT_HEIGHT, g_dlgFind, g_PrefsDlg, g_qeglobals, texturewin_t::height, qtexture_s::height, CFindTextureDlg::isOpen(), QEGlobals_t::m_bBrushPrimitMode, CPrefsDlg::m_bHiColorTextures, CPrefsDlg::m_nTextureScale, qtexture_s::name, texdef_t::name, texturewin_t::originy, texturewin_t::pTexdef, q, qtexture_t, RADIANT_TEXTURE, Select_SetTexture(), Sys_Status(), Sys_UpdateWindows(), texturewin_t::texdef, Texture_NextPos(), Texture_StartPos(), CFindTextureDlg::updateTextures(), W_TEXTURE, qtexture_s::width, x, and y.

Referenced by Drag_Begin(), QERApp_SetCurrentTexture(), Select_Ray(), and SelectTexture().

02055 {
02056     qtexture_t  *q;
02057     int         x,y;
02058 
02059     if (texdef->name[0] == '(')
02060     {
02061         Sys_Status("Can't select an entity texture\n", 0);
02062         return;
02063     }
02064     g_qeglobals.d_texturewin.texdef = *texdef;
02065     g_qeglobals.d_texturewin.texdef.flags &= ~SURF_KEEP;
02066     g_qeglobals.d_texturewin.texdef.contents &= ~CONTENTS_KEEP;
02067     // store the texture coordinates for new brush primitive mode
02068     // be sure that all the callers are using the default 2x2 texture
02069     if (g_qeglobals.m_bBrushPrimitMode)
02070     {
02071         g_qeglobals.d_texturewin.brushprimit_texdef = *brushprimit_texdef;
02072     }
02073     // surface properties plugin
02074     if (g_qeglobals.bSurfacePropertiesPlugin)
02075     {
02076         if (g_qeglobals.d_texturewin.pTexdef)
02077         {
02078             // decrement reference count
02079             static_cast<IPluginTexdef *>(g_qeglobals.d_texturewin.pTexdef)->DecRef();
02080             g_qeglobals.d_texturewin.pTexdef = NULL;
02081         }
02082         if (pTexdef)
02083         {
02084             g_qeglobals.d_texturewin.pTexdef = pTexdef->Copy();
02085         }
02086     }
02087 
02088     Sys_UpdateWindows (W_TEXTURE);
02089 
02090   g_dlgFind.updateTextures(texdef->name);
02091 
02092   if (!g_dlgFind.isOpen() && bSetSelection)
02093   {
02094     Select_SetTexture(texdef,brushprimit_texdef,bFitScale);
02095   }
02096 
02097 
02098     //plugins: send a message telling that the selected texture may have changed
02099     DispatchRadiantMsg( RADIANT_TEXTURE );
02100 
02101     // scroll origin so the texture is completely on screen
02102     Texture_StartPos ();
02103     while (1)
02104     {
02105         q = Texture_NextPos (&x, &y);
02106         if (!q)
02107             break;
02108 
02109     int nWidth = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->width * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->width;
02110     int nHeight = (g_PrefsDlg.m_bHiColorTextures == TRUE) ? q->height * ((float)g_PrefsDlg.m_nTextureScale / 100) : q->height;
02111         if (!strcmpi(texdef->name, q->name))
02112         {
02113             if (y > g_qeglobals.d_texturewin.originy)
02114             {
02115                 g_qeglobals.d_texturewin.originy = y;
02116                 Sys_UpdateWindows (W_TEXTURE);
02117                 return;
02118             }
02119 
02120             if (y-nHeight-2*FONT_HEIGHT < g_qeglobals.d_texturewin.originy-g_qeglobals.d_texturewin.height)
02121             {
02122                 g_qeglobals.d_texturewin.originy = y-nHeight-2*FONT_HEIGHT+g_qeglobals.d_texturewin.height;
02123                 Sys_UpdateWindows (W_TEXTURE);
02124                 return;
02125             }
02126 
02127             return;
02128         }
02129     }
02130 }

Here is the call graph for this function:

void Texture_ShowAll  ) 
 

Definition at line 1885 of file TexWnd.cpp.

References Sys_Printf(), Sys_UpdateWindows(), Texture_SetInuse(), and W_TEXTURE.

Referenced by CMainFrame::OnTexturesShowall().

01886 {
01887   Texture_SetInuse();
01888     Sys_Printf("Showing all textures...\n");
01889     Sys_UpdateWindows (W_TEXTURE);
01890 }

Here is the call graph for this function:

void Texture_ShowDirectory char *  pPath,
bool  bLinked
 

Definition at line 1753 of file TexWnd.cpp.

References AddToFileListAlphabetized(), ClearFileList(), QEGlobals_t::d_hwndEntity, QEGlobals_t::d_texturewin, FILELIST, FROMDISK, g_dontuse, g_PrefsDlg, g_qeglobals, GetTextureExtension(), GetTextureExtensionCount(), texturewin_t::height, k, CPrefsDlg::m_bHiColorTextures, texdef_t::name, name, FileListStruct::next, texturewin_t::originy, QE_ConvertDOSToUnixName(), SelectTexture(), SortTextures(), sprintf(), strcpy(), StripExtension(), strlen(), Sys_Printf(), Sys_Status(), texturewin_t::texdef, Texture_ClearInuse(), texture_directory, Texture_ForName(), and texture_showinuse.

Referenced by CMainFrame::OnTexturesLoad(), CMainFrame::OnTexturesLoadlist(), CMainFrame::OnTextureWad(), and Texture_ShowDirectory().

01754 {
01755     struct _finddata_t fileinfo;
01756     int     handle;
01757     char    name[1024];
01758     char    dirstring[1024];
01759     char    linkstring[1024];
01760     FILELIST            *list = NULL, *temp;
01761 
01762   //Texture_Flush(false);
01763 
01764     texture_showinuse = false;
01765     Texture_ClearInuse();
01766     strcpy (texture_directory, pPath);
01767 
01768   if (g_PrefsDlg.m_bHiColorTextures == FALSE)
01769   {
01770   }
01771 
01772     g_qeglobals.d_texturewin.originy = 0;
01773     Sys_Status("loading all textures\n", 0);
01774 
01775     // load all .wal files
01776   for (int nExt = 0; nExt < GetTextureExtensionCount(); nExt++)
01777   {
01778     sprintf(dirstring, "%s*.%s", pPath,GetTextureExtension(nExt));
01779                                           
01780       Sys_Printf ("Scanning %s\n", dirstring);
01781 
01782       handle = _findfirst (dirstring, &fileinfo);
01783 
01784     if (handle != -1)
01785       {
01786           do
01787           {
01788               sprintf (name, "%s%s", texture_directory, fileinfo.name);
01789               AddToFileListAlphabetized(&list, name, FROMDISK, 0, false);
01790           } while (_findnext( handle, &fileinfo ) != -1);
01791           _findclose (handle);
01792       }
01793       else
01794       {
01795           //sprintf (dirstring, "%s*.wal", texture_menunames[menunum-CMD_TEXTUREWAD]);
01796           //if(!GetPackFileList(&list, dirstring))
01797               return;
01798       }
01799   }
01800 
01801     g_dontuse = true;
01802     for(temp = list; temp; temp = temp->next)
01803     {
01804         if(temp->offset == -1)
01805             sprintf(name, "%s", temp->filename);
01806         else
01807           sprintf(name, "%s%s", pPath, temp->filename);
01808         StripExtension (name);
01809 
01810     int nLen = strlen(name)-1;
01811     ASSERT(nLen > 0);
01812     while (name[nLen] != '\\')
01813       nLen--;
01814     // found first one
01815     nLen--;
01816     ASSERT(nLen > 0);
01817     while (name[nLen] != '\\')
01818       nLen--;
01819     ASSERT(nLen >= 0);
01820     QE_ConvertDOSToUnixName(name, name);
01821     Texture_ForName(&name[nLen+1]);
01822 
01823     }
01824 
01825     ClearFileList(&list);
01826 
01827     g_dontuse = false;
01828 
01829   SortTextures();
01830 
01831   if (!bLinked)
01832   {
01833 
01834     for (int k = 0; k < 10; k++)
01835     {
01836       sprintf(name, "Path%d", k);
01837       if (GetPrivateProfileString("Include", name, "", dirstring, 1024, linkstring) > 0)
01838       {
01839         Texture_ShowDirectory(dirstring, true);
01840       }
01841     }
01842 
01843 
01844       sprintf (name, "Textures: %s", texture_directory);
01845       SetWindowText(g_qeglobals.d_hwndEntity, name);
01846 
01847       // select the first texture in the list
01848       if (!g_qeglobals.d_texturewin.texdef.name[0])
01849           SelectTexture (16, g_qeglobals.d_texturewin.height -16 ,false);
01850   }
01851 }

Here is the call graph for this function:

void Texture_ShowDirectory int  menunum,
bool  bLinked
 

Definition at line 1617 of file TexWnd.cpp.

References AddToFileListAlphabetized(), ClearFileList(), CMD_TEXTUREWAD, QEGlobals_t::d_hwndEntity, QEGlobals_t::d_project_entity, QEGlobals_t::d_texturewin, FILELIST, FROMDISK, g_dontuse, g_pParentWnd, g_PrefsDlg, g_qeglobals, GetPackFileList(), CMainFrame::GetPlugInMgr(), GetTextureExtension(), GetTextureExtensionCount(), CPlugInManager::GetTextureInfo(), texturewin_t::height, k, LoadShadersFromDir(), CPrefsDlg::m_bHiColorTextures, _QERTextureInfo::m_bWadStyle, texdef_t::name, name, FileListStruct::next, texturewin_t::originy, SelectTexture(), SortTextures(), sprintf(), strcpy(), StripExtension(), Sys_Printf(), Sys_Status(), texturewin_t::texdef, Texture_ClearInuse(), texture_directory, Texture_ForName(), texture_menunames, Texture_ShowDirectory(), texture_showinuse, and ValueForKey().

01618 {
01619     struct _finddata_t fileinfo;
01620     int     handle;
01621     char    name[1024];
01622     char    dirstring[1024];
01623     char    linkstring[1024];
01624     FILELIST            *list = NULL, *temp;
01625   CString strTemp;
01626 
01627   //Texture_Flush(false);
01628     //Select_Deselect();
01629     Texture_ClearInuse();
01630     texture_showinuse = false;
01631     strcpy (texture_directory, texture_menunames[menunum-CMD_TEXTUREWAD]);
01632 
01633   if (g_pParentWnd->GetPlugInMgr().GetTextureInfo() != NULL)
01634   {
01635     if (g_pParentWnd->GetPlugInMgr().GetTextureInfo()->m_bWadStyle)
01636       return;
01637   }
01638 
01639   // new
01640 /*
01641   if (!g_PrefsDlg.m_bShaderTest)
01642   {
01643     g_dontuse = true;   // needed because this next piece of code calls Texture_ForName() internally! -slc
01644     LoadDeferred(texture_directory);
01645     g_dontuse = false;
01646   }
01647 */
01648   if (g_PrefsDlg.m_bHiColorTextures == FALSE)
01649   {
01650   }
01651 
01652     g_qeglobals.d_texturewin.originy = 0;
01653 
01654   //--if (g_PrefsDlg.m_bUseShaders)
01655   //--{
01656   //--  sprintf (dirstring, "%s/scripts/%s", ValueForKey (g_qeglobals.d_project_entity, "basepath"), texture_directory);
01657     //--  Sys_Printf("loading textures from shader %s\n", dirstring);
01658   //--  LoadShader(dirstring);
01659   //--}
01660   //--else
01661   //--{
01662       Sys_Status("Loading textures\n", 0);
01663 
01664       // load all image files
01665                                           
01666     sprintf (linkstring, "%s/textures/%stextureinfo.ini", ValueForKey (g_qeglobals.d_project_entity, "basepath"), texture_menunames[menunum-CMD_TEXTUREWAD]);
01667 
01668     for (int nExt = 0; nExt < GetTextureExtensionCount(); nExt++)
01669     {
01670       sprintf (dirstring, "%s/textures/%s*.%s", ValueForKey (g_qeglobals.d_project_entity, "basepath"), texture_menunames[menunum-CMD_TEXTUREWAD],GetTextureExtension(nExt));
01671       Sys_Printf ("Scanning %s\n", dirstring);
01672         handle = _findfirst (dirstring, &fileinfo);
01673 
01674       if (handle == -1)
01675       {
01676         sprintf(dirstring, "%s/%s*.%s", ValueForKey (g_qeglobals.d_project_entity, "texturepath"), texture_menunames[menunum-CMD_TEXTUREWAD],GetTextureExtension(nExt));
01677         handle = _findfirst (dirstring, &fileinfo);
01678       }
01679       if (handle != -1)
01680         {
01681             do
01682           {
01683               sprintf (name, "%s%s", texture_directory, fileinfo.name);
01684               AddToFileListAlphabetized(&list, name, FROMDISK, 0, false);
01685           } while (_findnext( handle, &fileinfo ) != -1);
01686           _findclose (handle);
01687       }
01688         else
01689         {
01690           sprintf (dirstring, "%s*.%s", texture_menunames[menunum-CMD_TEXTUREWAD],GetTextureExtension(nExt));
01691           GetPackFileList(&list, dirstring);
01692         }
01693     }
01694 
01695       g_dontuse = true;
01696       for(temp = list; temp; temp = temp->next)
01697       {
01698           if(temp->offset == -1)
01699               sprintf(name, "%s", temp->filename);
01700           else
01701               sprintf(name, "%s%s", texture_menunames[menunum-CMD_TEXTUREWAD], temp->filename);
01702           StripExtension (name);
01703       strTemp = name;
01704       strTemp.MakeLower();
01705       if ( strTemp.Find(".specular") >= 0 ||
01706            strTemp.Find(".glow") >= 0 ||
01707            strTemp.Find(".bump") >= 0 ||
01708            strTemp.Find(".diffuse") >= 0 ||
01709            strTemp.Find(".blend") >= 0 ||
01710            strTemp.Find(".alpha") >= 0
01711          )
01712         continue;
01713       else
01714       {
01715             Texture_ForName (name, true);
01716       }
01717       }
01718 
01719       ClearFileList(&list);
01720   //--}
01721 
01722 
01723     g_dontuse = false;
01724 
01725   if (!bLinked)
01726   {
01727 
01728     for (int k = 0; k < 10; k++)
01729     {
01730       sprintf(name, "Path%d", k);
01731       if (GetPrivateProfileString("Include", name, "", dirstring, 1024, linkstring) > 0)
01732       {
01733         Texture_ShowDirectory(dirstring, true);
01734       }
01735     }
01736 
01737     LoadShadersFromDir(texture_directory);
01738 
01739     SortTextures();
01740       
01741     sprintf (name, "Textures: %s", texture_directory);
01742       SetWindowText(g_qeglobals.d_hwndEntity, name);
01743 
01744       // select the first texture in the list
01745       if (!g_qeglobals.d_texturewin.texdef.name[0])
01746           SelectTexture (16, g_qeglobals.d_texturewin.height -16, false);
01747   }
01748 }

Here is the call graph for this function:

void Texture_ShowInuse void   ) 
 

Definition at line 1897 of file TexWnd.cpp.

References active_brushes, b, brush_s::brush_faces, brush_t, QEGlobals_t::d_hwndEntity, patchMesh_t::d_texture, QEGlobals_t::d_texturewin, f, face_t, g_dontuse, g_qeglobals, texturewin_t::height, texdef_t::name, qtexture_s::name, name, face_s::next, brush_s::next, NULL, texturewin_t::originy, brush_s::patchBrush, brush_s::pPatch, selected_brushes, SelectTexture(), SortTextures(), sprintf(), Sys_Status(), Sys_UpdateWindows(), texturewin_t::texdef, face_s::texdef, Texture_ClearInuse(), Texture_ForName(), texture_showinuse, and W_TEXTURE.

Referenced by Map_LoadFile(), CMainFrame::OnTexturesShowinuse(), and Texture_FlushUnused().

01898 {
01899     face_t  *f;
01900     brush_t *b;
01901     char    name[1024];
01902 
01903     texture_showinuse = true;
01904     g_dontuse = false;
01905 
01906     g_qeglobals.d_texturewin.originy = 0;   
01907 
01908     Texture_ClearInuse();
01909     Sys_Status("Selecting active textures\n", 0);
01910 
01911     for (b=active_brushes.next ; b != NULL && b != &active_brushes ; b=b->next)
01912   {
01913     if (b->patchBrush)
01914     {
01915       Texture_ForName(b->pPatch->d_texture->name);
01916     }
01917     else
01918     {
01919           for (f=b->brush_faces ; f ; f=f->next)
01920       {
01921               Texture_ForName (f->texdef.name);
01922       }
01923     }
01924   }
01925 
01926     for (b=selected_brushes.next ; b != NULL && b != &selected_brushes ; b=b->next)
01927   {
01928     if (b->patchBrush)
01929     {
01930       Texture_ForName(b->pPatch->d_texture->name);
01931     }
01932     else
01933     {
01934           for (f=b->brush_faces ; f ; f=f->next)
01935       {
01936               Texture_ForName (f->texdef.name);
01937       }
01938     }
01939   }
01940 
01941     SortTextures();
01942     //SetInspectorMode(W_TEXTURE);
01943     Sys_UpdateWindows (W_TEXTURE);
01944 
01945     sprintf (name, "Textures: in use");
01946     SetWindowText(g_qeglobals.d_hwndEntity, name);
01947 
01948     // select the first texture in the list
01949     if (!g_qeglobals.d_texturewin.texdef.name[0])
01950   {
01951         SelectTexture (16, g_qeglobals.d_texturewin.height -16, false);
01952   }
01953 }

Here is the call graph for this function:

void Texture_StartPos void   ) 
 

Definition at line 1963 of file TexWnd.cpp.

References current_row, current_texture, current_x, current_y, QEGlobals_t::d_qtextures, and g_qeglobals.

Referenced by QERApp_GetTexture(), QERApp_TextureCount(), SelectTexture(), Texture_Draw2(), and Texture_SetTexture().

01964 {
01965     current_texture = g_qeglobals.d_qtextures;
01966     current_x = 8;
01967     current_y = -8;
01968     current_row = 0;
01969 }

void ViewShader const char *  pFile,
const char *  pName
 

Definition at line 2164 of file TexWnd.cpp.

References Delay(), FindEditWindow(), LoadFile(), n, PakLoadAnyFile(), s, and Sys_Printf().

Referenced by SelectTexture().

02165 {
02166   CString str;
02167   char* pBuff = NULL;
02168   int nSize = LoadFile(pFile, reinterpret_cast<void**>(&pBuff));
02169   if (nSize == -1)
02170   {
02171     nSize = PakLoadAnyFile(pFile, reinterpret_cast<void**>(&pBuff));
02172   }
02173   if (nSize > 0)
02174   {
02175     str = pBuff;
02176   }
02177   int nStart = 0; 
02178   if (str.GetLength() > 0)
02179   {
02180     CString strFind = pName;
02181     CString strLook = str;
02182     strLook.MakeLower();
02183     strFind.MakeLower();
02184     int n = strLook.Find(strFind);
02185     if (n >= 0)
02186     {
02187       nStart = n;
02188     }
02189   }
02190 
02191   CString s= "editpad ";
02192   s += pFile;
02193   WinExec(s, SW_SHOWNORMAL);
02194 
02195   Delay(1.5);
02196 
02197   HWND hwndEdit = FindEditWindow();
02198 
02199   if (hwndEdit != NULL)
02200   {
02201     PostMessage(hwndEdit, EM_SETSEL, nStart, nStart);
02202   }
02203   else
02204   {
02205     Sys_Printf("Unable to load shader editor.\n");
02206   }
02207 
02208 
02209 }

Here is the call graph for this function:


Variable Documentation

int current_row
 

Definition at line 81 of file TexWnd.cpp.

Referenced by Texture_NextPos(), and Texture_StartPos().

qtexture_t* current_texture = NULL
 

Definition at line 80 of file TexWnd.cpp.

Referenced by Texture_NextPos(), and Texture_StartPos().

int current_x
 

Definition at line 81 of file TexWnd.cpp.

Referenced by Texture_NextPos(), and Texture_StartPos().

int current_y
 

Definition at line 81 of file TexWnd.cpp.

Referenced by Texture_NextPos(), and Texture_StartPos().

bool g_bFilterEnabled = false
 

Definition at line 76 of file TexWnd.cpp.

Referenced by CTexWnd::UpdateFilter().

char g_cLastChar
 

Definition at line 2873 of file TexWnd.cpp.

Referenced by CTexWnd::UpdateFilter().

qboolean g_dontuse = true
 

Definition at line 87 of file TexWnd.cpp.

Referenced by Texture_ShowDirectory(), and Texture_ShowInuse().

CPtrArray g_lstShaders
 

Definition at line 96 of file TexWnd.cpp.

Referenced by FreeShaders(), hasShader(), LoadShader(), and LoadShadersFromDir().

CPtrArray g_lstSkinCache
 

Definition at line 97 of file TexWnd.cpp.

Referenced by Texture_Cleanup(), and Texture_LoadSkin().

int g_nCurrentTextureMenuName
 

Definition at line 68 of file TexWnd.cpp.

int g_nTextureOffset = 0
 

Definition at line 70 of file TexWnd.cpp.

Referenced by CTexWnd::OnPaint(), and CTexWnd::UpdatePrefs().

int g_nTimerHandle = -1
 

Definition at line 2872 of file TexWnd.cpp.

Referenced by CTexWnd::OnTimer(), and CTexWnd::UpdateFilter().

qtexture_t* g_pluginTexture = NULL
 

Definition at line 50 of file TexWnd.cpp.

Referenced by Texture_LoadFromPlugIn().

CString g_strFilter
 

Definition at line 77 of file TexWnd.cpp.

Referenced by Texture_NextPos(), and CTexWnd::UpdateFilter().

HFONT ghFont = NULL
 

Definition at line 2356 of file TexWnd.cpp.

Str m_gStr
 

Definition at line 37 of file TexWnd.cpp.

qboolean nomips = false [static]
 

Definition at line 52 of file TexWnd.cpp.

qtexture_t* notexture = NULL
 

Definition at line 49 of file TexWnd.cpp.

Referenced by CMainFrame::OnDestroy(), Texture_MakeNoshadertexture(), and Texture_MakeNotexture().

HDC s_hdcTexture = NULL
 

Definition at line 57 of file TexWnd.cpp.

Referenced by CTexWnd::OnPaint(), Texture_LoadSkin(), Texture_LoadTexture(), Texture_LoadTGATexture(), Texture_MakeDefault(), and Texture_SetMode().

HGLRC s_hglrcTexture = NULL
 

Definition at line 56 of file TexWnd.cpp.

Referenced by CTexWnd::OnPaint(), Texture_LoadSkin(), Texture_LoadTexture(), Texture_LoadTGATexture(), Texture_MakeDefault(), and Texture_SetMode().

unsigned tex_palette[256] [static]
 

Definition at line 47 of file TexWnd.cpp.

Referenced by Texture_InitPalette(), and Texture_LoadTexture().

char texture_directory[128]
 

Definition at line 73 of file TexWnd.cpp.

Referenced by Texture_NextPos(), and Texture_ShowDirectory().

int texture_extension_number = 1
 

Definition at line 67 of file TexWnd.cpp.

Referenced by Texture_CreateSolid(), Texture_Flush(), Texture_LoadSkin(), Texture_LoadTexture(), Texture_LoadTGATexture(), Texture_MakeDefault(), and Texture_MakeNoshadertexture().

char texture_menunames[MAX_TEXTUREDIRS][128]
 

Definition at line 85 of file TexWnd.cpp.

Referenced by FillTextureMenu(), and Texture_ShowDirectory().

int texture_mode = GL_LINEAR_MIPMAP_LINEAR
 

Definition at line 64 of file TexWnd.cpp.

Referenced by SetTexParameters(), and Texture_SetMode().

int texture_nummenus
 

Definition at line 83 of file TexWnd.cpp.

Referenced by FillTextureMenu().

qboolean texture_showinuse
 

Definition at line 74 of file TexWnd.cpp.

Referenced by CMainFrame::OnUpdateTexturesShowinuse(), Texture_NextPos(), Texture_ShowDirectory(), and Texture_ShowInuse().

int textures_cursorx [static]
 

Definition at line 2044 of file TexWnd.cpp.

Referenced by Texture_MouseDown(), and Texture_MouseMoved().

int textures_cursory [static]
 

Definition at line 2044 of file TexWnd.cpp.

Referenced by Texture_MouseDown(), and Texture_MouseMoved().

OnTexturesFlush UINT uMsg
 

Definition at line 2696 of file TexWnd.cpp.

OnTexturesFlush UINT WPARAM wParam
 

Definition at line 2696 of file TexWnd.cpp.


Generated on Thu Aug 25 18:36:57 2005 for Quake III Arena by  doxygen 1.3.9.1