From 9554373756969d7a93cdf41700e5a45eddae2662 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 20 Jan 2011 00:03:28 +0000 Subject: [PATCH] Remove unused file. --- src/array.h | 132 ---------------------------------------------------- 1 file changed, 132 deletions(-) delete mode 100644 src/array.h diff --git a/src/array.h b/src/array.h deleted file mode 100644 index 8e4ffac3..00000000 --- a/src/array.h +++ /dev/null @@ -1,132 +0,0 @@ -// -// Lol Engine -// -// Copyright: (c) 2010-2011 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://sam.zoy.org/projects/COPYING.WTFPL for more details. -// - -// -// The Matrix classes -// ------------------ -// - -#if !defined __DH_MATRIX_H__ -#define __DH_MATRIX_H__ - -#include - -#define VECTOR_OP(elems, op) \ - template \ - inline Vec##elems operator op(Vec##elems const &val) const \ - { \ - Vec##elems ret; \ - for (int n = 0; n < elems; n++) \ - ret[n] = (*this)[n] op val[n]; \ - return ret; \ - } - -#define SCALAR_OP(elems, op) \ - inline Vec##elems operator op(T const &val) const \ - { \ - Vec##elems ret; \ - for (int n = 0; n < elems; n++) \ - ret[n] = (*this)[n] op val; \ - return ret; \ - } - -#define OPERATORS(elems) \ - inline T& operator[](int n) { return *(&x + n); } \ - inline T const& operator[](int n) const { return *(&x + n); } \ - \ - VECTOR_OP(elems, -) \ - VECTOR_OP(elems, +) \ - VECTOR_OP(elems, *) \ - VECTOR_OP(elems, /) \ - \ - SCALAR_OP(elems, -) \ - SCALAR_OP(elems, +) \ - SCALAR_OP(elems, *) \ - SCALAR_OP(elems, /) \ - \ - template \ - inline operator Vec##elems() const \ - { \ - Vec##elems ret; \ - for (int n = 0; n < elems; n++) \ - ret[n] = static_cast((*this)[n]); \ - return ret; \ - } \ - \ - inline T sqlen() const \ - { \ - T acc = 0; \ - for (int n = 0; n < elems; n++) \ - acc += (*this)[n] * (*this)[n]; \ - return acc; \ - } \ - \ - inline float len() const \ - { \ - return sqrtf((float)sqlen()); \ - } - -template struct Vec2 -{ - inline Vec2() { x = y = 0; } - inline Vec2(T val) { x = y = val; } - inline Vec2(T _x, T _y) { x = _x; y = _y; } - - OPERATORS(2) - - union { T x; T a; T i; }; - union { T y; T b; T j; }; -}; - -typedef Vec2 Float2; -typedef Vec2 Int2; - -template struct Vec3 -{ - inline Vec3() { x = y = z = 0; } - inline Vec3(T val) { x = y = z = val; } - inline Vec3(T _x, T _y, T _z) { x = _x; y = _y; z = _z; } - - OPERATORS(3) - - union { T x; T a; T i; }; - union { T y; T b; T j; }; - union { T z; T c; T k; }; -}; - -typedef Vec3 Float3; -typedef Vec3 Int3; - -#define SCALAR_GLOBAL(elems, op, U) \ - template \ - static inline Vec##elems operator op(U const &val, \ - Vec##elems const &that) \ - { \ - Vec##elems ret; \ - for (int n = 0; n < elems; n++) \ - ret[n] = val op that[n]; \ - return ret; \ - } - -#define SCALAR_GLOBAL2(elems, op) \ - SCALAR_GLOBAL(elems, op, int) \ - SCALAR_GLOBAL(elems, op, float) - -#define GLOBALS(elems) \ - SCALAR_GLOBAL2(elems, -) \ - SCALAR_GLOBAL2(elems, +) \ - SCALAR_GLOBAL2(elems, *) \ - SCALAR_GLOBAL2(elems, /) - -GLOBALS(2) -GLOBALS(3) - -#endif // __DH_MATRIX_H__ -