From bef7cef6f859f619e0a9ca5ab14627165ad02ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Mon, 18 Mar 2024 09:07:31 +0100 Subject: [PATCH] emitter debug fix, lua binding --- .../ScriptingAPI-Documentation.md | 1 + Editor/ContentBrowserWindow.cpp | 30 +++++++++---------- Editor/ContentBrowserWindow.h | 2 +- WickedEngine/wiRenderer.cpp | 9 +++++- WickedEngine/wiScene_BindLua.cpp | 21 +++++++++++++ WickedEngine/wiScene_BindLua.h | 2 ++ WickedEngine/wiVersion.cpp | 2 +- 7 files changed, 49 insertions(+), 18 deletions(-) diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md index dd6472838..38d100ad8 100644 --- a/Content/Documentation/ScriptingAPI-Documentation.md +++ b/Content/Documentation/ScriptingAPI-Documentation.md @@ -1021,6 +1021,7 @@ TextureSlot = { - SetScaleY(float value) -- set scaling along lifetime in Y axis - SetRotation(float value) -- set rotation speed - SetMotionBlurAmount(float value) -- set the motion elongation factor +- SetCollidersDisabled(bool value) -- disable GPU colliders #### HairParticleSystem - _flags : int diff --git a/Editor/ContentBrowserWindow.cpp b/Editor/ContentBrowserWindow.cpp index e163f3897..9022b838b 100644 --- a/Editor/ContentBrowserWindow.cpp +++ b/Editor/ContentBrowserWindow.cpp @@ -177,6 +177,21 @@ void ContentBrowserWindow::RefreshContent() RemoveWidget(&x); } + if (!editor->recentFilenames.empty()) + { + wi::gui::Button& button = folderButtons[SELECTION_RECENT]; + button.Create("Recently Used"); + button.SetLocalizationEnabled(false); + button.SetSize(XMFLOAT2(wid, hei)); + button.OnClick([this](wi::gui::EventArgs args) { + SetSelection(SELECTION_RECENT); + }); + AddWidget(&button, wi::gui::Window::AttachmentOptions::NONE); + if (current_selection == SELECTION_COUNT) + { + current_selection = SELECTION_RECENT; + } + } if (wi::helper::DirectoryExists(content_folder + "scripts")) { wi::gui::Button& button = folderButtons[SELECTION_SCRIPTS]; @@ -207,21 +222,6 @@ void ContentBrowserWindow::RefreshContent() current_selection = SELECTION_MODELS; } } - if (!editor->recentFilenames.empty()) - { - wi::gui::Button& button = folderButtons[SELECTION_RECENT]; - button.Create("Recently Used"); - button.SetLocalizationEnabled(false); - button.SetSize(XMFLOAT2(wid, hei)); - button.OnClick([this](wi::gui::EventArgs args) { - SetSelection(SELECTION_RECENT); - }); - AddWidget(&button, wi::gui::Window::AttachmentOptions::NONE); - if (current_selection == SELECTION_COUNT) - { - current_selection = SELECTION_RECENT; - } - } if (current_selection != SELECTION_COUNT) { diff --git a/Editor/ContentBrowserWindow.h b/Editor/ContentBrowserWindow.h index 44edf9947..be9438b79 100644 --- a/Editor/ContentBrowserWindow.h +++ b/Editor/ContentBrowserWindow.h @@ -11,9 +11,9 @@ public: std::string content_folder; enum SELECTION { + SELECTION_RECENT, SELECTION_SCRIPTS, SELECTION_MODELS, - SELECTION_RECENT, SELECTION_COUNT }; diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index 45d6ae09d..3eebbfa34 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -7189,7 +7189,14 @@ void DrawDebugWorld( Entity entity = scene.emitters.GetEntity(i); const MeshComponent* mesh = scene.meshes.GetComponent(emitter.meshID); - XMStoreFloat4x4(&sb.g_xTransform, XMLoadFloat4x4(&emitter.worldMatrix)*camera.GetViewProjection()); + XMMATRIX W = XMLoadFloat4x4(&emitter.worldMatrix) * camera.GetViewProjection(); + if (mesh != nullptr && IsFormatUnorm(mesh->position_format) && !mesh->so_pos.IsValid()) + { + XMMATRIX R = mesh->aabb.getUnormRemapMatrix(); + W = R * W; + } + + XMStoreFloat4x4(&sb.g_xTransform, W); sb.g_xColor = float4(0, 1, 0, 1); device->BindDynamicConstantBuffer(sb, CB_GETBINDSLOT(MiscCB), cmd); diff --git a/WickedEngine/wiScene_BindLua.cpp b/WickedEngine/wiScene_BindLua.cpp index 3f31cea34..28d016001 100644 --- a/WickedEngine/wiScene_BindLua.cpp +++ b/WickedEngine/wiScene_BindLua.cpp @@ -4459,6 +4459,8 @@ Luna::FunctionType EmitterComponent_BindLua::methods[] lunamethod(EmitterComponent_BindLua, SetScaleY), lunamethod(EmitterComponent_BindLua, SetRotation), lunamethod(EmitterComponent_BindLua, SetMotionBlurAmount), + lunamethod(EmitterComponent_BindLua, IsCollidersDisabled), + lunamethod(EmitterComponent_BindLua, SetCollidersDisabled), { NULL, NULL } }; Luna::PropertyType EmitterComponent_BindLua::properties[] = { @@ -4699,6 +4701,25 @@ int EmitterComponent_BindLua::SetMotionBlurAmount(lua_State* L) return 0; } +int EmitterComponent_BindLua::IsCollidersDisabled(lua_State* L) +{ + wi::lua::SSetBool(L, component->IsCollidersDisabled()); + return 1; +} +int EmitterComponent_BindLua::SetCollidersDisabled(lua_State* L) +{ + int argc = wi::lua::SGetArgCount(L); + if (argc > 0) + { + component->SetCollidersDisabled(wi::lua::SGetBool(L, 1)); + } + else + { + wi::lua::SError(L, "SetCollidersDisabled(bool value) not enough arguments!"); + } + + return 0; +} diff --git a/WickedEngine/wiScene_BindLua.h b/WickedEngine/wiScene_BindLua.h index 9dc14179c..678c7127d 100644 --- a/WickedEngine/wiScene_BindLua.h +++ b/WickedEngine/wiScene_BindLua.h @@ -636,6 +636,8 @@ namespace wi::lua::scene int GetScaleY(lua_State* L); int GetRotation(lua_State* L); int GetMotionBlurAmount(lua_State* L); + int IsCollidersDisabled(lua_State* L); + int SetCollidersDisabled(lua_State* L); }; class HairParticleSystem_BindLua diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index ddfea0379..6c8ae8b50 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 400; + const int revision = 401; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);