X-Git-Url: https://git.rohieb.name/MicroTrace.git/blobdiff_plain/0e3446ceb6fd6db0cb292671f37b46daaa2aed5b..dfcd78f3f458d8c4bfbc27b08ced5aae0f2e57d4:/Vec3f.cxx diff --git a/Vec3f.cxx b/Vec3f.cxx index f656d29..7c39435 100644 --- a/Vec3f.cxx +++ b/Vec3f.cxx @@ -211,3 +211,15 @@ Vec3f::operator[](unsigned int i) assert(i < 3); return m_values[i]; } + +void +Vec3f::clamp() +{ + for(unsigned int i = 0; i < 3; ++i) + { + if(m_values[i] < 0.0) + m_values[i] = 0.0; + if(m_values[i] > 1.0) + m_values[i] = 1.0; + } +}