GLSpriteRenderer: Replace GLRenderer * with GLRenderer &

This commit is contained in:
yvt 2019-08-08 00:53:08 +09:00
parent bd005ac5a2
commit 6ad4800e70
No known key found for this signature in database
GPG Key ID: 48F2768FA8D07C92
3 changed files with 13 additions and 13 deletions

View File

@ -141,7 +141,7 @@ namespace spades {
else if (settings.r_softParticles)
spriteRenderer = new GLSoftSpriteRenderer(*this);
else
spriteRenderer = new GLSpriteRenderer(this);
spriteRenderer = new GLSpriteRenderer(*this);
longSpriteRenderer = new GLLongSpriteRenderer(*this);
modelRenderer = new GLModelRenderer(*this);

View File

@ -29,10 +29,10 @@
namespace spades {
namespace draw {
GLSpriteRenderer::GLSpriteRenderer(GLRenderer *renderer)
GLSpriteRenderer::GLSpriteRenderer(GLRenderer &renderer)
: renderer(renderer),
device(renderer->GetGLDevice()),
settings(renderer->GetSettings()),
device(renderer.GetGLDevice()),
settings(renderer.GetSettings()),
projectionViewMatrix("projectionViewMatrix"),
rightVector("rightVector"),
upVector("upVector"),
@ -46,7 +46,7 @@ namespace spades {
colorAttribute("colorAttribute") {
SPADES_MARK_FUNCTION();
program = renderer->RegisterProgram("Shaders/Sprite.program");
program = renderer.RegisterProgram("Shaders/Sprite.program");
}
GLSpriteRenderer::~GLSpriteRenderer() { SPADES_MARK_FUNCTION(); }
@ -101,19 +101,19 @@ namespace spades {
spritePosAttribute(program);
colorAttribute(program);
projectionViewMatrix.SetValue(renderer->GetProjectionViewMatrix());
viewMatrix.SetValue(renderer->GetViewMatrix());
projectionViewMatrix.SetValue(renderer.GetProjectionViewMatrix());
viewMatrix.SetValue(renderer.GetViewMatrix());
fogDistance.SetValue(renderer->GetFogDistance());
fogDistance.SetValue(renderer.GetFogDistance());
const auto &viewOrigin = renderer->GetSceneDef().viewOrigin;
const auto &viewOrigin = renderer.GetSceneDef().viewOrigin;
viewOriginVector.SetValue(viewOrigin.x, viewOrigin.y, viewOrigin.z);
Vector3 fogCol = renderer->GetFogColor();
Vector3 fogCol = renderer.GetFogColor();
fogCol *= fogCol;
fogColor.SetValue(fogCol.x, fogCol.y, fogCol.z);
const client::SceneDefinition &def = renderer->GetSceneDef();
const client::SceneDefinition &def = renderer.GetSceneDef();
rightVector.SetValue(def.viewAxis[0].x, def.viewAxis[0].y, def.viewAxis[0].z);
upVector.SetValue(def.viewAxis[1].x, def.viewAxis[1].y, def.viewAxis[1].z);
texture.SetValue(0);

View File

@ -56,7 +56,7 @@ namespace spades {
float r, g, b, a;
};
GLRenderer *renderer;
GLRenderer &renderer;
IGLDevice &device;
GLSettings &settings;
std::vector<Sprite> sprites;
@ -83,7 +83,7 @@ namespace spades {
void Flush();
public:
GLSpriteRenderer(GLRenderer *);
GLSpriteRenderer(GLRenderer &);
~GLSpriteRenderer();
void Add(GLImage *img, Vector3 center, float rad, float ang, Vector4 color) override;