From c0d1c53f03c6e549ab23b5af6bb6a43546ab1e93 Mon Sep 17 00:00:00 2001 From: Anders Pistol Date: Tue, 23 Apr 2024 08:54:14 +0200 Subject: [PATCH] Traktor: Reduced default height of scene controller editor. Removed HiZ debug drawing code. --- code/Scene/Editor/DefaultEntityEditor.cpp | 126 +++++++++++----------- code/Scene/Editor/SceneEditorPage.cpp | 2 +- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/code/Scene/Editor/DefaultEntityEditor.cpp b/code/Scene/Editor/DefaultEntityEditor.cpp index 7310c884bd..5157c11807 100644 --- a/code/Scene/Editor/DefaultEntityEditor.cpp +++ b/code/Scene/Editor/DefaultEntityEditor.cpp @@ -244,69 +244,69 @@ void DefaultEntityEditor::drawGuide(render::PrimitiveRenderer* primitiveRenderer primitiveRenderer->drawWireAabb(boundingBox, 1.0f, m_colorBoundingBox); primitiveRenderer->popWorld(); - if (m_entityAdapter->isSelected()) - { - Vector4 center = (boundingBox.mn + boundingBox.mx) / 2.0_simd; - //Scalar radius = ((boundingBox.mx - boundingBox.mn) / 2.0_simd).length(); - - Scalar radius = max(boundingBox.mx.length(), boundingBox.mn.length()); - - Vector4 worldCenter = transform.translation() + center; - Vector4 viewCenter = primitiveRenderer->getView() * worldCenter.xyz1(); - - Scalar znear = 0.1_simd; - Scalar P00 = primitiveRenderer->getProjection().get(0, 0); - Scalar P11 = primitiveRenderer->getProjection().get(1, 1); - - Vector4 aabb; - if (projectSphere(viewCenter, radius, znear, P00, P11, aabb)) - { - Matrix44 proj = primitiveRenderer->getProjection(); - - primitiveRenderer->pushWorld(Matrix44::identity()); - primitiveRenderer->pushView(Matrix44::identity()); - - // Setup projection as UV space. - primitiveRenderer->setProjection(orthoLh( - -1.0f, 1.0f, - 1.0f, -1.0f, - -1.0f, 1.0f - ) * translate(-1.0f, -1.0f, 0.0f) * scale(2.0f, 2.0f, 1.0f)); - - const float w = (aabb.z() - aabb.x()) * clientSize.cx; - const float h = (aabb.w() - aabb.y()) * clientSize.cy; - - const int32_t level = int32_t(std::floor(std::log2(std::max(w, h)))); - const float step = 4096.0f / std::max(4096 >> level, 1); - for (float y = 0.0f; y < clientSize.cy; y += step) - { - const float fy = float(y) / clientSize.cy; - primitiveRenderer->drawLine( - Vector4(0.0f, fy, 0.0f, 1.0f), - Vector4(1.0f, fy, 0.0f, 1.0f), - Color4ub(255, 255, 0, 120) - ); - } - for (float x = 0.0f; x < clientSize.cx; x += step) - { - const float fx = float(x) / clientSize.cx; - primitiveRenderer->drawLine( - Vector4(fx, 0.0f, 0.0f, 1.0f), - Vector4(fx, 1.0f, 0.0f, 1.0f), - Color4ub(255, 255, 0, 120) - ); - } - - primitiveRenderer->drawLine(Vector4(aabb.x(), aabb.y(), 0.0f, 1.0f), Vector4(aabb.z(), aabb.y(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); - primitiveRenderer->drawLine(Vector4(aabb.x(), aabb.w(), 0.0f, 1.0f), Vector4(aabb.z(), aabb.w(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); - primitiveRenderer->drawLine(Vector4(aabb.x(), aabb.y(), 0.0f, 1.0f), Vector4(aabb.x(), aabb.w(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); - primitiveRenderer->drawLine(Vector4(aabb.z(), aabb.y(), 0.0f, 1.0f), Vector4(aabb.z(), aabb.w(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); - - primitiveRenderer->setProjection(proj); - primitiveRenderer->popView(); - primitiveRenderer->popWorld(); - } - } + // if (m_entityAdapter->isSelected()) + // { + // Vector4 center = (boundingBox.mn + boundingBox.mx) / 2.0_simd; + // //Scalar radius = ((boundingBox.mx - boundingBox.mn) / 2.0_simd).length(); + + // Scalar radius = max(boundingBox.mx.length(), boundingBox.mn.length()); + + // Vector4 worldCenter = transform.translation() + center; + // Vector4 viewCenter = primitiveRenderer->getView() * worldCenter.xyz1(); + + // Scalar znear = 0.1_simd; + // Scalar P00 = primitiveRenderer->getProjection().get(0, 0); + // Scalar P11 = primitiveRenderer->getProjection().get(1, 1); + + // Vector4 aabb; + // if (projectSphere(viewCenter, radius, znear, P00, P11, aabb)) + // { + // Matrix44 proj = primitiveRenderer->getProjection(); + + // primitiveRenderer->pushWorld(Matrix44::identity()); + // primitiveRenderer->pushView(Matrix44::identity()); + + // // Setup projection as UV space. + // primitiveRenderer->setProjection(orthoLh( + // -1.0f, 1.0f, + // 1.0f, -1.0f, + // -1.0f, 1.0f + // ) * translate(-1.0f, -1.0f, 0.0f) * scale(2.0f, 2.0f, 1.0f)); + + // const float w = (aabb.z() - aabb.x()) * clientSize.cx; + // const float h = (aabb.w() - aabb.y()) * clientSize.cy; + + // const int32_t level = int32_t(std::floor(std::log2(std::max(w, h)))); + // const float step = 4096.0f / std::max(4096 >> level, 1); + // for (float y = 0.0f; y < clientSize.cy; y += step) + // { + // const float fy = float(y) / clientSize.cy; + // primitiveRenderer->drawLine( + // Vector4(0.0f, fy, 0.0f, 1.0f), + // Vector4(1.0f, fy, 0.0f, 1.0f), + // Color4ub(255, 255, 0, 120) + // ); + // } + // for (float x = 0.0f; x < clientSize.cx; x += step) + // { + // const float fx = float(x) / clientSize.cx; + // primitiveRenderer->drawLine( + // Vector4(fx, 0.0f, 0.0f, 1.0f), + // Vector4(fx, 1.0f, 0.0f, 1.0f), + // Color4ub(255, 255, 0, 120) + // ); + // } + + // primitiveRenderer->drawLine(Vector4(aabb.x(), aabb.y(), 0.0f, 1.0f), Vector4(aabb.z(), aabb.y(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); + // primitiveRenderer->drawLine(Vector4(aabb.x(), aabb.w(), 0.0f, 1.0f), Vector4(aabb.z(), aabb.w(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); + // primitiveRenderer->drawLine(Vector4(aabb.x(), aabb.y(), 0.0f, 1.0f), Vector4(aabb.x(), aabb.w(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); + // primitiveRenderer->drawLine(Vector4(aabb.z(), aabb.y(), 0.0f, 1.0f), Vector4(aabb.z(), aabb.w(), 0.0f, 1.0f), Color4ub(255, 0, 0, 255)); + + // primitiveRenderer->setProjection(proj); + // primitiveRenderer->popView(); + // primitiveRenderer->popWorld(); + // } + // } if (m_entityAdapter->isSelected() && m_context->getSnapMode() == SceneEditorContext::SmNeighbour) { diff --git a/code/Scene/Editor/SceneEditorPage.cpp b/code/Scene/Editor/SceneEditorPage.cpp index 8e87baf867..5a1c94ed09 100644 --- a/code/Scene/Editor/SceneEditorPage.cpp +++ b/code/Scene/Editor/SceneEditorPage.cpp @@ -447,7 +447,7 @@ bool SceneEditorPage::create(ui::Container* parent) m_controllerPanel->create(parent, ui::WsNone, new ui::FloodLayout()); m_controllerPanel->setText(i18n::Text(L"SCENE_EDITOR_CONTROLLER")); - m_site->createAdditionalPanel(m_controllerPanel, 280_ut, true); + m_site->createAdditionalPanel(m_controllerPanel, 140_ut, true); // Create the scene, loads textures etc, using a background job since it might take significant amount of time. Ref< Job > job = JobManager::getInstance().add([&]() {