Merge remote-tracking branch 'origin/SP3-16-Math' into SP3-1-Rendering
This commit is contained in:
commit
96112e5251
|
@ -191,7 +191,7 @@ namespace SHADE
|
|||
|
||||
SHVec4 SHMatrix::operator*(const SHVec4& rhs) const noexcept
|
||||
{
|
||||
return SHVec4::Transform3D(rhs, *this);
|
||||
return SHVec4::Transform(rhs, *this);
|
||||
}
|
||||
|
||||
SHMatrix SHMatrix::operator*(float rhs) const noexcept
|
||||
|
|
|
@ -263,6 +263,9 @@ namespace SHADE
|
|||
auto* node = EVENT_DATA->data->node;
|
||||
auto* tf = SHComponentManager::GetComponent_s<SHTransformComponent>(node->GetEntityID());
|
||||
|
||||
if (tf == nullptr)
|
||||
return EVENT_DATA->handle;
|
||||
|
||||
// Recompute local transform and store localToWorld Matrix
|
||||
SHMatrix localToWorld = SHMatrix::Identity;
|
||||
SHMatrix worldToLocal = SHMatrix::Identity;
|
||||
|
|
|
@ -445,9 +445,7 @@ namespace SHADE
|
|||
{
|
||||
SHVec3 result;
|
||||
|
||||
const XMMATRIX TF = XMLoadFloat4x4(&transformMtx);
|
||||
|
||||
XMStoreFloat3(&result, XMVector3TransformCoord(v, TF));
|
||||
XMStoreFloat3(&result, XMVector3TransformCoord(v, transformMtx));
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -460,13 +460,19 @@ namespace SHADE
|
|||
return result;
|
||||
}
|
||||
|
||||
SHVec4 SHVec4::Transform(const SHVec4& v, const SHMatrix& transformMtx) noexcept
|
||||
{
|
||||
SHVec4 result;
|
||||
|
||||
XMStoreFloat4(&result, XMVector4Transform(v, transformMtx));
|
||||
return result;
|
||||
}
|
||||
|
||||
SHVec4 SHVec4::Transform3D(const SHVec4& v, const SHMatrix& transformMtx) noexcept
|
||||
{
|
||||
SHVec4 result;
|
||||
|
||||
const XMMATRIX TF = XMLoadFloat4x4(&transformMtx);
|
||||
|
||||
XMStoreFloat4(&result, XMVector3TransformCoord(v, TF));
|
||||
XMStoreFloat4(&result, XMVector3TransformCoord(v, transformMtx));
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -134,6 +134,7 @@ namespace SHADE
|
|||
[[nodiscard]] static SHVec4 Project3D (const SHVec4& v, const SHVec4& u) noexcept;
|
||||
[[nodiscard]] static SHVec4 Reflect (const SHVec4& v, const SHVec4& normal) noexcept;
|
||||
[[nodiscard]] static SHVec4 Reflect3D (const SHVec4& v, const SHVec4& normal) noexcept;
|
||||
[[nodiscard]] static SHVec4 Transform (const SHVec4& v, const SHMatrix& transformMtx) noexcept;
|
||||
[[nodiscard]] static SHVec4 Transform3D (const SHVec4& v, const SHMatrix& transformMtx) noexcept;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue