612 Commits

Author SHA1 Message Date
AnyOldName3 0877c22458 Constrain the maximum number of a particular warning per file
A corrupt mesh file could cause the warning to be logged up to uint32_t max times.
We cannot log four billion warnings without a large performance cost.

According to https://gitlab.com/OpenMW/openmw/-/work_items/9024, a corrupt mesh in BCOM could trigger this at least four million times, which triggered the freeze catcher.

This is completely untested, but at least it compiles and I remembered to run the formatter.
2026-03-23 18:06:19 +00:00
Alexei Kotov 3387ff5f65 Generate TCB tangents in a less confusing way
This should silence a couple of Coverity false-positive warnings.
2026-03-09 19:46:09 +03:00
Evil Eye ebb4ccdd95 Merge branch 'sciencecompelsustoflipthesun' into 'master'
Change the texture asset origin convention to top-left (#6885)

See merge request OpenMW/openmw!5135
2026-02-25 16:31:36 +00:00
elsid 66cd9114b8 Fix return type for FileView::getFilename 2026-02-15 13:24:44 +01:00
Alexei Kotov a357dcc1b1 Change the texture asset convention to top-left (#6885)
This is basically a MR description but this commit covers a lot of things so I'll include it so you don't have to look at the MR:

This allows us to use BC6H and BC7 textures as is, provided the used OSG revision and hardware support them
DDS images are unflipped by default, non-DDS bottom-left convention images are flipped (TGA, BMP, PNG, JPG)
3D DDS images always used top-left convention if they were used in post-processing

Numerous things flipped in this commit to guarantee the same visual results are:
- Terrain UV and blend maps
- Water UV, normal map and simple water ripple alignment

- NiTriShapeData and BSTriShape UV (unflipped), NiUVController vertical offset
- NIF particles are NOT flipped, they remain flipped for Morrowind compatibility

- GUI widget texture UV and convention
- Cursor
- Character preview inventory doll and race menu head UV and display
- Loading screen scene image UV
- Local and global map UVs (fog of war, unexplored and explored maps)
- Saved game screenshot UV
- Video widget UV

- Rain particle alignment
- Sun and moon UV

- Tangent space handedness (bitangent direction)
- Parallax vertical offset

Things where this is a breaking change
- Collada geometry UV (Example Suite and anything else affected must adopt the changes)
- Compressed non-S3TC images that should but can't be flipped (this is KTX which we don't technically support yet)
- Any forward pass shader replacements that currently still use the original tangent space handedness and parallax convention
2026-02-05 21:05:35 +03:00
Alexei Kotov a0b73d5e62 Make NIF base record members conform to the naming conventions 2025-12-16 13:23:30 +03:00
Alexei Kotov 3927eaef66 Reserve capacity for controller NIF collections 2025-12-15 15:20:59 +03:00
Alexei Kotov 02d9c26289 Reserve capacity for node NIF collections 2025-12-15 15:20:59 +03:00
Alexei Kotov 7332b4e232 Reserve capacity for extra data NIF collections 2025-12-15 10:44:45 +03:00
Alexei Kotov ea506019dc Reserve capacity for data NIF collections 2025-12-15 10:44:37 +03:00
Alexei Kotov 137382b424 Reserve capacity for physics NIF collections 2025-12-15 10:44:27 +03:00
jvoisin 472240526d Merge branch 'fix_niftest_afl_findings' into 'master'
Fix AFL findings in niftest

See merge request OpenMW/openmw!4988
2025-11-24 21:41:46 +00:00
Alexei Kotov c687a21ccb Merge branch 'enum_naming' into 'master'
Fix and enforce enum naming (#8424)

See merge request OpenMW/openmw!4986
2025-11-23 22:36:23 +03:00
elsid 7e1c1e8625 Use proper type for bhkRagdollTemplate::mBones 2025-11-23 13:21:41 +01:00
elsid 246759ecd2 Only reserve capacity when reading collections
But do not initialize. If the meta information is invalid and has a big
value, initialization will take significant amount of time but there
might be no actual data in the file because it's too small.
2025-11-23 13:17:00 +01:00
elsid 434f450778 Check Nif::RecordPtrT in debug builds
To verify class invariant.
2025-11-23 13:17:00 +01:00
elsid 0c2164330b Use at instead of operator[] to access nif record types
To fix crash on out of bounds access.
2025-11-23 13:17:00 +01:00
elsid 20c388a410 Replace asserts by exceptions in RecordPtrT
It's possible to fail when reading nif file.
2025-11-23 13:17:00 +01:00
elsid aa4caae2bf Use proper naming for Nif::RecordPtrT index 2025-11-23 13:16:59 +01:00
elsid e882c1c722 Check if nif stream has requested amount of data
Memory allocation with initialization may take significat amount of time
if meta information does not match actual content.
2025-11-23 13:16:59 +01:00
elsid 1ae0aadfed Use fail function to verify nif stream state
If there is a failure to read the file like incomplete read, bad returns
false, but fail returns true. This is important for reading number of
items more than the file actually has.
2025-11-23 13:16:59 +01:00
elsid d4ce5a2ac6 Fix and enforce enum naming 2025-11-22 11:19:18 +01:00
AnyOldName3 ef8e7d97cb Resolve merge conflicts from !4971 2025-11-10 16:01:47 +00:00
rapidsamphire a3d99ce636 Add post-processing for bhkListShape subshapes
bhkListShape contains a list of subshape references that need to be
resolved after initial parsing. Without calling postRecordList(), the
mSubshapes list would contain unresolved RecordPtrs.

This adds the missing post() override to properly load subshape data,
consistent with other NIF record types that contain RecordPtr lists.
2025-11-07 14:56:05 -06:00
Evil Eye f7292680d6 Fix most conversion warnings in components 2025-09-18 22:00:55 +02:00
elsid 3067294f0d Add and fix -Wshadow 2025-08-18 21:09:06 +02:00
Alexei Kotov 93cb69b012 Assume NIF controller data is already sorted (#8545) 2025-07-18 00:09:28 +03:00
Alexei Kotov a03a2a5ff2 Re-reimplement TCB interpolation for scalars and vectors (#2379) 2025-07-14 13:09:23 +03:00
Alexei Kotov 119a87b7f4 Revert "Merge branch 'tbcornottbcwaititstcbactually' into 'master'"
This reverts merge request !4539
2025-07-13 18:02:15 +03:00
psi29a 9347fe5c4a Merge branch 'tbcornottbcwaititstcbactually' into 'master'
Implement TCB interpolation for vectors and scalars (#2379)

See merge request OpenMW/openmw!4539
2025-07-01 20:46:47 +00:00
Alexei Kotov ac9505b536 Rename components/to_utf8 directory and files to follow naming conventions 2025-02-23 00:18:07 +03:00
Alexei Kotov 1a9e29844b Implement TCB interpolation for vectors and scalars (#2379) 2025-02-13 13:41:34 +03:00
Alexei Kotov c1960635d2 Optimize NIF boolean vector reading 2025-02-07 04:55:06 +03:00
psi29a c454675cff Merge branch 'nilightcolorcontroller' into 'master'
Give NiLightColorController its own struct

See merge request OpenMW/openmw!4472
2024-12-02 16:40:05 +00:00
Alexei Kotov a923e311f5 Give NiLightColorController its own struct 2024-12-01 02:00:12 +03:00
elsid a550a8af36 Use normalized path for KeyframeManager::get 2024-11-20 21:29:36 +01:00
Alexei Kotov 6e70893113 Parse bhkPoseArray 2024-09-18 23:53:33 +03:00
Alexei Kotov 695932d2db Parse BSDistantObjectInstancedNode 2024-09-18 23:53:33 +03:00
Alexei Kotov 7149fbb408 Parse NiPSysRotDampeningCtlr 2024-09-18 22:03:15 +03:00
Alexei Kotov 5f7fa640b0 Parse bhkRagdollTemplate/bhkRagdollTemplateData 2024-09-17 00:26:06 +03:00
Max Yari 55ffb6d7d2 Animation blending implementation for NIF and osgAnimation through YAML files
Signed-off-by: Sam Hellawell <sshellawell@gmail.com>
2024-07-19 00:04:15 +01:00
Alexei Kotov 1d96c0adbf Read BSTreadTransfInterpolator 2024-05-13 01:20:23 +03:00
Alexei Kotov 5f4a0c3bf1 Read BSAnimNote/BSAnimNotes 2024-05-13 01:12:09 +03:00
Alexei Kotov c5a11f0c9f Read BSRotAccumTransfInterpolator 2024-05-13 00:49:10 +03:00
Alexei Kotov c647374c0d Add compact B-Spline interpolators 2024-05-13 00:36:10 +03:00
Alexei Kotov d458c07b36 Add base typed B-Spline interpolators 2024-05-13 00:20:32 +03:00
Alexei Kotov 5c6fca14c1 Read NiBSplineData/NiBSplineBasisData 2024-05-12 23:58:05 +03:00
Alexei Kotov 52bc744642 Fix reading backlight power in NIF stream version 132 2024-04-26 17:32:07 +03:00
Alexei Kotov d7bd5e76ca Move wrapping flag handling to relevant properties 2024-04-23 23:40:14 +03:00
elsid 79b73e45a1 Replace std::filesystem::path by std::string and std::string_view in nif code
It's used only for error reporting.
2024-03-11 22:07:37 +01:00