From a95bde468770f134217b83d8b9459ac2923b1ab7 Mon Sep 17 00:00:00 2001 From: Mikulas Florek Date: Wed, 18 Oct 2023 18:36:16 +0200 Subject: [PATCH] fixed assert --- src/editor/asset_browser.cpp | 2 +- src/renderer/editor/render_plugins.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/editor/asset_browser.cpp b/src/editor/asset_browser.cpp index 80667e004..f19784e94 100644 --- a/src/editor/asset_browser.cpp +++ b/src/editor/asset_browser.cpp @@ -1185,7 +1185,7 @@ struct AssetBrowserImpl : AssetBrowser { static TextFilter filter; filter.gui("Filter", width, focus); - float h = ImGui::GetContentRegionAvail().y - ImGui::GetTextLineHeightWithSpacing() * 2; + float h = maximum(200.f, ImGui::GetContentRegionAvail().y - ImGui::GetTextLineHeightWithSpacing() * 2); ImGui::BeginChild("Resources", ImVec2(0, h), false, ImGuiWindowFlags_HorizontalScrollbar); AssetCompiler& compiler = m_app.getAssetCompiler(); diff --git a/src/renderer/editor/render_plugins.cpp b/src/renderer/editor/render_plugins.cpp index ab52fed5c..266f9955f 100644 --- a/src/renderer/editor/render_plugins.cpp +++ b/src/renderer/editor/render_plugins.cpp @@ -2919,9 +2919,9 @@ struct ModelPlugin final : AssetBrowser::IPlugin, AssetCompiler::IPlugin { } } - const float radius = length(aabb.max - aabb.min) * 0.50001f; + const float radius = maximum(1e-5f, length(aabb.max - aabb.min) * 0.50001f); const Vec3 center = (aabb.max + aabb.min) * 0.5f; - const Vec3 eye = center + Vec3(1, 1, 1) * length(aabb.max - aabb.min) / SQRT2; + const Vec3 eye = center + Vec3(1, 1, 1) * maximum(1e-5f, length(aabb.max - aabb.min)) / SQRT2; Matrix mtx; mtx.lookAt(eye, center, normalize(Vec3(1, -1, 1))); Viewport viewport;