Skip to content

Commit

Permalink
Initialize fLookAt member
Browse files Browse the repository at this point in the history
  • Loading branch information
kbinani committed Dec 15, 2024
1 parent d12d440 commit 517c868
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Source/LookAt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ struct LookAt {
float fX;
float fZ;
float fBlocksPerPixel;

LookAt() : fX(0), fZ(0), fBlocksPerPixel(5) {}
LookAt(float x, float z, float blocksPerPixel) : fX(x), fZ(z), fBlocksPerPixel(blocksPerPixel) {}
};

} // namespace mcview
4 changes: 2 additions & 2 deletions Source/MapViewComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class MapViewComponent
static int constexpr kMinimumHeight = 250;

explicit MapViewComponent(Delegate *delegate)
: fLookAt({0, 0, 5}),
: fLookAt(LookAt()),
fWaterOpticalDensity(Settings::kDefaultWaterOpticalDensity),
fWaterTranslucent(true),
fEnableBiome(true),
Expand Down Expand Up @@ -1477,7 +1477,7 @@ class MapViewComponent
auto c = clampLookAt(next);
fLookAt = c;
if (fPool) {
fPool->fLookAt = c;
fPool->setLookAt(c);
}
updateAllPinComponentPosition();
unsafeUpdateCaptureButtonStatus();
Expand Down
8 changes: 5 additions & 3 deletions Source/TexturePackThreadPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TexturePackThreadPool : public ThreadPool, public TexturePackJob::Delegate
virtual void texturePackThreadPoolDidFinishJob(TexturePackThreadPool *pool, std::shared_ptr<TexturePackJob::Result> result) = 0;
};

explicit TexturePackThreadPool(Delegate *delegate) : ThreadPool((std::max)(1, (int)std::thread::hardware_concurrency() - 1)), fDelegate(delegate) {}
explicit TexturePackThreadPool(Delegate *delegate) : ThreadPool((std::max)(1, (int)std::thread::hardware_concurrency() - 1)), fLookAt(LookAt()), fDelegate(delegate) {}
virtual ~TexturePackThreadPool() {}

virtual void addTexturePackJob(Region region, bool useCache) {}
Expand Down Expand Up @@ -54,10 +54,12 @@ class TexturePackThreadPool : public ThreadPool, public TexturePackJob::Delegate
removeAllJobs(true, timeoutMs);
}

public:
std::atomic<LookAt> fLookAt;
void setLookAt(LookAt const &la) {
fLookAt.store(la);
}

private:
std::atomic<LookAt> fLookAt;
std::mutex fMut;
Delegate *fDelegate;
};
Expand Down

0 comments on commit 517c868

Please sign in to comment.