GLModelManager: Replace GLRenderer * with GLRenderer &

This commit is contained in:
yvt 2019-08-08 00:01:33 +09:00
parent 8101f85d6c
commit 16a2785cba
No known key found for this signature in database
GPG Key ID: 48F2768FA8D07C92
3 changed files with 5 additions and 9 deletions

View File

@ -30,11 +30,7 @@
namespace spades {
namespace draw {
GLModelManager::GLModelManager(GLRenderer *r) {
SPADES_MARK_FUNCTION();
renderer = r;
}
GLModelManager::GLModelManager(GLRenderer &r) : renderer{r} { SPADES_MARK_FUNCTION(); }
GLModelManager::~GLModelManager() {
SPADES_MARK_FUNCTION();
@ -64,7 +60,7 @@ namespace spades {
auto voxelModel = VoxelModelLoader::Load(name);
return renderer->CreateModelOptimized(*voxelModel).Cast<GLModel>().Unmanage();
return renderer.CreateModelOptimized(*voxelModel).Cast<GLModel>().Unmanage();
}
void GLModelManager::ClearCache() { models.clear(); }

View File

@ -30,12 +30,12 @@ namespace spades {
class GLModel;
class GLRenderer;
class GLModelManager {
GLRenderer *renderer;
GLRenderer &renderer;
std::map<std::string, GLModel *> models;
GLModel *CreateModel(const char *);
public:
GLModelManager(GLRenderer *);
GLModelManager(GLRenderer &);
~GLModelManager();
GLModel *RegisterModel(const char *);

View File

@ -135,7 +135,7 @@ namespace spades {
SPLog("GLRenderer initializing for 3D rendering");
shadowMapRenderer = GLShadowMapShader::CreateShadowMapRenderer(*this);
modelManager = new GLModelManager(this);
modelManager = new GLModelManager(*this);
if ((int)settings.r_softParticles >= 2)
spriteRenderer = new GLSoftLitSpriteRenderer(this);
else if (settings.r_softParticles)