Commit Graph

27 Commits (master)

Author SHA1 Message Date
Sam Hellawell 2288a691d2 Replace osgAnimation bone underscore naming at load time, map bone instances, reset root bone transform each frame 9 months ago
Sam Hellawell 7897ff7ac9 Fix weapon sheathing for non-nif meshes 9 months ago
clang-format-bot ddb0522bbf
Apply clang-format to code base 2 years ago
elsid 5dc612aa54
Replace ciCompareLen with ciStartsWith where possible
`ciCompareLen(a, b, b.size()) == 0` expression is an equivalent of checking for
equality of `a` prefix with size `b.size()` with `b`.

`ciCompareLen(a, b, a.size()) == 0` is also the same thing but `a` is a prefix
`b` should start with.
2 years ago
unknown 827a2f0b77 Use string_view in animation code 2 years ago
elsid f99ed6f1db
Split components/misc/stringops.hpp into multiple headers
Replace all ciEqual overloads with one having std::string_view as argument.
2 years ago
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.
3 years ago
psi29a ac3fda0b3d Merge branch 'string_view' into 'master'
Pass std::string_view instead of const std::string&

See merge request OpenMW/openmw!1209
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
Bo Svensson d36c373cc7
visitor.cpp early out 3 years ago
Alexei Dobrohotov 1fc7cb8191 Don't use FreezeOnCull for any particle system (#4744) 3 years ago
jvoisin 895864099c Simplify NodeMapVisitor::apply
No need to run a find() before a std::replace
4 years ago
Nelsson Huotari 1221889cf7 Limit conversion of underscores to nodes origating from osgAnimation library 4 years ago
Nelsson Huotari 5b88d16a50 Clean-up 4 years ago
Nelsson Huotari 7d3f2bc113 Convert underscores in bone names to whitespaces 4 years ago
Andrei Kortunov 065ed5138e Use emplace_back instead of push_back 4 years ago
bzzt a567111400 Use emplace instead of find-assign 6 years ago
Andrei Kortunov e06f0b797a Replace all NULLs to nullptr 6 years ago
Kyle Cooley 6bece13a32 Use new Log class for error message 6 years ago
Kyle Cooley e2ac392a40 Move common stuff to scene util, fix errors with 1st person meshes 6 years ago
Kyle Cooley 8444ee9981 Start rendering npc's 6 years ago
Miloslav Číž 380a5799dd use bbox as wrap range & apply to all particle systems 7 years ago
Miloslav Číž 33a1459b11 search for particle system by class name 7 years ago
scrawl 33e654f94d Add explicit handling of most commonly used nodes to NodeVisitors to avoid excessive virtual function calls 8 years ago
scrawl f898bf493f Don't use Geodes 9 years ago
scrawl f1ac408f35 Place Drawables directly in the scene graph when built with OSG 3.4
OSG 3.4 adds the ability to place Drawables directly in the scene graph, without a Geode decorating them. Leveraging this should give a small performance boost, because the redundant Geodes increase culling overhead.

There is still an oustanding issue with the RemoveDrawableVisitor no longer working correctly, because Drawables can have multiple parents.
9 years ago
scrawl fd1ccd21ff Disable freezeOnCull for weather particles 9 years ago