Subversion Repositories gelsvn

Rev

Rev 12 | Rev 50 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12 Rev 43
1
#ifndef __CGLA_MAT4X4_H__
1
#ifndef __CGLA_MAT4X4_H__
2
#define __CGLA_MAT4X4_H__
2
#define __CGLA_MAT4X4_H__
3
 
3
 
4
#include "ExceptionStandard.h"
4
#include "ExceptionStandard.h"
5
#include "CGLA.h"
5
#include "CGLA.h"
6
#include "Vec3f.h"
6
#include "Vec3f.h"
7
#include "Vec3Hf.h"
7
#include "Vec3Hf.h"
8
#include "Vec4f.h"
8
#include "Vec4f.h"
9
#include "ArithSqMat4x4Float.h"
9
#include "ArithSqMat4x4Float.h"
10
 
10
 
11
 
11
 
12
namespace CGLA 
12
namespace CGLA 
13
{
13
{
14
 
14
 
15
 
15
 
16
  /** Four by four float matrix.
16
  /** Four by four float matrix.
17
      This class is useful for transformations such as perspective projections 
17
      This class is useful for transformations such as perspective projections 
18
      or translation where 3x3 matrices do not suffice. */
18
      or translation where 3x3 matrices do not suffice. */
19
  class Mat4x4f: public ArithSqMat4x4Float<Vec4f, Mat4x4f>
19
  class Mat4x4f: public ArithSqMat4x4Float<Vec4f, Mat4x4f>
20
    {
20
    {
21
    public:
21
    public:
22
  
22
  
23
      /// Construct a Mat4x4f from four Vec4f vectors
23
      /// Construct a Mat4x4f from four Vec4f vectors
24
      Mat4x4f(Vec4f _a, Vec4f _b, Vec4f _c, Vec4f _d): 
24
      Mat4x4f(Vec4f _a, Vec4f _b, Vec4f _c, Vec4f _d): 
25
	ArithSqMat4x4Float<Vec4f, Mat4x4f> (_a,_b,_c,_d) {}
25
	ArithSqMat4x4Float<Vec4f, Mat4x4f> (_a,_b,_c,_d) {}
26
  
26
  
27
      /// Construct the NaN matrix
27
      /// Construct the NaN matrix
28
      Mat4x4f() {}
28
      Mat4x4f() {}
29
 
29
 
30
      /// Construct a matrix with identical elements.
30
      /// Construct a matrix with identical elements.
31
      Mat4x4f(float a): 
-
 
32
	ArithSqMat4x4Float<Vec4f, Mat4x4f> (a) {}
31
      explicit Mat4x4f(float a) : ArithSqMat4x4Float<Vec4f, Mat4x4f> (a) {}
33
    };
32
    };
34
 
33
 
35
  /// Create a rotation _matrix. Rotates about one of the major axes.
34
  /// Create a rotation _matrix. Rotates about one of the major axes.
36
  Mat4x4f rotation_Mat4x4f(CGLA::Axis axis, float angle);
35
  Mat4x4f rotation_Mat4x4f(CGLA::Axis axis, float angle);
37
 
36
 
38
  /// Create a translation matrix
37
  /// Create a translation matrix
39
  Mat4x4f translation_Mat4x4f(const Vec3f&);
38
  Mat4x4f translation_Mat4x4f(const Vec3f&);
40
 
39
 
41
  /// Create a scaling matrix.
40
  /// Create a scaling matrix.
42
  Mat4x4f scaling_Mat4x4f(const Vec3f&);
41
  Mat4x4f scaling_Mat4x4f(const Vec3f&);
43
 
42
 
44
  /// Create an identity matrix.
43
  /// Create an identity matrix.
45
  inline Mat4x4f identity_Mat4x4f()
44
  inline Mat4x4f identity_Mat4x4f()
46
    {
45
    {
47
      return Mat4x4f(Vec4f(1,0,0,0), 
46
      return Mat4x4f(Vec4f(1,0,0,0), 
48
		     Vec4f(0,1,0,0), 
47
		     Vec4f(0,1,0,0), 
49
		     Vec4f(0,0,1,0), 
48
		     Vec4f(0,0,1,0), 
50
		     Vec4f(0,0,0,1));
49
		     Vec4f(0,0,0,1));
51
    }
50
    }
52
}
51
}
53
#endif
52
#endif
54
 
53
 
55
 
54
 
56
 
55
 
57
 
56
 
58
 
57
 
59
 
58
 
60
 
59
 
61
 
60