mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 08:29:56 +00:00
Remove M_PI, documenation cleanup
This commit is contained in:
parent
5deacb82ff
commit
9beb380c7d
5 changed files with 11 additions and 17 deletions
|
@ -4,10 +4,7 @@
|
||||||
|
|
||||||
#include <osgAnimation/Bone>
|
#include <osgAnimation/Bone>
|
||||||
|
|
||||||
#define _USE_MATH_DEFINES
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -25,17 +22,17 @@ namespace MWRender
|
||||||
|
|
||||||
float sineOut(float x)
|
float sineOut(float x)
|
||||||
{
|
{
|
||||||
return sin((x * M_PI) / 2);
|
return sin((x * osg::PIf) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float sineIn(float x)
|
float sineIn(float x)
|
||||||
{
|
{
|
||||||
return 1 - cos((x * M_PI) / 2);
|
return 1 - cos((x * osg::PIf) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float sineInOut(float x)
|
float sineInOut(float x)
|
||||||
{
|
{
|
||||||
return -(cos(M_PI * x) - 1) / 2;
|
return -(cos(osg::PIf * x) - 1) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
float cubicOut(float t)
|
float cubicOut(float t)
|
||||||
|
@ -90,7 +87,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
// Higher lambda = lower swing amplitude. 1 = 150% swing amplitude.
|
// Higher lambda = lower swing amplitude. 1 = 150% swing amplitude.
|
||||||
// w is the frequency of oscillation in the easing func, controls the amount of overswing
|
// w is the frequency of oscillation in the easing func, controls the amount of overswing
|
||||||
constexpr float w = 1.5f * M_PI; // 4.71238
|
const float w = 1.5f * osg::PIf; // 4.71238
|
||||||
return 1 - expf(-lambda * x) * cos(w * x);
|
return 1 - expf(-lambda * x) * cos(w * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ namespace SceneUtil
|
||||||
}
|
}
|
||||||
return std::make_pair(group, key);
|
return std::make_pair(group, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using BlendRule = AnimBlendRules::BlendRule;
|
using BlendRule = AnimBlendRules::BlendRule;
|
||||||
|
@ -168,5 +167,4 @@ namespace SceneUtil
|
||||||
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,9 @@ In examples below ``.yaml`` config file will be used. You can provide ``.json``
|
||||||
|
|
||||||
Animation blending config file is a list of blending rules that look like this:
|
Animation blending config file is a list of blending rules that look like this:
|
||||||
|
|
||||||
```
|
::
|
||||||
blending_rules:
|
|
||||||
|
blending_rules:
|
||||||
- from: "*"
|
- from: "*"
|
||||||
to: "*"
|
to: "*"
|
||||||
easing: "sineOut"
|
easing: "sineOut"
|
||||||
|
@ -30,9 +31,8 @@ blending_rules:
|
||||||
to: "idlesneak*"
|
to: "idlesneak*"
|
||||||
easing: "springOutWeak"
|
easing: "springOutWeak"
|
||||||
duration: 0.4
|
duration: 0.4
|
||||||
```
|
|
||||||
|
|
||||||
See ``OpenMW\files\data\animations\animation-config.yaml`` for an example of such a file.
|
See `files/data/animations/animation-config.yaml <https://gitlab.com/OpenMW/openmw/-/tree/master/files/data/animations/animation-config.yaml>`__ for an example of such a file.
|
||||||
|
|
||||||
Every blending rule should include a set of following fields:
|
Every blending rule should include a set of following fields:
|
||||||
|
|
||||||
|
@ -85,6 +85,6 @@ List of possible easings
|
||||||
|
|
||||||
Its hard to give an example of use cases for the latter 2 types of easing functions, they are there for developers to experiment.
|
Its hard to give an example of use cases for the latter 2 types of easing functions, they are there for developers to experiment.
|
||||||
|
|
||||||
The possible easings are largely ported from `here <https://easings.net/>`__ and have similar names. Except for the ``springOut`` family, those are similar to ``elasticOut`` from `easings.net <https://easings.net/>`__, with ``springOutWeak`` being almost identical to ``elasticOut``.
|
The possible easings are largely ported from `easings.net <https://easings.net/>`__ and have similar names. Except for the ``springOut`` family, those are similar to ``elasticOut``, with ``springOutWeak`` being almost identical to ``elasticOut``.
|
||||||
|
|
||||||
Don't be afraid to experiment with different timing and easing functions!
|
Don't be afraid to experiment with different timing and easing functions!
|
|
@ -543,7 +543,7 @@ Enabling this option disables this swaying by having the player character move i
|
||||||
This setting can be controlled in the Settings tab of the launcher.
|
This setting can be controlled in the Settings tab of the launcher.
|
||||||
|
|
||||||
smooth animation transitions
|
smooth animation transitions
|
||||||
---------------------------------
|
----------------------------
|
||||||
|
|
||||||
:Type: boolean
|
:Type: boolean
|
||||||
:Range: True/False
|
:Range: True/False
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# This is the default OpenMW animation blending config file (global config) , will affect NPCs and creatures but not animated objects.
|
# This is the default OpenMW animation blending config file (global config) , will affect NPCs and creatures but not animated objects.
|
||||||
# If you want to provide an animation blending config for your modded animations - DO NOT override the global config in your mod.
|
# If you want to provide an animation blending config for your modded animations - DO NOT override the global config in your mod.
|
||||||
# For details on how to edit and create your own blending rules, see https://openmw.readthedocs.io/en/latest/reference/modding/animation-blending.html
|
# For details on how to edit and create your own blending rules, see https://openmw.readthedocs.io/en/latest/reference/modding/animation-blending.html
|
||||||
# Author: Maksim Eremenko (Max Yari)
|
|
||||||
|
|
||||||
blending_rules:
|
blending_rules:
|
||||||
# General blending rule, any transition that will not be caught by the rules below - will use this rule
|
# General blending rule, any transition that will not be caught by the rules below - will use this rule
|
||||||
|
|
Loading…
Reference in a new issue