Commit Graph

230 Commits (f007025cedcfd1b24a3cb8d2c14d063c58035a6c)

Author SHA1 Message Date
elsid bb26ba30b6
Add progress reporter type
To log/report progress of long duration operations using given time period.
3 years ago
elsid 23026caacc
Fix LuaUtilPackageTest.Transform
It can fail due to float arithmetic precision with error:
Expected equality of these values:
  getAsString(lua, "moveAndScale")
    Which is: "TransformM{ move(6, 22, 18) scale(0.5, 1, 0.5) rotation(angle=8.53284e-17, axis=(1, 0, 0)) }"
  "TransformM{ move(6, 22, 18) scale(0.5, 1, 0.5) }"
3 years ago
elsid 046b5f83ee
Add ESM data loader
A component to load ESM content files with limited support for record types and
selection which of them to load. Supported record types are:
ACTI, CELL, CONT, DOOR, GMST, LAND, STAT.
3 years ago
elsid c88367b6a6
Add sqlite3 helpers 3 years ago
psi29a ae31138686 Merge branch 'options_tests' into 'master'
Add tests for openmw options

See merge request OpenMW/openmw!1253
3 years ago
florent teppe e5abadc234 Fix keyword search when the keyword is preceded by a non whitespace non alpha character 3 years ago
elsid 035307b012
Add tests for openmw options
In attempt to document current behaviour. Add commented out checks as desired
behaviour.
3 years ago
Petr Mikheev 48538d5cef 3D transforms in Lua 3 years ago
Evil Eye 2f4df12b2e Merge branch 'Fix_ASCII' into 'master'
Fixed an issue where keyword search expected the text to be all ASCII characters

See merge request OpenMW/openmw!1227
3 years ago
florent.teppe 2d32954888 Replaced Assert_true with expect_eq 3 years ago
florent.teppe 0e06e9b221 Removed useless comment and converted the file to UTF8 to keep special characters 3 years ago
florent.teppe c1c501ca35 Added test to make sure keyword search works even with non ascii characters 3 years ago
Petr Mikheev 2f25257a3e Move LuaState::makeReadOnly(sol::table) out of the class because it doesn't need to access LuaState internals. 3 years ago
elsid 6b7434ca69
Pass std::string_view instead of const std::string&
* Starting with Actor::getBodyPartMesh and ending with
  Misc::StringUtils::ciEqual.
* Add tests for Misc::StringUtils::ciEqual.
3 years ago
Petr Mikheev 33d4d88447 Function LuaUtil::toString 3 years ago
elsid fea4fb6e69
Make AiPursue path destination to be as close as possible to target
Even when target is not reachable actor will try to run there either because
target navmesh polygon is selected within extended area or because partial path
is built to the closest possible polygon.
3 years ago
psi29a 6595c731f7 Merge branch 'fix_rc_poly_mesh_flags_length' into 'master'
Fix flags length for rcPolyMesh

