Commit Graph

5344 Commits (5f8e4870129809351911628a739d67d24c26dbd4)

Author SHA1 Message Date
Bo Svensson db3d938ee9
cleans up BSAFile (#3177)
We currently build a large map of a BSAFile's contents unused by Open MW. We already map archive contents in VFS. With this PR we remove the map from BSAFile and reimplement its only current use in BSATool.
3 years ago
Dan Church 42bd10f356
Fix FTBFS against older versions of osg
Bring back osg version guard.

Drawable::dirtyGLObjects wasn't available until OpenSceneGraph-3.5.10.
3 years ago
Evil Eye ec6451e93a Merge branch 'recordtype' into 'master'
Avoid copying std::string in MWWorld::Ptr::getTypeDescription()

See merge request OpenMW/openmw!1290
3 years ago
Bo Svensson 617eec338a
removes version guard (#3173)
We currently use a version guard to adapt to a change in the number of parameters supplied to osg::TriangleFunctor's operator() template functor. The differing parameter is unused in our code. Crucially, operator() is not an override, so we can just add a default value for the differing parameter. Such a default allows us to apply identical code to both versions of the library without regressing functionality.
3 years ago
Bo Svensson b0132be53f
do not dirty unchanged arrays (#3164)
This PR proposes a simple change to `RigGeometry` `dirtyGLObjects` logic.

1. We will avoid dirtying unmodified arrays.
2. We can drop an osg version guard since `Drawable::dirtyGLObjects` is not nearly as harmful as `Geometry::dirtyGLObjects`.
3. We will avoid crashes in an as yet unfinished future PR concerning `Array` sharing improvements.
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
psi29a 207a7245bc Merge branch 'navigator_settings' into 'master'
Initialize navigator max climb and max slope settings in makeSettingsFromSettingsManager

See merge request OpenMW/openmw!1283
3 years ago
Petr Mikheev a8acc19988 Avoid copying std::string in MWWorld::Ptr::getTypeDescription() 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
elsid 6986feb81b
Initialize navigator max climb and max slope settings in makeSettingsFromSettingsManager
To avoid having multiple places to initialize them when they will be required
by multiple binaries.
3 years ago
Bo Svensson 93848ef01c
avoids virtual function calls in ComputeLightSpaceBounds (#3167)
osg::NodeVisitor is designed to recursively call virtual apply signatures until we find an implemented signature. Encountered nodes that we do not explicitely handle will trigger additional virtual function calls. With this PR we avoid these additional virtual function calls in the particularly costly ComputeLightSpaceBounds by adding some explicit signatures.
3 years ago
Bo Svensson 98f8295765
allows to skip ComputeLightSpaceBounds traversal (#3152)
Currently, we always traverse the scene graph an additional time with a ComputeLightSpaceBounds visitor during shadow casting. ComputeLightSpaceBounds is only useful when the shadow casting mask allows us to shrink the bounds of the rendered scene, so we guard its traversal with a check against getCastsShadowTraversalMask. In practice, this guard never works because we build the traversal mask inclusively.

With this PR we limit the getCastsShadowTraversalMask check to relevant masks. This new check allows us to skip a superfluous ComputeLightSpaceBounds traversal with most settings.
3 years ago
psi29a f9124ccea6 Merge branch 'recast_mesh_slope' into 'master'
Use different colors for walkable and non-walkable recast mesh triangles

See merge request OpenMW/openmw!1277
3 years ago
psi29a f014edd27c Merge branch 'fix_write_recast_mesh' into 'master'
Fix writing to file for RecastMesh

See merge request OpenMW/openmw!1278
3 years ago
Bo Svensson 7c50f823d8
devirtualises BSAFile (#3161)
Currently, Open MW's basic file access speed is limited by a peculiar layer of virtualisation in BSAFile's interface. This PR removes such virtualisation by properly separating BSAFile from CompressedBSAFile in low level contexts.
3 years ago
Bo Svensson c2d836c6c4
optimises riggeometry.cpp (#3165)
We skip this during node path iterations. this is not a node we are interested in.
We avoid allocating a new mGeomToSkelMatrix per frame and avoid a ref_ptr associated with its update.
We speed up a search for the Skeleton node by adding a continue; condition prior to an expensive dynamic_cast.
3 years ago
Bo Svensson 031871cd48
speeds up optimizer (#3162)
We can expect marginally improved loading times with this PR. Drawable, Transform and Node counts in stats panels are expected to remain unchanged - this PR does not add new scene graph optimisations, it just increases the speed with which we apply existing ones.

1. We add explicit `NodeVisitor::apply` overrides for commonly encountered node types to avoid additional virtual function calls per node associated with the default `apply` implementation.
2. We skip pushing `StateSet`s when  `_mergeAlphaBlending` is enabled or the `StateSet` contains no relevant state.
3. We add a specialised variant of `CollectLowestTransformsVisitor::addTransform` accepting `MatrixTransform` to avoid matrix copies and multiplications.
3 years ago
elsid 0c8a811ad5
Render only cached recast mesh
To avoid waiting while recast mesh is generating.

Remove redundant continue.
3 years ago
elsid daff7aba01
Use different colors for walkable and non-walkable triangles 3 years ago
elsid 88ac77df1f
Fix writing to file for RecastMesh
Add missing scaling and y, z coordinates swap.
3 years ago
Bo Svensson b61140b8ba
optimises skeleton.cpp (#3158)
With this PR we optimise a function that is called quite often when loading new cells.

We remove avoidable dynamic_casts.
We remove an unused pair.second element.
We convert a map to an unordered_map because its ordering is irrelevant in this case.
We avoid adding the root Skeleton node to the bones' node path.
3 years ago
psi29a 7af245d205 Merge branch 'sync_sync_with_async' into 'master'
Merge logic of sync and async physics simulation

See merge request OpenMW/openmw!1250
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
Bo Svensson 5242e2695c
avoids memory allocations within ComputeLightSpaceBounds (#3156)
Currently, we create a new ComputeLightSpaceBounds visitor per frame. Within this visitor, we require excessive memory allocations, mainly a new osg::RefMatrix per encountered Transform node.

With this PR we reuse a single ComputeLightSpaceBounds visitor across frames and enable the createOrReuseMatrix functionality to avoid allocating new matrices every frame. osgUtil::CullVisitor internally uses the same approach.
3 years ago
psi29a 88d5b4a90b Merge branch 'variable_function' into 'master'
Parse local variables sharing a name with a function as variables

Closes #6291

See merge request OpenMW/openmw!1269
3 years ago
psi29a fc7e13d76a Merge branch 'omwaddon_dep' into 'master'
Allow creating omwaddons without a dependency on an omwgame

See merge request OpenMW/openmw!1243
3 years ago
Bret Curtis 8d37d79d6c
Merge pull request #3154 from bosvensson1/patch-29
improves RemoveRedundantNodesVisitor performance for large children vectors
3 years ago
Bo Svensson 08608da62c
optimizer.cpp 3 years ago
Evil Eye 5037def3b3 Parse local variables sharing a name with a function as variables 3 years ago
Bo Svensson 87d52dc1fd
fixes coverity-ci warning 3 years ago
Bo Svensson cd4d76f8c5
discard off-screen lights (#3120)
Currently, we run culling tests against all lights in the scene during LightListCallback::pushLightState. We can avoid most of these tests by removing off-screen lights at an earlier stage. We should benchmark the cumulative time spent within LightListCallback::pushLightState before and after this PR.
3 years ago
Bo Svensson 787f91211d resets state updater to apply light settings (#3141)
resets state updater to apply light settings

With this PR we achieve the same effect with fewer lines of code.
3 years ago
psi29a c3f5e8f968 Merge branch 'lua_transform' into 'master'
3D transforms in Lua

See merge request OpenMW/openmw!1235
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
fredzio 21dbe314bf Use common function for sync and async case. Now both cases follow the
same flow, synchronous simulation is just a special case.
3 years ago
Bo Svensson 4b1c009ffd
use StateSet define for translucentFramebuffer (#3138)
With this PR we test out osg's shader define system for a somewhat harmless feature. As we can see, our code becomes more concise and efficient in this case. Most importantly, we no longer create unneeded vertex shader objects.
3 years ago
Bo Svensson b2af81bc18
converts remaining osg::NodeCallback (#3147)
With this PR we convert remaining instantiations of the deprecated osg::NodeCallback in Open MW to SceneUtil::NodeCallback.
3 years ago
Bo Svensson 3f731cd102
attempts to fix spellcasting freezes (#3146)
Firstly, this PR reintroduces commit "Recreate a special case for IntersectionVisitor on QuadTreeWorld" we forgot to reapply while reverting a revert commit. Secondly, in cases we still need to build a view for an intersection visitor, we now use the available `osgUtil::IntersectionVisitor::getReferenceEyePoint` instead of falling back to the origin position that was previously causing long rebuild times.
3 years ago
Bo Svensson 14d15dcfac
cleans up osgacontroller.cpp (#3142)
`handle_stateset` is not needed because `UpdateMatrixTransform` is a `NodeCallback` only allowed to be set on a `Node`. `Geode` and `Drawable` do not need explicit logic because they are both derived from `Node`.
3 years ago
Bo Svensson aaf7b423d6
adds a replacement for osg::NodeCallback (#3144)
* nodecallback.hpp

* lightmanager.hpp

* lightmanager.cpp

* lightmanager.hpp

* nodecallback.hpp

* nodecallback.hpp

* [ci skip]

* lightmanager.hpp

* nodecallback.hpp

* nodecallback.hpp

* lightmanager.cpp

* lightmanager.cpp

* nodecallback.hpp

* [ci skip]

* [ci skip]

* controller.cpp

* [ci skip]

* osgacontroller.cpp

* keyframe.hpp

* controller.hpp

* keyframe.hpp

* [ci skip]

* keyframe.hpp

* animation.hpp

* [ci skip]

* weaponanimation.cpp

* nodecallback.hpp
3 years ago
psi29a 2c8c36fe5d Merge branch 'master' into 'effective_magic'
# Conflicts:
#   CHANGELOG.md
3 years ago
Bo Svensson 2568f119a4
reapplies PR without npe (#3137)
* avoids creating empty statesets on drawables

Currently, we attempt to skip creating state on drawable nodes when this state matches the default state. This attempt is incomplete because we still create an avoidable empty stateset in the default case.

* renderingmanager.cpp

* nifloader.cpp

* nifloader.cpp

* shadervisitor.cpp
3 years ago
Petr Mikheev 24ecdc37a7 Fix crash in LuaUtil::ScriptsContainer::~ScriptsContainer() 3 years ago
Evil Eye dc1fe62dde Overhaul magic effects to work with onApply and onEnd events 3 years ago
Andrei Kortunov e109d86489 Revert "avoids creating empty statesets on drawables (#3132)"
This reverts commit 957c25a491.
3 years ago
Bret Curtis b7c1d9edb0 remove unnecessary includes 3 years ago
Bo Svensson d8707a763f
fixes build (#3134)
* quadtreeworld.cpp

* renderingmanager.cpp [ci skip]

* quadtreeworld.hpp

* cellborder.hpp

* cellborder.cpp
3 years ago
Bret Curtis 803195a05f add back some explicit includes 3 years ago
Bo Svensson 8358418555
set the correct program link parameters (#3110)
* shadermanager.hpp setProgramTemplate

* shadermanager.hpp

* shadermanager.cpp setProgramTemplate

* shadervisitor.hpp setProgramTemplate

* shadervisitor.cpp setProgramTemplate

* scenemanager.cpp setProgramTemplate

* scenemanager.hpp setProgramTemplate

* renderingmanager.cpp

* groundcover.cpp setProgramTemplate

* groundcover.hpp

* groundcover.cpp

* shadervisitor.cpp

* util.cpp

* lightmanager.cpp

* scenemanager.cpp

* scenemanager.hpp

* lightmanager.cpp

* lightmanager.cpp

* lightmanager.cpp

* scenemanager.hpp [ci skip]

* water.cpp

* groundcover.cpp

* shadermanager.hpp
3 years ago