Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/TextureManager.cpp
/* Copyright (C) 2015 Wildfire Games. | /* Copyright (C) 2017 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 485 Lines • ▼ Show 20 Lines | // LOGWARNING("Converting texture \"%s\"", srcPath.c_str()); | ||||
size_t GetBytesUploaded() const | size_t GetBytesUploaded() const | ||||
{ | { | ||||
size_t size = 0; | size_t size = 0; | ||||
for (TextureCache::const_iterator it = m_TextureCache.begin(); it != m_TextureCache.end(); ++it) | for (TextureCache::const_iterator it = m_TextureCache.begin(); it != m_TextureCache.end(); ++it) | ||||
size += (*it)->GetUploadedSize(); | size += (*it)->GetUploadedSize(); | ||||
return size; | return size; | ||||
} | } | ||||
void PrepareOverlayTexture(const VfsPath& texturePath, const VfsPath& textureMaskPath, | |||||
CTexturePtr& texture, CTexturePtr& textureMask, float maxAnisotropy) | |||||
{ | |||||
CTextureProperties texturePropsBase(texturePath); | |||||
texturePropsBase.SetWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE); | |||||
texturePropsBase.SetMaxAnisotropy(maxAnisotropy); | |||||
texture = CreateTexture(texturePropsBase); | |||||
CTextureProperties texturePropsMask(textureMaskPath); | |||||
texturePropsMask.SetWrap(GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE); | |||||
texturePropsMask.SetMaxAnisotropy(maxAnisotropy); | |||||
textureMask = CreateTexture(texturePropsMask); | |||||
} | |||||
private: | private: | ||||
PIVFS m_VFS; | PIVFS m_VFS; | ||||
CCacheLoader m_CacheLoader; | CCacheLoader m_CacheLoader; | ||||
bool m_DisableGL; | bool m_DisableGL; | ||||
CTextureConverter m_TextureConverter; | CTextureConverter m_TextureConverter; | ||||
Handle m_DefaultHandle; | Handle m_DefaultHandle; | ||||
Handle m_ErrorHandle; | Handle m_ErrorHandle; | ||||
▲ Show 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
return m->GenerateCachedTexture(path, outputPath); | return m->GenerateCachedTexture(path, outputPath); | ||||
} | } | ||||
size_t CTextureManager::GetBytesUploaded() const | size_t CTextureManager::GetBytesUploaded() const | ||||
{ | { | ||||
return m->GetBytesUploaded(); | return m->GetBytesUploaded(); | ||||
} | } | ||||
void CTextureManager::PrepareOverlayTexture(const VfsPath& texturePath, const VfsPath& textureMaskPath, | |||||
CTexturePtr& texture, CTexturePtr& textureMask, float maxAnisotropy) | |||||
{ | |||||
m->PrepareOverlayTexture(texturePath, textureMaskPath, texture, textureMask, maxAnisotropy); | |||||
} |
Wildfire Games · Phabricator