[DEV] add a basic limiter in int fo std vector2D

This commit is contained in:
Edouard DUPIN 2013-04-09 22:45:18 +02:00
parent 64812713c7
commit f9951e9f55
2 changed files with 19 additions and 1 deletions

View File

@ -372,7 +372,6 @@ namespace etk
etk::CCout& operator <<(etk::CCout &os, const etk::Vector2D<bool> obj);
};
// To siplify the writing of the code ==> this permit to have the same name with the glsl language...
typedef etk::Vector2D<float> vec2;
typedef etk::Vector2D<int32_t> ivec2;
@ -380,4 +379,14 @@ typedef etk::Vector2D<int32_t> ivec2;
typedef etk::Vector2D<uint32_t> uivec2;
typedef etk::Vector2D<bool> bvec2;
inline vec2 vec2ClipInt32(const vec2& val)
{
return vec2((int32_t)val.x(), (int32_t)val.y());
}
inline vec2 vec2ClipInt64(const vec2& val)
{
return vec2((int64_t)val.x(), (int64_t)val.y());
}
#endif

View File

@ -461,6 +461,15 @@ typedef etk::Vector3D<bool> bvec3;
vec3 quaternionToEulerXYZ(const btQuaternion& quat);
inline vec3 vec3ClipInt32(const vec3& val)
{
return vec3((int32_t)val.x(), (int32_t)val.y(), (int32_t)val.z());
}
inline vec3 vec3ClipInt64(const vec3& val)
{
return vec3((int64_t)val.x(), (int64_t)val.y(), (int64_t)val.z());
}
#endif