Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File: matrix.hpp, created on Sep 8, 2011 by WeltEnSTurm
- #ifndef MATRIX_HPP_
- #define MATRIX_HPP_
- template<typename T>
- struct matrix3 {
- T
- x1, y1, z1,
- x2, y2, z2,
- x3, y3, z3;
- matrix3(const T* f){
- x1 = f[0], y1 = f[1], z1 = f[2];
- x2 = f[3], y2 = f[4], z2 = f[5];
- x3 = f[6], y3 = f[7], z3 = f[8];
- }
- static const matrix3<T> identity = {
- 1, 0, 0,
- 0, 1, 0,
- 0, 0, 1
- };
- };
- typedef matrix3<float> matrix3f;
- typedef matrix3<double> matrix3d;
- template<typename T>
- struct matrix4 {
- T
- x1, y1, z1, w1,
- x2, y2, z2, w2,
- x3, y3, z3, w3,
- x4, y4, z4, w4;
- matrix4(const T* f){
- x1 = f[0], y1 = f[1], z1 = f[2], w1 = f[3];
- x2 = f[4], y2 = f[5], z2 = f[6], w2 = f[7];
- x3 = f[8], y3 = f[9], z3 = f[10], w3 = f[11];
- x4 = f[12], y4 = f[13], z4 = f[14], w4 = f[15];
- }
- static const matrix4<T> identity = {
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1
- };
- };
- typedef matrix4<float> matrix4f;
- typedef matrix4<double> matrix4d;
- #endif /* MATRIX_HPP_ */
- /*
- **** Build of configuration Debug for project Game Engine ****
- **** Internal Builder is used for build ****
- g++ -std=gnu++0x -IC:/Users/WeltEnSTurm/Dropbox/Programming/lib/GLTools/include -IC:\Users\WeltEnSTurm\workspace\Game Engine\include -IC:\Users\WeltEnSTurm\Dropbox\Programming\lib\freetype-2.4.6\include -O0 -g3 -Wall -c -fmessage-length=0 -o src\main.o ..\src\main.cpp
- In file included from C:\Users\WeltEnSTurm\workspace\Game Engine\include/engine/render/shader.hpp:10:0,
- from ..\src\main.cpp:10:
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:20:37: error:
- a brace-enclosed initializer is not allowed here before '{' token
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:45:37: error:
- a brace-enclosed initializer is not allowed here before '{' token
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:
- In instantiation of 'matrix3<float>':
- ..\src\main.cpp:76:49: instantiated from here
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:24:2:
- error: invalid in-class initialization of static data member of
- non-integral type 'const matrix3<float>'
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:
- In instantiation of 'matrix4<float>':
- ..\src\main.cpp:76:49: instantiated from here
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:50:2:
- error: invalid in-class initialization of static data member of
- non-integral type 'const matrix4<float>'
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:
- In instantiation of 'const matrix4<float> matrix4<float>::identity':
- ..\src\main.cpp:95:47: instantiated from here
- C:\Users\WeltEnSTurm\workspace\Game Engine\include/math/matrix.hpp:50:2:
- error: 'matrix4<float>::identity' cannot be initialized
- by a non-constant expression when being declared
- Build error occurred, build is stopped
- Time consumed: 1223 ms.
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement