소스 검색

math: allow to easily create a 4x4 matrix from a 3x3 matrix, and so on.

legacy
Sam Hocevar sam 12 년 전
부모
커밋
9dad69c630
1개의 변경된 파일34개의 추가작업 그리고 0개의 파일을 삭제
  1. +34
    -0
      src/lol/math/vector.h

+ 34
- 0
src/lol/math/vector.h 파일 보기

@@ -1434,6 +1434,16 @@ template <typename T> struct Mat3
v1((T)0, val, (T)0),
v2((T)0, (T)0, val) {}

explicit inline Mat3(Mat2<T> mat)
: v0(mat[0], (T)0),
v1(mat[1], (T)0),
v2((T)0, (T)0, (T)0) {}

explicit inline Mat3(Mat2<T> mat, T val)
: v0(Vec3<T>(mat[0], (T)0)),
v1(Vec3<T>(mat[1], (T)0)),
v2((T)0, (T)0, val) {}

explicit inline Mat3(Mat4<T> const &mat)
: v0(mat[0].xyz),
v1(mat[1].xyz),
@@ -1521,6 +1531,30 @@ template <typename T> struct Mat4
v2((T)0, (T)0, val, (T)0),
v3((T)0, (T)0, (T)0, val) {}

explicit inline Mat4(Mat2<T> mat)
: v0(mat[0], (T)0, (T)0),
v1(mat[1], (T)0, (T)0),
v2((T)0, (T)0, (T)0, (T)0),
v3((T)0, (T)0, (T)0, (T)0) {}

explicit inline Mat4(Mat2<T> mat, T val1, T val2)
: v0(mat[0], (T)0, (T)0),
v1(mat[1], (T)0, (T)0),
v2((T)0, (T)0, val1, (T)0),
v3((T)0, (T)0, (T)0, val2) {}

explicit inline Mat4(Mat3<T> mat)
: v0(mat[0], (T)0),
v1(mat[1], (T)0),
v2(mat[2], (T)0),
v3((T)0, (T)0, (T)0, (T)0) {}

explicit inline Mat4(Mat3<T> mat, T val)
: v0(mat[0], (T)0),
v1(mat[1], (T)0),
v2(mat[2], (T)0),
v3((T)0, (T)0, (T)0, val) {}

inline Vec4<T>& operator[](size_t n) { return (&v0)[n]; }
inline Vec4<T> const& operator[](size_t n) const { return (&v0)[n]; }



불러오는 중...
취소
저장