Cleanup some code
This commit is contained in:
@@ -248,7 +248,7 @@ public:
|
||||
/// <returns>True if the current BoundingFrustum intersects a BoundingBox, otherwise false.</returns>
|
||||
FORCE_INLINE bool Intersects(const BoundingBox& box) const
|
||||
{
|
||||
return CollisionsHelper::FrustumIntersectsBox(*this, box);
|
||||
return CollisionsHelper::FrustumContainsBox(*this, box) != ContainmentType::Disjoint;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -1301,43 +1301,33 @@ bool CollisionsHelper::FrustumIntersectsBox(const BoundingFrustum& frustum, cons
|
||||
|
||||
ContainmentType CollisionsHelper::FrustumContainsBox(const BoundingFrustum& frustum, const BoundingBox& box)
|
||||
{
|
||||
Vector3 p, n;
|
||||
Plane plane;
|
||||
auto result = ContainmentType::Contains;
|
||||
|
||||
for (int32 i = 0; i < 6; i++)
|
||||
{
|
||||
plane = frustum.GetPlane(i);
|
||||
GetBoxToPlanePVertexNVertex(box, plane.Normal, p, n);
|
||||
|
||||
Plane plane = frustum.GetPlane(i);
|
||||
Vector3 p = box.Minimum;
|
||||
if (plane.Normal.X >= 0)
|
||||
p.X = box.Maximum.X;
|
||||
if (plane.Normal.Y >= 0)
|
||||
p.Y = box.Maximum.Y;
|
||||
if (plane.Normal.Z >= 0)
|
||||
p.Z = box.Maximum.Z;
|
||||
if (PlaneIntersectsPoint(plane, p) == PlaneIntersectionType::Back)
|
||||
return ContainmentType::Disjoint;
|
||||
|
||||
if (PlaneIntersectsPoint(plane, n) == PlaneIntersectionType::Back)
|
||||
p = box.Maximum;
|
||||
if (plane.Normal.X >= 0)
|
||||
p.X = box.Minimum.X;
|
||||
if (plane.Normal.Y >= 0)
|
||||
p.Y = box.Minimum.Y;
|
||||
if (plane.Normal.Z >= 0)
|
||||
p.Z = box.Minimum.Z;
|
||||
if (PlaneIntersectsPoint(plane, p) == PlaneIntersectionType::Back)
|
||||
result = ContainmentType::Intersects;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void CollisionsHelper::GetBoxToPlanePVertexNVertex(const BoundingBox& box, const Vector3& planeNormal, Vector3& p, Vector3& n)
|
||||
{
|
||||
p = box.Minimum;
|
||||
if (planeNormal.X >= 0)
|
||||
p.X = box.Maximum.X;
|
||||
if (planeNormal.Y >= 0)
|
||||
p.Y = box.Maximum.Y;
|
||||
if (planeNormal.Z >= 0)
|
||||
p.Z = box.Maximum.Z;
|
||||
|
||||
n = box.Maximum;
|
||||
if (planeNormal.X >= 0)
|
||||
n.X = box.Minimum.X;
|
||||
if (planeNormal.Y >= 0)
|
||||
n.Y = box.Minimum.Y;
|
||||
if (planeNormal.Z >= 0)
|
||||
n.Z = box.Minimum.Z;
|
||||
}
|
||||
|
||||
bool CollisionsHelper::LineIntersectsLine(const Vector2& l1p1, const Vector2& l1p2, const Vector2& l2p1, const Vector2& l2p2)
|
||||
{
|
||||
float q = (l1p1.Y - l2p1.Y) * (l2p2.X - l2p1.X) - (l1p1.X - l2p1.X) * (l2p2.Y - l2p1.Y);
|
||||
|
||||
@@ -550,8 +550,6 @@ public:
|
||||
|
||||
static ContainmentType FrustumContainsBox(const BoundingFrustum& frustum, const BoundingBox& box);
|
||||
|
||||
static void GetBoxToPlanePVertexNVertex(const BoundingBox& box, const Vector3& planeNormal, Vector3& p, Vector3& n);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a line intersects with the other line.
|
||||
/// </summary>
|
||||
|
||||
@@ -175,6 +175,15 @@ void GPUResource::OnReleaseGPU()
|
||||
{
|
||||
}
|
||||
|
||||
String GPUResource::ToString() const
|
||||
{
|
||||
#if GPU_ENABLE_RESOURCE_NAMING
|
||||
return GetName();
|
||||
#else
|
||||
return TEXT("GPU Resource");
|
||||
#endif
|
||||
}
|
||||
|
||||
void GPUResource::OnDeleteObject()
|
||||
{
|
||||
ReleaseGPU();
|
||||
|
||||
@@ -126,14 +126,7 @@ protected:
|
||||
public:
|
||||
|
||||
// [PersistentScriptingObject]
|
||||
String ToString() const override
|
||||
{
|
||||
#if GPU_ENABLE_RESOURCE_NAMING
|
||||
return GetName();
|
||||
#else
|
||||
return TEXT("GPU Resource");
|
||||
#endif
|
||||
}
|
||||
String ToString() const override;
|
||||
void OnDeleteObject() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -45,12 +45,8 @@ public:
|
||||
void Initialize(uint32 subresourceCount, StateType initialState, bool usePerSubresourceTracking)
|
||||
{
|
||||
ASSERT(_subresourceState.IsEmpty() && subresourceCount > 0);
|
||||
|
||||
// Initialize state
|
||||
_allSubresourcesSame = true;
|
||||
_resourceState = initialState;
|
||||
|
||||
// Allocate space for per-subresource state tracking
|
||||
if (usePerSubresourceTracking && subresourceCount > 1)
|
||||
_subresourceState.Resize(subresourceCount, false);
|
||||
#if BUILD_DEBUG
|
||||
@@ -82,29 +78,19 @@ public:
|
||||
bool CheckResourceState(StateType state) const
|
||||
{
|
||||
if (_allSubresourcesSame)
|
||||
{
|
||||
return state == _resourceState;
|
||||
}
|
||||
|
||||
// Check all subresources
|
||||
for (int32 i = 0; i < _subresourceState.Count(); i++)
|
||||
{
|
||||
if (_subresourceState[i] != state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
StateType GetSubresourceState(uint32 subresourceIndex) const
|
||||
{
|
||||
if (_allSubresourcesSame)
|
||||
{
|
||||
return _resourceState;
|
||||
}
|
||||
|
||||
ASSERT(subresourceIndex >= 0 && subresourceIndex < static_cast<uint32>(_subresourceState.Count()));
|
||||
return _subresourceState[subresourceIndex];
|
||||
}
|
||||
@@ -113,12 +99,9 @@ public:
|
||||
{
|
||||
_allSubresourcesSame = 1;
|
||||
_resourceState = state;
|
||||
|
||||
#if BUILD_DEBUG
|
||||
for (int32 i = 0; i < _subresourceState.Count(); i++)
|
||||
{
|
||||
_subresourceState[i] = InvalidState;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -137,9 +120,7 @@ public:
|
||||
if (_allSubresourcesSame)
|
||||
{
|
||||
for (int32 i = 0; i < _subresourceState.Count(); i++)
|
||||
{
|
||||
_subresourceState[i] = _resourceState;
|
||||
}
|
||||
_allSubresourcesSame = 0;
|
||||
#if BUILD_DEBUG
|
||||
_resourceState = InvalidState;
|
||||
|
||||
@@ -77,15 +77,6 @@ API_ENUM() enum class MaterialBlendMode : byte
|
||||
Multiply = 3,
|
||||
};
|
||||
|
||||
// Old material blending mode used before introducing MaterialShadingModel
|
||||
// [Deprecated on 10.09.2018, expires on 10.05.2019]
|
||||
enum class OldMaterialBlendMode : byte
|
||||
{
|
||||
Opaque = 0,
|
||||
Transparent = 1,
|
||||
Unlit = 2,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material shading modes. Defines how material inputs and properties are combined to result the final surface color.
|
||||
/// </summary>
|
||||
@@ -417,243 +408,6 @@ API_ENUM() enum class MaterialSceneTextures
|
||||
ShadingModel = 10,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 1
|
||||
/// [Deprecated on 10.09.2018, expires on 10.05.2019]
|
||||
/// </summary>
|
||||
struct MaterialInfo1
|
||||
{
|
||||
int32 Version;
|
||||
MaterialDomain Domain;
|
||||
OldMaterialBlendMode BlendMode;
|
||||
MaterialFlags_Deprecated Flags;
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo1& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& Flags == other.Flags;
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 2
|
||||
/// [Deprecated on 10.09.2018, expires on 10.05.2019]
|
||||
/// </summary>
|
||||
struct MaterialInfo2
|
||||
{
|
||||
int32 Version;
|
||||
MaterialDomain Domain;
|
||||
OldMaterialBlendMode BlendMode;
|
||||
MaterialFlags_Deprecated Flags;
|
||||
MaterialTransparentLighting_Deprecated TransparentLighting;
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo2& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& Flags == other.Flags;
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 3
|
||||
/// [Deprecated on 10.09.2018, expires on 10.05.2019]
|
||||
/// </summary>
|
||||
struct MaterialInfo3
|
||||
{
|
||||
MaterialDomain Domain;
|
||||
OldMaterialBlendMode BlendMode;
|
||||
MaterialFlags_Deprecated Flags;
|
||||
MaterialTransparentLighting_Deprecated TransparentLighting;
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo3& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& Flags == other.Flags;
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 4
|
||||
/// [Deprecated on 10.09.2018, expires on 10.05.2019]
|
||||
/// </summary>
|
||||
struct MaterialInfo4
|
||||
{
|
||||
MaterialDomain Domain;
|
||||
OldMaterialBlendMode BlendMode;
|
||||
MaterialFlags_Deprecated Flags;
|
||||
MaterialTransparentLighting_Deprecated TransparentLighting;
|
||||
MaterialPostFxLocation PostFxLocation;
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo4& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& Flags == other.Flags;
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 5
|
||||
/// [Deprecated on 10.09.2018, expires on 10.05.2019]
|
||||
/// </summary>
|
||||
struct MaterialInfo5
|
||||
{
|
||||
MaterialDomain Domain;
|
||||
OldMaterialBlendMode BlendMode;
|
||||
MaterialFlags_Deprecated Flags;
|
||||
MaterialTransparentLighting_Deprecated TransparentLighting;
|
||||
MaterialPostFxLocation PostFxLocation;
|
||||
float MaskThreshold;
|
||||
float OpacityThreshold;
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo5& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||
&& Flags == other.Flags;
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 6
|
||||
/// [Deprecated on 10.09.2018, expires on 10.05.2019]
|
||||
/// </summary>
|
||||
struct MaterialInfo6
|
||||
{
|
||||
MaterialDomain Domain;
|
||||
OldMaterialBlendMode BlendMode;
|
||||
MaterialFlags_Deprecated Flags;
|
||||
MaterialTransparentLighting_Deprecated TransparentLighting;
|
||||
MaterialDecalBlendingMode DecalBlendingMode;
|
||||
MaterialPostFxLocation PostFxLocation;
|
||||
float MaskThreshold;
|
||||
float OpacityThreshold;
|
||||
|
||||
MaterialInfo6()
|
||||
{
|
||||
}
|
||||
|
||||
MaterialInfo6(const MaterialInfo5& other)
|
||||
{
|
||||
Domain = other.Domain;
|
||||
BlendMode = other.BlendMode;
|
||||
Flags = other.Flags;
|
||||
TransparentLighting = other.TransparentLighting;
|
||||
DecalBlendingMode = MaterialDecalBlendingMode::Translucent;
|
||||
PostFxLocation = other.PostFxLocation;
|
||||
MaskThreshold = other.MaskThreshold;
|
||||
OpacityThreshold = other.OpacityThreshold;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo6& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& DecalBlendingMode == other.DecalBlendingMode
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||
&& Flags == other.Flags;
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 7
|
||||
/// [Deprecated on 13.09.2018, expires on 13.12.2018]
|
||||
/// </summary>
|
||||
struct MaterialInfo7
|
||||
{
|
||||
MaterialDomain Domain;
|
||||
OldMaterialBlendMode BlendMode;
|
||||
MaterialFlags_Deprecated Flags;
|
||||
MaterialTransparentLighting_Deprecated TransparentLighting;
|
||||
MaterialDecalBlendingMode DecalBlendingMode;
|
||||
MaterialPostFxLocation PostFxLocation;
|
||||
float MaskThreshold;
|
||||
float OpacityThreshold;
|
||||
TessellationMethod TessellationMode;
|
||||
int32 MaxTessellationFactor;
|
||||
|
||||
MaterialInfo7()
|
||||
{
|
||||
}
|
||||
|
||||
MaterialInfo7(const MaterialInfo6& other)
|
||||
{
|
||||
Domain = other.Domain;
|
||||
BlendMode = other.BlendMode;
|
||||
Flags = other.Flags;
|
||||
TransparentLighting = other.TransparentLighting;
|
||||
DecalBlendingMode = other.DecalBlendingMode;
|
||||
PostFxLocation = other.PostFxLocation;
|
||||
MaskThreshold = other.MaskThreshold;
|
||||
OpacityThreshold = other.OpacityThreshold;
|
||||
TessellationMode = TessellationMethod::None;
|
||||
MaxTessellationFactor = 15;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo7& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& DecalBlendingMode == other.DecalBlendingMode
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||
&& Flags == other.Flags
|
||||
&& TessellationMode == other.TessellationMode
|
||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Material info structure - version 8
|
||||
/// [Deprecated on 24.07.2019, expires on 10.05.2021]
|
||||
@@ -676,53 +430,7 @@ struct MaterialInfo8
|
||||
{
|
||||
}
|
||||
|
||||
MaterialInfo8(const MaterialInfo7& other)
|
||||
{
|
||||
Domain = other.Domain;
|
||||
switch (other.BlendMode)
|
||||
{
|
||||
case OldMaterialBlendMode::Opaque:
|
||||
BlendMode = MaterialBlendMode::Opaque;
|
||||
ShadingModel = MaterialShadingModel::Lit;
|
||||
break;
|
||||
case OldMaterialBlendMode::Transparent:
|
||||
BlendMode = MaterialBlendMode::Transparent;
|
||||
ShadingModel = MaterialShadingModel::Lit;
|
||||
break;
|
||||
case OldMaterialBlendMode::Unlit:
|
||||
BlendMode = MaterialBlendMode::Opaque;
|
||||
ShadingModel = MaterialShadingModel::Unlit;
|
||||
break;
|
||||
}
|
||||
Flags = other.Flags;
|
||||
TransparentLighting = other.TransparentLighting;
|
||||
DecalBlendingMode = other.DecalBlendingMode;
|
||||
PostFxLocation = other.PostFxLocation;
|
||||
MaskThreshold = other.MaskThreshold;
|
||||
OpacityThreshold = other.OpacityThreshold;
|
||||
TessellationMode = other.TessellationMode;
|
||||
MaxTessellationFactor = other.MaxTessellationFactor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compare structure with other one
|
||||
/// </summary>
|
||||
/// <param name="other">Other structure to compare</param>
|
||||
/// <returns>True if both structures are equal</returns>
|
||||
bool operator==(const MaterialInfo8& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& ShadingModel == other.ShadingModel
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& DecalBlendingMode == other.DecalBlendingMode
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||
&& Flags == other.Flags
|
||||
&& TessellationMode == other.TessellationMode
|
||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||
}
|
||||
bool operator==(const MaterialInfo8& other) const;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -796,69 +504,8 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(MaterialInfo);
|
||||
{
|
||||
}
|
||||
|
||||
MaterialInfo(const MaterialInfo8& other)
|
||||
{
|
||||
Domain = other.Domain;
|
||||
BlendMode = other.BlendMode;
|
||||
ShadingModel = other.ShadingModel;
|
||||
UsageFlags = MaterialUsageFlags::None;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseMask)
|
||||
UsageFlags |= MaterialUsageFlags::UseMask;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseEmissive)
|
||||
UsageFlags |= MaterialUsageFlags::UseEmissive;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UsePositionOffset)
|
||||
UsageFlags |= MaterialUsageFlags::UsePositionOffset;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseVertexColor)
|
||||
UsageFlags |= MaterialUsageFlags::UseVertexColor;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseNormal)
|
||||
UsageFlags |= MaterialUsageFlags::UseNormal;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseDisplacement)
|
||||
UsageFlags |= MaterialUsageFlags::UseDisplacement;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseRefraction)
|
||||
UsageFlags |= MaterialUsageFlags::UseRefraction;
|
||||
FeaturesFlags = MaterialFeaturesFlags::None;
|
||||
if (other.Flags & MaterialFlags_Deprecated::Wireframe)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::Wireframe;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableDepthTest && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableDepthTest;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableFog && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableFog;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableReflections && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableReflections;
|
||||
if (other.Flags & MaterialFlags_Deprecated::DisableDepthWrite)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableDepthWrite;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableDistortion && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableDistortion;
|
||||
if (other.Flags & MaterialFlags_Deprecated::InputWorldSpaceNormal)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::InputWorldSpaceNormal;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseDitheredLODTransition)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DitheredLODTransition;
|
||||
if (other.BlendMode != MaterialBlendMode::Opaque && other.TransparentLighting == MaterialTransparentLighting_Deprecated::None)
|
||||
ShadingModel = MaterialShadingModel::Unlit;
|
||||
DecalBlendingMode = other.DecalBlendingMode;
|
||||
PostFxLocation = other.PostFxLocation;
|
||||
CullMode = other.Flags & MaterialFlags_Deprecated::TwoSided ? ::CullMode::TwoSided : ::CullMode::Normal;
|
||||
MaskThreshold = other.MaskThreshold;
|
||||
OpacityThreshold = other.OpacityThreshold;
|
||||
TessellationMode = other.TessellationMode;
|
||||
MaxTessellationFactor = other.MaxTessellationFactor;
|
||||
}
|
||||
|
||||
bool operator==(const MaterialInfo& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& ShadingModel == other.ShadingModel
|
||||
&& UsageFlags == other.UsageFlags
|
||||
&& FeaturesFlags == other.FeaturesFlags
|
||||
&& DecalBlendingMode == other.DecalBlendingMode
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& CullMode == other.CullMode
|
||||
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||
&& TessellationMode == other.TessellationMode
|
||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||
}
|
||||
MaterialInfo(const MaterialInfo8& other);
|
||||
bool operator==(const MaterialInfo& other) const;
|
||||
};
|
||||
|
||||
// The current material info descriptor version used by the material pipeline
|
||||
|
||||
@@ -12,6 +12,85 @@
|
||||
#include "Engine/Graphics/GPUDevice.h"
|
||||
#include "Engine/Graphics/GPULimits.h"
|
||||
|
||||
bool MaterialInfo8::operator==(const MaterialInfo8& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& ShadingModel == other.ShadingModel
|
||||
&& TransparentLighting == other.TransparentLighting
|
||||
&& DecalBlendingMode == other.DecalBlendingMode
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||
&& Flags == other.Flags
|
||||
&& TessellationMode == other.TessellationMode
|
||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||
}
|
||||
|
||||
MaterialInfo::MaterialInfo(const MaterialInfo8& other)
|
||||
{
|
||||
Domain = other.Domain;
|
||||
BlendMode = other.BlendMode;
|
||||
ShadingModel = other.ShadingModel;
|
||||
UsageFlags = MaterialUsageFlags::None;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseMask)
|
||||
UsageFlags |= MaterialUsageFlags::UseMask;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseEmissive)
|
||||
UsageFlags |= MaterialUsageFlags::UseEmissive;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UsePositionOffset)
|
||||
UsageFlags |= MaterialUsageFlags::UsePositionOffset;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseVertexColor)
|
||||
UsageFlags |= MaterialUsageFlags::UseVertexColor;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseNormal)
|
||||
UsageFlags |= MaterialUsageFlags::UseNormal;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseDisplacement)
|
||||
UsageFlags |= MaterialUsageFlags::UseDisplacement;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseRefraction)
|
||||
UsageFlags |= MaterialUsageFlags::UseRefraction;
|
||||
FeaturesFlags = MaterialFeaturesFlags::None;
|
||||
if (other.Flags & MaterialFlags_Deprecated::Wireframe)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::Wireframe;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableDepthTest && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableDepthTest;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableFog && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableFog;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableReflections && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableReflections;
|
||||
if (other.Flags & MaterialFlags_Deprecated::DisableDepthWrite)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableDepthWrite;
|
||||
if (other.Flags & MaterialFlags_Deprecated::TransparentDisableDistortion && BlendMode != MaterialBlendMode::Opaque)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DisableDistortion;
|
||||
if (other.Flags & MaterialFlags_Deprecated::InputWorldSpaceNormal)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::InputWorldSpaceNormal;
|
||||
if (other.Flags & MaterialFlags_Deprecated::UseDitheredLODTransition)
|
||||
FeaturesFlags |= MaterialFeaturesFlags::DitheredLODTransition;
|
||||
if (other.BlendMode != MaterialBlendMode::Opaque && other.TransparentLighting == MaterialTransparentLighting_Deprecated::None)
|
||||
ShadingModel = MaterialShadingModel::Unlit;
|
||||
DecalBlendingMode = other.DecalBlendingMode;
|
||||
PostFxLocation = other.PostFxLocation;
|
||||
CullMode = other.Flags & MaterialFlags_Deprecated::TwoSided ? ::CullMode::TwoSided : ::CullMode::Normal;
|
||||
MaskThreshold = other.MaskThreshold;
|
||||
OpacityThreshold = other.OpacityThreshold;
|
||||
TessellationMode = other.TessellationMode;
|
||||
MaxTessellationFactor = other.MaxTessellationFactor;
|
||||
}
|
||||
|
||||
bool MaterialInfo::operator==(const MaterialInfo& other) const
|
||||
{
|
||||
return Domain == other.Domain
|
||||
&& BlendMode == other.BlendMode
|
||||
&& ShadingModel == other.ShadingModel
|
||||
&& UsageFlags == other.UsageFlags
|
||||
&& FeaturesFlags == other.FeaturesFlags
|
||||
&& DecalBlendingMode == other.DecalBlendingMode
|
||||
&& PostFxLocation == other.PostFxLocation
|
||||
&& CullMode == other.CullMode
|
||||
&& Math::NearEqual(MaskThreshold, other.MaskThreshold)
|
||||
&& Math::NearEqual(OpacityThreshold, other.OpacityThreshold)
|
||||
&& TessellationMode == other.TessellationMode
|
||||
&& MaxTessellationFactor == other.MaxTessellationFactor;
|
||||
}
|
||||
|
||||
const Char* ToString(MaterialParameterType value)
|
||||
{
|
||||
const Char* result;
|
||||
|
||||
@@ -214,7 +214,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the parameter ID (not the parameter instance Id but the original parameter ID).
|
||||
/// </summary>
|
||||
/// <returns>The ID.</returns>
|
||||
API_PROPERTY() FORCE_INLINE Guid GetParameterID() const
|
||||
{
|
||||
return _paramId;
|
||||
@@ -223,7 +222,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the parameter type.
|
||||
/// </summary>
|
||||
/// <returns>The type.</returns>
|
||||
API_PROPERTY() FORCE_INLINE MaterialParameterType GetParameterType() const
|
||||
{
|
||||
return _type;
|
||||
@@ -232,7 +230,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the parameter name.
|
||||
/// </summary>
|
||||
/// <returns>The name.</returns>
|
||||
API_PROPERTY() FORCE_INLINE const String& GetName() const
|
||||
{
|
||||
return _name;
|
||||
@@ -241,7 +238,6 @@ public:
|
||||
/// <summary>
|
||||
/// Returns true is parameter is public visible.
|
||||
/// </summary>
|
||||
/// <returns>True if parameter has public access, otherwise false.</returns>
|
||||
API_PROPERTY() FORCE_INLINE bool IsPublic() const
|
||||
{
|
||||
return _isPublic;
|
||||
@@ -250,7 +246,6 @@ public:
|
||||
/// <summary>
|
||||
/// Returns true is parameter is overriding the value.
|
||||
/// </summary>
|
||||
/// <returns>True if parameter is overriding the value, otherwise false.</returns>
|
||||
API_PROPERTY() FORCE_INLINE bool IsOverride() const
|
||||
{
|
||||
return _override;
|
||||
@@ -259,7 +254,6 @@ public:
|
||||
/// <summary>
|
||||
/// Sets the value override mode.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
API_PROPERTY() void SetIsOverride(bool value)
|
||||
{
|
||||
_override = value;
|
||||
@@ -268,7 +262,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the parameter resource graphics pipeline binding register index.
|
||||
/// </summary>
|
||||
/// <returns>The binding register.</returns>
|
||||
FORCE_INLINE byte GetRegister() const
|
||||
{
|
||||
return _registerIndex;
|
||||
@@ -277,7 +270,6 @@ public:
|
||||
/// <summary>
|
||||
/// Gets the parameter binding offset since the start of the constant buffer.
|
||||
/// </summary>
|
||||
/// <returns>The binding data offset (in bytes).</returns>
|
||||
FORCE_INLINE uint16 GetBindOffset() const
|
||||
{
|
||||
return _offset;
|
||||
|
||||
@@ -21,7 +21,7 @@ int32 ModelsStreamingHandler::CalculateResidency(StreamableResource* resource, S
|
||||
if (quality < ZeroTolerance)
|
||||
return 0;
|
||||
|
||||
int32 lods = Math::CeilToInt(quality * lodCount);
|
||||
int32 lods = Math::CeilToInt(quality * (StreamingQuality)lodCount);
|
||||
|
||||
ASSERT(model.IsValidLODIndex(lods - 1));
|
||||
return lods;
|
||||
|
||||
@@ -108,27 +108,13 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
// Streaming Manager cached variables
|
||||
struct StreamingCache
|
||||
{
|
||||
/// <summary>
|
||||
/// The minimum usage distance since last update (eg. mesh draw distance from camera).
|
||||
/// Used to calculate resource quality.
|
||||
/// </summary>
|
||||
//float MinDstSinceLastUpdate;
|
||||
|
||||
DateTime LastUpdate;
|
||||
int32 TargetResidency;
|
||||
DateTime TargetResidencyChange;
|
||||
//float MinDstSinceLastUpdate = MAX_float;
|
||||
DateTime LastUpdate = 0;
|
||||
int32 TargetResidency = 0;
|
||||
DateTime TargetResidencyChange = 0;
|
||||
SamplesBuffer<StreamingQuality, 5> QualitySamples;
|
||||
|
||||
StreamingCache()
|
||||
//: MinDstSinceLastUpdate(MAX_float)
|
||||
: LastUpdate(0)
|
||||
, TargetResidency(0)
|
||||
, TargetResidencyChange(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
StreamingCache Streaming;
|
||||
|
||||
Reference in New Issue
Block a user