From 21505e46cea22f2eb51b89437a01537875aa4ba9 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 15 Nov 2017 17:24:20 -1000 Subject: [PATCH] CLineRenderer fixes --- Runtime/CResLoader.cpp | 9 +-------- Runtime/Graphics/CLineRenderer.cpp | 2 ++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Runtime/CResLoader.cpp b/Runtime/CResLoader.cpp index 3ae32d2ff..3bcc76f82 100644 --- a/Runtime/CResLoader.cpp +++ b/Runtime/CResLoader.cpp @@ -172,11 +172,8 @@ FourCC CResLoader::GetResourceTypeById(CAssetId id) const const SObjectTag* CResLoader::GetResourceIdByName(std::string_view name) const { for (const std::unique_ptr& file : x18_pakLoadedList) - { - const SObjectTag* id = file->GetResIdByName(name); - if (id) + if (const SObjectTag* id = file->GetResIdByName(name)) return id; - } return nullptr; } @@ -312,13 +309,9 @@ void CResLoader::EnumerateResources(const std::function void CResLoader::EnumerateNamedResources(const std::function& lambda) const { for (auto it = x18_pakLoadedList.begin() ; it != x18_pakLoadedList.end() ; ++it) - { for (const auto& name : (*it)->GetNameList()) - { if (!lambda(name.first, name.second)) return; - } - } } } diff --git a/Runtime/Graphics/CLineRenderer.cpp b/Runtime/Graphics/CLineRenderer.cpp index 369569dd2..774d2cfae 100644 --- a/Runtime/Graphics/CLineRenderer.cpp +++ b/Runtime/Graphics/CLineRenderer.cpp @@ -106,6 +106,8 @@ static zeus::CVector2f IntersectLines(const zeus::CVector2f& pa1, const zeus::CV zeus::CVector2f pa1mpa2 = pa1 - pa2; zeus::CVector2f pb1mpb2 = pb1 - pb2; float denom = pa1mpa2.x * pb1mpb2.y - pa1mpa2.y * pb1mpb2.x; + if (denom < 0.0001f) + return pa2; float numt1 = pa1.x * pa2.y - pa1.y * pa2.x; float numt2 = pb1.x * pb2.y - pb1.y * pb2.x; return {(numt1 * pb1mpb2.x - pa1mpa2.x * numt2) / denom,