mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Rename CTextureManager and CTextureEntry since they are only for terrain textures
This was SVN commit r8076.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#include "graphics/Patch.h"
|
||||
#include "graphics/SkeletonAnimManager.h"
|
||||
#include "graphics/Terrain.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/TerrainTextureManager.h"
|
||||
#include "graphics/Unit.h"
|
||||
#include "graphics/UnitManager.h"
|
||||
#include "lib/input.h"
|
||||
@@ -384,7 +384,7 @@ void CGameView::RegisterInit()
|
||||
RegMemFun(this, &CGameView::Initialize, L"CGameView init", 1);
|
||||
|
||||
// previously done by CGameView::InitResources
|
||||
RegMemFun(g_TexMan.GetSingletonPtr(), &CTextureManager::LoadTerrainTextures, L"LoadTerrainTextures", 60);
|
||||
RegMemFun(g_TexMan.GetSingletonPtr(), &CTerrainTextureManager::LoadTerrainTextures, L"LoadTerrainTextures", 60);
|
||||
RegMemFun(g_Renderer.GetSingletonPtr(), &CRenderer::LoadAlphaMaps, L"LoadAlphaMaps", 5);
|
||||
RegMemFun(g_Renderer.GetSingletonPtr()->GetWaterManager(), &WaterManager::LoadWaterTextures, L"LoadWaterTextures", 80);
|
||||
RegMemFun(g_Renderer.GetSingletonPtr()->GetSkyManager(), &SkyManager::LoadSkyTextures, L"LoadSkyTextures", 15);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "graphics/GameView.h"
|
||||
#include "graphics/Patch.h"
|
||||
#include "graphics/Terrain.h"
|
||||
#include "graphics/TextureEntry.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/TerrainTextureEntry.h"
|
||||
#include "graphics/TerrainTextureManager.h"
|
||||
#include "lib/timer.h"
|
||||
#include "maths/MathUtil.h"
|
||||
#include "ps/CLogger.h"
|
||||
@@ -161,8 +161,8 @@ int CMapReader::UnpackTerrain()
|
||||
CStr texturename;
|
||||
unpacker.UnpackString(texturename);
|
||||
|
||||
CTextureEntry* texentry = NULL;
|
||||
if (CTextureManager::IsInitialised())
|
||||
CTerrainTextureEntry* texentry = NULL;
|
||||
if (CTerrainTextureManager::IsInitialised())
|
||||
texentry = g_TexMan.FindTexture(texturename);
|
||||
m_TerrainTextures.push_back(texentry);
|
||||
|
||||
@@ -489,8 +489,8 @@ void CXMLReader::ReadTerrain(XMBElement parent)
|
||||
m_MapReader.m_PatchesPerSide = patches;
|
||||
|
||||
// Load the texture
|
||||
CTextureEntry* texentry = NULL;
|
||||
if (CTextureManager::IsInitialised())
|
||||
CTerrainTextureEntry* texentry = NULL;
|
||||
if (CTerrainTextureManager::IsInitialised())
|
||||
texentry = g_TexMan.FindTexture(texture);
|
||||
|
||||
m_MapReader.pTerrain->Initialize(patches, NULL);
|
||||
|
||||
@@ -33,7 +33,7 @@ class CLightEnv;
|
||||
class CCinemaManager;
|
||||
class CTriggerManager;
|
||||
class CSimulation2;
|
||||
class CTextureEntry;
|
||||
class CTerrainTextureEntry;
|
||||
class CScriptValRooted;
|
||||
class ScriptInterface;
|
||||
class CGameView;
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
// heightmap for map
|
||||
std::vector<u16> m_Heightmap;
|
||||
// list of terrain textures used by map
|
||||
std::vector<CTextureEntry*> m_TerrainTextures;
|
||||
std::vector<CTerrainTextureEntry*> m_TerrainTextures;
|
||||
// tile descriptions for each tile
|
||||
std::vector<STileDesc> m_Tiles;
|
||||
// lightenv stored in file
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "MapWriter.h"
|
||||
#include "Patch.h"
|
||||
#include "Terrain.h"
|
||||
#include "TextureEntry.h"
|
||||
#include "TextureManager.h"
|
||||
#include "TerrainTextureEntry.h"
|
||||
#include "TerrainTextureManager.h"
|
||||
|
||||
#include "maths/MathUtil.h"
|
||||
#include "maths/NUSpline.h"
|
||||
@@ -69,7 +69,7 @@ void CMapWriter::SaveMap(const VfsPath& pathname, CTerrain* pTerrain,
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GetHandleIndex: return the index of the given handle in the given list; or 0xFFFF if
|
||||
// handle isn't in list
|
||||
static u16 GetEntryIndex(const CTextureEntry* entry, const std::vector<CTextureEntry*>& entries)
|
||||
static u16 GetEntryIndex(const CTerrainTextureEntry* entry, const std::vector<CTerrainTextureEntry*>& entries)
|
||||
{
|
||||
const size_t limit = std::min(entries.size(), size_t(0xFFFEu)); // paranoia
|
||||
for (size_t i=0;i<limit;i++) {
|
||||
@@ -89,7 +89,7 @@ void CMapWriter::EnumTerrainTextures(CTerrain *pTerrain,
|
||||
std::vector<STileDesc>& tiles)
|
||||
{
|
||||
// the list of all handles in use
|
||||
std::vector<CTextureEntry*> entries;
|
||||
std::vector<CTerrainTextureEntry*> entries;
|
||||
|
||||
// resize tile array to required size
|
||||
tiles.resize(SQR(pTerrain->GetVerticesPerSide()-1));
|
||||
@@ -120,7 +120,7 @@ void CMapWriter::EnumTerrainTextures(CTerrain *pTerrain,
|
||||
// now find the texture names for each handle
|
||||
for (size_t i=0;i<entries.size();i++) {
|
||||
CStr texturename;
|
||||
CTextureEntry* texentry=entries[i];
|
||||
CTerrainTextureEntry* texentry=entries[i];
|
||||
if (!texentry) {
|
||||
// uh-oh, this shouldn't happen; set texturename to empty string
|
||||
texturename="";
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "lib/res/handle.h"
|
||||
|
||||
#include "graphics/TextureEntry.h"
|
||||
#include "graphics/TerrainTextureEntry.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// CMiniPatch: definition of a single terrain tile
|
||||
@@ -35,11 +35,11 @@ public:
|
||||
CMiniPatch();
|
||||
|
||||
// texture applied to tile
|
||||
CTextureEntry* Tex;
|
||||
CTerrainTextureEntry* Tex;
|
||||
// 'priority' of the texture - determines drawing order of terrain textures
|
||||
int Priority;
|
||||
|
||||
CTextureEntry* GetTextureEntry() { return Tex; }
|
||||
CTerrainTextureEntry* GetTextureEntry() { return Tex; }
|
||||
Handle GetHandle() { return Tex ? Tex->GetHandle() : 0; }
|
||||
int GetPriority() { return Priority; }
|
||||
};
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include "renderer/WaterManager.h"
|
||||
|
||||
#include "TerrainProperties.h"
|
||||
#include "TextureEntry.h"
|
||||
#include "TextureManager.h"
|
||||
#include "TerrainTextureEntry.h"
|
||||
#include "TerrainTextureManager.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "Terrain.h"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "ps/XML/XeroXMB.h"
|
||||
#include "ps/XML/Xeromyces.h"
|
||||
|
||||
#include "TextureManager.h"
|
||||
#include "TerrainTextureManager.h"
|
||||
#include "ps/Overlay.h"
|
||||
|
||||
|
||||
|
||||
@@ -22,19 +22,13 @@
|
||||
#include "lib/ogl.h"
|
||||
#include "lib/res/graphics/ogl_tex.h"
|
||||
|
||||
#include "ps/CLogger.h"
|
||||
|
||||
#include "TextureEntry.h"
|
||||
#include "TextureManager.h"
|
||||
#include "TerrainTextureEntry.h"
|
||||
#include "TerrainTextureManager.h"
|
||||
#include "TerrainProperties.h"
|
||||
#include "Texture.h"
|
||||
#include "renderer/Renderer.h"
|
||||
|
||||
#define LOG_CATEGORY L"graphics"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// CTextureEntry constructor
|
||||
CTextureEntry::CTextureEntry(CTerrainPropertiesPtr props, const VfsPath& path):
|
||||
CTerrainTextureEntry::CTerrainTextureEntry(CTerrainPropertiesPtr props, const VfsPath& path):
|
||||
m_pProperties(props),
|
||||
m_Handle(-1),
|
||||
m_BaseColor(0),
|
||||
@@ -51,9 +45,7 @@ CTextureEntry::CTextureEntry(CTerrainPropertiesPtr props, const VfsPath& path):
|
||||
m_Tag = fs::basename(m_TexturePath);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// CTextureEntry destructor
|
||||
CTextureEntry::~CTextureEntry()
|
||||
CTerrainTextureEntry::~CTerrainTextureEntry()
|
||||
{
|
||||
if (m_Handle > 0)
|
||||
(void)ogl_tex_free(m_Handle);
|
||||
@@ -62,9 +54,8 @@ CTextureEntry::~CTextureEntry()
|
||||
(*it)->RemoveTerrain(this);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// LoadTexture: actually load the texture resource from file
|
||||
void CTextureEntry::LoadTexture()
|
||||
void CTerrainTextureEntry::LoadTexture()
|
||||
{
|
||||
CTexture texture(m_TexturePath);
|
||||
if (g_Renderer.LoadTexture(&texture,GL_REPEAT)) {
|
||||
@@ -74,11 +65,9 @@ void CTextureEntry::LoadTexture()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// BuildBaseColor: calculate the root colour of the texture, used for coloring minimap, and store
|
||||
// in m_BaseColor member
|
||||
void CTextureEntry::BuildBaseColor()
|
||||
void CTerrainTextureEntry::BuildBaseColor()
|
||||
{
|
||||
if (m_pProperties && m_pProperties->HasBaseColor())
|
||||
{
|
||||
@@ -24,15 +24,15 @@
|
||||
#include "lib/file/vfs/vfs_path.h"
|
||||
#include "ps/CStr.h"
|
||||
|
||||
#include "TextureManager.h"
|
||||
#include "TerrainTextureManager.h"
|
||||
|
||||
class XMBElement;
|
||||
class CXeromyces;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CTextureEntry: class wrapping a terrain texture object; contains various other required
|
||||
// CTerrainTextureEntry: class wrapping a terrain texture object; contains various other required
|
||||
// elements - color of minimap, terrain "group" it belongs to, etc
|
||||
class CTextureEntry
|
||||
class CTerrainTextureEntry
|
||||
{
|
||||
public:
|
||||
typedef std::vector<CTerrainGroup *> GroupVector;
|
||||
@@ -65,8 +65,8 @@ private:
|
||||
public:
|
||||
// Most of the texture's data is delay-loaded, so after the constructor has
|
||||
// been called, the texture entry is ready to be used.
|
||||
CTextureEntry(CTerrainPropertiesPtr props, const VfsPath& path);
|
||||
~CTextureEntry();
|
||||
CTerrainTextureEntry(CTerrainPropertiesPtr props, const VfsPath& path);
|
||||
~CTerrainTextureEntry();
|
||||
|
||||
CStr GetTag() const
|
||||
{ return m_Tag; }
|
||||
@@ -20,8 +20,8 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "TextureManager.h"
|
||||
#include "TextureEntry.h"
|
||||
#include "TerrainTextureManager.h"
|
||||
#include "TerrainTextureEntry.h"
|
||||
#include "TerrainProperties.h"
|
||||
|
||||
#include "lib/res/graphics/ogl_tex.h"
|
||||
@@ -33,16 +33,16 @@
|
||||
|
||||
#define LOG_CATEGORY L"graphics"
|
||||
|
||||
CTextureManager::CTextureManager():
|
||||
CTerrainTextureManager::CTerrainTextureManager():
|
||||
m_LastGroupIndex(0)
|
||||
{}
|
||||
|
||||
CTextureManager::~CTextureManager()
|
||||
CTerrainTextureManager::~CTerrainTextureManager()
|
||||
{
|
||||
UnloadTerrainTextures();
|
||||
}
|
||||
|
||||
void CTextureManager::UnloadTerrainTextures()
|
||||
void CTerrainTextureManager::UnloadTerrainTextures()
|
||||
{
|
||||
for (size_t i=0; i < m_TextureEntries.size(); i++)
|
||||
delete m_TextureEntries[i];
|
||||
@@ -59,7 +59,7 @@ void CTextureManager::UnloadTerrainTextures()
|
||||
m_LastGroupIndex = 0;
|
||||
}
|
||||
|
||||
CTextureEntry* CTextureManager::FindTexture(const CStr& tag_)
|
||||
CTerrainTextureEntry* CTerrainTextureManager::FindTexture(const CStr& tag_)
|
||||
{
|
||||
CStr tag(tag_);
|
||||
// Strip extension off of tag
|
||||
@@ -74,25 +74,25 @@ CTextureEntry* CTextureManager::FindTexture(const CStr& tag_)
|
||||
return m_TextureEntries[i];
|
||||
}
|
||||
|
||||
LOG(CLogger::Warning, LOG_CATEGORY, L"TextureManager: Couldn't find terrain %hs", tag.c_str());
|
||||
LOG(CLogger::Warning, LOG_CATEGORY, L"CTerrainTextureManager: Couldn't find terrain %hs", tag.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
CTerrainPropertiesPtr CTextureManager::GetPropertiesFromFile(const CTerrainPropertiesPtr& props, const VfsPath& pathname)
|
||||
CTerrainPropertiesPtr CTerrainTextureManager::GetPropertiesFromFile(const CTerrainPropertiesPtr& props, const VfsPath& pathname)
|
||||
{
|
||||
return CTerrainProperties::FromXML(props, pathname);
|
||||
}
|
||||
|
||||
CTextureEntry *CTextureManager::AddTexture(const CTerrainPropertiesPtr& props, const VfsPath& path)
|
||||
CTerrainTextureEntry *CTerrainTextureManager::AddTexture(const CTerrainPropertiesPtr& props, const VfsPath& path)
|
||||
{
|
||||
CTextureEntry *entry = new CTextureEntry(props, path);
|
||||
CTerrainTextureEntry *entry = new CTerrainTextureEntry(props, path);
|
||||
m_TextureEntries.push_back(entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
void CTextureManager::DeleteTexture(CTextureEntry* entry)
|
||||
void CTerrainTextureManager::DeleteTexture(CTerrainTextureEntry* entry)
|
||||
{
|
||||
typedef std::vector<CTextureEntry*>::iterator Iter;
|
||||
typedef std::vector<CTerrainTextureEntry*>::iterator Iter;
|
||||
Iter i=std::find(m_TextureEntries.begin(),m_TextureEntries.end(),entry);
|
||||
if (i!=m_TextureEntries.end()) {
|
||||
m_TextureEntries.erase(i);
|
||||
@@ -106,7 +106,7 @@ void CTextureManager::DeleteTexture(CTextureEntry* entry)
|
||||
// jw: indeed this is inefficient and RecurseDirectory should be implemented
|
||||
// via VFSUtil::EnumFiles, but it works fine and "only" takes 25ms for
|
||||
// typical maps. therefore, we'll leave it for now.
|
||||
void CTextureManager::LoadTextures(const CTerrainPropertiesPtr& props, const VfsPath& path)
|
||||
void CTerrainTextureManager::LoadTextures(const CTerrainPropertiesPtr& props, const VfsPath& path)
|
||||
{
|
||||
VfsPaths pathnames;
|
||||
if(fs_util::GetPathnames(g_VFS, path, 0, pathnames) < 0)
|
||||
@@ -129,7 +129,7 @@ void CTextureManager::LoadTextures(const CTerrainPropertiesPtr& props, const Vfs
|
||||
{
|
||||
myprops = GetPropertiesFromFile(props, pathnameXML);
|
||||
if (myprops)
|
||||
LOG(CLogger::Normal, LOG_CATEGORY, L"CTextureManager: Successfully loaded override xml %ls for texture %ls", pathnameXML.string().c_str(), pathnames[i].string().c_str());
|
||||
LOG(CLogger::Normal, LOG_CATEGORY, L"CTerrainTextureManager: Successfully loaded override xml %ls for texture %ls", pathnameXML.string().c_str(), pathnames[i].string().c_str());
|
||||
}
|
||||
|
||||
// Error or non-existant xml file -> use parent props
|
||||
@@ -140,7 +140,7 @@ void CTextureManager::LoadTextures(const CTerrainPropertiesPtr& props, const Vfs
|
||||
}
|
||||
}
|
||||
|
||||
void CTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& parentProps, const VfsPath& path)
|
||||
void CTerrainTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& parentProps, const VfsPath& path)
|
||||
{
|
||||
//LOG(CLogger::Normal, LOG_CATEGORY, L"CTextureManager::RecurseDirectory(%ls)", path.string().c_str());
|
||||
|
||||
@@ -154,7 +154,7 @@ void CTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& parentProps,
|
||||
// No terrains.xml, or read failures -> use parent props (i.e.
|
||||
if (!props)
|
||||
{
|
||||
LOG(CLogger::Normal, LOG_CATEGORY, L"CTextureManager::RecurseDirectory(%ls): no terrains.xml (or errors while loading) - using parent properties", path.string().c_str());
|
||||
LOG(CLogger::Normal, LOG_CATEGORY, L"CTerrainTextureManager::RecurseDirectory(%ls): no terrains.xml (or errors while loading) - using parent properties", path.string().c_str());
|
||||
props = parentProps;
|
||||
}
|
||||
|
||||
@@ -171,13 +171,13 @@ void CTextureManager::RecurseDirectory(const CTerrainPropertiesPtr& parentProps,
|
||||
}
|
||||
|
||||
|
||||
int CTextureManager::LoadTerrainTextures()
|
||||
int CTerrainTextureManager::LoadTerrainTextures()
|
||||
{
|
||||
RecurseDirectory(CTerrainPropertiesPtr(), L"art/textures/terrain/types/");
|
||||
return 0;
|
||||
}
|
||||
|
||||
CTerrainGroup* CTextureManager::FindGroup(const CStr& name)
|
||||
CTerrainGroup* CTerrainTextureManager::FindGroup(const CStr& name)
|
||||
{
|
||||
TerrainGroupMap::const_iterator it=m_TerrainGroups.find(name);
|
||||
if (it != m_TerrainGroups.end())
|
||||
@@ -186,14 +186,14 @@ CTerrainGroup* CTextureManager::FindGroup(const CStr& name)
|
||||
return m_TerrainGroups[name] = new CTerrainGroup(name, ++m_LastGroupIndex);
|
||||
}
|
||||
|
||||
void CTerrainGroup::AddTerrain(CTextureEntry *pTerrain)
|
||||
void CTerrainGroup::AddTerrain(CTerrainTextureEntry *pTerrain)
|
||||
{
|
||||
m_Terrains.push_back(pTerrain);
|
||||
}
|
||||
|
||||
void CTerrainGroup::RemoveTerrain(CTextureEntry *pTerrain)
|
||||
void CTerrainGroup::RemoveTerrain(CTerrainTextureEntry *pTerrain)
|
||||
{
|
||||
std::vector<CTextureEntry *>::iterator it;
|
||||
std::vector<CTerrainTextureEntry *>::iterator it;
|
||||
it=find(m_Terrains.begin(), m_Terrains.end(), pTerrain);
|
||||
if (it != m_Terrains.end())
|
||||
m_Terrains.erase(it);
|
||||
@@ -27,12 +27,12 @@
|
||||
#include "ps/CStr.h"
|
||||
#include "ps/Singleton.h"
|
||||
|
||||
// access to sole CTextureManager object
|
||||
#define g_TexMan CTextureManager::GetSingleton()
|
||||
// access to sole CTerrainTextureManager object
|
||||
#define g_TexMan CTerrainTextureManager::GetSingleton()
|
||||
|
||||
class XMBElement;
|
||||
class CXeromyces;
|
||||
class CTextureEntry;
|
||||
class CTerrainTextureEntry;
|
||||
class CTerrainProperties;
|
||||
|
||||
typedef shared_ptr<CTerrainProperties> CTerrainPropertiesPtr;
|
||||
@@ -45,7 +45,7 @@ class CTerrainGroup
|
||||
// priorities
|
||||
size_t m_Index;
|
||||
// list of textures of this type (found from the texture directory)
|
||||
std::vector<CTextureEntry*> m_Terrains;
|
||||
std::vector<CTerrainTextureEntry*> m_Terrains;
|
||||
|
||||
public:
|
||||
CTerrainGroup(CStr name, size_t index):
|
||||
@@ -54,22 +54,22 @@ public:
|
||||
{}
|
||||
|
||||
// Add a texture entry to this terrain type
|
||||
void AddTerrain(CTextureEntry *);
|
||||
void AddTerrain(CTerrainTextureEntry *);
|
||||
// Remove a texture entry
|
||||
void RemoveTerrain(CTextureEntry *);
|
||||
void RemoveTerrain(CTerrainTextureEntry *);
|
||||
|
||||
size_t GetIndex() const
|
||||
{ return m_Index; }
|
||||
CStr GetName() const
|
||||
{ return m_Name; }
|
||||
|
||||
const std::vector<CTextureEntry*> &GetTerrains() const
|
||||
const std::vector<CTerrainTextureEntry*> &GetTerrains() const
|
||||
{ return m_Terrains; }
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CTextureManager : manager class for all terrain texture objects
|
||||
class CTextureManager : public Singleton<CTextureManager>
|
||||
// CTerrainTextureManager : manager class for all terrain texture objects
|
||||
class CTerrainTextureManager : public Singleton<CTerrainTextureManager>
|
||||
{
|
||||
public:
|
||||
typedef std::map<CStr, CTerrainGroup *> TerrainGroupMap;
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
private:
|
||||
// All texture entries created by this class, for easy freeing now that
|
||||
// textures may be in several STextureType's
|
||||
std::vector<CTextureEntry *> m_TextureEntries;
|
||||
std::vector<CTerrainTextureEntry *> m_TextureEntries;
|
||||
|
||||
TerrainGroupMap m_TerrainGroups;
|
||||
|
||||
@@ -94,8 +94,8 @@ private:
|
||||
|
||||
public:
|
||||
// constructor, destructor
|
||||
CTextureManager();
|
||||
~CTextureManager();
|
||||
CTerrainTextureManager();
|
||||
~CTerrainTextureManager();
|
||||
|
||||
// Find all XML's in the directory (with subdirs) and try to load them as
|
||||
// terrain XML's
|
||||
@@ -103,14 +103,14 @@ public:
|
||||
|
||||
void UnloadTerrainTextures();
|
||||
|
||||
CTextureEntry* FindTexture(const CStr& tag);
|
||||
CTerrainTextureEntry* FindTexture(const CStr& tag);
|
||||
|
||||
// Create a texture object for a new terrain texture at path, using the
|
||||
// property sheet props.
|
||||
CTextureEntry *AddTexture(const CTerrainPropertiesPtr& props, const VfsPath& path);
|
||||
CTerrainTextureEntry *AddTexture(const CTerrainPropertiesPtr& props, const VfsPath& path);
|
||||
|
||||
// Remove the texture from all our maps and lists and delete it afterwards.
|
||||
void DeleteTexture(CTextureEntry* entry);
|
||||
void DeleteTexture(CTerrainTextureEntry* entry);
|
||||
|
||||
// Find or create a new texture group. All terrain groups are owned by the
|
||||
// texturemanager (TerrainTypeManager)
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "graphics/GameView.h"
|
||||
#include "graphics/MiniPatch.h"
|
||||
#include "graphics/Terrain.h"
|
||||
#include "graphics/TextureEntry.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/TerrainTextureEntry.h"
|
||||
#include "graphics/TerrainTextureManager.h"
|
||||
#include "lib/ogl.h"
|
||||
#include "lib/external_libraries/sdl.h"
|
||||
#include "lib/bits.h"
|
||||
@@ -467,7 +467,7 @@ void CMiniMap::RebuildTerrainTexture()
|
||||
CMiniPatch *mp = m_Terrain->GetTile(x + i, y + j);
|
||||
if(mp)
|
||||
{
|
||||
CTextureEntry *tex = mp->GetTextureEntry();
|
||||
CTerrainTextureEntry *tex = mp->GetTextureEntry();
|
||||
if(tex)
|
||||
color = tex->GetBaseColor();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include "graphics/MapReader.h"
|
||||
#include "graphics/MaterialManager.h"
|
||||
#include "graphics/ParticleEngine.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/TerrainTextureManager.h"
|
||||
|
||||
#include "renderer/Renderer.h"
|
||||
#include "renderer/VertexBufferManager.h"
|
||||
@@ -513,7 +513,7 @@ static void InitRenderer()
|
||||
g_Renderer.SetOptionFloat(CRenderer::OPT_LODBIAS, g_LodBias);
|
||||
|
||||
// create terrain related stuff
|
||||
new CTextureManager;
|
||||
new CTerrainTextureManager;
|
||||
|
||||
// create the material manager
|
||||
new CMaterialManager;
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#include "graphics/Patch.h"
|
||||
#include "graphics/SkeletonAnimManager.h"
|
||||
#include "graphics/Terrain.h"
|
||||
#include "graphics/TextureEntry.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/TerrainTextureEntry.h"
|
||||
#include "graphics/TerrainTextureManager.h"
|
||||
#include "graphics/UnitManager.h"
|
||||
#include "maths/MathUtil.h"
|
||||
#include "ps/Font.h"
|
||||
@@ -94,7 +94,7 @@ ActorViewer::ActorViewer()
|
||||
// Create a tiny empty piece of terrain, just so we can put shadows
|
||||
// on it without having to think too hard
|
||||
m.Terrain.Initialize(1, NULL);
|
||||
CTextureEntry* tex = g_TexMan.FindTexture("whiteness");
|
||||
CTerrainTextureEntry* tex = g_TexMan.FindTexture("whiteness");
|
||||
if (tex)
|
||||
{
|
||||
CPatch* patch = m.Terrain.GetPatch(0, 0);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "graphics/MapWriter.h"
|
||||
#include "graphics/Patch.h"
|
||||
#include "graphics/Terrain.h"
|
||||
#include "graphics/TextureEntry.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/TerrainTextureEntry.h"
|
||||
#include "graphics/TerrainTextureManager.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/Loader.h"
|
||||
#include "ps/World.h"
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#include "../CommandProc.h"
|
||||
|
||||
#include "graphics/Patch.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
#include "graphics/TextureEntry.h"
|
||||
#include "graphics/TerrainTextureManager.h"
|
||||
#include "graphics/TerrainTextureEntry.h"
|
||||
#include "graphics/Terrain.h"
|
||||
#include "ps/Game.h"
|
||||
#include "ps/World.h"
|
||||
@@ -41,9 +41,9 @@ namespace AtlasMessage {
|
||||
|
||||
QUERYHANDLER(GetTerrainGroups)
|
||||
{
|
||||
const CTextureManager::TerrainGroupMap &groups = g_TexMan.GetGroups();
|
||||
const CTerrainTextureManager::TerrainGroupMap &groups = g_TexMan.GetGroups();
|
||||
std::vector<std::wstring> groupnames;
|
||||
for (CTextureManager::TerrainGroupMap::const_iterator it = groups.begin(); it != groups.end(); ++it)
|
||||
for (CTerrainTextureManager::TerrainGroupMap::const_iterator it = groups.begin(); it != groups.end(); ++it)
|
||||
groupnames.push_back(CStrW(it->first));
|
||||
msg->groupnames = groupnames;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ QUERYHANDLER(GetTerrainGroupPreviews)
|
||||
std::vector<sTerrainGroupPreview> previews;
|
||||
|
||||
CTerrainGroup* group = g_TexMan.FindGroup(CStrW(*msg->groupname));
|
||||
for (std::vector<CTextureEntry*>::const_iterator it = group->GetTerrains().begin(); it != group->GetTerrains().end(); ++it)
|
||||
for (std::vector<CTerrainTextureEntry*>::const_iterator it = group->GetTerrains().begin(); it != group->GetTerrains().end(); ++it)
|
||||
{
|
||||
previews.push_back(sTerrainGroupPreview());
|
||||
previews.back().name = CStrW((*it)->GetTag());
|
||||
@@ -139,8 +139,8 @@ BEGIN_COMMAND(PaintTerrain)
|
||||
{
|
||||
struct TerrainTile
|
||||
{
|
||||
TerrainTile(CTextureEntry* t, ssize_t p) : tex(t), priority(p) {}
|
||||
CTextureEntry* tex;
|
||||
TerrainTile(CTerrainTextureEntry* t, ssize_t p) : tex(t), priority(p) {}
|
||||
CTerrainTextureEntry* tex;
|
||||
ssize_t priority;
|
||||
};
|
||||
class TerrainArray : public DeltaArray2D<TerrainTile>
|
||||
@@ -152,7 +152,7 @@ BEGIN_COMMAND(PaintTerrain)
|
||||
m_VertsPerSide = g_Game->GetWorld()->GetTerrain()->GetVerticesPerSide();
|
||||
}
|
||||
|
||||
void PaintTile(ssize_t x, ssize_t y, CTextureEntry* tex, ssize_t priority)
|
||||
void PaintTile(ssize_t x, ssize_t y, CTerrainTextureEntry* tex, ssize_t priority)
|
||||
{
|
||||
// Ignore out-of-bounds tiles
|
||||
if (size_t(x) >= size_t(m_VertsPerSide-1) || size_t(y) >= size_t(m_VertsPerSide-1))
|
||||
@@ -215,7 +215,7 @@ BEGIN_COMMAND(PaintTerrain)
|
||||
ssize_t x0, y0;
|
||||
g_CurrentBrush.GetBottomLeft(x0, y0);
|
||||
|
||||
CTextureEntry* texentry = g_TexMan.FindTexture(CStrW(*msg->texture));
|
||||
CTerrainTextureEntry* texentry = g_TexMan.FindTexture(CStrW(*msg->texture));
|
||||
if (! texentry)
|
||||
{
|
||||
debug_warn(L"Can't find texentry"); // TODO: nicer error handling
|
||||
|
||||
Reference in New Issue
Block a user