summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/TransformUnit.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-09-11 23:43:17 -0400
committerLioncash <mathew1800@gmail.com>2015-09-12 01:18:28 -0400
commitb9e360df7bcb8a1051d0f82d42cc6e9ae047d282 (patch)
treec0f7fb97777f693be94570b8f95400c983e2a250 /Source/Core/VideoBackends/Software/TransformUnit.cpp
parentc5685ba53a6866cce5c32bf0c3bbbd7aa52dbf6c (diff)
MathUtil: Convert Clamp into a constexpr function
Diffstat (limited to 'Source/Core/VideoBackends/Software/TransformUnit.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/TransformUnit.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/Source/Core/VideoBackends/Software/TransformUnit.cpp b/Source/Core/VideoBackends/Software/TransformUnit.cpp
index c72fd0f8f0..edfd3d8852 100644
--- a/Source/Core/VideoBackends/Software/TransformUnit.cpp
+++ b/Source/Core/VideoBackends/Software/TransformUnit.cpp
@@ -336,12 +336,9 @@ void TransformColor(const InputVertexData *src, OutputVertexData *dst)
LightColor(dst->mvPosition, dst->normal[0], i, colorchan, lightCol);
}
- int light_x = int(lightCol.x);
- int light_y = int(lightCol.y);
- int light_z = int(lightCol.z);
- MathUtil::Clamp(&light_x, 0, 255);
- MathUtil::Clamp(&light_y, 0, 255);
- MathUtil::Clamp(&light_z, 0, 255);
+ int light_x = MathUtil::Clamp(static_cast<int>(lightCol.x), 0, 255);
+ int light_y = MathUtil::Clamp(static_cast<int>(lightCol.y), 0, 255);
+ int light_z = MathUtil::Clamp(static_cast<int>(lightCol.z), 0, 255);
chancolor[1] = (matcolor[1] * (light_x + (light_x >> 7))) >> 8;
chancolor[2] = (matcolor[2] * (light_y + (light_y >> 7))) >> 8;
chancolor[3] = (matcolor[3] * (light_z + (light_z >> 7))) >> 8;
@@ -373,8 +370,7 @@ void TransformColor(const InputVertexData *src, OutputVertexData *dst)
LightAlpha(dst->mvPosition, dst->normal[0], i, alphachan, lightCol);
}
- int light_a = int(lightCol);
- MathUtil::Clamp(&light_a, 0, 255);
+ int light_a = MathUtil::Clamp(static_cast<int>(lightCol), 0, 255);
chancolor[0] = (matcolor[0] * (light_a + (light_a >> 7))) >> 8;
}
else