mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 22:41:25 +12:00
Round squircled axis values to nearest whole number
This commit is contained in:
parent
44b3709d1d
commit
6a9e0c52c3
1 changed files with 2 additions and 2 deletions
|
@ -255,8 +255,8 @@ std::tuple<u16, u16> PadHandlerBase::ConvertToSquirclePoint(u16 inX, u16 inY, in
|
||||||
const f32 newLen = (1 + std::pow(std::sin(2 * angle), 2.f) / (squircle_factor / 1000.f)) * r;
|
const f32 newLen = (1 + std::pow(std::sin(2 * angle), 2.f) / (squircle_factor / 1000.f)) * r;
|
||||||
|
|
||||||
// we now have len and angle, convert to cartesian
|
// we now have len and angle, convert to cartesian
|
||||||
const int newX = Clamp0To255(((newLen * std::cos(angle)) + 1) * 127.5f);
|
const int newX = Clamp0To255(std::round(((newLen * std::cos(angle)) + 1) * 127.5f));
|
||||||
const int newY = Clamp0To255(((newLen * std::sin(angle)) + 1) * 127.5f);
|
const int newY = Clamp0To255(std::round(((newLen * std::sin(angle)) + 1) * 127.5f));
|
||||||
return std::tuple<u16, u16>(newX, newY);
|
return std::tuple<u16, u16>(newX, newY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue