diff --git a/CMakeLists.txt b/CMakeLists.txt index 6726e49fd..e895ac830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,9 +19,9 @@ option(WICKED_EDITOR "Build WickedEngine editor" ON) option(WICKED_TESTS "Build WickedEngine tests" ON) option(WICKED_IMGUI_EXAMPLE "Build WickedEngine imgui example" ON) if (CMAKE_HOST_WIN32) - set(symlink_default OFF) + set(symlink_default OFF) else() - set(symlink_default ON) + set(symlink_default ON) endif() option(WICKED_USE_SYMLINKS "Prefer symlinking over copying directories" ${symlink_default}) @@ -71,25 +71,26 @@ if (WIN32) elseif(UNIX) set(PLATFORM "SDL2") add_compile_definitions(SDL2=1) + + # Common compiler options and warning level for CLANG and GCC: + add_compile_options( + -Wall + + -Wno-unused-variable + -Wno-unused-function + -Wno-unused-but-set-variable + -Wno-sign-compare + ) endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # CLANG specific compile options: add_compile_options( -fdeclspec -fms-extensions - -Wuninitialized - #-Wwrite-strings - #-Winit-self - #-Wreturn-type - #-Wreorder - #-Werror=delete-non-virtual-dtor - #-Werror - #uncomment this to stop the compilation at the first error - # -Wfatal-errors - - # turn off some warnings we don't want - -Wno-nullability-completeness # _Nonnull etc. are only supported on Clang + -Wno-nullability-completeness + -Wno-unused-private-field ) if (USE_LIBCXX) add_compile_options( @@ -100,25 +101,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ) endif() elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") -# add some warnings and set them as errors -# read more details here: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html + # GCC specific compile options: add_compile_options( - -Wuninitialized - -Wmaybe-uninitialized - -Wwrite-strings - -Winit-self - -Wreturn-type - $<$:-Wreorder> - $<$:-Werror=delete-non-virtual-dtor> - -Werror - - # some GCC versions have bugs triggering this warning - -Wno-stringop-overflow - # this is just silly - -Wno-format-zero-length - - #uncomment this to stop the compilation at the first error - # -Wfatal-errors + -Wno-strict-aliasing ) endif() diff --git a/Editor/AnimationWindow.cpp b/Editor/AnimationWindow.cpp index c12c6ce2c..37aa21aef 100644 --- a/Editor/AnimationWindow.cpp +++ b/Editor/AnimationWindow.cpp @@ -1105,7 +1105,7 @@ void AnimationWindow::SetEntity(Entity entity) } } -void AnimationWindow::Update() +void AnimationWindow::UpdateData() { Scene& scene = editor->GetCurrentScene(); diff --git a/Editor/AnimationWindow.h b/Editor/AnimationWindow.h index a4babe79c..d5ff13399 100644 --- a/Editor/AnimationWindow.h +++ b/Editor/AnimationWindow.h @@ -32,7 +32,7 @@ public: wi::gui::CheckBox rootMotionCheckBox; wi::gui::ComboBox rootBoneComboBox; - void Update(); + void UpdateData(); void RefreshKeyframesList(); diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp index b4b5f33b8..d73515164 100644 --- a/Editor/CameraWindow.cpp +++ b/Editor/CameraWindow.cpp @@ -295,7 +295,7 @@ void CameraWindow::SetEntity(Entity entity) } } -void CameraWindow::Update() +void CameraWindow::UpdateData() { CameraComponent& camera = editor->GetCurrentEditorScene().camera; diff --git a/Editor/CameraWindow.h b/Editor/CameraWindow.h index e60bac5b1..99534bd14 100644 --- a/Editor/CameraWindow.h +++ b/Editor/CameraWindow.h @@ -11,7 +11,7 @@ public: EditorComponent* editor = nullptr; wi::ecs::Entity entity = wi::ecs::INVALID_ENTITY; void SetEntity(wi::ecs::Entity entity); - void Update(); + void UpdateData(); wi::gui::Slider farPlaneSlider; diff --git a/Editor/ComponentsWindow.cpp b/Editor/ComponentsWindow.cpp index 729827cb0..77c65c906 100644 --- a/Editor/ComponentsWindow.cpp +++ b/Editor/ComponentsWindow.cpp @@ -586,10 +586,10 @@ void ComponentsWindow::Create(EditorComponent* _editor) } SetSize(size); } -void ComponentsWindow::Update(float dt) +void ComponentsWindow::UpdateData(float dt) { - animWnd.Update(); - weatherWnd.Update(); + animWnd.UpdateData(); + weatherWnd.UpdateData(); } void ComponentsWindow::ResizeLayout() @@ -1379,37 +1379,37 @@ bool ComponentsWindow::CheckEntityFilter(wi::ecs::Entity entity) bool valid = false; if ( - has_flag(filter, Filter::Transform) && scene.transforms.Contains(entity) || - has_flag(filter, Filter::Material) && scene.materials.Contains(entity) || - has_flag(filter, Filter::Mesh) && scene.meshes.Contains(entity) || - has_flag(filter, Filter::Object) && scene.objects.Contains(entity) || - has_flag(filter, Filter::EnvironmentProbe) && scene.probes.Contains(entity) || - has_flag(filter, Filter::Decal) && scene.decals.Contains(entity) || - has_flag(filter, Filter::Sound) && scene.sounds.Contains(entity) || - has_flag(filter, Filter::Weather) && scene.weathers.Contains(entity) || - has_flag(filter, Filter::Light) && scene.lights.Contains(entity) || - has_flag(filter, Filter::Animation) && scene.animations.Contains(entity) || - has_flag(filter, Filter::Force) && scene.forces.Contains(entity) || - has_flag(filter, Filter::Emitter) && scene.emitters.Contains(entity) || - has_flag(filter, Filter::IK) && scene.inverse_kinematics.Contains(entity) || - has_flag(filter, Filter::Camera) && scene.cameras.Contains(entity) || - has_flag(filter, Filter::Armature) && scene.armatures.Contains(entity) || - has_flag(filter, Filter::Collider) && scene.colliders.Contains(entity) || - has_flag(filter, Filter::Script) && scene.scripts.Contains(entity) || - has_flag(filter, Filter::Expression) && scene.expressions.Contains(entity) || - has_flag(filter, Filter::Terrain) && scene.terrains.Contains(entity) || - has_flag(filter, Filter::Spring) && scene.springs.Contains(entity) || - has_flag(filter, Filter::Humanoid) && scene.humanoids.Contains(entity) || - has_flag(filter, Filter::Video) && scene.videos.Contains(entity) || - has_flag(filter, Filter::Sprite) && scene.sprites.Contains(entity) || - has_flag(filter, Filter::Font) && scene.fonts.Contains(entity) || - has_flag(filter, Filter::VoxelGrid) && scene.voxel_grids.Contains(entity) || - has_flag(filter, Filter::RigidBody) && scene.rigidbodies.Contains(entity) || - has_flag(filter, Filter::SoftBody) && scene.softbodies.Contains(entity) || - has_flag(filter, Filter::Metadata) && scene.metadatas.Contains(entity) || - has_flag(filter, Filter::Constraint) && scene.constraints.Contains(entity) || - has_flag(filter, Filter::Spline) && scene.splines.Contains(entity) || - has_flag(filter, Filter::Vehicle) && (scene.rigidbodies.Contains(entity) && scene.rigidbodies.GetComponent(entity)->IsVehicle()) + (has_flag(filter, Filter::Transform) && scene.transforms.Contains(entity)) || + (has_flag(filter, Filter::Material) && scene.materials.Contains(entity)) || + (has_flag(filter, Filter::Mesh) && scene.meshes.Contains(entity)) || + (has_flag(filter, Filter::Object) && scene.objects.Contains(entity)) || + (has_flag(filter, Filter::EnvironmentProbe) && scene.probes.Contains(entity)) || + (has_flag(filter, Filter::Decal) && scene.decals.Contains(entity)) || + (has_flag(filter, Filter::Sound) && scene.sounds.Contains(entity)) || + (has_flag(filter, Filter::Weather) && scene.weathers.Contains(entity)) || + (has_flag(filter, Filter::Light) && scene.lights.Contains(entity)) || + (has_flag(filter, Filter::Animation) && scene.animations.Contains(entity)) || + (has_flag(filter, Filter::Force) && scene.forces.Contains(entity)) || + (has_flag(filter, Filter::Emitter) && scene.emitters.Contains(entity)) || + (has_flag(filter, Filter::IK) && scene.inverse_kinematics.Contains(entity)) || + (has_flag(filter, Filter::Camera) && scene.cameras.Contains(entity)) || + (has_flag(filter, Filter::Armature) && scene.armatures.Contains(entity)) || + (has_flag(filter, Filter::Collider) && scene.colliders.Contains(entity)) || + (has_flag(filter, Filter::Script) && scene.scripts.Contains(entity)) || + (has_flag(filter, Filter::Expression) && scene.expressions.Contains(entity)) || + (has_flag(filter, Filter::Terrain) && scene.terrains.Contains(entity)) || + (has_flag(filter, Filter::Spring) && scene.springs.Contains(entity)) || + (has_flag(filter, Filter::Humanoid) && scene.humanoids.Contains(entity)) || + (has_flag(filter, Filter::Video) && scene.videos.Contains(entity)) || + (has_flag(filter, Filter::Sprite) && scene.sprites.Contains(entity)) || + (has_flag(filter, Filter::Font) && scene.fonts.Contains(entity)) || + (has_flag(filter, Filter::VoxelGrid) && scene.voxel_grids.Contains(entity)) || + (has_flag(filter, Filter::RigidBody) && scene.rigidbodies.Contains(entity)) || + (has_flag(filter, Filter::SoftBody) && scene.softbodies.Contains(entity)) || + (has_flag(filter, Filter::Metadata) && scene.metadatas.Contains(entity)) || + (has_flag(filter, Filter::Constraint) && scene.constraints.Contains(entity)) || + (has_flag(filter, Filter::Spline) && scene.splines.Contains(entity)) || + (has_flag(filter, Filter::Vehicle) && (scene.rigidbodies.Contains(entity) && scene.rigidbodies.GetComponent(entity)->IsVehicle())) ) { valid = true; diff --git a/Editor/ComponentsWindow.h b/Editor/ComponentsWindow.h index d7b65ffaa..93461185e 100644 --- a/Editor/ComponentsWindow.h +++ b/Editor/ComponentsWindow.h @@ -40,7 +40,7 @@ class ComponentsWindow : public wi::gui::Window { public: void Create(EditorComponent* editor); - void Update(float dt); + void UpdateData(float dt); void ResizeLayout() override; diff --git a/Editor/ConstraintWindow.cpp b/Editor/ConstraintWindow.cpp index 8ae4cf4fa..4cf3da38c 100644 --- a/Editor/ConstraintWindow.cpp +++ b/Editor/ConstraintWindow.cpp @@ -53,9 +53,9 @@ void ConstraintWindow::Create(EditorComponent* _editor) }; }; - auto forEachSelectedWithRefresh = [this, forEachSelected](auto func) { - return [this, forEachSelected, func](auto args) { - forEachSelected([this, func](auto physicscomponent, auto args) { + auto forEachSelectedWithRefresh = [forEachSelected](auto func) { + return [forEachSelected, func](auto args) { + forEachSelected([func](auto physicscomponent, auto args) { func(physicscomponent, args); physicscomponent->SetRefreshParametersNeeded(true); })(args); diff --git a/Editor/ContentBrowserWindow.cpp b/Editor/ContentBrowserWindow.cpp index c18664831..e52ed40b5 100644 --- a/Editor/ContentBrowserWindow.cpp +++ b/Editor/ContentBrowserWindow.cpp @@ -325,7 +325,7 @@ void ContentBrowserWindow::SetSelection(SELECTION selection) AddItems(folder, "fbx", ICON_OBJECT); AddItems(folder, "obj", ICON_OBJECT); AddItems(folder, "lua", ICON_SCRIPT); - openFolderButton.OnClick([this, folder](wi::gui::EventArgs args) { + openFolderButton.OnClick([folder](wi::gui::EventArgs args) { wi::helper::OpenUrl(folder); }); AddWidget(&openFolderButton, wi::gui::Window::AttachmentOptions::NONE); diff --git a/Editor/DummyVisualizer.cpp b/Editor/DummyVisualizer.cpp index 0b052591f..00c7a8978 100644 --- a/Editor/DummyVisualizer.cpp +++ b/Editor/DummyVisualizer.cpp @@ -19,7 +19,7 @@ void DummyVisualizer::Draw( static PipelineState pso[2]; if (!pso[0].IsValid() || !pso[1].IsValid()) { - static auto LoadShaders = [depth] { + static auto LoadShaders = [] { PipelineStateDesc desc; desc.vs = wi::renderer::GetShader(wi::enums::VSTYPE_VERTEXCOLOR); desc.ps = wi::renderer::GetShader(wi::enums::PSTYPE_VERTEXCOLOR); diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 2f502e606..84adfeba4 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -1287,7 +1287,7 @@ void EditorComponent::Load() exitButton.SetTooltip("Exit"); exitButton.SetColor(wi::Color(160, 50, 50, 180), wi::gui::WIDGETSTATE::IDLE); exitButton.SetColor(wi::Color(200, 50, 50, 255), wi::gui::WIDGETSTATE::FOCUS); - exitButton.OnClick([this](wi::gui::EventArgs args) { + exitButton.OnClick([](wi::gui::EventArgs args) { wi::platform::Exit(); }); topmenuWnd.AddWidget(&exitButton); @@ -1474,10 +1474,10 @@ void EditorComponent::Update(float dt) scene.Entity_Remove(grass_interaction_entity); } - cameraWnd.Update(); - paintToolWnd.Update(dt); - graphicsWnd.Update(); - componentsWnd.Update(dt); + cameraWnd.UpdateData(); + paintToolWnd.UpdateData(dt); + graphicsWnd.UpdateData(); + componentsWnd.UpdateData(dt); // Pulsating selection color update: outlineTimer += dt; @@ -2405,7 +2405,7 @@ void EditorComponent::Update(float dt) main->infoDisplay.colorgrading_helper = false; // Control operations... - if (!GetGUI().IsTyping() && wi::input::Down(wi::input::KEYBOARD_BUTTON_LCONTROL) || wi::input::Down(wi::input::KEYBOARD_BUTTON_RCONTROL)) + if (!GetGUI().IsTyping() && (wi::input::Down(wi::input::KEYBOARD_BUTTON_LCONTROL) || wi::input::Down(wi::input::KEYBOARD_BUTTON_RCONTROL))) { bool isCtrlDown = wi::input::Down(wi::input::KEYBOARD_BUTTON_LCONTROL) || wi::input::Down(wi::input::KEYBOARD_BUTTON_RCONTROL); bool isShiftDown = wi::input::Down(wi::input::KEYBOARD_BUTTON_LSHIFT) || wi::input::Down(wi::input::KEYBOARD_BUTTON_RSHIFT); @@ -5209,7 +5209,7 @@ void EditorComponent::Open(std::string filename) } RefreshSceneList(); - componentsWnd.weatherWnd.Update(); + componentsWnd.weatherWnd.UpdateData(); componentsWnd.RefreshEntityTree(); wi::backlog::post("[Editor] finished loading model: " + filename); }); diff --git a/Editor/GeneralWindow.cpp b/Editor/GeneralWindow.cpp index 5f7417064..a013bc813 100644 --- a/Editor/GeneralWindow.cpp +++ b/Editor/GeneralWindow.cpp @@ -864,7 +864,7 @@ void GeneralWindow::Create(EditorComponent* _editor) } editor->componentsWnd.weatherWnd.default_sky_horizon = theme_color_background; editor->componentsWnd.weatherWnd.default_sky_zenith = theme_color_idle; - editor->componentsWnd.weatherWnd.Update(); + editor->componentsWnd.weatherWnd.UpdateData(); for (auto& x : editor->componentsWnd.lightWnd.cascades) { diff --git a/Editor/GraphicsWindow.cpp b/Editor/GraphicsWindow.cpp index 88137a260..43001eab4 100644 --- a/Editor/GraphicsWindow.cpp +++ b/Editor/GraphicsWindow.cpp @@ -1579,7 +1579,7 @@ void GraphicsWindow::UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain) }); } -void GraphicsWindow::Update() +void GraphicsWindow::UpdateData() { if (vsyncCheckBox.GetCheck() != editor->main->swapChain.desc.vsync) { diff --git a/Editor/GraphicsWindow.h b/Editor/GraphicsWindow.h index cc5a70663..edfdb149d 100644 --- a/Editor/GraphicsWindow.h +++ b/Editor/GraphicsWindow.h @@ -114,7 +114,7 @@ public: void ChangeRenderPath(RENDERPATH path); void UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain); - void Update(); + void UpdateData(); void ResizeLayout() override; diff --git a/Editor/MaterialWindow.cpp b/Editor/MaterialWindow.cpp index b41060681..cd8182705 100644 --- a/Editor/MaterialWindow.cpp +++ b/Editor/MaterialWindow.cpp @@ -796,7 +796,7 @@ void MaterialWindow::Create(EditorComponent* _editor) params.description = "Texture"; params.extensions = wi::resourcemanager::GetSupportedImageExtensions(); Entity materialEntity = entity; - wi::helper::FileDialog(params, [this, materialEntity, slot](std::string fileName) { + wi::helper::FileDialog(params, [this, slot](std::string fileName) { wi::eventhandler::Subscribe_Once(wi::eventhandler::EVENT_THREAD_SAFE_POINT, [=](uint64_t userdata) { MaterialComponent* material = editor->GetCurrentScene().materials.GetComponent(entity); wi::resourcemanager::Flags flags = material->GetTextureSlotResourceFlags(MaterialComponent::TEXTURESLOT(slot)); @@ -981,6 +981,8 @@ void MaterialWindow::SetEntity(Entity entity) clearcoatSlider.SetEnabled(true); clearcoatRoughnessSlider.SetEnabled(true); break; + default: + break; } sheenRoughnessSlider.SetValue(material->sheenRoughness); clearcoatSlider.SetValue(material->clearcoat); diff --git a/Editor/ModelImporter_GLTF.cpp b/Editor/ModelImporter_GLTF.cpp index 933a9b6d9..241e6fac7 100644 --- a/Editor/ModelImporter_GLTF.cpp +++ b/Editor/ModelImporter_GLTF.cpp @@ -3056,8 +3056,6 @@ void Import_Extension_VRMC(LoaderState& state) } } } - int asd = 90; - asd = asd; } else { diff --git a/Editor/ModelImporter_OBJ.cpp b/Editor/ModelImporter_OBJ.cpp index b6a93a166..3e4526b99 100644 --- a/Editor/ModelImporter_OBJ.cpp +++ b/Editor/ModelImporter_OBJ.cpp @@ -11,6 +11,7 @@ #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif + using namespace wi::graphics; using namespace wi::scene; using namespace wi::ecs; diff --git a/Editor/PaintToolWindow.cpp b/Editor/PaintToolWindow.cpp index 05cb6425e..33a85e5c7 100644 --- a/Editor/PaintToolWindow.cpp +++ b/Editor/PaintToolWindow.cpp @@ -333,7 +333,7 @@ void PaintToolWindow::Create(EditorComponent* _editor) SetVisible(false); } -void PaintToolWindow::Update(float dt) +void PaintToolWindow::UpdateData(float dt) { RecordHistory(INVALID_ENTITY); @@ -489,6 +489,8 @@ void PaintToolWindow::Update(float dt) switch (mode) { + default: + break; case MODE_TEXTURE: { Ray pickRay = editor->pickRay; @@ -745,6 +747,8 @@ void PaintToolWindow::Update(float dt) case MODE_WIND: material->SetUseWind(true); break; + default: + break; } } } @@ -777,6 +781,8 @@ void PaintToolWindow::Update(float dt) rebuild = true; } break; + default: + break; } if (painting) @@ -822,6 +828,8 @@ void PaintToolWindow::Update(float dt) mesh->vertex_windweights[j] = vcol.getA(); } break; + default: + break; } } } @@ -1006,6 +1014,8 @@ void PaintToolWindow::Update(float dt) case MODE_SCULPTING_SUBTRACT: PL -= sculptDir * x.affection; break; + default: + break; } XMStoreFloat3(&mesh->vertex_positions[x.ind], PL); @@ -1255,6 +1265,8 @@ void PaintToolWindow::Update(float dt) hair.vertex_lengths[j] = wi::math::Clamp(hair.vertex_lengths[j], 1.0f / 255.0f, 1.0f); } break; + default: + break; } hair._flags |= wi::HairParticleSystem::REBUILD_BUFFERS; } diff --git a/Editor/PaintToolWindow.h b/Editor/PaintToolWindow.h index a31d575fd..49f224c4f 100644 --- a/Editor/PaintToolWindow.h +++ b/Editor/PaintToolWindow.h @@ -61,7 +61,7 @@ public: wi::gui::Button revealTextureButton; wi::gui::ComboBox axisCombo; - void Update(float dt); + void UpdateData(float dt); void DrawBrush(const wi::Canvas& canvas, wi::graphics::CommandList cmd) const; XMFLOAT2 pos = XMFLOAT2(0, 0); diff --git a/Editor/RigidBodyWindow.cpp b/Editor/RigidBodyWindow.cpp index ed4cefb45..8017dee65 100644 --- a/Editor/RigidBodyWindow.cpp +++ b/Editor/RigidBodyWindow.cpp @@ -39,8 +39,8 @@ void RigidBodyWindow::Create(EditorComponent* _editor) }; }; - auto forEachSelectedPhysicsComponentWithRefresh = [this, forEachSelectedPhysicsComponent](auto /* void(RigidBodyPhysicsComponent*, wi::gui::EventArgs) */ func) { - return forEachSelectedPhysicsComponent([this, func](auto physicscomponent, auto args) { + auto forEachSelectedPhysicsComponentWithRefresh = [forEachSelectedPhysicsComponent](auto /* void(RigidBodyPhysicsComponent*, wi::gui::EventArgs) */ func) { + return forEachSelectedPhysicsComponent([func](auto physicscomponent, auto args) { func(physicscomponent, args); physicscomponent->SetRefreshParametersNeeded(); }); diff --git a/Editor/WeatherWindow.cpp b/Editor/WeatherWindow.cpp index e85fce1cd..564881ef5 100644 --- a/Editor/WeatherWindow.cpp +++ b/Editor/WeatherWindow.cpp @@ -1034,7 +1034,7 @@ void WeatherWindow::SetEntity(wi::ecs::Entity entity) } } -void WeatherWindow::Update() +void WeatherWindow::UpdateData() { if (editor == nullptr) return; diff --git a/Editor/WeatherWindow.h b/Editor/WeatherWindow.h index a5b6b3952..aacb7e541 100644 --- a/Editor/WeatherWindow.h +++ b/Editor/WeatherWindow.h @@ -7,7 +7,7 @@ class WeatherWindow : public wi::gui::Window public: void Create(EditorComponent* editor); - void Update(); + void UpdateData(); EditorComponent* editor = nullptr; diff --git a/Samples/Example_ImGui_Docking/Example_ImGui_Docking.cpp b/Samples/Example_ImGui_Docking/Example_ImGui_Docking.cpp index c62ff21f1..1b16314cf 100644 --- a/Samples/Example_ImGui_Docking/Example_ImGui_Docking.cpp +++ b/Samples/Example_ImGui_Docking/Example_ImGui_Docking.cpp @@ -831,8 +831,8 @@ void Example_ImGuiRenderer::Update(float dt) //PE: stop flickering when scrollbar goes on/off. if (ImGui::GetCurrentWindow()->ScrollbarSizes.x > 0) { - ImGui::Text(""); - ImGui::Text(""); + ImGui::Text("%s", ""); + ImGui::Text("%s", ""); } } @@ -847,7 +847,7 @@ void Example_ImGuiRenderer::Update(float dt) object = scene.objects.GetComponent(highlight_entity); bSettingsOpen = true; } - ImGui::SetNextItemOpen(&bSettingsOpen); + ImGui::SetNextItemOpen(bSettingsOpen); if (ImGui::CollapsingHeader(ICON_MD_HIGHLIGHT_ALT " Selection", ImGuiTreeNodeFlags_DefaultOpen)) //ImGuiTreeNodeFlags_None { @@ -1237,8 +1237,8 @@ void Example_ImGuiRenderer::Update(float dt) //PE: stop flickering when scrollbar goes on/off. if (ImGui::GetCurrentWindow()->ScrollbarSizes.x > 0) { - ImGui::Text(""); - ImGui::Text(""); + ImGui::Text("%s", ""); + ImGui::Text("%s", ""); } ImRect bbwin(ImGui::GetWindowPos(), ImGui::GetWindowPos() + ImGui::GetWindowSize()); diff --git a/WickedEngine/Utility/cpuinfo.hpp b/WickedEngine/Utility/cpuinfo.hpp index c349dd054..301c4f1fa 100644 --- a/WickedEngine/Utility/cpuinfo.hpp +++ b/WickedEngine/Utility/cpuinfo.hpp @@ -139,7 +139,7 @@ CPUInfo::CPUInfo() mNumLogCpus = (cpuID1.EBX() >> 16) & 0xFF; if (HFS >= 4) { - mNumCores = 1 + (CPUID(4, 0).EAX() >> 26) & 0x3F; + mNumCores = 1 + ((CPUID(4, 0).EAX() >> 26) & 0x3F); } } if (mIsHTT) diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index 17f08107a..19a16fb67 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -4739,7 +4739,6 @@ namespace wi::gui colorpickerstate = CPS_IDLE; } - dragged = dragged; if (colorpickerstate == CPS_HUE && dragged) { //hue pick diff --git a/WickedEngine/wiMath.h b/WickedEngine/wiMath.h index d55db646d..75d2a2686 100644 --- a/WickedEngine/wiMath.h +++ b/WickedEngine/wiMath.h @@ -21,12 +21,9 @@ // In this case, DirectXMath is coming from supplied source code // On platforms that don't have Windows SDK, the source code for DirectXMath is provided // as part of the engine utilities -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" #include "Utility/DirectXMath/DirectXMath.h" #include "Utility/DirectXMath/DirectXPackedVector.h" #include "Utility/DirectXMath/DirectXCollision.h" -#pragma GCC diagnostic pop #endif using namespace DirectX; diff --git a/WickedEngine/wiPhysics_Jolt.cpp b/WickedEngine/wiPhysics_Jolt.cpp index 9d5e50eb7..5f0bf0f4c 100644 --- a/WickedEngine/wiPhysics_Jolt.cpp +++ b/WickedEngine/wiPhysics_Jolt.cpp @@ -1996,7 +1996,7 @@ namespace wi::physics // First, do the creations when needed (AddRigidBody, AddSoftBody, etc): // These will be locking updates, but doesn't need to be performed frequently - wi::jobsystem::Dispatch(ctx, (uint32_t)scene.rigidbodies.GetCount(), dispatchGroupSize, [&scene, &physics_scene](wi::jobsystem::JobArgs args) { + wi::jobsystem::Dispatch(ctx, (uint32_t)scene.rigidbodies.GetCount(), dispatchGroupSize, [&scene](wi::jobsystem::JobArgs args) { RigidBodyPhysicsComponent& physicscomponent = scene.rigidbodies[args.jobIndex]; Entity entity = scene.rigidbodies.GetEntity(args.jobIndex); @@ -2016,7 +2016,7 @@ namespace wi::physics AddRigidBody(scene, entity, physicscomponent, *transform, mesh); } }); - wi::jobsystem::Dispatch(ctx, (uint32_t)scene.softbodies.GetCount(), 1, [&scene, &physics_scene](wi::jobsystem::JobArgs args) { + wi::jobsystem::Dispatch(ctx, (uint32_t)scene.softbodies.GetCount(), 1, [&scene](wi::jobsystem::JobArgs args) { SoftBodyPhysicsComponent& physicscomponent = scene.softbodies[args.jobIndex]; Entity entity = scene.softbodies.GetEntity(args.jobIndex); @@ -2033,7 +2033,7 @@ namespace wi::physics AddSoftBody(scene, entity, physicscomponent, *mesh); } }); - wi::jobsystem::Dispatch(ctx, (uint32_t)scene.humanoids.GetCount(), 1, [&scene, &physics_scene](wi::jobsystem::JobArgs args) { + wi::jobsystem::Dispatch(ctx, (uint32_t)scene.humanoids.GetCount(), 1, [&scene](wi::jobsystem::JobArgs args) { HumanoidComponent& humanoid = scene.humanoids[args.jobIndex]; Entity humanoidEntity = scene.humanoids.GetEntity(args.jobIndex); float scale = 1; @@ -3287,6 +3287,8 @@ namespace wi::physics case HumanoidComponent::HumanoidBone::LeftLowerLeg: bodypart = Ragdoll::BODYPART_LEFT_LOWER_LEG; break; + default: + break; } if (bodypart == Ragdoll::BODYPART_COUNT) return; @@ -3368,6 +3370,8 @@ namespace wi::physics case HumanoidComponent::HumanoidBone::LeftLowerLeg: bodypart = Ragdoll::BODYPART_LEFT_LOWER_LEG; break; + default: + break; } if (bodypart == Ragdoll::BODYPART_COUNT) return; diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index 34159099b..85ddd3e7c 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -455,6 +455,8 @@ SHADERTYPE GetMSTYPE(RENDERPASS renderPass, bool tessellation, bool alphatest, b case RENDERPASS_RAINBLOCKER: realMS = MSTYPE_SHADOW; break; + default: + break; } return realMS; @@ -526,6 +528,8 @@ SHADERTYPE GetVSTYPE(RENDERPASS renderPass, bool tessellation, bool alphatest, b case RENDERPASS_RAINBLOCKER: realVS = VSTYPE_SHADOW; break; + default: + break; } return realVS; @@ -554,6 +558,8 @@ SHADERTYPE GetGSTYPE(RENDERPASS renderPass, bool alphatest, bool transparent) } #endif // PLATFORM_PS5 break; + default: + break; } return realGS; @@ -578,6 +584,8 @@ SHADERTYPE GetHSTYPE(RENDERPASS renderPass, bool tessellation, bool alphatest) case RENDERPASS_MAIN: return HSTYPE_OBJECT; break; + default: + break; } } @@ -601,6 +609,8 @@ SHADERTYPE GetDSTYPE(RENDERPASS renderPass, bool tessellation, bool alphatest) } case RENDERPASS_MAIN: return DSTYPE_OBJECT; + default: + break; } } @@ -3188,6 +3198,8 @@ void RenderMeshes( { pso = tessellatorRequested ? &PSO_object_wire_tessellation : &PSO_object_wire; } + default: + break; } } else if (material.customShaderID >= 0 && material.customShaderID < (int)customShaders.size()) @@ -3570,7 +3582,7 @@ void UpdateVisibility(Visibility& vis) if (vis.flags & Visibility::ALLOW_OCCLUSION_CULLING) { - if (!light.IsStatic() && light.GetType() != LightComponent::DIRECTIONAL || light.occlusionquery < 0) + if (!light.IsStatic() && light.GetType() != LightComponent::DIRECTIONAL && light.occlusionquery < 0) { if (!aabb.intersects(vis.camera->Eye)) { @@ -3838,7 +3850,7 @@ void UpdateVisibility(Visibility& vis) } // Shadow atlas packing: - if (IsShadowsEnabled() && (vis.flags & Visibility::ALLOW_SHADOW_ATLAS_PACKING) && !vis.visibleLights.empty() || vis.scene->weather.rain_amount > 0) + if ((IsShadowsEnabled() && (vis.flags & Visibility::ALLOW_SHADOW_ATLAS_PACKING) && !vis.visibleLights.empty()) || vis.scene->weather.rain_amount > 0) { auto range = wi::profiler::BeginRangeCPU("Shadowmap packing"); float iterative_scaling = 1; @@ -3907,6 +3919,8 @@ void UpdateVisibility(Visibility& vis) rect.h = int(max_shadow_resolution_cube * amount); } break; + default: + break; } if (rect.w > 8 && rect.h > 8) { @@ -3948,6 +3962,8 @@ void UpdateVisibility(Visibility& vis) case LightComponent::POINT: lightrect.w /= 6; break; + default: + break; } } } @@ -6967,6 +6983,8 @@ void DrawShadowmaps( } break; + default: + break; } // terminate switch } diff --git a/WickedEngine/wiSDLInput.cpp b/WickedEngine/wiSDLInput.cpp index 63a39205c..b5e6445e7 100644 --- a/WickedEngine/wiSDLInput.cpp +++ b/WickedEngine/wiSDLInput.cpp @@ -275,48 +275,50 @@ namespace wi::input::sdlinput return wi::input::KEYBOARD_BUTTON_PAGEDOWN; case SDL_SCANCODE_PAGEUP: return wi::input::KEYBOARD_BUTTON_PAGEUP; - case SDL_SCANCODE_KP_0: - return wi::input::KEYBOARD_BUTTON_NUMPAD0; - case SDL_SCANCODE_KP_1: - return wi::input::KEYBOARD_BUTTON_NUMPAD1; - case SDL_SCANCODE_KP_2: - return wi::input::KEYBOARD_BUTTON_NUMPAD2; - case SDL_SCANCODE_KP_3: - return wi::input::KEYBOARD_BUTTON_NUMPAD3; - case SDL_SCANCODE_KP_4: - return wi::input::KEYBOARD_BUTTON_NUMPAD4; - case SDL_SCANCODE_KP_5: - return wi::input::KEYBOARD_BUTTON_NUMPAD5; - case SDL_SCANCODE_KP_6: - return wi::input::KEYBOARD_BUTTON_NUMPAD6; - case SDL_SCANCODE_KP_7: - return wi::input::KEYBOARD_BUTTON_NUMPAD7; - case SDL_SCANCODE_KP_8: - return wi::input::KEYBOARD_BUTTON_NUMPAD8; - case SDL_SCANCODE_KP_9: - return wi::input::KEYBOARD_BUTTON_NUMPAD9; - case SDL_SCANCODE_KP_MULTIPLY: - return wi::input::KEYBOARD_BUTTON_MULTIPLY; - case SDL_SCANCODE_KP_PLUS: - return wi::input::KEYBOARD_BUTTON_ADD; - case SDL_SCANCODE_SEPARATOR: - return wi::input::KEYBOARD_BUTTON_SEPARATOR; - case SDL_SCANCODE_KP_MINUS: - return wi::input::KEYBOARD_BUTTON_SUBTRACT; - case SDL_SCANCODE_KP_DECIMAL: - return wi::input::KEYBOARD_BUTTON_DECIMAL; - case SDL_SCANCODE_KP_DIVIDE: - return wi::input::KEYBOARD_BUTTON_DIVIDE; - case SDL_SCANCODE_INSERT: - return wi::input::KEYBOARD_BUTTON_INSERT; - case SDL_SCANCODE_TAB: - return wi::input::KEYBOARD_BUTTON_TAB; - case SDL_SCANCODE_GRAVE: - return wi::input::KEYBOARD_BUTTON_TILDE; - case SDL_SCANCODE_LALT: - return wi::input::KEYBOARD_BUTTON_ALT; - case SDL_SCANCODE_RALT: - return wi::input::KEYBOARD_BUTTON_ALTGR; + case SDL_SCANCODE_KP_0: + return wi::input::KEYBOARD_BUTTON_NUMPAD0; + case SDL_SCANCODE_KP_1: + return wi::input::KEYBOARD_BUTTON_NUMPAD1; + case SDL_SCANCODE_KP_2: + return wi::input::KEYBOARD_BUTTON_NUMPAD2; + case SDL_SCANCODE_KP_3: + return wi::input::KEYBOARD_BUTTON_NUMPAD3; + case SDL_SCANCODE_KP_4: + return wi::input::KEYBOARD_BUTTON_NUMPAD4; + case SDL_SCANCODE_KP_5: + return wi::input::KEYBOARD_BUTTON_NUMPAD5; + case SDL_SCANCODE_KP_6: + return wi::input::KEYBOARD_BUTTON_NUMPAD6; + case SDL_SCANCODE_KP_7: + return wi::input::KEYBOARD_BUTTON_NUMPAD7; + case SDL_SCANCODE_KP_8: + return wi::input::KEYBOARD_BUTTON_NUMPAD8; + case SDL_SCANCODE_KP_9: + return wi::input::KEYBOARD_BUTTON_NUMPAD9; + case SDL_SCANCODE_KP_MULTIPLY: + return wi::input::KEYBOARD_BUTTON_MULTIPLY; + case SDL_SCANCODE_KP_PLUS: + return wi::input::KEYBOARD_BUTTON_ADD; + case SDL_SCANCODE_SEPARATOR: + return wi::input::KEYBOARD_BUTTON_SEPARATOR; + case SDL_SCANCODE_KP_MINUS: + return wi::input::KEYBOARD_BUTTON_SUBTRACT; + case SDL_SCANCODE_KP_DECIMAL: + return wi::input::KEYBOARD_BUTTON_DECIMAL; + case SDL_SCANCODE_KP_DIVIDE: + return wi::input::KEYBOARD_BUTTON_DIVIDE; + case SDL_SCANCODE_INSERT: + return wi::input::KEYBOARD_BUTTON_INSERT; + case SDL_SCANCODE_TAB: + return wi::input::KEYBOARD_BUTTON_TAB; + case SDL_SCANCODE_GRAVE: + return wi::input::KEYBOARD_BUTTON_TILDE; + case SDL_SCANCODE_LALT: + return wi::input::KEYBOARD_BUTTON_ALT; + case SDL_SCANCODE_RALT: + return wi::input::KEYBOARD_BUTTON_ALTGR; + default: + break; } @@ -347,7 +349,7 @@ namespace wi::input::sdlinput case SDL_CONTROLLER_BUTTON_RIGHTSTICK: btnenum = wi::input::GAMEPAD_BUTTON_8; break; case SDL_CONTROLLER_BUTTON_BACK: btnenum = wi::input::GAMEPAD_BUTTON_9; break; case SDL_CONTROLLER_BUTTON_START: btnenum = wi::input::GAMEPAD_BUTTON_10; break; - default: assert(0); return; + default: assert(0); return; } btnenum = 1 << (btnenum - wi::input::GAMEPAD_RANGE_START - 1); if(pressed){ @@ -376,10 +378,10 @@ namespace wi::input::sdlinput bool GetControllerState(wi::input::ControllerState* state, int index) { if(index < controllers.size()){ if (state != nullptr) - { - *state = controllers[index].state; - } - return true; + { + *state = controllers[index].state; + } + return true; } return false; } diff --git a/WickedEngine/wiScene.cpp b/WickedEngine/wiScene.cpp index 23e619dde..543499ecf 100644 --- a/WickedEngine/wiScene.cpp +++ b/WickedEngine/wiScene.cpp @@ -5594,7 +5594,7 @@ namespace wi::scene XMVECTOR movement = XMLoadFloat3(&character.movement); XMVECTOR position = XMLoadFloat3(&character.position); XMVECTOR height = XMVectorSet(0, character.height, 0, 0); - const bool any_movement = character.movement.x != 0 || character.movement.y != 0 && character.movement.z != 0; + const bool any_movement = character.movement.x != 0 || character.movement.y != 0 || character.movement.z != 0; // Swimming: character.swimming = false;