Merge branch '1.5' into dotnet7
# Conflicts: # Content/Shaders/GI/DDGI.flax # Content/Shaders/GI/GlobalSurfaceAtlas.flax # Content/Shaders/TAA.flax # Content/Shaders/VolumetricFog.flax # Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs
This commit is contained in:
@@ -350,7 +350,7 @@ public:
|
||||
/// </summary>
|
||||
FORCE_INLINE bool IsTransformStatic() const
|
||||
{
|
||||
return (_staticFlags & StaticFlags::Transform) != 0;
|
||||
return (_staticFlags & StaticFlags::Transform) != StaticFlags::None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -373,7 +373,7 @@ public:
|
||||
/// </summary>
|
||||
FORCE_INLINE bool HasStaticFlag(StaticFlags flag) const
|
||||
{
|
||||
return (_staticFlags & flag) == (int)flag;
|
||||
return EnumHasAllFlags(_staticFlags, flag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -391,7 +391,7 @@ public:
|
||||
/// <param name="flags">The flags to remove.</param>
|
||||
FORCE_INLINE void RemoveStaticFlags(StaticFlags flags)
|
||||
{
|
||||
SetStaticFlags(static_cast<StaticFlags>(_staticFlags & ~flags));
|
||||
SetStaticFlags(_staticFlags & ~flags);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -401,7 +401,7 @@ public:
|
||||
/// <param name="value">The target value of the flag.</param>
|
||||
FORCE_INLINE void SetStaticFlag(StaticFlags flag, bool value)
|
||||
{
|
||||
SetStaticFlags(static_cast<StaticFlags>(_staticFlags & ~flag) | (value ? flag : StaticFlags::None));
|
||||
SetStaticFlags((_staticFlags & ~flag) | (value ? flag : StaticFlags::None));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -730,7 +730,7 @@ void AnimatedModel::Draw(RenderContext& renderContext)
|
||||
draw.World = &world;
|
||||
draw.DrawState = &_drawState;
|
||||
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
||||
draw.DrawModes = (DrawPass)(DrawModes & renderContext.View.GetShadowsDrawPassMask(ShadowsMode));
|
||||
draw.DrawModes = DrawModes & renderContext.View.GetShadowsDrawPassMask(ShadowsMode);
|
||||
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
||||
draw.Bounds = _sphere;
|
||||
draw.Bounds.Center -= renderContext.View.Origin;
|
||||
@@ -785,7 +785,7 @@ void AnimatedModel::Draw(RenderContextBatch& renderContextBatch)
|
||||
// TODO: maybe deserialize ShadowsMode into ModelInstanceBuffer entries options?
|
||||
for (auto& e : renderContextBatch.Contexts)
|
||||
{
|
||||
draw.DrawModes = (DrawPass)(DrawModes & e.View.GetShadowsDrawPassMask(ShadowsMode));
|
||||
draw.DrawModes = DrawModes & e.View.GetShadowsDrawPassMask(ShadowsMode);
|
||||
SkinnedModel->Draw(e, draw);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ bool Camera::HasContentLoaded() const
|
||||
|
||||
void Camera::Draw(RenderContext& renderContext)
|
||||
{
|
||||
if (renderContext.View.Flags & ViewFlags::EditorSprites
|
||||
if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::EditorSprites)
|
||||
&& _previewModel
|
||||
&& _previewModel->IsLoaded())
|
||||
{
|
||||
@@ -291,7 +291,7 @@ void Camera::Draw(RenderContext& renderContext)
|
||||
draw.Lightmap = nullptr;
|
||||
draw.LightmapUVs = nullptr;
|
||||
draw.Flags = StaticFlags::Transform;
|
||||
draw.DrawModes = (DrawPass)((DrawPass::Depth | DrawPass::GBuffer | DrawPass::Forward) & renderContext.View.Pass);
|
||||
draw.DrawModes = (DrawPass::Depth | DrawPass::GBuffer | DrawPass::Forward) & renderContext.View.Pass;
|
||||
BoundingSphere::FromBox(_previewModelBox, draw.Bounds);
|
||||
draw.Bounds.Center -= renderContext.View.Origin;
|
||||
draw.PerInstanceRandom = GetPerInstanceRandom();
|
||||
|
||||
@@ -69,8 +69,8 @@ void Decal::OnLayerChanged()
|
||||
|
||||
void Decal::Draw(RenderContext& renderContext)
|
||||
{
|
||||
if ((renderContext.View.Flags & ViewFlags::Decals) != 0 &&
|
||||
renderContext.View.Pass & DrawPass::GBuffer &&
|
||||
if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::Decals) &&
|
||||
EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer) &&
|
||||
Material &&
|
||||
Material->IsLoaded() &&
|
||||
Material->IsDecal())
|
||||
|
||||
@@ -20,8 +20,8 @@ void DirectionalLight::Draw(RenderContext& renderContext)
|
||||
AdjustBrightness(renderContext.View, brightness);
|
||||
const Float3 position = GetPosition() - renderContext.View.Origin;
|
||||
if (Brightness > ZeroTolerance
|
||||
&& (renderContext.View.Flags & ViewFlags::DirectionalLights) != 0
|
||||
&& renderContext.View.Pass & DrawPass::GBuffer
|
||||
&& EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::DirectionalLights)
|
||||
&& EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer)
|
||||
&& (ViewDistance < ZeroTolerance || Float3::DistanceSquared(renderContext.View.Position, position) < ViewDistance * ViewDistance))
|
||||
{
|
||||
RendererDirectionalLightData data;
|
||||
|
||||
@@ -178,8 +178,8 @@ void EnvironmentProbe::UpdateBounds()
|
||||
void EnvironmentProbe::Draw(RenderContext& renderContext)
|
||||
{
|
||||
if (Brightness > ZeroTolerance &&
|
||||
(renderContext.View.Flags & ViewFlags::Reflections) != 0 &&
|
||||
renderContext.View.Pass & DrawPass::GBuffer)
|
||||
EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::Reflections) &&
|
||||
EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer))
|
||||
{
|
||||
if (UpdateMode == ProbeUpdateMode::Realtime)
|
||||
ProbesRenderer::Bake(this, 0.0f);
|
||||
|
||||
@@ -35,8 +35,8 @@ void ExponentialHeightFog::Draw(RenderContext& renderContext)
|
||||
{
|
||||
// Render only when shader is valid and fog can be rendered
|
||||
// Do not render exponential fog in orthographic views
|
||||
if ((renderContext.View.Flags & ViewFlags::Fog) != 0
|
||||
&& renderContext.View.Pass & DrawPass::GBuffer
|
||||
if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::Fog)
|
||||
&& EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer)
|
||||
&& _shader
|
||||
&& _shader->IsLoaded()
|
||||
&& renderContext.View.IsPerspectiveProjection())
|
||||
|
||||
@@ -83,9 +83,9 @@ void PointLight::Draw(RenderContext& renderContext)
|
||||
AdjustBrightness(renderContext.View, brightness);
|
||||
const Float3 position = GetPosition() - renderContext.View.Origin;
|
||||
const float radius = GetScaledRadius();
|
||||
if ((renderContext.View.Flags & ViewFlags::PointLights) != 0
|
||||
if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::PointLights)
|
||||
&& EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer)
|
||||
&& brightness > ZeroTolerance
|
||||
&& renderContext.View.Pass & DrawPass::GBuffer
|
||||
&& radius > ZeroTolerance
|
||||
&& (ViewDistance < ZeroTolerance || Vector3::DistanceSquared(renderContext.View.Position, position) < ViewDistance * ViewDistance))
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ void Sky::DrawFog(GPUContext* context, RenderContext& renderContext, GPUTextureV
|
||||
data.ViewOffset = renderContext.View.Origin + GetPosition();
|
||||
InitConfig(data.Fog);
|
||||
data.Fog.AtmosphericFogSunPower *= SunLight ? SunLight->Brightness : 1.0f;
|
||||
bool useSpecularLight = (renderContext.View.Flags & ViewFlags::SpecularLight) != 0;
|
||||
bool useSpecularLight = EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::SpecularLight);
|
||||
if (!useSpecularLight)
|
||||
{
|
||||
data.Fog.AtmosphericFogSunDiscScale = 0;
|
||||
@@ -223,7 +223,7 @@ void Sky::ApplySky(GPUContext* context, RenderContext& renderContext, const Matr
|
||||
data.ViewOffset = renderContext.View.Origin + GetPosition();
|
||||
InitConfig(data.Fog);
|
||||
//data.Fog.AtmosphericFogSunPower *= SunLight ? SunLight->Brightness : 1.0f;
|
||||
bool useSpecularLight = (renderContext.View.Flags & ViewFlags::SpecularLight) != 0;
|
||||
bool useSpecularLight = EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::SpecularLight);
|
||||
if (!useSpecularLight)
|
||||
{
|
||||
// Hide sun disc if specular light is disabled
|
||||
|
||||
@@ -106,8 +106,8 @@ void SkyLight::Draw(RenderContext& renderContext)
|
||||
float brightness = Brightness;
|
||||
AdjustBrightness(renderContext.View, brightness);
|
||||
const Float3 position = GetPosition() - renderContext.View.Origin;
|
||||
if ((renderContext.View.Flags & ViewFlags::SkyLights) != 0
|
||||
&& renderContext.View.Pass & DrawPass::GBuffer
|
||||
if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::SkyLights)
|
||||
&& EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer)
|
||||
&& brightness > ZeroTolerance
|
||||
&& (ViewDistance < ZeroTolerance || Vector3::DistanceSquared(renderContext.View.Position, position) < ViewDistance * ViewDistance))
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ void Skybox::Draw(RenderContext& renderContext)
|
||||
bool isReady;
|
||||
if (CustomMaterial)
|
||||
{
|
||||
isReady = CustomMaterial->IsLoaded() && CustomMaterial->IsSurface() && CustomMaterial->GetDrawModes() & DrawPass::GBuffer;
|
||||
isReady = CustomMaterial->IsLoaded() && CustomMaterial->IsSurface() && EnumHasAnyFlags(CustomMaterial->GetDrawModes(), DrawPass::GBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -348,7 +348,7 @@ bool SplineModel::HasContentLoaded() const
|
||||
|
||||
void SplineModel::Draw(RenderContext& renderContext)
|
||||
{
|
||||
const DrawPass actorDrawModes = (DrawPass)(DrawModes & renderContext.View.Pass);
|
||||
const DrawPass actorDrawModes = DrawModes & renderContext.View.Pass;
|
||||
if (!_spline || !Model || !Model->IsLoaded() || !Model->CanBeRendered() || actorDrawModes == DrawPass::None)
|
||||
return;
|
||||
auto model = Model.Get();
|
||||
@@ -428,8 +428,8 @@ void SplineModel::Draw(RenderContext& renderContext)
|
||||
continue;
|
||||
|
||||
// Check if skip rendering
|
||||
const auto shadowsMode = static_cast<ShadowsCastingMode>(entry.ShadowsMode & slot.ShadowsMode);
|
||||
const auto drawModes = static_cast<DrawPass>(actorDrawModes & renderContext.View.GetShadowsDrawPassMask(shadowsMode) & (uint32)material->GetDrawModes());
|
||||
const auto shadowsMode = entry.ShadowsMode & slot.ShadowsMode;
|
||||
const auto drawModes = actorDrawModes & renderContext.View.GetShadowsDrawPassMask(shadowsMode) & material->GetDrawModes();
|
||||
if (drawModes == DrawPass::None)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -132,8 +132,8 @@ void SpotLight::Draw(RenderContext& renderContext)
|
||||
const Float3 position = GetPosition() - renderContext.View.Origin;
|
||||
const float radius = GetScaledRadius();
|
||||
const float outerConeAngle = GetOuterConeAngle();
|
||||
if ((renderContext.View.Flags & ViewFlags::SpotLights) != 0
|
||||
&& renderContext.View.Pass & DrawPass::GBuffer
|
||||
if (EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::SpotLights)
|
||||
&& EnumHasAnyFlags(renderContext.View.Pass, DrawPass::GBuffer)
|
||||
&& brightness > ZeroTolerance
|
||||
&& radius > ZeroTolerance
|
||||
&& outerConeAngle > ZeroTolerance
|
||||
|
||||
@@ -262,13 +262,13 @@ void StaticModel::Draw(RenderContext& renderContext)
|
||||
return;
|
||||
if (renderContext.View.Pass == DrawPass::GlobalSDF)
|
||||
{
|
||||
if (DrawModes & DrawPass::GlobalSDF)
|
||||
if (EnumHasAnyFlags(DrawModes, DrawPass::GlobalSDF))
|
||||
GlobalSignDistanceFieldPass::Instance()->RasterizeModelSDF(this, Model->SDF, _transform, _box);
|
||||
return;
|
||||
}
|
||||
if (renderContext.View.Pass == DrawPass::GlobalSurfaceAtlas)
|
||||
{
|
||||
if (DrawModes & DrawPass::GlobalSurfaceAtlas)
|
||||
if (EnumHasAnyFlags(DrawModes, DrawPass::GlobalSurfaceAtlas))
|
||||
GlobalSurfaceAtlasPass::Instance()->RasterizeActor(this, this, _sphere, _transform, Model->LODs.Last().GetBox());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void PrefabInstanceData::CollectPrefabInstances(Array<PrefabInstanceData>& prefa
|
||||
for (int32 instanceIndex = 0; instanceIndex < instances.Count(); instanceIndex++)
|
||||
{
|
||||
const auto instance = instances[instanceIndex];
|
||||
if ((instance->Flags & ObjectFlags::WasMarkedToDelete) != 0)
|
||||
if (EnumHasAnyFlags(instance->Flags, ObjectFlags::WasMarkedToDelete))
|
||||
continue;
|
||||
if (instance != defaultInstance && targetActor != instance && !targetActor->HasActorInHierarchy(instance))
|
||||
usedCount++;
|
||||
@@ -195,7 +195,7 @@ void PrefabInstanceData::CollectPrefabInstances(Array<PrefabInstanceData>& prefa
|
||||
{
|
||||
// Skip default instance because it will be recreated, skip input actor because it needs just to be linked
|
||||
Actor* instance = instances[instanceIndex];
|
||||
if ((instance->Flags & ObjectFlags::WasMarkedToDelete) != 0)
|
||||
if (EnumHasAnyFlags(instance->Flags, ObjectFlags::WasMarkedToDelete))
|
||||
continue;
|
||||
if (instance != defaultInstance && targetActor != instance && !targetActor->HasActorInHierarchy(instance))
|
||||
{
|
||||
@@ -268,7 +268,7 @@ bool PrefabInstanceData::SynchronizePrefabInstances(Array<PrefabInstanceData>& p
|
||||
|
||||
// If prefab object root was changed during changes apply then update the TargetActor to point a valid object
|
||||
Actor* oldTargetActor = instance.TargetActor;
|
||||
if (!oldTargetActor || (oldTargetActor->Flags & ObjectFlags::WasMarkedToDelete) != 0)
|
||||
if (!oldTargetActor || EnumHasAnyFlags(oldTargetActor->Flags, ObjectFlags::WasMarkedToDelete))
|
||||
continue;
|
||||
Actor* newTargetActor = FindActorWithPrefabObjectId(instance.TargetActor, defaultInstance->GetID());
|
||||
if (!newTargetActor)
|
||||
@@ -670,7 +670,7 @@ bool Prefab::ApplyAll(Actor* targetActor)
|
||||
for (int32 i = 0; i < nestedPrefabIds.Count(); i++)
|
||||
{
|
||||
const auto nestedPrefab = Content::LoadAsync<Prefab>(nestedPrefabIds[i]);
|
||||
if (nestedPrefab && nestedPrefab != this && (nestedPrefab->Flags & ObjectFlags::WasMarkedToDelete) == 0)
|
||||
if (nestedPrefab && nestedPrefab != this && (nestedPrefab->Flags & ObjectFlags::WasMarkedToDelete) == ObjectFlags::None)
|
||||
{
|
||||
allPrefabs.Add(nestedPrefab);
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ bool PrefabManager::CreatePrefab(Actor* targetActor, const StringView& outputPat
|
||||
LOG(Error, "Cannot create prefab from scene actor.");
|
||||
return true;
|
||||
}
|
||||
if ((targetActor->HideFlags & HideFlags::DontSave) != 0)
|
||||
if (EnumHasAnyFlags(targetActor->HideFlags, HideFlags::DontSave))
|
||||
{
|
||||
LOG(Error, "Cannot create prefab from actor marked with HideFlags.DontSave.");
|
||||
return true;
|
||||
|
||||
@@ -85,10 +85,10 @@ void SceneRendering::Draw(RenderContextBatch& renderContextBatch, DrawCategory c
|
||||
}
|
||||
|
||||
#if USE_EDITOR
|
||||
if (view.Pass & DrawPass::GBuffer && category == SceneDraw)
|
||||
if (EnumHasAnyFlags(view.Pass, DrawPass::GBuffer) && category == SceneDraw)
|
||||
{
|
||||
// Draw physics shapes
|
||||
if (view.Flags & ViewFlags::PhysicsDebug || view.Mode == ViewMode::PhysicsColliders)
|
||||
if (EnumHasAnyFlags(view.Flags, ViewFlags::PhysicsDebug) || view.Mode == ViewMode::PhysicsColliders)
|
||||
{
|
||||
const PhysicsDebugCallback* physicsDebugData = PhysicsDebug.Get();
|
||||
for (int32 i = 0; i < PhysicsDebug.Count(); i++)
|
||||
@@ -203,7 +203,7 @@ void SceneRendering::DrawActorsJob(int32)
|
||||
// Offline pass with additional static flags culling
|
||||
FOR_EACH_BATCH_ACTOR
|
||||
e.Bounds.Center -= view.Origin;
|
||||
if (CHECK_ACTOR && e.Actor->GetStaticFlags() & view.StaticFlagsMask)
|
||||
if (CHECK_ACTOR && (e.Actor->GetStaticFlags() & view.StaticFlagsMask) != StaticFlags::None)
|
||||
{
|
||||
DRAW_ACTOR(*_drawBatch);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ void SceneObject::Serialize(SerializeStream& stream, const void* otherObj)
|
||||
|
||||
#if !COMPILE_WITHOUT_CSHARP
|
||||
// Handle C# objects data serialization
|
||||
if (Flags & ObjectFlags::IsManagedType)
|
||||
if (EnumHasAnyFlags(Flags, ObjectFlags::IsManagedType))
|
||||
{
|
||||
stream.JKEY("V");
|
||||
if (other)
|
||||
@@ -134,7 +134,7 @@ void SceneObject::Serialize(SerializeStream& stream, const void* otherObj)
|
||||
#endif
|
||||
|
||||
// Handle custom scripting objects data serialization
|
||||
if (Flags & ObjectFlags::IsCustomScriptingType)
|
||||
if (EnumHasAnyFlags(Flags, ObjectFlags::IsCustomScriptingType))
|
||||
{
|
||||
stream.JKEY("D");
|
||||
_type.Module->SerializeObject(stream, this, other);
|
||||
@@ -150,7 +150,7 @@ void SceneObject::Deserialize(DeserializeStream& stream, ISerializeModifier* mod
|
||||
|
||||
#if !COMPILE_WITHOUT_CSHARP
|
||||
// Handle C# objects data serialization
|
||||
if (Flags & ObjectFlags::IsManagedType)
|
||||
if (EnumHasAnyFlags(Flags, ObjectFlags::IsManagedType))
|
||||
{
|
||||
auto* const v = SERIALIZE_FIND_MEMBER(stream, "V");
|
||||
if (v != stream.MemberEnd() && v->value.IsObject() && v->value.MemberCount() != 0)
|
||||
@@ -161,7 +161,7 @@ void SceneObject::Deserialize(DeserializeStream& stream, ISerializeModifier* mod
|
||||
#endif
|
||||
|
||||
// Handle custom scripting objects data serialization
|
||||
if (Flags & ObjectFlags::IsCustomScriptingType)
|
||||
if (EnumHasAnyFlags(Flags, ObjectFlags::IsCustomScriptingType))
|
||||
{
|
||||
auto* const v = SERIALIZE_FIND_MEMBER(stream, "D");
|
||||
if (v != stream.MemberEnd() && v->value.IsObject() && v->value.MemberCount() != 0)
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
/// </summary>
|
||||
API_PROPERTY() FORCE_INLINE bool IsDuringPlay() const
|
||||
{
|
||||
return (Flags & ObjectFlags::IsDuringPlay) != 0;
|
||||
return (Flags & ObjectFlags::IsDuringPlay) == ObjectFlags::IsDuringPlay;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -54,7 +54,7 @@ void SceneQuery::GetAllSceneObjects(Actor* root, Array<SceneObject*>& objects)
|
||||
|
||||
bool GetAllSerializableSceneObjectsQuery(Actor* actor, Array<SceneObject*>& objects)
|
||||
{
|
||||
if ((actor->HideFlags & HideFlags::DontSave) != 0)
|
||||
if (EnumHasAnyFlags(actor->HideFlags, HideFlags::DontSave))
|
||||
return false;
|
||||
|
||||
objects.Add(actor);
|
||||
|
||||
Reference in New Issue
Block a user