Commit 5317014b authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Fixed GLMatrixT so it works with VC++, again.


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14165 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9f902036
......@@ -98,20 +98,39 @@ public:
/**
* Initialize an affine matrix from column vectors.
*/
#ifdef _MSC_VER
inline GLMatrixT(const Vec3 &col1, const Vec3 &col2, const Vec3 &col3) {
throw "Either use a different compiler or a different constructor.";
/*
* Don't try to optimize anything by hand, here. gcc -O2 does the right thing:
*
* mov %rax,-0x70(%rsp)
* mov %rdx,-0x68(%rsp)
* mov %rsi,-0x50(%rsp)
* lea -0x68(%rsp),%rdx
* mov %rax,0x8(%rsp)
* mov %rcx,-0x60(%rsp)
* lea 0x10(%rsp),%rsi
* movq $0x0,-0x58(%rsp)
* mov %rdi,-0x48(%rsp)
* xor %eax,%eax
* mov %r8,-0x40(%rsp)
* movq $0x0,-0x38(%rsp)
* mov %r9,-0x30(%rsp)
* mov %r10,-0x28(%rsp)
* mov %r11,-0x20(%rsp)
* movq $0x0,-0x18(%rsp)
* movq $0x0,-0x10(%rsp)
* movq $0x0,-0x8(%rsp)
* movq $0x0,(%rsp)
*
*/
memcpy(this->mat_ + 0, col1.data(), sizeof(double) * 3);
this->mat_[3] = 0;
memcpy(this->mat_ + 4, col2.data(), sizeof(double) * 3);
this->mat_[7] = 0;
memcpy(this->mat_ + 8, col2.data(), sizeof(double) * 3);
for (int i = 11; i < 15; ++i) this->mat_[i] = 0;
this->mat_[15] = 1;
}
#else
inline GLMatrixT(const Vec3 &col1, const Vec3 &col2, const Vec3 &col3) :
Matrix4x4T<Scalar>((Scalar[]){
col1[0], col1[1], col1[2], 0,
col2[0], col2[1], col2[2], 0,
col3[0], col3[1], col3[2], 0,
0, 0, 0, 1
}) {
}
#endif
/// destructor
......
......@@ -114,6 +114,9 @@ public:
/** setup matrix using an array of N*N scalar values.
elements are ordered 'column first' (like OpenGL) */
inline Matrix4x4T(const Scalar _array[16]) {
/*
* Why aren't we doing a memcpy here?
*/
matrixOperator(_array, mat_, =);
}
......@@ -251,7 +254,7 @@ public:
inline const Scalar* raw() const { return mat_; }
inline const Scalar* data() const { return mat_; }
private:
protected:
Scalar mat_[16];
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment