Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/TextureManager.cpp
Show First 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | if (h <= 0) | ||||
// Replace with error texture to make it obvious | // Replace with error texture to make it obvious | ||||
texture->SetHandle(m_ErrorHandle); | texture->SetHandle(m_ErrorHandle); | ||||
return; | return; | ||||
} | } | ||||
// Get some flags for later use | // Get some flags for later use | ||||
size_t flags = 0; | size_t flags = 0; | ||||
(void)ogl_tex_get_format(h, &flags, NULL); | (void)ogl_tex_get_format(h, &flags, nullptr); | ||||
// Initialise base color from the texture | // Initialise base color from the texture | ||||
(void)ogl_tex_get_average_color(h, &texture->m_BaseColor); | (void)ogl_tex_get_average_color(h, &texture->m_BaseColor); | ||||
// Set GL upload properties | // Set GL upload properties | ||||
(void)ogl_tex_set_wrap(h, texture->m_Properties.m_WrapS, texture->m_Properties.m_WrapT); | (void)ogl_tex_set_wrap(h, texture->m_Properties.m_WrapS, texture->m_Properties.m_WrapT); | ||||
(void)ogl_tex_set_anisotropy(h, texture->m_Properties.m_Aniso); | (void)ogl_tex_set_anisotropy(h, texture->m_Properties.m_Aniso); | ||||
▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | for (fs::wpath::iterator it = srcPath.begin(); it != srcPath.end(); ++it) | ||||
files.push_back(f); | files.push_back(f); | ||||
p = p / GetWstringFromWpath(*it); | p = p / GetWstringFromWpath(*it); | ||||
} | } | ||||
return m_TextureConverter.ComputeSettings(GetWstringFromWpath(srcPath.leaf()), files); | return m_TextureConverter.ComputeSettings(GetWstringFromWpath(srcPath.leaf()), files); | ||||
} | } | ||||
/** | /** | ||||
* Return the (cached) settings file with the given filename, | * Return the (cached) settings file with the given filename, | ||||
* or NULL if it doesn't exist. | * or nullptr if it doesn't exist. | ||||
*/ | */ | ||||
CTextureConverter::SettingsFile* GetSettingsFile(const VfsPath& path) | CTextureConverter::SettingsFile* GetSettingsFile(const VfsPath& path) | ||||
{ | { | ||||
SettingsFilesMap::iterator it = m_SettingsFiles.find(path); | SettingsFilesMap::iterator it = m_SettingsFiles.find(path); | ||||
if (it != m_SettingsFiles.end()) | if (it != m_SettingsFiles.end()) | ||||
return it->second.get(); | return it->second.get(); | ||||
if (m_VFS->GetFileInfo(path, NULL) >= 0) | if (m_VFS->GetFileInfo(path, nullptr) >= 0) | ||||
{ | { | ||||
shared_ptr<CTextureConverter::SettingsFile> settings(m_TextureConverter.LoadSettings(path)); | shared_ptr<CTextureConverter::SettingsFile> settings(m_TextureConverter.LoadSettings(path)); | ||||
m_SettingsFiles.insert(std::make_pair(path, settings)); | m_SettingsFiles.insert(std::make_pair(path, settings)); | ||||
return settings.get(); | return settings.get(); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_SettingsFiles.insert(std::make_pair(path, shared_ptr<CTextureConverter::SettingsFile>())); | m_SettingsFiles.insert(std::make_pair(path, shared_ptr<CTextureConverter::SettingsFile>())); | ||||
return NULL; | return nullptr; | ||||
} | } | ||||
} | } | ||||
static Status ReloadChangedFileCB(void* param, const VfsPath& path) | static Status ReloadChangedFileCB(void* param, const VfsPath& path) | ||||
{ | { | ||||
return static_cast<CTextureManagerImpl*>(param)->ReloadChangedFile(path); | return static_cast<CTextureManagerImpl*>(param)->ReloadChangedFile(path); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator