Merge remote-tracking branch 'origin/master' into 1.9

# Conflicts:
#	Source/Engine/Content/Storage/FlaxStorage.cpp
#	Source/Engine/Renderer/GBufferPass.cpp
This commit is contained in:
Wojtek Figat
2024-05-15 23:49:05 +02:00
54 changed files with 902 additions and 360 deletions

View File

@@ -609,7 +609,10 @@ void Actor::SetIsActive(bool value)
void Actor::SetStaticFlags(StaticFlags value)
{
if (_staticFlags == value)
return;
_staticFlags = value;
OnStaticFlagsChanged();
}
void Actor::SetTransform(const Transform& value)
@@ -1229,6 +1232,14 @@ void Actor::OnOrderInParentChanged()
Level::callActorEvent(Level::ActorEventType::OnActorOrderInParentChanged, this, nullptr);
}
void Actor::OnStaticFlagsChanged()
{
}
void Actor::OnLayerChanged()
{
}
BoundingBox Actor::GetBoxWithChildren() const
{
BoundingBox result = GetBox();

View File

@@ -886,14 +886,12 @@ public:
/// Gets rotation of the actor oriented towards the specified world position with upwards direction.
/// </summary>
/// <param name="worldPos">The world position to orient towards.</param>
/// <param name="worldUp">The up direction that Constrains y 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>
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
public:
/// <summary>
/// Execute custom action on actors tree.
/// Action should returns false to stop calling deeper.
/// First action argument is current actor object.
/// </summary>
/// <param name="action">Actor to call on every actor in the tree. Returns true if keep calling deeper.</param>
/// <param name="args">Custom arguments for the function</param>
@@ -903,14 +901,12 @@ public:
if (action(this, args...))
{
for (int32 i = 0; i < Children.Count(); i++)
Children[i]->TreeExecute<Params...>(action, args...);
Children.Get()[i]->TreeExecute<Params...>(action, args...);
}
}
/// <summary>
/// Execute custom action on actor children tree.
/// Action should returns false to stop calling deeper.
/// First action argument is current actor object.
/// </summary>
/// <param name="action">Actor to call on every actor in the tree. Returns true if keep calling deeper.</param>
/// <param name="args">Custom arguments for the function</param>
@@ -918,7 +914,7 @@ public:
void TreeExecuteChildren(Function<bool(Actor*, Params ...)>& action, Params ... args)
{
for (int32 i = 0; i < Children.Count(); i++)
Children[i]->TreeExecute<Params...>(action, args...);
Children.Get()[i]->TreeExecute<Params...>(action, args...);
}
public:
@@ -1016,12 +1012,15 @@ public:
/// </summary>
virtual void OnOrderInParentChanged();
/// <summary>
/// Called when actor static flag gets changed.
/// </summary>
virtual void OnStaticFlagsChanged();
/// <summary>
/// Called when layer gets changed.
/// </summary>
virtual void OnLayerChanged()
{
}
virtual void OnLayerChanged();
/// <summary>
/// Called when adding object to the game.

View File

@@ -33,7 +33,7 @@ void PostFxVolume::Collect(RenderContext& renderContext)
}
}
if (weight > ZeroTolerance)
if (weight > ZeroTolerance && renderContext.View.RenderLayersMask.HasLayer(GetLayer()))
{
const float totalSizeSqrt = (_transform.Scale * _size).LengthSquared();
renderContext.List->AddSettingsBlend((IPostFxSettingsProvider*)this, weight, _priority, totalSizeSqrt);

View File

@@ -99,7 +99,7 @@ void Skybox::ApplySky(GPUContext* context, RenderContext& renderContext, const M
DrawCall drawCall;
drawCall.World = world;
drawCall.ObjectPosition = drawCall.World.GetTranslation();
drawCall.ObjectRadius = _sphere.Radius;
drawCall.ObjectRadius = (float)_sphere.Radius;
drawCall.Surface.GeometrySize = _box.GetSize();
drawCall.WorldDeterminantSign = Math::FloatSelect(world.RotDeterminant(), 1, -1);
drawCall.PerInstanceRandom = GetPerInstanceRandom();

View File

@@ -410,7 +410,7 @@ void SplineModel::Draw(RenderContext& renderContext)
const Transform splineTransform = GetTransform();
renderContext.View.GetWorldMatrix(splineTransform, drawCall.World);
drawCall.ObjectPosition = drawCall.World.GetTranslation() + drawCall.Deformable.LocalMatrix.GetTranslation();
drawCall.ObjectRadius = _sphere.Radius; // TODO: use radius for the spline chunk rather than whole spline
drawCall.ObjectRadius = (float)_sphere.Radius; // TODO: use radius for the spline chunk rather than whole spline
const float worldDeterminantSign = drawCall.World.RotDeterminant() * drawCall.Deformable.LocalMatrix.RotDeterminant();
for (int32 segment = 0; segment < _instances.Count(); segment++)
{

View File

@@ -30,6 +30,12 @@ bool SceneAsset::IsInternalType() const
return true;
}
void SceneNavigation::Clear()
{
Volumes.Clear();
Actors.Clear();
}
BoundingBox SceneNavigation::GetNavigationBounds()
{
if (Volumes.IsEmpty())
@@ -373,6 +379,7 @@ void Scene::EndPlay()
// Improve scene cleanup performance by removing all data from scene rendering and ticking containers
Ticking.Clear();
Rendering.Clear();
Navigation.Clear();
// Base
Actor::EndPlay();

View File

@@ -23,6 +23,17 @@ public:
/// </summary>
Array<NavMesh*> Meshes;
/// <summary>
/// The list of registered navigation-relevant actors (on the scene).
/// </summary>
Array<Actor*> Actors;
public:
/// <summary>
/// Clears this instance data.
/// </summary>
void Clear();
/// <summary>
/// Gets the total navigation volumes bounds.
/// </summary>

View File

@@ -18,7 +18,7 @@ class FLAXENGINE_API SceneQuery
{
public:
/// <summary>
/// Try to find actor hit by the given ray
/// Try to find actor hit by the given ray.
/// </summary>
/// <param name="ray">Ray to test</param>
/// <returns>Hit actor or nothing</returns>
@@ -55,19 +55,16 @@ public:
public:
/// <summary>
/// Execute custom action on actors tree.
/// Action should returns false to stop calling deeper.
/// First action argument is current actor object.
/// </summary>
/// <param name="action">Actor to call on every actor in the tree. Returns true if keep calling deeper.</param>
/// <param name="args">Custom arguments for the function</param>
template<typename... Params>
static void TreeExecute(Function<bool(Actor*, Params ...)>& action, Params ... args)
static void TreeExecute(Function<bool(Actor*, Params...)>& action, Params... args)
{
#if SCENE_QUERIES_WITH_LOCK
ScopeLock lock(Level::ScenesLock);
#endif
for (int32 i = 0; i < Level::Scenes.Count(); i++)
Level::Scenes[i]->TreeExecute<Params...>(action, args...);
Level::Scenes.Get()[i]->TreeExecute<Params...>(action, args...);
}
};