Mini tweak
This commit is contained in:
parent
c153c88032
commit
8d56c159c6
@ -3,10 +3,10 @@ Pos=60,60
|
||||
Size=400,400
|
||||
|
||||
[Window][Khaotic Engine]
|
||||
Pos=1068,19
|
||||
Pos=765,19
|
||||
Size=694,367
|
||||
|
||||
[Window][Objects]
|
||||
Pos=74,113
|
||||
Pos=44,57
|
||||
Size=492,353
|
||||
|
||||
|
@ -89,9 +89,23 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
||||
XMVECTOR position = object->GetPosition();
|
||||
XMVECTOR rotation = object->GetRotation();
|
||||
XMVECTOR scale = object->GetScale();
|
||||
ImGui::Text("Position: %.2f %.2f %.2f", XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position));
|
||||
ImGui::Text("Rotation: %.2f %.2f %.2f", XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation));
|
||||
ImGui::Text("Scale: %.2f %.2f %.2f", XMVectorGetX(scale), XMVectorGetY(scale), XMVectorGetZ(scale));
|
||||
float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
|
||||
if (ImGui::DragFloat3("Position", pos))
|
||||
{
|
||||
object->SetPosition(XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
|
||||
}
|
||||
|
||||
float rot[3] = { XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation) };
|
||||
if (ImGui::DragFloat3("Rotation", rot))
|
||||
{
|
||||
object->SetRotation(XMVectorSet(rot[0], rot[1], rot[2], 0.0f));
|
||||
}
|
||||
|
||||
float scl[3] = { XMVectorGetX(scale), XMVectorGetY(scale), XMVectorGetZ(scale) };
|
||||
if (ImGui::DragFloat3("Scale", scl))
|
||||
{
|
||||
object->SetScale(XMVectorSet(scl[0], scl[1], scl[2], 0.0f));
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user