See merge request OpenMW/openmw!1134
3 years ago
elsid 54a676f2e3
Add functions to get length of recast type arrays
To avoid duplicating same formulas in multiple places.
3 years ago
elsid 05258ed644
Remove redundant TileCachedRecastMeshManager::hasTile function
It's used only for tests. getMesh is a valid replacement.
3 years ago
psi29a e10e9c0005 Merge branch 'navmesh_reduce_lock_wait' into 'master'
Reduce waiting duration on locks when updating navmesh object in the main thread (#6193)

Closes #6193

See merge request OpenMW/openmw!1079
3 years ago
Petr Mikheev 3ce5e9e680 Improve error messages in components/lua/serialization.cpp 3 years ago
elsid c8987bda2f
Store reference to BulletShapeInstance for btCollisionShape
To keep btCollisionShape lifetime.
3 years ago
elsid 4574e5f565
Remove redundant Navigator API functions 3 years ago
elsid 9a5ec5fd03
Store heightfields as array of heights instead of triangles
To reduce size of RecastMesh and therefore cache size.
3 years ago
elsid fdee9db20c
Consider RecastMeshManager not empty when there is water 3 years ago
elsid 5d6c93566d
Rename DetourNavigator::Water -> Cell 3 years ago
elsid 753767d6d9
Store only water shift
Rotation is not used.
3 years ago
elsid a1549321d7
Move Water struct out of RecastMesh class 3 years ago
elsid d60edb36aa
Make RecastMesh independent from recast scale factor
To avoid scaling until it's required by delaying coordinates conversion until
navmesh generation.
3 years ago
elsid af7059373c
Make RecastMesh independent from the order of RecastMeshBuilder calls
To make sure RecastMesh objects are equal if built with the same data but in
different order. Will be used later when there will be more than one place
building RecasMesh objects.
3 years ago
elsid f92843e3d2
Fix UB: reference binding to misaligned address in Lua tests
/home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:166:34: runtime error: reference binding to misaligned address 0x562ea892076c for type 'const struct TestStruct1', which requires 8 byte alignment
0x562ea892076c: note: pointer points here
  00 74 73 31 00 00 00 00  00 00 f8 3f 00 00 00 00  00 00 04 40 21 79 4b 08  00 00 00 74 65 73 74 5f
              ^
    #0 0x562ea6462b8e in deserialize /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:166
    #1 0x562ea68b7402 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:172
    #2 0x562ea68b7bf6 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:204
    #3 0x562ea68b86ea in LuaUtil::deserialize(sol::state&, std::basic_string_view<char, std::char_traits<char> >, LuaUtil::UserdataSerializer const*) /home/elsid/dev/openmw/components/lua/serialization.cpp:251
    #4 0x562ea6464d96 in TestBody /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:197
    #5 0x562ea6d9dac6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    #6 0x562ea6d9dac6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    #7 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2682
    #8 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2672
    #9 0x562ea6d93024 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2861
    #10 0x562ea6d93728 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2834
    #11 0x562ea6d93728 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:3015
    #12 0x562ea6d94142 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2994
    #13 0x562ea6d94142 in testing::internal::UnitTestImpl::RunAllTests() /home/elsid/dev/googletest/googletest/src/gtest.cc:5855
    #14 0x562ea6d9e096 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    #15 0x562ea6d9e096 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    #16 0x562ea6d93140 in testing::UnitTest::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:5438
    #17 0x562ea5d3fdc6 in RUN_ALL_TESTS() /home/elsid/dev/googletest/build/gcc/release/install/include/gtest/gtest.h:2490
    #18 0x562ea5d3fc6f in main /home/elsid/dev/openmw/apps/openmw_test_suite/openmw_test_suite.cpp:11
    #19 0x7fe3938d0b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #20 0x562ea5d3fb7d in _start (/home/elsid/dev/openmw/build/gcc/ubsan/openmw_test_suite+0x173eb7d)

/home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:176:34: runtime error: reference binding to misaligned address 0x562ea892078f for type 'const struct TestStruct2', which requires 4 byte alignment
0x562ea892078f: note: pointer points here
 75 63 74 32 04  00 00 00 03 00 00 00 04  00 6e 64 69 74 69 6f 6e  73 00 73 68 61 70 65 00  51 00 00
             ^
    #0 0x562ea6462df9 in deserialize /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:176
    #1 0x562ea68b7402 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:172
    #2 0x562ea68b7bf6 in deserializeImpl /home/elsid/dev/openmw/components/lua/serialization.cpp:204
    #3 0x562ea68b86ea in LuaUtil::deserialize(sol::state&, std::basic_string_view<char, std::char_traits<char> >, LuaUtil::UserdataSerializer const*) /home/elsid/dev/openmw/components/lua/serialization.cpp:251
    #4 0x562ea6464d96 in TestBody /home/elsid/dev/openmw/apps/openmw_test_suite/lua/test_serialization.cpp:197
    #5 0x562ea6d9dac6 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    #6 0x562ea6d9dac6 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    #7 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2682
    #8 0x562ea6d92e25 in testing::Test::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2672
    #9 0x562ea6d93024 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2861
    #10 0x562ea6d93728 in testing::TestInfo::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2834
    #11 0x562ea6d93728 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:3015
    #12 0x562ea6d94142 in testing::TestSuite::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:2994
    #13 0x562ea6d94142 in testing::internal::UnitTestImpl::RunAllTests() /home/elsid/dev/googletest/googletest/src/gtest.cc:5855
    #14 0x562ea6d9e096 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2607
    #15 0x562ea6d9e096 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/elsid/dev/googletest/googletest/src/gtest.cc:2643
    #16 0x562ea6d93140 in testing::UnitTest::Run() /home/elsid/dev/googletest/googletest/src/gtest.cc:5438
    #17 0x562ea5d3fdc6 in RUN_ALL_TESTS() /home/elsid/dev/googletest/build/gcc/release/install/include/gtest/gtest.h:2490
    #18 0x562ea5d3fc6f in main /home/elsid/dev/openmw/apps/openmw_test_suite/openmw_test_suite.cpp:11
    #19 0x7fe3938d0b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #20 0x562ea5d3fb7d in _start (/home/elsid/dev/openmw/build/gcc/ubsan/openmw_test_suite+0x173eb7d)
4 years ago
elsid beeb882ea8
Do not use off mesh connections as a part of navmesh cache key
To reduce cache size and make it more flexible.

Adding off mesh connections to the navmesh is the last step of navmesh
generation and it's very fast comparing to other steps (microseconds vs
milliseconds). Having less cache size makes get and set operations almost 2x
times faster that also have an order of microseconds. So in total there is
no performance impact.
4 years ago
Petr Mikheev 702eb19271 Fixes and refactoring 4 years ago
Petr Mikheev b53667d555 Queries. Data structures and lua bindings. 4 years ago
Petr Mikheev 479856f812 Add components/lua/scriptscontainer and components/esm/luascripts 4 years ago
Petr Mikheev 8dbaf6022c Add components/lua/serilalization 4 years ago
Petr Mikheev 4b068b27ca Add components/lua/luastate and components/lua/utilpackage 4 years ago
elsid 09f9075842
Use RecastMeshBuilder once to create RecastMesh
This allows to move all data out of the object instead of copying.
4 years ago
elsid 84d6dea277
Inscribe physical bounding box into navmesh agent cylinder
To disallow too narrow navmesh for a bounding box.
4 years ago
elsid e9433a91fb
Add more tests for TileCachedRecastMeshManager 4 years ago
elsid d122e184cc
Report navmesh change for not posted tiles
Corresponding recast mesh tiles can be updated but navmesh tiles may never
appear for them. Report back zero navmesh version to allow oscillating recast
objects detection to work. This version is always less than any generated
navmesh tile version so any report for generated navmesh will override it.
If zero navmesh version is reported after recast mesh tile got report about
generated navmesh tile it is a no-op since generated version is always greater
than zero.
4 years ago
elsid 105cd5b06f
Add more checks to NavMeshTilesCache tests 4 years ago
psi29a e9fbd76e9b Merge branch 'windows_tests' into 'master'
Support running tests and benchmarks for windows

