예제 #1
0
static inline uint packUnorm2x16(const float2& v)
{
	uint x = (uint)round(clamp(v.getX(), 0, 1) * 65535.0f);
	uint y = (uint)round(clamp(v.getY(), 0, 1) * 65535.0f);
	return ((uint)0x0000FFFF & x) | ((y << 16) & (uint)0xFFFF0000);
}
예제 #2
0
static inline float2 sumPerElem(const float2 &v, const float2& w)
{
	return float2(v.getX() + w.getX(), v.getY() + w.getY());
}
예제 #3
0
static inline float2 mulPerElem(const float2 &v, float f)
{
	return float2(v.getX()*f, v.getY()*f);
}
예제 #4
0
static inline float2 step(const float2& y, const float2& x)
{
	return float2(x.getX() >= y.getX() ? 1.f : 0.f,
		x.getY() >= y.getY() ? 1.f : 0.f);
}
예제 #5
0
static inline float2 subtract(const float2& v, const float2& w)
{
	return float2(v.getX() - w.getX(), v.getY() - w.getY());
}
예제 #6
0
static inline float2 abs(const float2& v)
{
	return float2(fabsf(v.getX()), fabsf(v.getY()));
}