source: trunk/src/matrix.h @ 232

Last change on this file since 232 was 232, checked in by sam, 11 years ago

Float2 and Float3 are now templates, thus creating Int2 and Int3.

  • Property svn:keywords set to Id
File size: 998 bytes
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11//
12// The Matrix classes
13// ------------------
14//
15
16#if !defined __DH_MATRIX_H__
17#define __DH_MATRIX_H__
18
19template <typename T> struct Vector2
20{
21    Vector2() { x = y = 0; }
22    Vector2(T _x, T _y) { x = _x; y = _y; }
23
24    union { T x; T a; T i; };
25    union { T y; T b; T j; };
26};
27
28typedef Vector2<float> Float2;
29typedef Vector2<int> Int2;
30
31template <typename T> struct Vector3
32{
33    Vector3() { x = y = z = 0; }
34    Vector3(T _x, T _y, T _z) { x = _x; y = _y; z = _z; }
35
36    union { T x; T a; T i; };
37    union { T y; T b; T j; };
38    union { T z; T c; T k; };
39};
40
41typedef Vector3<float> Float3;
42typedef Vector3<int> Int3;
43
44#endif // __DH_MATRIX_H__
45
Note: See TracBrowser for help on using the repository browser.