MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / LoadTexture

Method LoadTexture

CrySystem/ScriptObjectSystem.cpp:1001–1036  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// !load a texture @param szFileName the texture file path @return the texture id if succeded nil if failed */

Source from the content-addressed store, hash-verified

999 @return the texture id if succeded nil if failed
1000*/
1001int CScriptObjectSystem::LoadTexture(IFunctionHandler *pH)
1002{
1003// CHECK_PARAMETERS(1);
1004 const char *szFileName;
1005 int nTid=0;
1006 pH->GetParam(1,szFileName);
1007
1008 int nLoadAsCubeMap=0;
1009 bool bClamp = false;
1010 if (pH->GetParamCount()>=2)
1011 {
1012 pH->GetParam(2,nLoadAsCubeMap);
1013 pH->GetParam(3,bClamp);
1014 }
1015
1016 ITexPic * pPic = 0;
1017 if(nLoadAsCubeMap)
1018 pPic = m_pSystem->GetIRenderer()->EF_LoadTexture((char*)szFileName, 0, FT2_FORCECUBEMAP, eTT_Cubemap);
1019 else
1020 pPic = m_pRenderer->EF_LoadTexture((char*)szFileName,FT_CLAMP | FT_NOREMOVE,0,eTT_Base);
1021
1022 if (pPic && pPic->IsTextureLoaded())
1023 {
1024 nTid=pPic->GetTextureID();
1025 m_pSystem->GetIRenderer()->SetTexture(nTid);
1026 m_pSystem->GetIRenderer()->SetTexClampMode(bClamp);
1027
1028 if(nLoadAsCubeMap)
1029 return pH->EndFunction(nTid);
1030
1031
1032 USER_DATA ud=m_pScriptSystem->CreateUserData((int)nTid,USER_DATA_TEXTURE);
1033 return pH->EndFunction(ud);
1034 }
1035 return pH->EndFunctionNull();
1036}
1037
1038/////////////////////////////////////////////////////////////////////////////////
1039/////////////////////////////////////////////////////////////////////////////////

Callers 7

SpawnTestParticlesMethod · 0.45
AddDialogMethod · 0.45
GrassTypeMethod · 0.45
LoadResourcesMethod · 0.45
ProcessMethod · 0.45
RenderMethod · 0.45

Calls 11

EF_LoadTextureMethod · 0.80
IsTextureLoadedMethod · 0.80
GetTextureIDMethod · 0.80
EndFunctionMethod · 0.80
CreateUserDataMethod · 0.80
EndFunctionNullMethod · 0.80
GetParamMethod · 0.45
GetParamCountMethod · 0.45
GetIRendererMethod · 0.45
SetTextureMethod · 0.45
SetTexClampModeMethod · 0.45

Tested by

no test coverage detected