Update old API usage

#4080 #4081
This commit is contained in:
2026-05-12 18:40:21 +02:00
parent 0bcc01c3c7
commit d697bd7402
11 changed files with 25 additions and 27 deletions
+1 -1
View File
@@ -195,7 +195,7 @@ void RenderView::CopyFrom(const Camera* camera, const Viewport* viewport)
const Vector3 cameraPos = camera->GetPosition();
LargeWorlds::UpdateOrigin(Origin, cameraPos);
Position = cameraPos - Origin;
Direction = camera->GetDirection();
Direction = camera->GetForward();
Near = camera->GetNearPlane();
Far = camera->GetFarPlane();
camera->GetMatrices(View, Projection, viewport ? *viewport : camera->GetViewport(), Origin);
+1 -1
View File
@@ -96,7 +96,7 @@ namespace FlaxEngine
Vector3 cameraPos = camera.Position;
LargeWorlds.UpdateOrigin(ref Origin, cameraPos);
Position = cameraPos - Origin;
Direction = camera.Direction;
Direction = camera.Forward;
Near = camera.NearPlane;
Far = camera.FarPlane;
camera.GetMatrices(out View, out Projection, ref viewport, ref Origin);
+4 -5
View File
@@ -1719,13 +1719,13 @@ Actor* Actor::Intersects(const Ray& ray, Real& distance, Vector3& normal)
void Actor::LookAt(const Vector3& worldPos)
{
const Quaternion orientation = LookingAt(worldPos);
const Quaternion orientation = GetLookAtDirection(worldPos);
SetOrientation(orientation);
}
void Actor::LookAt(const Vector3& worldPos, const Vector3& worldUp)
{
const Quaternion orientation = LookingAt(worldPos, worldUp);
const Quaternion orientation = GetLookAtDirection(worldPos, worldUp);
SetOrientation(orientation);
}
@@ -1771,12 +1771,11 @@ Quaternion Actor::GetLookAtDirection(const Vector3& worldPos, const Vector3& wor
const Vector3 direction = worldPos - _transform.Translation;
if (direction.LengthSquared() < ZeroTolerance)
return _parent ? _parent->GetOrientation() : Quaternion::Identity;
const Float3 forward = Vector3::Normalize(direction);
const Float3 up = Vector3::Normalize(worldUp);
if (Math::IsOne(Float3::Dot(forward, up)))
{
return LookingAt(worldPos);
}
return GetLookAtDirection(worldPos);
Quaternion orientation;
Quaternion::LookRotation(direction, up, orientation);
+8 -10
View File
@@ -551,14 +551,14 @@ public:
/// Gets actor direction vector (forward vector).
/// [Deprecated in v1.13]
/// </summary>
DEPRECATED("Use GetForward instead.")
API_PROPERTY(Attributes="HideInEditor, NoSerialize") FORCE_INLINE Float3 GetDirection() const
API_PROPERTY(Attributes="HideInEditor, NoSerialize") DEPRECATED("Use GetForward instead.")
FORCE_INLINE Float3 GetDirection() const
{
return GetForward();
}
/// <summary>
/// Gets the actor's forward vector.
/// Gets the actor's forward vector (direction).
/// </summary>
API_PROPERTY(Attributes="HideInEditor, NoSerialize") FORCE_INLINE Float3 GetForward() const
{
@@ -570,11 +570,11 @@ public:
/// [Deprecated in v1.13]
/// </summary>
/// <param name="value">The value to set.</param>
DEPRECATED("Use SetForward instead.")
API_PROPERTY() void SetDirection(const Float3& value);
API_PROPERTY() DEPRECATED("Use SetForward instead.")
void SetDirection(const Float3& value);
/// <summary>
/// Rotates the actor to align its forward vector with the passed in value.
/// Rotates the actor to align its forward vector with the passed in value (direction).
/// </summary>
/// <param name="value">The value to align to.</param>
API_PROPERTY() void SetForward(const Float3& value);
@@ -918,8 +918,7 @@ public:
/// [Deprecated in v1.13]
/// </summary>
/// <param name="worldPos">The world position to orient towards.</param>
DEPRECATED("Use GetLookAtDirection instead.")
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos) const;
API_FUNCTION() DEPRECATED("Use GetLookAtDirection instead.") Quaternion LookingAt(const Vector3& worldPos) const;
/// <summary>
/// Gets rotation of the actor oriented towards the specified world position.
@@ -933,8 +932,7 @@ public:
/// </summary>
/// <param name="worldPos">The world position to orient towards.</param>
/// <param name="worldUp">The up direction that constrains up axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
DEPRECATED("Use GetLookAtDirection instead.")
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
API_FUNCTION() DEPRECATED("Use GetLookAtDirection instead.") Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
/// <summary>
/// Gets rotation of the actor oriented towards the specified world position with upwards direction.
+1 -1
View File
@@ -210,7 +210,7 @@ Ray Camera::ConvertMouseToRay(const Float2& mousePosition, const Viewport& viewp
{
Vector3 position = GetPosition();
if (viewport.Width < ZeroTolerance || viewport.Height < ZeroTolerance || mousePosition.IsNaN())
return Ray(position, GetDirection());
return Ray(position, GetForward());
// Use different logic in orthographic projection
if (!_usePerspective)
@@ -30,7 +30,7 @@ void DirectionalLight::Draw(RenderContext& renderContext)
data.ShadowsDistance = ShadowsDistance;
data.Color = Color.ToFloat3() * (Color.A * brightness);
data.ShadowsStrength = ShadowsStrength;
data.Direction = GetDirection();
data.Direction = GetForward();
data.ShadowsFadeDistance = ShadowsFadeDistance;
data.ShadowsNormalOffsetScale = ShadowsNormalOffsetScale;
data.ShadowsDepthBias = ShadowsDepthBias;
@@ -163,7 +163,7 @@ void ExponentialHeightFog::GetExponentialHeightFogData(const RenderView& view, S
result.FogCutoffDistance = FogCutoffDistance >= 0 ? FogCutoffDistance : view.Far + FogCutoffDistance;
if (useDirectionalLightInscattering)
{
result.InscatteringLightDirection = -DirectionalInscatteringLight->GetDirection();
result.InscatteringLightDirection = -DirectionalInscatteringLight->GetForward();
result.DirectionalInscatteringColor = DirectionalInscatteringColor.ToFloat3();
result.DirectionalInscatteringExponent = Math::Clamp(DirectionalInscatteringExponent, 0.000001f, 1000.0f);
result.DirectionalInscatteringStartDistance = Math::Min(DirectionalInscatteringStartDistance, view.Far - 1.0f);
+1 -1
View File
@@ -73,7 +73,7 @@ void Sky::InitConfig(ShaderAtmosphericFogData& config) const
if (SunLight)
{
config.AtmosphericFogSunDirection = -SunLight->GetDirection();
config.AtmosphericFogSunDirection = -SunLight->GetForward();
config.AtmosphericFogSunColor = SunLight->Color.ToFloat3() * SunLight->Color.A;
}
else
+4 -4
View File
@@ -27,7 +27,7 @@ SpotLight::SpotLight(const SpawnParams& params)
_cosInnerCone = Math::Cos(_innerConeAngle * DegreesToRadians);
_invCosConeDifference = 1.0f / (_cosInnerCone - _cosOuterCone);
const float boundsRadius = Math::Sqrt(1.25f * _radius * _radius - _radius * _radius * _cosOuterCone);
_sphere = BoundingSphere(GetPosition() + 0.5f * GetDirection() * _radius, boundsRadius);
_sphere = BoundingSphere(GetPosition() + 0.5f * GetForward() * _radius, boundsRadius);
BoundingBox::FromSphere(_sphere, _box);
}
@@ -113,7 +113,7 @@ void SpotLight::UpdateBounds()
// Note: we use the law of cosines to find the distance to the furthest edge of the spotlight cone from a position that is halfway down the spotlight direction
const float radius = GetScaledRadius();
const float boundsRadius = Math::Sqrt(1.25f * radius * radius - radius * radius * _cosOuterCone);
_sphere = BoundingSphere(GetPosition() + 0.5f * GetDirection() * radius, boundsRadius);
_sphere = BoundingSphere(GetPosition() + 0.5f * GetForward() * radius, boundsRadius);
BoundingBox::FromSphere(_sphere, _box);
if (_sceneRenderingKey != -1)
@@ -199,7 +199,7 @@ void SpotLight::OnDebugDrawSelected()
const auto color = Color::Yellow;
Vector3 right = _transform.GetRight();
Vector3 up = _transform.GetUp();
Vector3 forward = GetDirection();
Vector3 forward = GetForward();
float radius = GetScaledRadius();
float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians);
float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians);
@@ -231,7 +231,7 @@ void SpotLight::DrawLightsDebug(RenderView& view)
const auto color = Color::Yellow;
Vector3 right = _transform.GetRight();
Vector3 up = _transform.GetUp();
Vector3 forward = GetDirection();
Vector3 forward = GetForward();
float radius = GetScaledRadius();
float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians);
float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians);
+1 -1
View File
@@ -465,7 +465,7 @@ namespace FlaxEngine
Quaternion.Euler(180, 180, 0, out var quat);
Matrix.RotationQuaternion(ref quat, out m2);
Matrix.Multiply(ref m3, ref m2, out m1);
m2 = Matrix.Transformation(Vector3.One, Quaternion.FromDirection(-camera.Direction), translation);
m2 = Matrix.Transformation(Vector3.One, Quaternion.FromDirection(-camera.Forward), translation);
Matrix.Multiply(ref m1, ref m2, out world);
}
else if (_renderMode == CanvasRenderMode.CameraSpace && camera)