2012-06-12 11:48:17 +00:00
|
|
|
/* math/conv.h
|
|
|
|
|
2012-06-15 14:58:04 +00:00
|
|
|
Temporary conversion functions for D3DVECTOR and D3DMATRIX */
|
2012-06-12 11:48:17 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <d3d.h>
|
|
|
|
|
|
|
|
#include "vector.h"
|
2012-06-15 14:58:04 +00:00
|
|
|
#include "matrix.h"
|
2012-06-12 11:48:17 +00:00
|
|
|
|
2012-06-15 14:58:04 +00:00
|
|
|
inline D3DVECTOR VEC_TO_D3DVEC(Math::Vector vec)
|
2012-06-12 11:48:17 +00:00
|
|
|
{
|
|
|
|
return D3DVECTOR(vec.x, vec.y, vec.z);
|
|
|
|
}
|
|
|
|
|
2012-06-15 14:58:04 +00:00
|
|
|
inline Math::Vector D3DVEC_TO_VEC(D3DVECTOR vec)
|
2012-06-12 11:48:17 +00:00
|
|
|
{
|
|
|
|
return Math::Vector(vec.x, vec.y, vec.z);
|
|
|
|
}
|
2012-06-15 14:58:04 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|