Mini tweak

This commit is contained in:
2024-03-26 15:24:38 +01:00
parent c153c88032
commit 8d56c159c6
3 changed files with 47 additions and 5 deletions

View File

@@ -89,4 +89,32 @@ XMVECTOR Object::GetScale()
float scaleY = XMVectorGetX(XMVector3Length(XMVectorSet(matrix._21, matrix._22, matrix._23, 0.0f)));
float scaleZ = XMVectorGetX(XMVector3Length(XMVectorSet(matrix._31, matrix._32, matrix._33, 0.0f)));
return XMVectorSet(scaleX, scaleY, scaleZ, 0.0f);
}
void Object::SetPosition(XMVECTOR position)
{
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_worldMatrix);
matrix._41 = XMVectorGetX(position);
matrix._42 = XMVectorGetY(position);
matrix._43 = XMVectorGetZ(position);
m_worldMatrix = XMLoadFloat4x4(&matrix);
}
void Object::SetRotation(XMVECTOR rotation)
{
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_rotateMatrix);
XMMATRIX rotationMatrix = XMMatrixRotationRollPitchYaw(XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation));
m_rotateMatrix = rotationMatrix;
}
void Object::SetScale(XMVECTOR scale)
{
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_scaleMatrix);
matrix._11 = XMVectorGetX(scale);
matrix._22 = XMVectorGetY(scale);
matrix._33 = XMVectorGetZ(scale);
m_scaleMatrix = XMLoadFloat4x4(&matrix);
}