Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Animation
CGradientBandInterpolation.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2024 Skylicht Technology CO., LTD
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
// Reference:
26
// https://github.com/runevision/LocomotionSystem/blob/master/Assets/Locomotion%20System%20Files/Locomotion%20System/PolarGradientBandInterpolator.cs
27
// https://www.shadertoy.com/view/XlKXWR
28
29
30
#pragma once
31
32
namespace
Skylicht
33
{
58
class
SKYLICHT_API CGradientBandInterpolation
59
{
60
public
:
64
struct
SSample
65
{
67
int
Id
;
68
70
core::vector3df
Vector
;
71
73
float
Weight
;
74
75
SSample()
76
{
77
Id
= 0;
78
Weight
= 0.0f;
79
}
80
};
81
82
protected
:
84
core::array<SSample*>
m_samples
;
85
86
public
:
87
CGradientBandInterpolation();
88
89
virtual
~CGradientBandInterpolation();
90
95
inline
core::array<SSample*>&
getSamples
()
96
{
97
return
m_samples
;
98
}
99
106
SSample
*
addSample
(
int
id
,
const
core::vector3df& vector);
107
112
void
removeSample
(
SSample
* sample);
113
117
void
clear
();
118
125
void
sampleWeightsPolar
(
const
core::vector3df& vector);
126
133
void
sampleWeightsCartesian
(
const
core::vector3df& vector);
134
};
135
}
Skylicht::CGradientBandInterpolation::removeSample
void removeSample(SSample *sample)
Removes a specific animation sample.
Skylicht::CGradientBandInterpolation::sampleWeightsPolar
void sampleWeightsPolar(const core::vector3df &vector)
Calculates blending weights using polar gradient band interpolation.
Skylicht::CGradientBandInterpolation::getSamples
core::array< SSample * > & getSamples()
Gets the list of animation samples.
Definition
CGradientBandInterpolation.h:95
Skylicht::CGradientBandInterpolation::sampleWeightsCartesian
void sampleWeightsCartesian(const core::vector3df &vector)
Calculates blending weights using Cartesian gradient band interpolation.
Skylicht::CGradientBandInterpolation::addSample
SSample * addSample(int id, const core::vector3df &vector)
Adds a new animation sample point.
Skylicht::CGradientBandInterpolation::clear
void clear()
Removes all animation samples.
Skylicht::CGradientBandInterpolation::m_samples
core::array< SSample * > m_samples
List of all animation samples.
Definition
CGradientBandInterpolation.h:84
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
Skylicht::CGradientBandInterpolation::SSample
Represents an animation sample point with its associated weight.
Definition
CGradientBandInterpolation.h:65
Skylicht::CGradientBandInterpolation::SSample::Vector
core::vector3df Vector
Position vector in parameter space.
Definition
CGradientBandInterpolation.h:70
Skylicht::CGradientBandInterpolation::SSample::Id
int Id
User-defined ID for the animation sample.
Definition
CGradientBandInterpolation.h:67
Skylicht::CGradientBandInterpolation::SSample::Weight
float Weight
Calculated blending weight (0 to 1).
Definition
CGradientBandInterpolation.h:73
Generated by
1.17.0