Commit Graph

398 Commits (a854a6e04a8437d74078906d1d1720c0649e4e6f)

Author SHA1 Message Date
Bo Svensson a854a6e04a
removes UnrefQueue (#3181)
Currently, we use an `UnrefQueue` which supposedly aims to transfer destruction costs to another thread. The implications of this unusual pattern can not be well understood because some allocators might free resources more efficiently if they are freed by the same thread that allocated them. In addition, `UnrefQueue` complicates the validation of thread safety in our engine. Lastly, our current usage of `UnrefQueue` triggers `ref()`, `unref()` atomic operations as objects are passed into the queue. These operations could be more expensive than the actual destruction.

With this PR we thus remove `UnrefQueue`. We can expect these changes to have a minor impact at most because we free most resources elsewhere in `ResourceSystem::updateCache`.
3 years ago
psi29a 67fa8413f3 Merge branch 'physics_heightfield' into 'master'
Replace float type for arguments to create heightfield with int

See merge request OpenMW/openmw!1285
3 years ago
elsid 405e814190
Move btCollisionObject creation for MWPhysics::Object into components 3 years ago
elsid 7c5a590890
Replace float type for arguments to create heightfield with int
To reduce amount of computations on the caller side and restrict possible
values.

* verts can't be non-int because it's a number of things.
* worldsize is initially defined as int by ESM::Land::REAL_SIZE.
* Put function to calculate heightfied shift into components to be able to
  reuse by other binaries.
3 years ago
psi29a 2c8c36fe5d Merge branch 'master' into 'effective_magic'
# Conflicts:
#   CHANGELOG.md
3 years ago
Bret Curtis 52a10a4bc0 remove one last assert 3 years ago
Bret Curtis 8309910d9d Restore the cell grid to its former non-exorbitant size, reducing stutter and also threw in a simple alternative fix for the actor position adjustment issue. 3 years ago
Evil Eye b8e4f18751 Clear temporary effects before unloading actors to prevent absorb effects becoming permanent 3 years ago
Andrei Kortunov fc2076db1a
Fix MSVC warnings about local variables redeclaration (#3130) 3 years ago
elsid 5878b1fce6
Use same logic for testing cell as for loading cell
Having different branches makes testing less useful. If something fails in
regular executing it should fail in testing. To make it possible there should
be none differences in the execution paths.
3 years ago
Bo Svensson f62adab43a
Avoid the terrain sync completely in most cases (#3103)
We can take elsid's commit 605cb8d further by avoiding the terrain sync completely in most cases. Currently in changeCellGrid we wait for a new preloading task to ensure the getPagedRefnums for the new active cells have been filled in by object paging. This is usually not necessary because we have already completed a preload in the past containing these active cells. With this PR we remember what we preloaded and skip the terrain sync if it is not needed.
3 years ago
elsid 605cb8db7c
Make sync terrain preloading sleep free
This reduces average time spent on in. 5 milliseconds as a base precision is
quite a lot considering that for 60 FPS frame time is 1000/16 = ~16.67 ms
when it's a cell loading frame and there is more important work to do rather
than sleeping.
3 years ago
fredzio d1a5bc207b Iterate over mInactiveCells when unloading cells in TestCells / TestInteriorCells. Otherwise we dereference an invalid iterator after deactiveCell(). 3 years ago
psi29a faa3e04494 Merge branch 'const_reff' into 'master'
Sprinkle some const-ref

See merge request OpenMW/openmw!1145
3 years ago
Alexei Dobrohotov 7665ebfa67 Merge branch 'another_fix' into 'master'
Fix #6219

Closes #6219

See merge request OpenMW/openmw!1137
3 years ago
jvoisin 7a015d24c6 Sprinkle some const-ref 3 years ago
fredzio 713f612bdb Partially revert !1046: the player is added before the scene exists, so we need to check again the grounded state, as it correctly was. 3 years ago
elsid 3caf45807f
Use common implementation to filter hidden markers 3 years ago
elsid c8987bda2f
Store reference to BulletShapeInstance for btCollisionShape
To keep btCollisionShape lifetime.
3 years ago
fredzio a7b190ad29 Change rotateObject() to take a osg::Vec3f argument instead of 3 floats
for readability.
3 years ago
fredzio 88a5ca440b Change moveObject() to take a osg::Vec3f argument instead of 3 floats
for readability.
3 years ago
elsid 6adf7b10ae
Fix removing heightfield from navigator
It's added not as object so it shouldn't be removed as it.
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 753767d6d9
Store only water shift
Rotation is not used.
3 years ago
elsid 100cba6260
Use navigator field in Scene 3 years ago
fredzio f348b70733 Set mCanWaterWalk and mOnGround when adding Actor to the scene.
mCanWaterWalk was set to false and updated during next frame's simulation
mOnGround is set to true but then was updated as part of the scene
loading logic.
3 years ago
elsid b8fcd6d3ba
Manage work item lifetime on the client side
Instead of explicit work queue stop before any possibly used engine manager
is destructed. Based on an assumption that any engine manager can be destructed
independently from the work queue destruction. This model is already used in
CellPreloader that conflicts with explicit work queue stop.

After the work queue is requested to be stopped, any client waiting for a not
started work item to be done will wait forever because the work item is dropped
from the queue. Therefore either clients should not wait for own work items to
be completed in destructor or the work queue should not drop items before
clients are destructed. Other approaches are possible but are not considered
due to increasing complexity.

CellPreloader already tries to wait for all created work items to be done so
keep it that way and extend the model to AsyncScreenCaptureOperation and Scene.
Additionally abort all scheduled work items when owner is destructed. This
prevents a long exit when multiple screenshots are scheduled right before
exiting the game.
3 years ago
Petr Mikheev 914e604e06 Interactions between LuaManager and other parts of OpenMW 3 years ago
Evil Eye 0a15d7740a Delay physics for objects created by scripts 3 years ago
fredzio c795e0bce6 Some actors are supposed to spawn on an object that belongs to an adjacent cell.
Since actors can be active in 3x3 grid around the player, we need to
first load all objects in a 5x5 grid around the player.

Split load and unloading in 2 phases. Add an mInactiveCells set into the
scene, which contains all cells inside the aforementioned 5x5 grid.
These cells contains only heightfields and non-animated physics objects.

Animated objects are tied to the scene graph, which doesn't exists yet
in these cells, so we skip them.
3 years ago
psi29a 9dfba37ce9 Merge branch 'fix_big_object_navmesh_update' into 'master'
Fix overwhelming recast mesh and navmesh updates for big rotating objects (#6060)

Closes #6060

See merge request OpenMW/openmw!911
3 years ago
elsid 4a6961b365
Trigger navmesh update on moved player only when player tile has been changed 3 years ago
elsid 3915e5d2cc
Always center loading screen progress bar by height when there is active message box
To fix all possible situations when active message box overlaps with loading
screen progress.

The only used condition to center loading screen progress by height is
number of message boxes > 0. No need to pass it through interface.
LoadingScreen can check it inside setLabel function.
3 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.
3 years ago
psi29a fd89582e0c Merge branch 'navmesh_wait' into 'master'
Wait until navmesh is generated within given distance around player (#5500)

Closes #5500

See merge request OpenMW/openmw!819
3 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.
3 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.
3 years ago
jvoisin 998cc97a4f And done! 3 years ago
Andrei Kortunov 9647b670e4 Do not declare unused variables 3 years ago
Bret Curtis 40c989d732 allman style 3 years ago
Bret Curtis 9fc0649fb6 a better check to avoid the mCell assertion, so compariing nullptr to current cell will refurn false anyway 3 years ago
Bret Curtis 49545e6d29 add comments as to why we need to check that the player is grounded or not; only run once during initial cell loading 3 years ago
Bret Curtis c067782814 proper fix that traces down the player when a cell is loaded; we also only run once if the current cell being loaded is the one that the player is in. 3 years ago
Andrei Kortunov 7b727e4d70 Revert "Remove physics dependency on basenode"
This reverts commit 165c731492.
3 years ago
Andrei Kortunov 165af1c365 Revert "Some actors are supposed to spawn on a static object that belong to an adjacent cell."
This reverts commit f031a191b8.
3 years ago
Andrei Kortunov f8e8496d36 Revert "Revert a wrong change introduced in MR 546"
This reverts commit 23137d0c54.
3 years ago
fredzio 23137d0c54 Revert a wrong change introduced in MR 546
A prerequisite to create physics objects for statics was to remove the
dependency on base node (since it doesn't yet exists) for object
position. It is still necessary for animation though.

Restore the basenode (and the associated FIXME) so that animated objects works properly.
3 years ago
fredzio f031a191b8 Some actors are supposed to spawn on a static object that belong to an adjacent cell.
Since actors can be active in 3x3 grid around the player, we need to
first load all statics in a 5x5 grid around the player.

Split load and unloading in 2 phases. Add an mInactiveCells set into the
scene, which contains all cells inside the aforementioned 5x5 grid.
These cells contains only heightfields and physics objects of static
class.
3 years ago
fredzio 165c731492 Remove physics dependency on basenode
Necessary to be able to load physics objects from inactive cells.
3 years ago
Evil Eye a401c517bf Always unload height fields
loadCell always adds a height field, but unloadCell only removed it for
cells with height data. Reloading a cell overwrote the height field
added earlier (leading to its destruction) while the navigator retained
a reference to the now deleted collision shape, leading to a crash.
3 years ago