1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 19:29:56 +00:00
Commit graph

5379 commits

Author SHA1 Message Date
psi29a
b3f84df43c Merge branch 'sky_shaders' into 'master'
Sky shaders

See merge request OpenMW/openmw!1057
2021-10-27 20:25:40 +00:00
psi29a
3006c496fc Merge branch 'morrowland_scripting' into 'master'
Morrowland scripting

Closes #6363

See merge request OpenMW/openmw!1318
2021-10-26 10:07:45 +00:00
psi29a
2765bcee5e Merge branch 'serialization' into 'master'
Add helpers for binary serialization

See merge request OpenMW/openmw!1319
2021-10-26 08:25:17 +00:00
glassmancody.info
07e32c0fa6 remove object shader path 2021-10-25 10:23:16 -07:00
Bret Curtis
3d0da9b9b2
Merge pull request #3191 from akortunov/warnfix
Fix some MSVC warnings
2021-10-25 15:17:05 +02:00
Bret Curtis
ac02753da7
Merge pull request #3190 from akortunov/master
Fix showscenegraph warnings
2021-10-25 12:59:36 +02:00
Bo Svensson
1ff8318a52
refactors premultiplied alpha (#3189)
With this PR we refactor a `premultiplied alpha` user string set by `characterpreview.cpp` into a more flexible mechanism allowing us to assign any state to GUI textures. We can consider these changes more future proof than the previous approach.
2021-10-25 09:28:32 +02:00
Bo Svensson
7f9beac3a7
refactors a case insensitive map (#3184)
This PR aims to spark the retirement of a questionable pattern I have found all over our code base. I will illustrate how this pattern encourages code duplication, lacks type safety, requires documentation and can be prone to bugs.
```
std::map<std::string, Object> mMap; // Stored in all lowercase for a case-insensitive lookup

std::string lowerKey = Misc::StringUtils::lowerCase(key);
mMap.emplace(lowerKey, object);

std::string lowerKey = Misc::StringUtils::lowerCase(key);
mMap.find(lowerKey);

mMap.find(key); // Not found. Oops!
```
An alternative approach produces no such issues.
```
std::unordered_map<std::string, Object, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual> mMap;

mMap.emplace(key, object);

mMap.find(key);
```
Of course, such an alternative will work for a `map` as well, but an `unordered_map` is generally preferable over a `map` with these changes because we have moved `lowerCase` into the comparison operator. 

In this PR I have refactored `Animation::mNodeMap` accordingly. I have reviewed and adapted all direct and indirect usage of `Animation::mNodeMap` to ensure we do not change behaviour with this PR.
2021-10-25 09:18:26 +02:00
Evil Eye
fef902617a Parse integer format arguments as variable names 2021-10-24 17:23:15 +02:00
Andrei Kortunov
0f3c0cb0a0 Fix argument types mismatch 2021-10-24 18:45:46 +04:00
Andrei Kortunov
107a9ecb17 Fix variables hiding 2021-10-24 18:45:04 +04:00
elsid
a58f1a94e3
Add helpers for binary serialization
To construct serializer from given entities:
* Data source/destination - any value that has to be serialized/deserialized,
  usually already existing type.
* Format - functional object to define high level serialization logic to
  define specific format and data schema. Like order of fields, allocation.
* Visitor - functional object to define low level serialization logic to
  operator on given data part.
  * BinaryWriter - copies given value into provided buffer.
  * BinaryReader - copies value into given destination from provided buffer.
  * SizeAccumulator - calculates required buffer size for given data.
2021-10-24 14:20:44 +02:00
Andrei Kortunov
566380c0d6 Fix showscenegraph warnings 2021-10-24 12:37:49 +04:00
glassmancody.info
1e40d27318 introduce sky shaders 2021-10-23 17:53:38 -07:00
Bo Svensson
41318a585f
fixes enable and disable commands (#3186)
This PR fixes a recent regression concerning enable and disable commands with object paging. In addition, we add a necessary comment to avoid such issues in the future.
2021-10-23 12:40:26 +02:00
Evil Eye
31aa19574b Make PositionCell take additional junk arguments 2021-10-23 11:47:42 +02:00
Evil Eye
dfb6bdf77e Allow integer variable names 2021-10-23 11:47:35 +02:00
Bo Svensson
c9c8d02332
fixes a crash (#3183)
This PR fixes a crash caused by the improperly ensured lifetime of RigGeometry::mSourceGeometry. mSourceGeometry was not adequate to ensure mSourceGeometry would outlive mGeometry because we extend mGeometrys lifetime beyond this lifetime by passing mGeometry to the draw traversal instead of this.
In addition,

We add important comments.
We detect and prevent generally unsafe operations in high level code.
We add a sprinkling of const to help clarify intentions.
2021-10-23 10:31:46 +02:00
Fanael Linithien
07d505563e Remove non-existent file from CMakeLists 2021-10-23 01:38:32 +02:00
psi29a
1ffa02b2fd Merge branch 'fix_windows_tests' into 'master'
Fix tests on windows

See merge request OpenMW/openmw!1313
2021-10-22 12:35:10 +00:00
psi29a
ed811176bc Merge branch 'fix_esm_loader' into 'master'
Fix logic expression for not found value in EsmLoader::getModel

See merge request OpenMW/openmw!1308
2021-10-22 12:33:39 +00:00
elsid
b5f0057ac9
Fix tests on windows 2021-10-21 19:48:31 +02:00
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`.
2021-10-20 23:02:15 +02:00
elsid
a3b6bc7263
Fix logic expression for not found value 2021-10-20 17:48:10 +02:00
elsid
06ea47f74b
Fix crash in DetourNavigator::fixupCorridor
Handle situation when resulting path does not fit into destination vector.
2021-10-19 22:54:46 +02:00
elsid
e5413c0664
Add functions to compress/decompress vector of bytes 2021-10-18 20:46:22 +02:00
elsid
bb26ba30b6
Add progress reporter type
To log/report progress of long duration operations using given time period.
2021-10-18 01:26:10 +02:00
psi29a
d8d16a52e1 Merge branch 'esm_loader' into 'master'
Add ESM data loader

See merge request OpenMW/openmw!1301
2021-10-17 19:21:32 +00:00
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.
2021-10-17 19:55:29 +02:00
elsid
18d3102148
Do not use union to access FIXED_STRING<4> as int
https://en.cppreference.com/w/cpp/language/union:
> It's undefined behavior to read from the member of the union that wasn't most recently written.
2021-10-17 17:16:21 +02:00
psi29a
62dfbb33d9 Merge branch 'fix_find_path_crash' into 'master'
Fix crash in finding path over navmesh (#6338)

Closes #6338

See merge request OpenMW/openmw!1296
2021-10-17 12:15:14 +00:00
Bo Svensson
01605433cb
quadtreeworld.cpp (#3174)
Currently, we disable a paging root node that we only need in exterior cells by setting its node mask to 0 when transitioning into an interior cell. Node masks are not ideal for this usage case because Node::getBound is unaware of masks. With this PR we just detach the unused node from the scene graph. _shadowedScene->getBound() in the MWShadowTechnique should return a much better value in interior cells with these changes.
2021-10-16 21:48:13 +02:00
elsid
c88367b6a6
Add sqlite3 helpers 2021-10-16 17:43:08 +02:00
elsid
f6d1689bb9
Avoid redundant polygon path reallocations
Use separate variable to store size and make all operations in-place.
2021-10-14 23:48:14 +02:00
elsid
79665cea66
Avoid access to the path vector element out of range
polygonPath.front() in some cases might reference to a first element of empty
vector. Copy the value into a local variable to be able to access later.
2021-10-14 23:46:50 +02:00
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.
2021-10-14 14:46:44 +02:00
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.
2021-10-13 13:55:16 -05:00
Evil Eye
ec6451e93a Merge branch 'recordtype' into 'master'
Avoid copying std::string in MWWorld::Ptr::getTypeDescription()

See merge request OpenMW/openmw!1290
2021-10-13 17:04:32 +00:00
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.
2021-10-13 16:12:47 +02:00
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.
2021-10-12 13:47:42 +02:00
psi29a
67fa8413f3 Merge branch 'physics_heightfield' into 'master'
Replace float type for arguments to create heightfield with int

See merge request OpenMW/openmw!1285
2021-10-12 07:58:34 +00:00
psi29a
207a7245bc Merge branch 'navigator_settings' into 'master'
Initialize navigator max climb and max slope settings in makeSettingsFromSettingsManager

See merge request OpenMW/openmw!1283
2021-10-12 07:02:08 +00:00
Petr Mikheev
a8acc19988 Avoid copying std::string in MWWorld::Ptr::getTypeDescription() 2021-10-12 00:18:23 +02:00
elsid
405e814190
Move btCollisionObject creation for MWPhysics::Object into components 2021-10-11 23:14:02 +02:00
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.
2021-10-11 19:28:08 +02:00
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.
2021-10-11 18:50:26 +02:00
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.
2021-10-11 15:11:59 +02:00
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.
2021-10-11 11:27:50 +02:00
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
2021-10-11 08:56:04 +00:00
psi29a
f014edd27c Merge branch 'fix_write_recast_mesh' into 'master'
Fix writing to file for RecastMesh

See merge request OpenMW/openmw!1278
2021-10-11 08:20:33 +00:00