From 027f6ef3574fb05de5a3c2ceedc7af07ac6cbd2e Mon Sep 17 00:00:00 2001 From: yvt Date: Thu, 8 Aug 2019 00:34:00 +0900 Subject: [PATCH] `GLRadiosityRenderer`: Replace `GLRenderer *` with `GLRenderer &` --- Sources/Draw/GLRadiosityRenderer.cpp | 10 +++++----- Sources/Draw/GLRadiosityRenderer.h | 4 ++-- Sources/Draw/GLRenderer.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/Draw/GLRadiosityRenderer.cpp b/Sources/Draw/GLRadiosityRenderer.cpp index 3df82508..1b56e74c 100644 --- a/Sources/Draw/GLRadiosityRenderer.cpp +++ b/Sources/Draw/GLRadiosityRenderer.cpp @@ -51,8 +51,8 @@ namespace spades { } }; - GLRadiosityRenderer::GLRadiosityRenderer(GLRenderer *r, client::GameMap *m) - : renderer(r), device(r->GetGLDevice()), settings(r->GetSettings()), map(m) { + GLRadiosityRenderer::GLRadiosityRenderer(GLRenderer &r, client::GameMap *m) + : renderer(r), device(r.GetGLDevice()), settings(r.GetSettings()), map(m) { SPADES_MARK_FUNCTION(); w = map->Width(); @@ -166,7 +166,7 @@ namespace spades { Vector3 pos = {ipos.x + .5f, ipos.y + .5f, ipos.z + .5f}; - GLMapShadowRenderer *shadowmap = renderer->mapShadowRenderer; + GLMapShadowRenderer *shadowmap = renderer.mapShadowRenderer; uint32_t *bitmap = shadowmap->bitmap.data(); int centerX = ipos.x; int centerY = ipos.y - ipos.z; @@ -355,7 +355,7 @@ namespace spades { if (!chunks[i].transferDone.load()) cnt++; } - GLProfiler::Context profiler(renderer->GetGLProfiler(), "Radiosity [>= %d chunk(s)]", + GLProfiler::Context profiler(renderer.GetGLProfiler(), "Radiosity [>= %d chunk(s)]", cnt); for (size_t i = 0; i < chunks.size(); i++) { Chunk &c = chunks[i]; @@ -393,7 +393,7 @@ namespace spades { int nearDirtyChunks = 0; // first, check only chunks in near range - Vector3 eyePos = renderer->GetSceneDef().viewOrigin; + Vector3 eyePos = renderer.GetSceneDef().viewOrigin; int eyeX = (int)(eyePos.x) >> ChunkSizeBits; int eyeY = (int)(eyePos.y) >> ChunkSizeBits; int eyeZ = (int)(eyePos.z) >> ChunkSizeBits; diff --git a/Sources/Draw/GLRadiosityRenderer.h b/Sources/Draw/GLRadiosityRenderer.h index 5e430efc..228bc15b 100644 --- a/Sources/Draw/GLRadiosityRenderer.h +++ b/Sources/Draw/GLRadiosityRenderer.h @@ -42,7 +42,7 @@ namespace spades { class UpdateDispatch; enum { ChunkSize = 16, ChunkSizeBits = 4, Envelope = 6 }; - GLRenderer *renderer; + GLRenderer &renderer; IGLDevice &device; GLSettings &settings; client::GameMap *map; @@ -102,7 +102,7 @@ namespace spades { Vector3 base, x, y, z; }; - GLRadiosityRenderer(GLRenderer *renderer, client::GameMap *map); + GLRadiosityRenderer(GLRenderer &renderer, client::GameMap *map); ~GLRadiosityRenderer(); Result Evaluate(IntVector3); diff --git a/Sources/Draw/GLRenderer.cpp b/Sources/Draw/GLRenderer.cpp index dbb69ca5..d6beef6f 100644 --- a/Sources/Draw/GLRenderer.cpp +++ b/Sources/Draw/GLRenderer.cpp @@ -322,7 +322,7 @@ namespace spades { SPLog("Creating Ray-traced Ambient Occlusion Renderer"); ambientShadowRenderer = new GLAmbientShadowRenderer(*this, *newMap); SPLog("Creating Relective Shadow Maps Renderer"); - radiosityRenderer = new GLRadiosityRenderer(this, newMap.get_pointer()); + radiosityRenderer = new GLRadiosityRenderer(*this, newMap.get_pointer()); } else { SPLog("Radiosity is disabled"); }