summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Tony Wasserka2014-08-23 13:48:00 +0200
committerGravatar Tony Wasserka2014-08-25 22:03:19 +0200
commitb5b3aeb57699e531bdc0b8be156aa6476ea4f15d (patch)
tree6ecd43d29ede0d3c22679e695a23b2cb33b44ac0 /src
parentGPU: Fix a compiler warning about redundant semicolons. (diff)
downloadyuzu-b5b3aeb57699e531bdc0b8be156aa6476ea4f15d.tar.gz
yuzu-b5b3aeb57699e531bdc0b8be156aa6476ea4f15d.tar.xz
yuzu-b5b3aeb57699e531bdc0b8be156aa6476ea4f15d.zip
Math: Warning fixes.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/math.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/video_core/math.h b/src/video_core/math.h
index ca1fb0df2..83ba81235 100644
--- a/src/video_core/math.h
+++ b/src/video_core/math.h
@@ -50,9 +50,8 @@ static inline Vec4<T> MakeVec(const T& x, const T& y, const T& z, const T& w);
50template<typename T> 50template<typename T>
51class Vec2 { 51class Vec2 {
52public: 52public:
53 struct { 53 T x;
54 T x,y; 54 T y;
55 };
56 55
57 T* AsArray() { return &x; } 56 T* AsArray() { return &x; }
58 57
@@ -176,10 +175,9 @@ template<typename T>
176class Vec3 175class Vec3
177{ 176{
178public: 177public:
179 struct 178 T x;
180 { 179 T y;
181 T x,y,z; 180 T z;
182 };
183 181
184 T* AsArray() { return &x; } 182 T* AsArray() { return &x; }
185 183
@@ -315,7 +313,7 @@ public:
315 _DEFINE_SWIZZLER2(b, a, b##a); \ 313 _DEFINE_SWIZZLER2(b, a, b##a); \
316 _DEFINE_SWIZZLER2(b, a, b2##a2); \ 314 _DEFINE_SWIZZLER2(b, a, b2##a2); \
317 _DEFINE_SWIZZLER2(b, a, b3##a3); \ 315 _DEFINE_SWIZZLER2(b, a, b3##a3); \
318 _DEFINE_SWIZZLER2(b, a, b4##a4); 316 _DEFINE_SWIZZLER2(b, a, b4##a4)
319 317
320 DEFINE_SWIZZLER2(x, y, r, g, u, v, s, t); 318 DEFINE_SWIZZLER2(x, y, r, g, u, v, s, t);
321 DEFINE_SWIZZLER2(x, z, r, b, u, w, s, q); 319 DEFINE_SWIZZLER2(x, z, r, b, u, w, s, q);
@@ -330,16 +328,27 @@ Vec3<T> operator * (const V& f, const Vec3<T>& vec)
330 return Vec3<T>(f*vec.x,f*vec.y,f*vec.z); 328 return Vec3<T>(f*vec.x,f*vec.y,f*vec.z);
331} 329}
332 330
331template<>
332inline float Vec3<float>::Length() const {
333 return std::sqrt(x * x + y * y + z * z);
334}
335
336template<>
337inline Vec3<float> Vec3<float>::Normalized() const {
338 return *this / Length();
339}
340
341
333typedef Vec3<float> Vec3f; 342typedef Vec3<float> Vec3f;
334 343
335template<typename T> 344template<typename T>
336class Vec4 345class Vec4
337{ 346{
338public: 347public:
339 struct 348 T x;
340 { 349 T y;
341 T x,y,z,w; 350 T z;
342 }; 351 T w;
343 352
344 T* AsArray() { return &x; } 353 T* AsArray() { return &x; }
345 354
@@ -456,7 +465,7 @@ public:
456 _DEFINE_SWIZZLER2(a, b, a##b); \ 465 _DEFINE_SWIZZLER2(a, b, a##b); \
457 _DEFINE_SWIZZLER2(a, b, a2##b2); \ 466 _DEFINE_SWIZZLER2(a, b, a2##b2); \
458 _DEFINE_SWIZZLER2(b, a, b##a); \ 467 _DEFINE_SWIZZLER2(b, a, b##a); \
459 _DEFINE_SWIZZLER2(b, a, b2##a2); 468 _DEFINE_SWIZZLER2(b, a, b2##a2)
460 469
461 DEFINE_SWIZZLER2(x, y, r, g); 470 DEFINE_SWIZZLER2(x, y, r, g);
462 DEFINE_SWIZZLER2(x, z, r, b); 471 DEFINE_SWIZZLER2(x, z, r, b);
@@ -480,7 +489,7 @@ public:
480 _DEFINE_SWIZZLER3(b, a, c, b2##a2##c2); \ 489 _DEFINE_SWIZZLER3(b, a, c, b2##a2##c2); \
481 _DEFINE_SWIZZLER3(b, c, a, b2##c2##a2); \ 490 _DEFINE_SWIZZLER3(b, c, a, b2##c2##a2); \
482 _DEFINE_SWIZZLER3(c, a, b, c2##a2##b2); \ 491 _DEFINE_SWIZZLER3(c, a, b, c2##a2##b2); \
483 _DEFINE_SWIZZLER3(c, b, a, c2##b2##a2); 492 _DEFINE_SWIZZLER3(c, b, a, c2##b2##a2)
484 493
485 DEFINE_SWIZZLER3(x, y, z, r, g, b); 494 DEFINE_SWIZZLER3(x, y, z, r, g, b);
486 DEFINE_SWIZZLER3(x, y, w, r, g, a); 495 DEFINE_SWIZZLER3(x, y, w, r, g, a);