@@ -195,7 +195,7 @@ void RenderView::CopyFrom(const Camera* camera, const Viewport* viewport)
|
|||||||
const Vector3 cameraPos = camera->GetPosition();
|
const Vector3 cameraPos = camera->GetPosition();
|
||||||
LargeWorlds::UpdateOrigin(Origin, cameraPos);
|
LargeWorlds::UpdateOrigin(Origin, cameraPos);
|
||||||
Position = cameraPos - Origin;
|
Position = cameraPos - Origin;
|
||||||
Direction = camera->GetDirection();
|
Direction = camera->GetForward();
|
||||||
Near = camera->GetNearPlane();
|
Near = camera->GetNearPlane();
|
||||||
Far = camera->GetFarPlane();
|
Far = camera->GetFarPlane();
|
||||||
camera->GetMatrices(View, Projection, viewport ? *viewport : camera->GetViewport(), Origin);
|
camera->GetMatrices(View, Projection, viewport ? *viewport : camera->GetViewport(), Origin);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ namespace FlaxEngine
|
|||||||
Vector3 cameraPos = camera.Position;
|
Vector3 cameraPos = camera.Position;
|
||||||
LargeWorlds.UpdateOrigin(ref Origin, cameraPos);
|
LargeWorlds.UpdateOrigin(ref Origin, cameraPos);
|
||||||
Position = cameraPos - Origin;
|
Position = cameraPos - Origin;
|
||||||
Direction = camera.Direction;
|
Direction = camera.Forward;
|
||||||
Near = camera.NearPlane;
|
Near = camera.NearPlane;
|
||||||
Far = camera.FarPlane;
|
Far = camera.FarPlane;
|
||||||
camera.GetMatrices(out View, out Projection, ref viewport, ref Origin);
|
camera.GetMatrices(out View, out Projection, ref viewport, ref Origin);
|
||||||
|
|||||||
@@ -1719,13 +1719,13 @@ Actor* Actor::Intersects(const Ray& ray, Real& distance, Vector3& normal)
|
|||||||
|
|
||||||
void Actor::LookAt(const Vector3& worldPos)
|
void Actor::LookAt(const Vector3& worldPos)
|
||||||
{
|
{
|
||||||
const Quaternion orientation = LookingAt(worldPos);
|
const Quaternion orientation = GetLookAtDirection(worldPos);
|
||||||
SetOrientation(orientation);
|
SetOrientation(orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::LookAt(const Vector3& worldPos, const Vector3& worldUp)
|
void Actor::LookAt(const Vector3& worldPos, const Vector3& worldUp)
|
||||||
{
|
{
|
||||||
const Quaternion orientation = LookingAt(worldPos, worldUp);
|
const Quaternion orientation = GetLookAtDirection(worldPos, worldUp);
|
||||||
SetOrientation(orientation);
|
SetOrientation(orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1771,12 +1771,11 @@ Quaternion Actor::GetLookAtDirection(const Vector3& worldPos, const Vector3& wor
|
|||||||
const Vector3 direction = worldPos - _transform.Translation;
|
const Vector3 direction = worldPos - _transform.Translation;
|
||||||
if (direction.LengthSquared() < ZeroTolerance)
|
if (direction.LengthSquared() < ZeroTolerance)
|
||||||
return _parent ? _parent->GetOrientation() : Quaternion::Identity;
|
return _parent ? _parent->GetOrientation() : Quaternion::Identity;
|
||||||
|
|
||||||
const Float3 forward = Vector3::Normalize(direction);
|
const Float3 forward = Vector3::Normalize(direction);
|
||||||
const Float3 up = Vector3::Normalize(worldUp);
|
const Float3 up = Vector3::Normalize(worldUp);
|
||||||
if (Math::IsOne(Float3::Dot(forward, up)))
|
if (Math::IsOne(Float3::Dot(forward, up)))
|
||||||
{
|
return GetLookAtDirection(worldPos);
|
||||||
return LookingAt(worldPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
Quaternion orientation;
|
Quaternion orientation;
|
||||||
Quaternion::LookRotation(direction, up, orientation);
|
Quaternion::LookRotation(direction, up, orientation);
|
||||||
|
|||||||
@@ -551,14 +551,14 @@ public:
|
|||||||
/// Gets actor direction vector (forward vector).
|
/// Gets actor direction vector (forward vector).
|
||||||
/// [Deprecated in v1.13]
|
/// [Deprecated in v1.13]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DEPRECATED("Use GetForward instead.")
|
API_PROPERTY(Attributes="HideInEditor, NoSerialize") DEPRECATED("Use GetForward instead.")
|
||||||
API_PROPERTY(Attributes="HideInEditor, NoSerialize") FORCE_INLINE Float3 GetDirection() const
|
FORCE_INLINE Float3 GetDirection() const
|
||||||
{
|
{
|
||||||
return GetForward();
|
return GetForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the actor's forward vector.
|
/// Gets the actor's forward vector (direction).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
API_PROPERTY(Attributes="HideInEditor, NoSerialize") FORCE_INLINE Float3 GetForward() const
|
API_PROPERTY(Attributes="HideInEditor, NoSerialize") FORCE_INLINE Float3 GetForward() const
|
||||||
{
|
{
|
||||||
@@ -570,11 +570,11 @@ public:
|
|||||||
/// [Deprecated in v1.13]
|
/// [Deprecated in v1.13]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The value to set.</param>
|
/// <param name="value">The value to set.</param>
|
||||||
DEPRECATED("Use SetForward instead.")
|
API_PROPERTY() DEPRECATED("Use SetForward instead.")
|
||||||
API_PROPERTY() void SetDirection(const Float3& value);
|
void SetDirection(const Float3& value);
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="value">The value to align to.</param>
|
/// <param name="value">The value to align to.</param>
|
||||||
API_PROPERTY() void SetForward(const Float3& value);
|
API_PROPERTY() void SetForward(const Float3& value);
|
||||||
@@ -918,8 +918,7 @@ public:
|
|||||||
/// [Deprecated in v1.13]
|
/// [Deprecated in v1.13]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="worldPos">The world position to orient towards.</param>
|
/// <param name="worldPos">The world position to orient towards.</param>
|
||||||
DEPRECATED("Use GetLookAtDirection instead.")
|
API_FUNCTION() DEPRECATED("Use GetLookAtDirection instead.") Quaternion LookingAt(const Vector3& worldPos) const;
|
||||||
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos) const;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets rotation of the actor oriented towards the specified world position.
|
/// Gets rotation of the actor oriented towards the specified world position.
|
||||||
@@ -933,8 +932,7 @@ public:
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="worldPos">The world position to orient towards.</param>
|
/// <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>
|
/// <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() DEPRECATED("Use GetLookAtDirection instead.") Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
|
||||||
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets rotation of the actor oriented towards the specified world position with upwards direction.
|
/// Gets rotation of the actor oriented towards the specified world position with upwards direction.
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ Ray Camera::ConvertMouseToRay(const Float2& mousePosition, const Viewport& viewp
|
|||||||
{
|
{
|
||||||
Vector3 position = GetPosition();
|
Vector3 position = GetPosition();
|
||||||
if (viewport.Width < ZeroTolerance || viewport.Height < ZeroTolerance || mousePosition.IsNaN())
|
if (viewport.Width < ZeroTolerance || viewport.Height < ZeroTolerance || mousePosition.IsNaN())
|
||||||
return Ray(position, GetDirection());
|
return Ray(position, GetForward());
|
||||||
|
|
||||||
// Use different logic in orthographic projection
|
// Use different logic in orthographic projection
|
||||||
if (!_usePerspective)
|
if (!_usePerspective)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void DirectionalLight::Draw(RenderContext& renderContext)
|
|||||||
data.ShadowsDistance = ShadowsDistance;
|
data.ShadowsDistance = ShadowsDistance;
|
||||||
data.Color = Color.ToFloat3() * (Color.A * brightness);
|
data.Color = Color.ToFloat3() * (Color.A * brightness);
|
||||||
data.ShadowsStrength = ShadowsStrength;
|
data.ShadowsStrength = ShadowsStrength;
|
||||||
data.Direction = GetDirection();
|
data.Direction = GetForward();
|
||||||
data.ShadowsFadeDistance = ShadowsFadeDistance;
|
data.ShadowsFadeDistance = ShadowsFadeDistance;
|
||||||
data.ShadowsNormalOffsetScale = ShadowsNormalOffsetScale;
|
data.ShadowsNormalOffsetScale = ShadowsNormalOffsetScale;
|
||||||
data.ShadowsDepthBias = ShadowsDepthBias;
|
data.ShadowsDepthBias = ShadowsDepthBias;
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void ExponentialHeightFog::GetExponentialHeightFogData(const RenderView& view, S
|
|||||||
result.FogCutoffDistance = FogCutoffDistance >= 0 ? FogCutoffDistance : view.Far + FogCutoffDistance;
|
result.FogCutoffDistance = FogCutoffDistance >= 0 ? FogCutoffDistance : view.Far + FogCutoffDistance;
|
||||||
if (useDirectionalLightInscattering)
|
if (useDirectionalLightInscattering)
|
||||||
{
|
{
|
||||||
result.InscatteringLightDirection = -DirectionalInscatteringLight->GetDirection();
|
result.InscatteringLightDirection = -DirectionalInscatteringLight->GetForward();
|
||||||
result.DirectionalInscatteringColor = DirectionalInscatteringColor.ToFloat3();
|
result.DirectionalInscatteringColor = DirectionalInscatteringColor.ToFloat3();
|
||||||
result.DirectionalInscatteringExponent = Math::Clamp(DirectionalInscatteringExponent, 0.000001f, 1000.0f);
|
result.DirectionalInscatteringExponent = Math::Clamp(DirectionalInscatteringExponent, 0.000001f, 1000.0f);
|
||||||
result.DirectionalInscatteringStartDistance = Math::Min(DirectionalInscatteringStartDistance, view.Far - 1.0f);
|
result.DirectionalInscatteringStartDistance = Math::Min(DirectionalInscatteringStartDistance, view.Far - 1.0f);
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void Sky::InitConfig(ShaderAtmosphericFogData& config) const
|
|||||||
|
|
||||||
if (SunLight)
|
if (SunLight)
|
||||||
{
|
{
|
||||||
config.AtmosphericFogSunDirection = -SunLight->GetDirection();
|
config.AtmosphericFogSunDirection = -SunLight->GetForward();
|
||||||
config.AtmosphericFogSunColor = SunLight->Color.ToFloat3() * SunLight->Color.A;
|
config.AtmosphericFogSunColor = SunLight->Color.ToFloat3() * SunLight->Color.A;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ SpotLight::SpotLight(const SpawnParams& params)
|
|||||||
_cosInnerCone = Math::Cos(_innerConeAngle * DegreesToRadians);
|
_cosInnerCone = Math::Cos(_innerConeAngle * DegreesToRadians);
|
||||||
_invCosConeDifference = 1.0f / (_cosInnerCone - _cosOuterCone);
|
_invCosConeDifference = 1.0f / (_cosInnerCone - _cosOuterCone);
|
||||||
const float boundsRadius = Math::Sqrt(1.25f * _radius * _radius - _radius * _radius * _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);
|
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
|
// 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 radius = GetScaledRadius();
|
||||||
const float boundsRadius = Math::Sqrt(1.25f * radius * radius - radius * radius * _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);
|
BoundingBox::FromSphere(_sphere, _box);
|
||||||
|
|
||||||
if (_sceneRenderingKey != -1)
|
if (_sceneRenderingKey != -1)
|
||||||
@@ -199,7 +199,7 @@ void SpotLight::OnDebugDrawSelected()
|
|||||||
const auto color = Color::Yellow;
|
const auto color = Color::Yellow;
|
||||||
Vector3 right = _transform.GetRight();
|
Vector3 right = _transform.GetRight();
|
||||||
Vector3 up = _transform.GetUp();
|
Vector3 up = _transform.GetUp();
|
||||||
Vector3 forward = GetDirection();
|
Vector3 forward = GetForward();
|
||||||
float radius = GetScaledRadius();
|
float radius = GetScaledRadius();
|
||||||
float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians);
|
float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians);
|
||||||
float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians);
|
float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians);
|
||||||
@@ -231,7 +231,7 @@ void SpotLight::DrawLightsDebug(RenderView& view)
|
|||||||
const auto color = Color::Yellow;
|
const auto color = Color::Yellow;
|
||||||
Vector3 right = _transform.GetRight();
|
Vector3 right = _transform.GetRight();
|
||||||
Vector3 up = _transform.GetUp();
|
Vector3 up = _transform.GetUp();
|
||||||
Vector3 forward = GetDirection();
|
Vector3 forward = GetForward();
|
||||||
float radius = GetScaledRadius();
|
float radius = GetScaledRadius();
|
||||||
float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians);
|
float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians);
|
||||||
float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians);
|
float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians);
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ namespace FlaxEngine
|
|||||||
Quaternion.Euler(180, 180, 0, out var quat);
|
Quaternion.Euler(180, 180, 0, out var quat);
|
||||||
Matrix.RotationQuaternion(ref quat, out m2);
|
Matrix.RotationQuaternion(ref quat, out m2);
|
||||||
Matrix.Multiply(ref m3, ref m2, out m1);
|
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);
|
Matrix.Multiply(ref m1, ref m2, out world);
|
||||||
}
|
}
|
||||||
else if (_renderMode == CanvasRenderMode.CameraSpace && camera)
|
else if (_renderMode == CanvasRenderMode.CameraSpace && camera)
|
||||||
|
|||||||
@@ -1052,7 +1052,8 @@ namespace Flax.Build.Bindings
|
|||||||
propertyInfo.Getter = functionInfo;
|
propertyInfo.Getter = functionInfo;
|
||||||
else
|
else
|
||||||
propertyInfo.Setter = functionInfo;
|
propertyInfo.Setter = functionInfo;
|
||||||
propertyInfo.DeprecatedMessage = functionInfo.DeprecatedMessage;
|
if (propertyInfo.DeprecatedMessage == null)
|
||||||
|
propertyInfo.DeprecatedMessage = functionInfo.DeprecatedMessage;
|
||||||
propertyInfo.IsHidden |= functionInfo.IsHidden;
|
propertyInfo.IsHidden |= functionInfo.IsHidden;
|
||||||
|
|
||||||
if (propertyInfo.Getter != null && propertyInfo.Setter != null)
|
if (propertyInfo.Getter != null && propertyInfo.Setter != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user