mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 14:36:13 +01:00
- [Curve, HSV Curve] Fix result error.
This commit is contained in:
parent
8cf705435e
commit
bfca246db2
2 changed files with 20 additions and 8 deletions
|
@ -74,11 +74,17 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
|
|||
}
|
||||
|
||||
float curveEval(in float[64] curve, in int amo, in float _x) {
|
||||
_x = clamp(_x, 0., 1.);
|
||||
int segments = amo / 6 - 1;
|
||||
|
||||
for( int i = 0; i < segments; i++ ) {
|
||||
int ind = i * 6;
|
||||
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
|
||||
int _segs = (amo - _shf) / 6 - 1;
|
||||
float _shift = _shf > 0? curve[0] : 0.;
|
||||
float _scale = _shf > 1? curve[1] : 1.;
|
||||
|
||||
_x = _x / _scale - _shift;
|
||||
_x = clamp(_x, 0., 1.);
|
||||
|
||||
for( int i = 0; i < _segs; i++ ) {
|
||||
int ind = _shf + i * 6;
|
||||
float _x0 = curve[ind + 2];
|
||||
float _y0 = curve[ind + 3];
|
||||
//float bx0 = _x0 + curve[ind + 0];
|
||||
|
|
|
@ -65,11 +65,17 @@ float eval_curve_segment_x(in float _y0, in float ax0, in float ay0, in float bx
|
|||
}
|
||||
|
||||
float curveEval(in float[64] curve, in int amo, in float _x) {
|
||||
_x = clamp(_x, 0., 1.);
|
||||
int segments = amo / 6 - 1;
|
||||
|
||||
for( int i = 0; i < segments; i++ ) {
|
||||
int ind = i * 6;
|
||||
int _shf = amo - int(floor(float(amo) / 6.) * 6.);
|
||||
int _segs = (amo - _shf) / 6 - 1;
|
||||
float _shift = _shf > 0? curve[0] : 0.;
|
||||
float _scale = _shf > 1? curve[1] : 1.;
|
||||
|
||||
_x = _x / _scale - _shift;
|
||||
_x = clamp(_x, 0., 1.);
|
||||
|
||||
for( int i = 0; i < _segs; i++ ) {
|
||||
int ind = _shf + i * 6;
|
||||
float _x0 = curve[ind + 2];
|
||||
float _y0 = curve[ind + 3];
|
||||
//float bx0 = _x0 + curve[ind + 0];
|
||||
|
|
Loading…
Reference in a new issue