16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

Replace clamp with std::clamp

This commit is contained in:
docentYT
2026-05-01 22:14:29 +02:00
parent 1bdd000443
commit d1f16411a1
36 changed files with 271 additions and 287 deletions

View File

@@ -1508,7 +1508,7 @@ texture_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad ) {
// intercept potential error, index specified using .t3d format convention
m_skinindex *= -1;
}
m_skinindex = clamp( m_skinindex, 1, 4 ); // TODO: define-based upper bound in case of future extension
m_skinindex = std::clamp( m_skinindex, 1, 4 ); // TODO: define-based upper bound in case of future extension
Input.getTokens(); // preload next token
}

View File

@@ -273,7 +273,7 @@ TSegment::find_nearest_point( glm::dvec3 const &Point ) const {
for( int segmentidx = 0; segmentidx < iSegCount; ++segmentidx ) {
auto const segmentpoint =
clamp(
std::clamp(
nearest_segment_point(
glm::dvec3{ FastGetPoint( fTsBuffer[ segmentidx ] ) },
glm::dvec3{ FastGetPoint( fTsBuffer[ segmentidx + 1 ] ) },
@@ -331,7 +331,7 @@ Math3D::vector3 TSegment::GetPoint(double const fDistance) const
return
interpolate(
Point1, Point2,
clamp(
std::clamp(
fDistance / fLength,
0.0, 1.0 ) );
}

View File

@@ -569,7 +569,7 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
if( fRadius != 0 ) {
// gdy podany promień
segsize =
clamp(
std::clamp(
std::abs( fRadius ) * ( 0.02 / Global.SplineFidelity ),
2.0 / Global.SplineFidelity,
10.0 / Global.SplineFidelity );
@@ -583,7 +583,7 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
else {
// HACK: divide roughly in 10 segments.
segsize =
clamp(
std::clamp(
glm::length( p1 - p2 ) * 0.1,
2.0 / Global.SplineFidelity,
10.0 / Global.SplineFidelity );
@@ -667,7 +667,7 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
if( fRadiusTable[ 0 ] != 0 ) {
// gdy podany promień
segsize =
clamp(
std::clamp(
std::abs( fRadiusTable[ 0 ] ) * ( 0.02 / Global.SplineFidelity ),
2.0 / Global.SplineFidelity,
10.0 / Global.SplineFidelity );
@@ -681,7 +681,7 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
else {
// HACK: divide roughly in 10 segments.
segsize =
clamp(
std::clamp(
glm::length( p1 - p2 ) * 0.1,
2.0 / Global.SplineFidelity,
10.0 / Global.SplineFidelity );
@@ -732,7 +732,7 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
if( fRadiusTable[ 1 ] != 0 ) {
// gdy podany promień
segsize =
clamp(
std::clamp(
std::abs( fRadiusTable[ 1 ] ) * ( 0.02 / Global.SplineFidelity ),
2.0 / Global.SplineFidelity,
10.0 / Global.SplineFidelity );
@@ -746,7 +746,7 @@ void TTrack::Load(cParser *parser, glm::dvec3 const &pOrigin)
else {
// HACK: divide roughly in 10 segments.
segsize =
clamp(
std::clamp(
glm::length( p3 - p4 ) * 0.1,
2.0 / Global.SplineFidelity,
10.0 / Global.SplineFidelity );
@@ -2531,7 +2531,7 @@ float TTrack::Friction() const {
return fFriction;
}
else {
return clamp( fFriction * m_friction.second->Value1() + m_friction.second->Value2(), 0.0, 1.0 );
return std::clamp( fFriction * m_friction.second->Value1() + m_friction.second->Value2(), 0.0, 1.0 );
}
}