summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-25 23:49:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-25 23:49:27 +0000
commit7b462801d500b43bd7ebebe69c2e8a9d5e3f1261 (patch)
tree3c0c941cd7a98defb8d8e138f0c0ddb5d5903c68 /game
parentAdd traits helpers for glTexParameter functions (diff)
downloadilt-7b462801d500b43bd7ebebe69c2e8a9d5e3f1261.tar.bz2
ilt-7b462801d500b43bd7ebebe69c2e8a9d5e3f1261.tar.xz
ilt-7b462801d500b43bd7ebebe69c2e8a9d5e3f1261.zip
Remove the static texture cache
Static variables persist too long, destruction is unmanaged and occurs after the gl context is gone.
Diffstat (limited to 'game')
-rw-r--r--game/network/network.cpp3
-rw-r--r--game/terrain.cpp4
2 files changed, 3 insertions, 4 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp
index 8aa9adb..500742c 100644
--- a/game/network/network.cpp
+++ b/game/network/network.cpp
@@ -2,7 +2,6 @@
#include "routeWalker.h"
#include <array>
#include <cache.h>
-#include <filesystem>
#include <game/network/link.h>
#include <gfx/models/texture.h>
#include <glm/gtx/intersect.hpp>
@@ -10,7 +9,7 @@
#include <stdexcept>
#include <utility>
-Network::Network(const std::string & tn) : texture {Texture::cachedTexture.get(tn)} { }
+Network::Network(const std::string & tn) : texture {std::make_shared<Texture>(tn)} { }
Node::Ptr
Network::nodeAt(GlobalPosition3D pos)
diff --git a/game/terrain.cpp b/game/terrain.cpp
index 3778f3d..a4b6510 100644
--- a/game/terrain.cpp
+++ b/game/terrain.cpp
@@ -18,8 +18,8 @@
#include <vector>
Terrain::Terrain(std::shared_ptr<GeoData> tm) :
- geoData {std::move(tm)}, grass {Texture::cachedTexture.get("grass.png")},
- water {Texture::cachedTexture.get("water.png")}
+ geoData {std::move(tm)}, grass {std::make_shared<Texture>("grass.png")},
+ water {std::make_shared<Texture>("water.png")}
{
generateMeshes();
}