See merge request OpenMW/openmw!839
4 years ago
elsid 3ef1b27099
Add missing includes 4 years ago
elsid 59f89d22f8
Apply min distance only for not present tiles
To avoid waiting when navmesh update is triggered by transformed object for
already present tiles.
4 years ago
elsid 7a51d0db18
Wait until navmesh is generated within given distance around player
Add a setting to change this distance.

To prevent situations when there is not enough navmesh generated and actors
can't find path correctly.
4 years ago
elsid f169f8e6f0
Wait until navmesh is generated for interior cells
Add special loading progress bar.

It should be fast enough to not keep loading screen for noticably long but
will provide better pathfinding for actors inside interior cells.
4 years ago
elsid ec87b3f8f7
Remove redundant ChunkyTriMesh
This AABB tree required when need to filter out input mesh that has not
influence navmesh tile output. This filtering is already done before. Each
recast mesh corresponds to a single navmesh tile and has appropriate bounds.
4 years ago
psi29a 16bb3919d1 Merge branch 'navmesh_cache_simplification' into 'master'
Simplify navmesh cache

See merge request OpenMW/openmw!691
4 years ago
elsid 3e67f5ffa5
Detect and ignore updates for oscillating objects
To avoid triggering NavMesh update when RecastMesh change should not change
NavMesh.

