feat(scripting): add mono csharp runtime foundation

This commit is contained in:
2026-03-27 13:07:39 +08:00
parent 134a80b334
commit b06932724c
33 changed files with 4227 additions and 18 deletions

View File

@@ -228,30 +228,27 @@ void TransformComponent::LookAt(const Math::Vector3& target, const Math::Vector3
void TransformComponent::Rotate(const Math::Vector3& eulers, Space relativeTo) {
Math::Quaternion rotation = Math::Quaternion::FromEulerAngles(eulers * Math::DEG_TO_RAD);
if (relativeTo == Space::Self) {
m_localRotation = m_localRotation * rotation;
SetRotation(GetRotation() * rotation);
} else {
m_localRotation = rotation * m_localRotation;
SetRotation(rotation * GetRotation());
}
SetDirty();
}
void TransformComponent::Rotate(const Math::Vector3& axis, float angle, Space relativeTo) {
Math::Quaternion rotation = Math::Quaternion::FromAxisAngle(axis, angle * Math::DEG_TO_RAD);
if (relativeTo == Space::Self) {
m_localRotation = m_localRotation * rotation;
SetRotation(GetRotation() * rotation);
} else {
m_localRotation = rotation * m_localRotation;
SetRotation(rotation * GetRotation());
}
SetDirty();
}
void TransformComponent::Translate(const Math::Vector3& translation, Space relativeTo) {
if (relativeTo == Space::Self) {
m_localPosition = m_localPosition + translation;
SetPosition(GetPosition() + TransformDirection(translation));
} else {
m_localPosition = m_localPosition + translation;
SetPosition(GetPosition() + translation);
}
SetDirty();
}
Math::Vector3 TransformComponent::TransformPoint(const Math::Vector3& point) const {
@@ -317,4 +314,4 @@ void TransformComponent::Deserialize(std::istream& is) {
}
} // namespace Components
} // namespace XCEngine
} // namespace XCEngine