Commit d43d4489 authored by D-AIRY's avatar D-AIRY

New DDS loader; Some refactor

parent 2bffcbeb
......@@ -338,7 +338,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xEngine", "..\..\xEngine\vs2013\xEngine.vcxproj", "{D2386C4E-7032-487B-8EAD-951778AD6EBC}"
ProjectSection(ProjectDependencies) = postProject
{7C0C8205-BDD3-44A3-AA3A-7855C7EFC88E} = {7C0C8205-BDD3-44A3-AA3A-7855C7EFC88E}
{AE74C93F-2FD3-462D-8E98-B3F3198B9104} = {AE74C93F-2FD3-462D-8E98-B3F3198B9104}
{C1C1F046-C839-4602-AF70-923CDD237C1B} = {C1C1F046-C839-4602-AF70-923CDD237C1B}
{FE640066-C8E8-41FB-AD13-89BC03BFFBFB} = {FE640066-C8E8-41FB-AD13-89BC03BFFBFB}
{718C186E-9155-41DF-B8AB-74ED03E204CD} = {718C186E-9155-41DF-B8AB-74ED03E204CD}
{3A5449A3-DCE7-4557-9C9F-DEEAFBAAC763} = {3A5449A3-DCE7-4557-9C9F-DEEAFBAAC763}
{120D29B8-D2D9-4B4E-8AC6-D951973B7398} = {120D29B8-D2D9-4B4E-8AC6-D951973B7398}
......
Subproject commit 317adf26851044423c0cffefb3cfd0a43e2a7cd4
Subproject commit 4c488f0c048793550e4c1b9551059cb78554e1ff
......@@ -317,7 +317,6 @@ bool CAnimatedModelShared::init(UINT uResourceCount, IXResourceModelAnimated **p
shaderDesc.szFileVS = "mtrlskin_base.vs";
shaderDesc.szFilePS = "mtrlgeom_base.ps";
char szMaterialName[256];
for(UINT i = 0; i < m_uSkinCount; ++i)
{
m_pppMaterials[i] = (IXMaterial**)(m_ppMaterialsBlob + m_uSkinCount + m_uMaterialCount * i);
......@@ -326,8 +325,7 @@ bool CAnimatedModelShared::init(UINT uResourceCount, IXResourceModelAnimated **p
{
if(aaMaterials[i][j].szName && aaMaterials[i][j].szName[0])
{
sprintf_s(szMaterialName, "%s.dds", aaMaterials[i][j].szName);
m_pMaterialSystem->loadMaterial(szMaterialName, &m_pppMaterials[i][j], &shaderDesc);
m_pMaterialSystem->loadMaterial(aaMaterials[i][j].szName, &m_pppMaterials[i][j], &shaderDesc);
}
else
{
......
......@@ -83,7 +83,6 @@ bool CDynamicModelShared::init(IXResourceModelStatic *pResource)
shaderDesc.szFileVS = "mtrlgeom_base.vs";
shaderDesc.szFilePS = "mtrlgeom_base.ps";
char szMaterialName[256];
const char *szMaterial;
for(UINT i = 0; i < m_uSkinCount; ++i)
{
......@@ -95,8 +94,7 @@ bool CDynamicModelShared::init(IXResourceModelStatic *pResource)
szMaterial = m_pResource->getMaterial(j, i);
if(szMaterial && szMaterial[0])
{
sprintf_s(szMaterialName, "%s.dds", szMaterial);
m_pMaterialSystem->loadMaterial(szMaterialName, &m_pppMaterials[i][j], &shaderDesc);
m_pMaterialSystem->loadMaterial(szMaterial, &m_pppMaterials[i][j], &shaderDesc);
}
else if(i == 0)
{
......
......@@ -155,6 +155,18 @@ CCore::CCore(const char *szName)
}
}
#endif
#if 0
while(1)
{
IXResourceTexture2D *pTex = NULL;
if(getResourceManager()->getTexture2D("textures/tp/tp_sga_window_center_up1.dds#+0button", &pTex))
{
printf(COLOR_LGREEN "Loaded!" COLOR_RESET "\n");
mem_release(pTex);
}
Sleep(10);
}
#endif
}
CCore::~CCore()
{
......
This diff is collapsed.
......@@ -18,6 +18,8 @@ public:
bool XMETHODCALLTYPE getModelStatic(const char *szName, IXResourceModelStatic **ppOut, bool bForceReload = false) override;
bool XMETHODCALLTYPE getModelAnimated(const char *szName, IXResourceModelAnimated **ppOut, bool bForceReload = false) override;
bool XMETHODCALLTYPE getModelInfo(const char *szName, XModelInfo *pInfo) override;
UINT XMETHODCALLTYPE getModelSupportedFormats() override;
const XFormatName* XMETHODCALLTYPE getModelSupportedFormat(UINT uIndex) override;
......@@ -27,6 +29,31 @@ public:
void onResourceModelRelease(CResourceModel *pResource);
bool XMETHODCALLTYPE getTexture(const char *szName, IXResourceTexture **ppOut, bool bForceReload = false) override;
bool XMETHODCALLTYPE getTexture2D(const char *szName, IXResourceTexture2D **ppOut, bool bForceReload = false) override;
bool XMETHODCALLTYPE getTextureCube(const char *szName, IXResourceTextureCube **ppOut, bool bForceReload = false) override;
UINT XMETHODCALLTYPE getTextureSupportedFormats() override;
const XFormatName* XMETHODCALLTYPE getTextureSupportedFormat(UINT uIndex) override;
bool XMETHODCALLTYPE getTextureInfo(const char *szName, XTextureInfo *pInfo) override;
IXResourceTexture2D* XMETHODCALLTYPE newResourceTexture2D() override;
IXResourceTextureCube* XMETHODCALLTYPE newResourceTextureCube() override;
void XMETHODCALLTYPE addTexture(const char *szName, IXResourceTexture *pTexture) override;
template<class T>
void onResourceTextureRelease(T *pTexture)
{
const char *szName = pTexture->getFileName();
if(szName)
{
m_mpModels[szName] = NULL;
}
}
protected:
IXCore *m_pCore;
......@@ -34,6 +61,14 @@ protected:
AssotiativeArray<String, IXResourceModel*> m_mpModels;
Array<XFormatName> m_aModelExts;
AssotiativeArray<AAString, Array<IXTextureLoader*>> m_mapTextureLoaders;
AssotiativeArray<String, IXResourceTexture*> m_mpTextures;
Array<XFormatName> m_aTextureExts;
const char* getExtension(const char *szName);
};
#endif
#include "ResourceTexture.h"
#include "ResourceManager.h"
CResourceTexture2D::CResourceTexture2D():
BaseClass(GXTEXTURE_TYPE_2D)
CResourceTexture2D::CResourceTexture2D(CResourceManager *pMgr):
BaseClass(GXTEXTURE_TYPE_2D, pMgr)
{
}
CResourceTexture2D::~CResourceTexture2D()
{
mem_delete_a(pDataBlob);
}
UINT XMETHODCALLTYPE CResourceTexture2D::getWidth() const
{
return(m_uWidth);
......@@ -52,7 +48,6 @@ void XMETHODCALLTYPE CResourceTexture2D::init(UINT uWidth, UINT uHeight, GXFORMA
}
size_t sizeData = uFrameCount * (sizeof(void*) + uMipmapCount * sizeof(XImageMip));
size_t sizeFrame = getTextureBytes(format, uWidth, uHeight);
UINT uTmpWidth = uWidth;
UINT uTmpHeight = uHeight;
for(UINT i = 0; i < uMipmapCount; ++i)
......@@ -127,16 +122,11 @@ IXResourceTexture2D* XMETHODCALLTYPE CResourceTexture2D::as2D()
//##########################################################################
CResourceTextureCube::CResourceTextureCube():
BaseClass(GXTEXTURE_TYPE_CUBE)
CResourceTextureCube::CResourceTextureCube(CResourceManager *pMgr):
BaseClass(GXTEXTURE_TYPE_CUBE, pMgr)
{
}
CResourceTextureCube::~CResourceTextureCube()
{
mem_delete_a(pDataBlob);
}
UINT XMETHODCALLTYPE CResourceTextureCube::getSize() const
{
return(m_uSize);
......@@ -188,7 +178,7 @@ void XMETHODCALLTYPE CResourceTextureCube::init(UINT uSize, GXFORMAT format, UIN
{
pppData[i] = (XImageMip**)pTmp;
pTmp += sizeof(void*) * uMipmapCount;
for(int mip = 0; mip < uMipmapCount; ++mip)
for(UINT mip = 0; mip < uMipmapCount; ++mip)
{
pppData[i][mip] = (XImageMip*)pTmp;
pTmp += sizeof(XImageMip) * 6;
......
......@@ -3,16 +3,23 @@
#include <xcommon/resource/IXResourceTexture.h>
class CResourceManager;
template<class T>
class CResourceTextureImpl: public T
{
public:
typedef CResourceTextureImpl<T> BaseClass;
CResourceTextureImpl(GXTEXTURE_TYPE type):
m_type(type)
CResourceTextureImpl(GXTEXTURE_TYPE type, CResourceManager *pMgr):
m_type(type),
m_pManager(pMgr)
{
}
~CResourceTextureImpl()
{
m_pManager->onResourceTextureRelease(this);
mem_delete_a(pDataBlob);
}
GXTEXTURE_TYPE XMETHODCALLTYPE getType() const override
{
......@@ -154,6 +161,15 @@ public:
return(false);
}
void setFileName(const char *szFilename)
{
m_szFileName = szFilename;
}
const char *getFileName() const
{
return(m_szFileName);
}
protected:
GXTEXTURE_TYPE m_type = GXTEXTURE_TYPE_UNKNOWN;
GXFORMAT m_format = GXFMT_UNKNOWN;
......@@ -162,14 +178,16 @@ protected:
float m_fFrameTime = 0.0f;
byte *pDataBlob = NULL;
const char *m_szFileName = NULL;
CResourceManager *m_pManager;
};
// Implemented in core
class CResourceTexture2D: public CResourceTextureImpl<IXResourceTexture2D>
{
public:
CResourceTexture2D();
~CResourceTexture2D();
CResourceTexture2D(CResourceManager *pMgr);
UINT XMETHODCALLTYPE getWidth() const override;
UINT XMETHODCALLTYPE getHeight() const override;
......@@ -194,8 +212,7 @@ protected:
class CResourceTextureCube: public CResourceTextureImpl<IXResourceTextureCube>
{
public:
CResourceTextureCube();
~CResourceTextureCube();
CResourceTextureCube(CResourceManager *pMgr);
UINT XMETHODCALLTYPE getSize() const override;
......
......@@ -118,6 +118,12 @@ bool XMETHODCALLTYPE CTextureLoader::open(const char *szFileName, const char *sz
return(false);
}
if(isBlockCompressed(m_format))
{
m_ddsHeader.width = max(1, ((m_ddsHeader.width + 3) / 4) * 4);
m_ddsHeader.height = max(1, ((m_ddsHeader.height + 3) / 4) * 4);
}
m_iXFrames = 1;
m_iYFrames = 1;
m_fFrameTime = 0.0f;
......@@ -257,6 +263,7 @@ GXTEXTURE_TYPE XMETHODCALLTYPE CTextureLoader::getType() const
}*/
return(GXTEXTURE_TYPE_UNKNOWN);
}
bool XMETHODCALLTYPE CTextureLoader::loadAs2D(IXResourceTexture2D *pResource)
{
if(getType() != GXTEXTURE_TYPE_2D)
......@@ -281,10 +288,42 @@ bool XMETHODCALLTYPE CTextureLoader::loadAs2D(IXResourceTexture2D *pResource)
{
size_t sizeMip = pResource->getTextureBytes(info.format, uMipWidth, uMipHeight);
if(m_pCurrentFile->readBin(pData, sizeMip) != sizeMip)
if(m_bConvertFromRGB24)
{
LibReport(REPORT_MSG_LEVEL_ERROR, "Unexpected end of file\n");
goto end;
UINT uPixels = uMipWidth * uMipHeight;
byte *pTmp = pData;
for(UINT j = 0; j < uPixels; ++j)
{
for(UINT k = 0; k < 3; ++k)
{
if(m_pCurrentFile->readBin(pTmp++, 1) != 1)
{
LibReport(REPORT_MSG_LEVEL_ERROR, "Unexpected end of file\n");
goto end;
}
}
*pTmp++ = 0xFF;
}
}
else
{
if(m_pCurrentFile->readBin(pData, sizeMip) != sizeMip)
{
LibReport(REPORT_MSG_LEVEL_ERROR, "Unexpected end of file\n");
goto end;
}
}
if(m_bConvertSwapRB)
{
UINT uPixels = uMipWidth * uMipHeight;
byte tmp;
for(UINT j = 0; j < uPixels; ++j)
{
tmp = pData[j * 4 + 0];
pData[j * 4 + 0] = pData[j * 4 + 2];
pData[j * 4 + 2] = tmp;
}
}
// m_iXFrames
......@@ -355,6 +394,7 @@ bool XMETHODCALLTYPE CTextureLoader::loadAs2D(IXResourceTexture2D *pResource)
uMipHeight = max(uMipHeight, 1);
}
mem_delete_a(pData);
return(true);
end:
mem_delete_a(pData);
......@@ -393,10 +433,42 @@ bool XMETHODCALLTYPE CTextureLoader::loadAsCube(IXResourceTextureCube *pResource
{
size_t sizeMip = pResource->getTextureBytes(info.format, uMipSize, uMipSize);
if(m_pCurrentFile->readBin(pData, sizeMip) != sizeMip)
if(m_bConvertFromRGB24)
{
UINT uPixels = uMipSize * uMipSize;
byte *pTmp = pData;
for(UINT j = 0; j < uPixels; ++j)
{
for(UINT k = 0; k < 3; ++k)
{
if(m_pCurrentFile->readBin(pTmp++, 1) != 1)
{
LibReport(REPORT_MSG_LEVEL_ERROR, "Unexpected end of file\n");
goto end;
}
}
*pTmp++ = 0xFF;
}
}
else
{
if(m_pCurrentFile->readBin(pData, sizeMip) != sizeMip)
{
LibReport(REPORT_MSG_LEVEL_ERROR, "Unexpected end of file\n");
goto end;
}
}
if(m_bConvertSwapRB)
{
LibReport(REPORT_MSG_LEVEL_ERROR, "Unexpected end of file\n");
goto end;
UINT uPixels = uMipSize * uMipSize;
byte tmp;
for(UINT j = 0; j < uPixels; ++j)
{
tmp = pData[j * 4 + 0];
pData[j * 4 + 0] = pData[j * 4 + 2];
pData[j * 4 + 2] = tmp;
}
}
// m_iXFrames
......@@ -416,6 +488,7 @@ bool XMETHODCALLTYPE CTextureLoader::loadAsCube(IXResourceTextureCube *pResource
}
}
}
mem_delete_a(pData);
return(true);
end:
mem_delete_a(pData);
......@@ -445,6 +518,9 @@ bool CTextureLoader::isBlockCompressed(GXFORMAT format)
GXFORMAT CTextureLoader::getFormat()
{
m_bConvertFromRGB24 = false;
m_bConvertSwapRB = false;
if(m_ddsHeader.ddspf.flags == DDS_RGB)
{
if(m_ddsHeader.ddspf.RGBBitCount == 16)
......@@ -458,7 +534,9 @@ GXFORMAT CTextureLoader::getFormat()
{
if(m_ddsHeader.ddspf.RBitMask == 0xff0000 && m_ddsHeader.ddspf.GBitMask == 0xff00 && m_ddsHeader.ddspf.BBitMask == 0xff)
{
return(GXFMT_R8G8B8);
//m_bConvertSwapRB = true;
m_bConvertFromRGB24 = true;
return(GXFMT_X8R8G8B8);
}
}
else if(m_ddsHeader.ddspf.RGBBitCount == 32)
......@@ -469,6 +547,7 @@ GXFORMAT CTextureLoader::getFormat()
}
if(m_ddsHeader.ddspf.RBitMask == 0xff0000 && m_ddsHeader.ddspf.GBitMask == 0xff00 && m_ddsHeader.ddspf.BBitMask == 0xff)
{
m_bConvertSwapRB = true;
return(GXFMT_X8R8G8B8);
}
}
......@@ -479,6 +558,7 @@ GXFORMAT CTextureLoader::getFormat()
{
if(m_ddsHeader.ddspf.RBitMask == 0xff0000 && m_ddsHeader.ddspf.GBitMask == 0xff00 && m_ddsHeader.ddspf.BBitMask == 0xff && m_ddsHeader.ddspf.ABitMask == 0xff000000)
{
m_bConvertSwapRB = true;
return(GXFMT_A8R8G8B8);
}
if(m_ddsHeader.ddspf.RBitMask == 0xff && m_ddsHeader.ddspf.GBitMask == 0xff00 && m_ddsHeader.ddspf.BBitMask == 0xff0000 && m_ddsHeader.ddspf.ABitMask == 0xff000000)
......
......@@ -43,6 +43,9 @@ protected:
int m_iYFrames = 1;
float m_fFrameTime = 0.0;
int m_iSkipFrames = 0;
bool m_bConvertFromRGB24 = false;
bool m_bConvertSwapRB = false;
};
#endif
/***********************************************************
Copyright Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018
Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018
See the license in LICENSE
***********************************************************/
......@@ -21,7 +21,7 @@ void CCrosshairManager::loadCrosshair(ID id, CCrosshair * pCCrosshair)
pCCrosshair->setNumSegmens(desc->iNumSegments);
pCCrosshair->setStyle(desc->style);
pCCrosshair->setTexInfo(desc->f2TexOffset, desc->f2TexSize);
pCCrosshair->setTexture(desc->idTexture);
pCCrosshair->setTexture(desc->pTexture);
}
void CCrosshairManager::loadConfig(const char * szFile)
......@@ -32,6 +32,9 @@ void CCrosshairManager::loadConfig(const char * szFile)
CrosshairDesc cd;
IXMaterialSystem *pMaterialSystem = (IXMaterialSystem*)Core_GetIXCore()->getPluginManager()->getInterface(IXMATERIALSYSTEM_GUID);
assert(pMaterialSystem);
for(int i = 0; i < sections; ++i)
{
sect = config->getSectionName(i);
......@@ -72,11 +75,11 @@ void CCrosshairManager::loadConfig(const char * szFile)
{
str = "split";
}
if(strcmpi(str, "split_move") == 0)
if(strcasecmp(str, "split_move") == 0)
{
cd.style = CCrosshair::SPLIT_MOVE;
}
else if(strcmpi(str, "scaled") == 0)
else if(strcasecmp(str, "scaled") == 0)
{
cd.style = CCrosshair::SCALED;
}
......@@ -90,7 +93,7 @@ void CCrosshairManager::loadConfig(const char * szFile)
if(config->keyExists(sect, "tex"))
{
tex = config->getKey(sect, "tex");
cd.idTexture = SGCore_LoadTexAddName(tex, LOAD_TEXTURE_TYPE_CONST);
pMaterialSystem->loadTexture(tex, &cd.pTexture);
}
else
{
......
/***********************************************************
Copyright Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018
Copyright © Vitaliy Buturlin, Evgeny Danilovich, 2017, 2018
See the license in LICENSE
***********************************************************/
......@@ -11,13 +11,15 @@ See the license in LICENSE
#include <common/AssotiativeArray.h>
#include <common/AAString.h>
#include "crosshair.h"
#include <mtrl/IXMaterialSystem.h>
class CCrosshairManager
{
public:
static void loadCrosshair(ID id, CCrosshair * pCrosshair);
static void loadConfig(const char * szFile);
static ID getCrosshairID(const char * szName);
static void loadCrosshair(ID id, CCrosshair *pCrosshair);
static void loadConfig(const char *szFile);
static ID getCrosshairID(const char *szName);
protected:
struct CrosshairDesc
......@@ -28,7 +30,7 @@ protected:
CCrosshair::STYLE style;
float2_t f2TexOffset;
float2_t f2TexSize;
ID idTexture;
IXTexture *pTexture;
};
static AssotiativeArray<AAString, ID> m_mIndex;
......
......@@ -12,7 +12,6 @@ CCrosshair::CCrosshair():
m_bDirty(true),
m_bBuildBuff(false),
m_fSize(0),
m_idTexture(-1),
m_bHidden(true),
m_fMaxSize(0.7f), // 70% of screen height
m_style(SPLIT_MOVE),
......@@ -81,6 +80,8 @@ CCrosshair::~CCrosshair()
mem_release(m_pVertexDeclaration);
mem_delete_a(m_pMemoryBlob);
mem_release(m_pTexture);
}
void CCrosshair::setTexInfo(const float2_t & offs, const float2_t & size)
......@@ -93,17 +94,8 @@ void CCrosshair::setTexInfo(const float2_t & offs, const float2_t & size)
void CCrosshair::update()
{
if(m_bDirty && m_idTexture >= 0)
if(m_bDirty && m_pTexture && m_pTexture->isReady())
{
if(!m_pTexture)
{
m_pTexture = SGCore_LoadTexGetTex(m_idTexture);
if(!m_pTexture)
{
return;
}
}
static const int *r_win_width = GET_PCVAR_INT("r_win_width");
static const int *r_win_height = GET_PCVAR_INT("r_win_height");
......@@ -366,7 +358,7 @@ void CCrosshair::update()
}
void CCrosshair::render()
{
if(m_bHidden || !m_pTexture)
if(m_bHidden || !m_pTexture || !m_pTexture->isReady())
{
return;
}
......@@ -392,7 +384,12 @@ void CCrosshair::render()
m_pDev->setSamplerState(m_pSamplerState, 0);
m_pDev->setIndexBuffer(m_pIndexBuffer);
m_pDev->setRenderBuffer(m_pRenderBuffer);
m_pDev->setTexture(m_pTexture);
IGXBaseTexture *pTex = NULL;
m_pTexture->getAPITexture(&pTex);
m_pDev->setTexture(pTex);
mem_release(pTex);
m_pDev->setDepthStencilState(m_pDepthState);
m_pDev->setPrimitiveTopology(GXPT_TRIANGLELIST);
m_pDev->drawIndexed(m_iVertexCount[m_u8ActiveBuffer], m_iIndexCount[m_u8ActiveBuffer] / 3);
......@@ -460,20 +457,17 @@ void CCrosshair::setMaxSize(float size)
m_bDirty = true;
m_fMaxSize = size;
}
void CCrosshair::setTexture(ID id)
void CCrosshair::setTexture(IXTexture *pTexture)
{
if(m_idTexture != id)
if(m_pTexture != pTexture)
{
m_bDirty = true;
m_idTexture = id;
if(m_idTexture == -1)
{
m_pTexture = NULL;
}
else
mem_release(m_pTexture);
if(pTexture)
{
m_pTexture = SGCore_LoadTexGetTex(m_idTexture);
pTexture->AddRef();
}
m_pTexture = pTexture;
}
}
......
......@@ -9,6 +9,7 @@ See the license in LICENSE
//#include <gdefines.h>
#include "sxgame.h"
#include <mtrl/IXMaterialSystem.h>
//#include <common/SXmath.h>
#define CROSSHAIR_MINSEGS 12
......@@ -39,7 +40,7 @@ public:
void setFixedRadius(float r);
void setStyle(STYLE style);
void setMaxSize(float size);
void setTexture(ID id);
void setTexture(IXTexture *pTexture);
void setSize(float size);
......@@ -56,7 +57,7 @@ protected:
bool m_bDirty;
bool m_bBuildBuff;
float m_fSize;
ID m_idTexture;
IXTexture *m_pTexture = NULL;
bool m_bHidden;
float m_fMaxSize;
STYLE m_style;
......@@ -77,8 +78,7 @@ protected:
IGXVertexDeclaration *m_pVertexDeclaration;
IGXRenderBuffer *m_pRenderBuffer;
IGXContext * m_pDev;
IGXTexture2D * m_pTexture;
IGXContext *m_pDev;
float2_t m_f2TexOffs;
float2_t m_f2TexSize;
......
......@@ -25,36 +25,6 @@ CLoaderTextures::~CLoaderTextures()
m_aPathes.clear();
}
bool CLoaderTextures::fileExists(const char* name)
{
char tmppath[SXGC_LOADTEX_MAX_SIZE_FULLPATH];
char tmp_path[SXGC_LOADTEX_MAX_SIZE_DIR];
char tmp_name[SXGC_LOADTEX_MAX_SIZE_NAME];
bool IsTruePath = false;
//обрезаем имя текстуры и папку
for(int i = 0; i<strlen(name); i++)
{
if(name[i] == '_')
{
memcpy(tmp_path, name, sizeof(char)*i);
tmp_path[i] = 0;
sprintf(tmp_name, "%s", name + i + 1);
IsTruePath = true;
break;
}
}
if(!IsTruePath)
{
//LibReport(REPORT_MSG_LEVEL_ERROR, "%s - wrong texture name [%s]!!!", GEN_MSG_LOCATION, name);
return false;
}
sprintf(tmppath, "textures/%s/%s", tmp_path, name);
return(Core_GetIXCore()->getFileSystem()->fileExists(tmppath));
}
void CLoaderTextures::clearLoaded()
{
int tmpcountdel = 0;
......
......@@ -24,9 +24,6 @@ public:
CLoaderTextures();
~CLoaderTextures();
//! существует ли текстура на диске
bool fileExists(const char *szName);
//! удалить все загруженные текстуры
void clearLoaded();
......
......@@ -173,6 +173,6 @@ void CreateBoundingBoxMesh(const float3* min, const float3* max, IMesh** bbmesh,
};
IMesh *pMesh = SGCore_CrMesh(iVC, iIC, pVertices, pIndices);
*bbmesh = pMesh;
}
......@@ -228,48 +228,6 @@ SX_LIB_API bool SGCore_ShaderFileExists(const char *szName)
//##########################################################################
SX_LIB_API bool SGCore_LoadTexFileExists(const char *szName)
{
SG_PRECOND(false);
return g_pManagerTextures->fileExists(szName);
}
SX_LIB_API void SGCore_LoadTexClearLoaded()
{
SG_PRECOND(_VOID);
g_pManagerTextures->clearLoaded();
}
SX_LIB_API void SGCore_LoadTexDelete(ID id)
{
SG_PRECOND(_VOID);
g_pManagerTextures->deleteTexture(id);
}
SX_LIB_API ID SGCore_LoadTexAddName(const char *szName, LOAD_TEXTURE_TYPE type)
{
SG_PRECOND(-1);
return g_pManagerTextures->addName(szName, type);
}
SX_LIB_API ID SGCore_LoadTexGetID(const char *szName)
{
SG_PRECOND(-1);
return g_pManagerTextures->getID(szName);
}
SX_LIB_API void SGCore_LoadTexGetName(ID id, char *szName)
{
SG_PRECOND(_VOID);
return g_pManagerTextures->getName(id, szName);