diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-06-15 16:58:04 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-06-15 16:58:04 +0200 |
commit | b8027ce9a7f050b95846a668a02f5801331e127f (patch) | |
tree | a41bdf9e5b5431c9a4469bd54ba102cc438fe3f9 /src/math/conv.h | |
parent | b735913debff93c1a6444ec731cd4bf99ae2a5c2 (diff) | |
download | colobot-b8027ce9a7f050b95846a668a02f5801331e127f.tar.gz colobot-b8027ce9a7f050b95846a668a02f5801331e127f.tar.bz2 colobot-b8027ce9a7f050b95846a668a02f5801331e127f.zip |
Tests and fixes in math geometry.h module
Diffstat (limited to 'src/math/conv.h')
-rw-r--r-- | src/math/conv.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/math/conv.h b/src/math/conv.h index 8cfdc6b..bb6700b 100644 --- a/src/math/conv.h +++ b/src/math/conv.h @@ -1,21 +1,39 @@ /* math/conv.h - Temporary conversion functions for D3DVECTOR and FPOINT */ + Temporary conversion functions for D3DVECTOR and D3DMATRIX */ #pragma once -#define STRICT -#define D3D_OVERLOADS #include <d3d.h> #include "vector.h" +#include "matrix.h" -inline D3DVECTOR V_TO_D3D(Math::Vector vec) +inline D3DVECTOR VEC_TO_D3DVEC(Math::Vector vec) { return D3DVECTOR(vec.x, vec.y, vec.z); } -inline Math::Vector D3D_TO_V(D3DVECTOR vec) +inline Math::Vector D3DVEC_TO_VEC(D3DVECTOR vec) { return Math::Vector(vec.x, vec.y, vec.z); } + +inline D3DMATRIX MAT_TO_D3DMAT(Math::Matrix mat) +{ + D3DMATRIX result; + mat.Transpose(); + for (int r = 0; r < 4; ++r) + { + for (int c = 0; c < 16; ++c) + result.m[r][c] = mat.m[4*c+r]; + } + return result; +} + +inline Math::Matrix D3DMAT_TO_MAT(D3DMATRIX mat) +{ + Math::Matrix result(mat.m); + result.Transpose(); + return result; +} |