Based on the following assumption:
Given a set of transformations and a bounding shape for all these
tranformations, a new object transformation that does not change this
bounding shape also should not change navmesh if for all of this object
transformations resulting navmesh tiles are equivalent

The idea is to report back to RecastMeshManager all changes of NavMesh if there
are any assiciated with RecastMesh version. So we know the last time when
RecastMesh change resulted into the NavMesh change. When later report shows
that there was no NavMesh change for a new RecastMesh version we can assume
that any object transformation within the same bounding box should not change
NavMesh.
4 years ago
elsid 8e1c92d9af
Use std::variant for ESM::Variant implementation 4 years ago
elsid 7f577f5f08
Do not compare hash in tests
Different std libraries have different implementation that produce different
results for the same values.
4 years ago
elsid dae3f022ba
Add tests for ESM::Variant 4 years ago
elsid f2ebad5115
Return cached element when set existing 4 years ago
elsid fac5759748
Set bounding min and max height for btHeightfieldTerrainShape
They must be set for proper AABB based filtering. Use
+-max(abs(min), abs(max)) to make sure bullet does not shift coordinates by z.
4 years ago
elsid fdca76ce86
Remove unused includes 4 years ago
elsid 8dba61f7ae
Use navmesh raycast to find reachable position around target 4 years ago
Sergey Fukanchik f3271cb66b Add unit test for swapEndiannessInplace(). Part of Bug #5837 4 years ago
elsid 489107c5ee
Count navmesh cache key once in item size
Key is stored only in NavMeshTilesCache::Item, TileMap uses KeyView with
a pointer to a vector.
4 years ago
Alexei Dobrohotov 8db2ba2b38
Merge pull request #3032 from akortunov/gtest
Mark mock methods as overrides (requires GTest 1.10)
4 years ago
Alexei Dobrohotov 8fd45d85ec Unify NiGeometry/NiGeometryData handling 4 years ago
Alexei Dobrohotov 15291f15d3 Make actor collision box components a struct 4 years ago
psi29a 7156b11dbc be explicit about narrowing to resolve: error: type 'btScalar *' (aka 'float *') cannot be narrowed to 'bool' in initializer list [-Wc++11-narrowing] 4 years ago
AnyOldName3 fd4a62ce35 Use correct variable types when loading config for tests 4 years ago
Andrei Kortunov 807367ca3f Mark mock methods as overrides (requires GTest 1.10) 4 years ago
Alexei Dobrohotov df9667e923 Read NIF bounding volume data correctly 4 years ago
Bret Curtis f6bead88a9 purge boost/optional.hpp headers 4 years ago
Bret Curtis 5a824d0333 components/compiler cleanup; also cleaned up related cascading warnings; fixed up final/override issues 4 years ago
Bret Curtis c99be77a32
Merge pull request #3008 from akortunov/strings
Rework fixed strings handling
4 years ago
psi29a bca698d951 Merge branch 'shader_line_numbering' into 'master'
Correctly resetting line numbering during shader processing.

See merge request OpenMW/openmw!317
4 years ago
Andrei Kortunov 822764d0fa Rework fixed strings handling 4 years ago
Alexei Dobrohotov 29ccb09da5 Introduce some extended NIF definitions 4 years ago
Mads Buvik Sandvei d5450a7d88 Correctly resetting line numbering during shader processing. 4 years ago
Evil Eye 6ad20ec9c7 Mutate base records when adding/removing spells 5 years ago
elsid 00197e1cd9
Optimize recast mesh size by vertex deduplication 5 years ago
elsid b095ca6c86
Use actor speed to define area cost for pathfinding 5 years ago
Bret Curtis c69c7d0b3b
Merge pull request #2049 from elsid/bullet_double_precision
Support bullet double precision
5 years ago
Capostrophic 30558c2434 Try to resolve CI concerns 5 years ago
elsid 2d7c3bae61
Support bullet with double precision 5 years ago
elsid ef5a5ef43f
Print not matched values with full precision 5 years ago
elsid 1f3dfaedcc
Add tests for ShaderManager 5 years ago
elsid b150d681a9
Update same navmesh tile with limited frequency 5 years ago
elsid bd1ef4dd6d
Add detournavigator test for multiple worker threads 5 years ago
elsid df6e85b619
Use callback to handle changed tiles
Instead of collecting changed tiles into a temporary vector.
5 years ago
Alexey Sokolov ddab86d940 Use approximate comparison for floating point in test
This fixes test suite on my machine
5 years ago
elsid 208a50340d
Specialize DetourNavigator::ObjectId ctor for pointers
To fix msvc error:
components\detournavigator\objectid.hpp(14,13): error C2440: 'reinterpret_cast': cannot convert from 'const T' to 'size_t'
          with
          [
              T=unsigned long
          ]
5 years ago
elsid 7ae7cb181d
Support recast mesh rendering 5 years ago
Capostrophic aef6cd7006 Fix handling of empty strings in NIF string tables 5 years ago
elsid 349040ffb2
Use status codes to handle navigator errors instead of exceptions
For find path use case.
5 years ago
elsid 1e106013a0
Use navmesh to find wander destination outside pathgrid for ground based actors
Use dtNavMeshQuery::findRandomPointAroundCircle from recastnavigation
5 years ago
capostrophic c61f64ae86 Fix tests 5 years ago
elsid 7ec5a20c64
Filter recast mesh triangles by global bounding box
Except heightfields to reduce slow down.
5 years ago
elsid 862f50346c
Add tests for settings parser 5 years ago
elsid 07660b5605
Fix detournavigator tests 5 years ago
Capostrophic 790531671a Fix tests 5 years ago
Capostrophic 8baddefdbd Refactor extra data and particle modifier handling
Objects no longer inherit from extra data class
"Controlled" harmful abstraction no longer exists
Introduced NiParticleModifier/NiParticleCollider abstractions
Extra data size reading moved into the base read() method
5 years ago
elsid 0479ebf5ae
Remove unused actors and navmeshes on update
When there is only one actor (player) on a scene and it moving to other
cell first it will be removed from navigator then added. Remove cause
navmesh removing for its half extents. After it is added navmesh for
same half extents is created and added. While this all happens there are
still jobs for old navmesh are processing. Old navmesh still exists
because it is stored by shared pointer. So jobs take tiles from cache
and place them into old navmesh. After that other jobs take same tiles
from cache (half extents and coordinates are equal) and place them into
other navmesh. dtNavMesh changes tile data on add and remove. Adding tile
to two dtNavMesh corrupts tile in both nameshes.
6 years ago
Bret Curtis c20e69ef24
Merge pull request #2227 from elsid/fix_twitchy_massive_creatures
Fix twitchy movement for massive creatures (bug #4907)
6 years ago
elsid b9f21ec81a
Use custom steps size to make smooth path depending on half extents 6 years ago
elsid f2e47d640d
Add option to limit max number of navmesh tiles 6 years ago