From cc8c7002ea442a9086630800e73d0b16bf822742 Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 15 Aug 2022 23:04:54 +0200 Subject: [PATCH 1/4] Cleanup components includes --- apps/essimporter/importscpt.hpp | 1 + apps/openmw/mwgui/windowmanagerimp.cpp | 1 + components/bullethelpers/aabb.hpp | 1 + components/compiler/fileparser.hpp | 1 - components/esm3/activespells.hpp | 1 - components/esm3/animationstate.hpp | 2 +- components/esm3/loadcont.hpp | 1 - components/esm3/loadregn.hpp | 1 - components/esm3/loadscpt.hpp | 1 - components/fx/types.hpp | 2 -- components/fx/widgets.hpp | 1 - components/lua_ui/properties.hpp | 1 + components/misc/budgetmeasurement.hpp | 2 ++ components/nif/data.hpp | 3 +-- components/nif/physics.hpp | 13 ++++++++++++- components/nifosg/nifloader.hpp | 2 -- components/resource/scenemanager.cpp | 2 ++ components/sceneutil/osgacontroller.hpp | 6 +++--- components/stereo/stereomanager.hpp | 3 ++- components/terrain/material.hpp | 2 -- components/terrain/view.hpp | 2 -- components/terrain/world.hpp | 1 - components/widgets/fontwrapper.hpp | 4 ++-- 23 files changed, 29 insertions(+), 25 deletions(-) diff --git a/apps/essimporter/importscpt.hpp b/apps/essimporter/importscpt.hpp index 15f4fde598..78c6baebe4 100644 --- a/apps/essimporter/importscpt.hpp +++ b/apps/essimporter/importscpt.hpp @@ -4,6 +4,7 @@ #include "importscri.hpp" #include +#include namespace ESM { diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index f8adeabffe..42e2cc54d7 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -48,6 +48,7 @@ #include #include +#include #include #include diff --git a/components/bullethelpers/aabb.hpp b/components/bullethelpers/aabb.hpp index bfa1dd6e4e..c961c1d49a 100644 --- a/components/bullethelpers/aabb.hpp +++ b/components/bullethelpers/aabb.hpp @@ -3,6 +3,7 @@ #include #include +#include inline bool operator==(const btAABB& lhs, const btAABB& rhs) { diff --git a/components/compiler/fileparser.hpp b/components/compiler/fileparser.hpp index b08ec9cdd3..fa91dc631f 100644 --- a/components/compiler/fileparser.hpp +++ b/components/compiler/fileparser.hpp @@ -4,7 +4,6 @@ #include "parser.hpp" #include "scriptparser.hpp" #include "locals.hpp" -#include "literals.hpp" namespace Compiler { diff --git a/components/esm3/activespells.hpp b/components/esm3/activespells.hpp index 91b3f495f5..80544b4dbb 100644 --- a/components/esm3/activespells.hpp +++ b/components/esm3/activespells.hpp @@ -3,7 +3,6 @@ #include "cellref.hpp" #include "components/esm/defs.hpp" -#include "effectlist.hpp" #include #include diff --git a/components/esm3/animationstate.hpp b/components/esm3/animationstate.hpp index 2a19eff63a..144fabdbf0 100644 --- a/components/esm3/animationstate.hpp +++ b/components/esm3/animationstate.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace ESM { diff --git a/components/esm3/loadcont.hpp b/components/esm3/loadcont.hpp index 0a28a89015..afef72ea80 100644 --- a/components/esm3/loadcont.hpp +++ b/components/esm3/loadcont.hpp @@ -4,7 +4,6 @@ #include #include -#include "components/esm/esmcommon.hpp" #include "components/esm/defs.hpp" namespace ESM diff --git a/components/esm3/loadregn.hpp b/components/esm3/loadregn.hpp index 555b5e1b8d..1a771f28e5 100644 --- a/components/esm3/loadregn.hpp +++ b/components/esm3/loadregn.hpp @@ -5,7 +5,6 @@ #include #include "components/esm/defs.hpp" -#include "components/esm/esmcommon.hpp" namespace ESM { diff --git a/components/esm3/loadscpt.hpp b/components/esm3/loadscpt.hpp index fdb31ad6a4..b93e0eeb96 100644 --- a/components/esm3/loadscpt.hpp +++ b/components/esm3/loadscpt.hpp @@ -5,7 +5,6 @@ #include #include "components/esm/defs.hpp" -#include "components/esm/esmcommon.hpp" namespace ESM { diff --git a/components/fx/types.hpp b/components/fx/types.hpp index 16f73115ff..18d730bc98 100644 --- a/components/fx/types.hpp +++ b/components/fx/types.hpp @@ -18,8 +18,6 @@ #include #include -#include "pass.hpp" - namespace fx { namespace Types diff --git a/components/fx/widgets.hpp b/components/fx/widgets.hpp index 23b578ad27..2d80bc71d4 100644 --- a/components/fx/widgets.hpp +++ b/components/fx/widgets.hpp @@ -11,7 +11,6 @@ #include -#include "technique.hpp" #include "types.hpp" namespace Gui diff --git a/components/lua_ui/properties.hpp b/components/lua_ui/properties.hpp index ade25156e3..56dcfa0cf9 100644 --- a/components/lua_ui/properties.hpp +++ b/components/lua_ui/properties.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include diff --git a/components/misc/budgetmeasurement.hpp b/components/misc/budgetmeasurement.hpp index 3d56477af1..d9ac866975 100644 --- a/components/misc/budgetmeasurement.hpp +++ b/components/misc/budgetmeasurement.hpp @@ -1,6 +1,8 @@ #ifndef OPENMW_COMPONENTS_MISC_BUDGETMEASUREMENT_H #define OPENMW_COMPONENTS_MISC_BUDGETMEASUREMENT_H +#include +#include namespace Misc { diff --git a/components/nif/data.hpp b/components/nif/data.hpp index f220aae373..73ac0e51d0 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -24,10 +24,9 @@ #ifndef OPENMW_COMPONENTS_NIF_DATA_HPP #define OPENMW_COMPONENTS_NIF_DATA_HPP -#include "base.hpp" - #include "nifkey.hpp" #include "niftypes.hpp" // Transformation +#include "recordptr.hpp" namespace Nif { diff --git a/components/nif/physics.hpp b/components/nif/physics.hpp index 613ec0ba43..d5e8564043 100644 --- a/components/nif/physics.hpp +++ b/components/nif/physics.hpp @@ -1,13 +1,24 @@ #ifndef OPENMW_COMPONENTS_NIF_PHYSICS_HPP #define OPENMW_COMPONENTS_NIF_PHYSICS_HPP -#include "base.hpp" +#include "record.hpp" +#include "recordptr.hpp" + +#include +#include +#include + +#include +#include // This header contains certain record definitions // specific to Bethesda implementation of Havok physics namespace Nif { +class NIFStream; +class NIFFile; + /// Non-record data types struct bhkWorldObjCInfoProperty diff --git a/components/nifosg/nifloader.hpp b/components/nifosg/nifloader.hpp index 8ee6b41674..ddee8031a9 100644 --- a/components/nifosg/nifloader.hpp +++ b/components/nifosg/nifloader.hpp @@ -8,8 +8,6 @@ #include #include -#include "controller.hpp" - namespace osg { class Node; diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index 1a00e18760..bbbdde68d7 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -21,6 +21,8 @@ #include #include +#include + #include #include diff --git a/components/sceneutil/osgacontroller.hpp b/components/sceneutil/osgacontroller.hpp index e9ffe2676f..07bf0d68a7 100644 --- a/components/sceneutil/osgacontroller.hpp +++ b/components/sceneutil/osgacontroller.hpp @@ -6,9 +6,9 @@ #include #include -#include -#include -#include +#include "nodecallback.hpp" +#include "keyframe.hpp" + #include namespace SceneUtil diff --git a/components/stereo/stereomanager.hpp b/components/stereo/stereomanager.hpp index 6a873e00f3..815f55f156 100644 --- a/components/stereo/stereomanager.hpp +++ b/components/stereo/stereomanager.hpp @@ -10,9 +10,10 @@ #include #include -#include #include +#include "types.hpp" + namespace osg { class FrameBufferObject; diff --git a/components/terrain/material.hpp b/components/terrain/material.hpp index d5ef40a29e..975bff2533 100644 --- a/components/terrain/material.hpp +++ b/components/terrain/material.hpp @@ -3,8 +3,6 @@ #include -#include "defs.hpp" - namespace osg { class Texture2D; diff --git a/components/terrain/view.hpp b/components/terrain/view.hpp index 1ce0876603..8017e25afd 100644 --- a/components/terrain/view.hpp +++ b/components/terrain/view.hpp @@ -1,9 +1,7 @@ #ifndef COMPONENTS_TERRAIN_VIEW_H #define COMPONENTS_TERRAIN_VIEW_H -#include #include -#include namespace Terrain { diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index 85114c32d2..09e8adaef0 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -10,7 +10,6 @@ #include -#include "defs.hpp" #include "cellborder.hpp" namespace osg diff --git a/components/widgets/fontwrapper.hpp b/components/widgets/fontwrapper.hpp index 16ebba3587..122cf20257 100644 --- a/components/widgets/fontwrapper.hpp +++ b/components/widgets/fontwrapper.hpp @@ -1,10 +1,10 @@ #ifndef OPENMW_WIDGETS_WRAPPER_H #define OPENMW_WIDGETS_WRAPPER_H -#include "widgets.hpp" - #include +#include + namespace Gui { template From 274afbc7a096d7473d645f409c21904c5edf2f7f Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 16 Aug 2022 20:06:25 +0200 Subject: [PATCH 2/4] Add missing include --- apps/openmw/mwrender/recastmesh.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/openmw/mwrender/recastmesh.cpp b/apps/openmw/mwrender/recastmesh.cpp index 5f202720b2..d0a086377d 100644 --- a/apps/openmw/mwrender/recastmesh.cpp +++ b/apps/openmw/mwrender/recastmesh.cpp @@ -1,5 +1,7 @@ #include "recastmesh.hpp" +#include + #include #include #include @@ -12,6 +14,7 @@ #include "../mwbase/world.hpp" #include "../mwbase/environment.hpp" + namespace MWRender { RecastMesh::RecastMesh(const osg::ref_ptr& root, bool enabled) From bcb4215c84ca19586686d76f65dac865e7559b01 Mon Sep 17 00:00:00 2001 From: psi29a Date: Wed, 17 Aug 2022 06:59:43 +0000 Subject: [PATCH 3/4] Comment out flatpack build for now. --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 052e2adcad..54c9251880 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -652,7 +652,7 @@ Windows_MSBuild_RelWithDebInfo: script: - scripts/find_missing_merge_requests.py --project_id=$CI_PROJECT_ID --ignored_mrs_path=$CI_PROJECT_DIR/.resubmitted_merge_requests.txt -flatpak: +.flatpak: image: 'docker.io/bilelmoussaoui/flatpak-github-actions' stage: build script: @@ -670,4 +670,4 @@ flatpak: - "openmw.flatpak" # When CCache doesn't exist (e.g. first build on a fork), build takes more than 1h, which is the default for forks. # Flatpak Builds compile all dependencies aswell so need more time. Build results of libraries are cached - timeout: 4h \ No newline at end of file + timeout: 4h From edbd05a3f7a57a56ecd0cab600849272005a0d1a Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Wed, 17 Aug 2022 01:27:41 +0300 Subject: [PATCH 4/4] Support more NiPixelData formats (feature #6945) --- CHANGELOG.md | 1 + components/nif/data.hpp | 5 +++-- components/nifosg/nifloader.cpp | 40 ++++++++++++++++++++++++++++----- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a24702725..aacb98999d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses Bug #5129: Stuttering animation on Centurion Archer Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load + Feature #6945: Support S3TC-compressed and BGR/BGRA NiPixelData 0.48.0 ------ diff --git a/components/nif/data.hpp b/components/nif/data.hpp index f220aae373..5fcd63e759 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -115,10 +115,11 @@ struct NiPixelData : public Record NIPXFMT_RGBA8, NIPXFMT_PAL8, NIPXFMT_PALA8, + NIPXFMT_BGR8, + NIPXFMT_BGRA8, NIPXFMT_DXT1, NIPXFMT_DXT3, - NIPXFMT_DXT5, - NIPXFMT_DXT5_ALT + NIPXFMT_DXT5 }; Format fmt{NIPXFMT_RGB8}; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index a313488074..19a83175a3 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1480,17 +1480,39 @@ namespace NifOsg { osg::ref_ptr image (new osg::Image); + // Pixel row alignment, defining it to be consistent with OSG DDS plugin + int packing = 1; GLenum pixelformat = 0; switch (pixelData->fmt) { case Nif::NiPixelData::NIPXFMT_RGB8: - case Nif::NiPixelData::NIPXFMT_PAL8: pixelformat = GL_RGB; break; case Nif::NiPixelData::NIPXFMT_RGBA8: - case Nif::NiPixelData::NIPXFMT_PALA8: pixelformat = GL_RGBA; break; + case Nif::NiPixelData::NIPXFMT_PAL8: + case Nif::NiPixelData::NIPXFMT_PALA8: + pixelformat = GL_RED; // Each color is defined by a byte. + break; + case Nif::NiPixelData::NIPXFMT_BGR8: + pixelformat = GL_BGR; + break; + case Nif::NiPixelData::NIPXFMT_BGRA8: + pixelformat = GL_BGRA; + break; + case Nif::NiPixelData::NIPXFMT_DXT1: + pixelformat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + packing = 2; + break; + case Nif::NiPixelData::NIPXFMT_DXT3: + pixelformat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + packing = 4; + break; + case Nif::NiPixelData::NIPXFMT_DXT5: + pixelformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; + packing = 4; + break; default: Log(Debug::Info) << "Unhandled internal pixel format " << pixelData->fmt << " in " << mFilename; return nullptr; @@ -1507,7 +1529,7 @@ namespace NifOsg { const Nif::NiPixelData::Mipmap& mip = pixelData->mipmaps[i]; - size_t mipSize = mip.height * mip.width * pixelData->bpp / 8; + size_t mipSize = osg::Image::computeImageSizeInBytes(mip.width, mip.height, 1, pixelformat, GL_UNSIGNED_BYTE, packing); if (mipSize + mip.dataOffset > pixelData->data.size()) { Log(Debug::Info) << "Internal texture's mipmap data out of bounds, ignoring texture"; @@ -1534,10 +1556,15 @@ namespace NifOsg { case Nif::NiPixelData::NIPXFMT_RGB8: case Nif::NiPixelData::NIPXFMT_RGBA8: + case Nif::NiPixelData::NIPXFMT_BGR8: + case Nif::NiPixelData::NIPXFMT_BGRA8: + case Nif::NiPixelData::NIPXFMT_DXT1: + case Nif::NiPixelData::NIPXFMT_DXT3: + case Nif::NiPixelData::NIPXFMT_DXT5: { unsigned char* data = new unsigned char[pixels.size()]; memcpy(data, pixels.data(), pixels.size()); - image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE); + image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE, packing); break; } case Nif::NiPixelData::NIPXFMT_PAL8: @@ -1548,6 +1575,7 @@ namespace NifOsg Log(Debug::Info) << "Palettized texture in " << mFilename << " is invalid, ignoring"; return nullptr; } + pixelformat = pixelData->fmt == Nif::NiPixelData::NIPXFMT_PAL8 ? GL_RGB : GL_RGBA; // We're going to convert the indices that pixel data contains // into real colors using the palette. const auto& palette = pixelData->palette->colors; @@ -1559,7 +1587,9 @@ namespace NifOsg memcpy(pixel, &palette[index], sizeof(unsigned char) * numChannels); pixel += numChannels; } - image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE); + for (unsigned int& offset : mipmapVector) + offset *= numChannels; + image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE, packing); break; } default: