Removing old math code.
@@ -7,12 +7,6 @@ using namespace DirectX;
///////////////////////////////////////////
-inline XMVECTOR to_fast3 (const vec3 &vec) { return XMLoadFloat3((XMFLOAT3 *)& vec); }
-inline vec3 from_fast3(const XMVECTOR &a) { vec3 result; XMStoreFloat3((XMFLOAT3 *)& result, a); return result; }
-inline quat from_fastq(const XMVECTOR &a) { quat result; XMStoreFloat4((XMFLOAT4 *)& result, a); return result; }
-
-///////////////////////////////////////////
-
void transform_initialize(transform_t &transform) {
transform._position = vec3_zero;
transform._rotation = quat_identity;
@@ -71,15 +65,14 @@ quat transform_get_rotation(transform_t &transform) {
///////////////////////////////////////////
vec3 transform_forward (transform_t &transform) {
- vec3 forward = { 0,0,-1 };
- return transform._rotation * forward;
+ return transform._rotation * vec3_forward;
}
///////////////////////////////////////////
void transform_lookat (transform_t &transform, const vec3 &at) {
- XMMATRIX mat = XMMatrixLookAtRH(to_fast3(transform._position), to_fast3(at), XMVectorSet(0, 1, 0, 0));
- transform._rotation = from_fastq(XMQuaternionRotationMatrix(XMMatrixTranspose(mat)));
+ XMMATRIX mat = XMMatrixLookAtRH(math_vec3_to_fast(transform._position), math_vec3_to_fast(at), XMVectorSet(0, 1, 0, 0));
+ transform._rotation = math_fast_to_quat(XMQuaternionRotationMatrix(XMMatrixTranspose(mat)));
transform._dirty = true;
}
