Codestyle adjustments #3343
This commit is contained in:
@@ -32,7 +32,7 @@ namespace FlaxEngine
|
||||
/// <summary>
|
||||
/// Determines whether the specified layer is set in the mask.
|
||||
/// </summary>
|
||||
/// <param name="layerName">Name of the layer (from layers settings).</param>
|
||||
/// <param name="layerName">Name of the layer (from Layers settings).</param>
|
||||
/// <returns><c>true</c> if the specified layer is set; otherwise, <c>false</c>.</returns>
|
||||
public bool HasLayer(string layerName)
|
||||
{
|
||||
@@ -42,21 +42,19 @@ namespace FlaxEngine
|
||||
/// <summary>
|
||||
/// Gets a layer mask based on a specific layer names.
|
||||
/// </summary>
|
||||
/// <param name="layerNames">The names of the layers (from layers settings).</param>
|
||||
/// <returns>A layer mask with the mask set to the layers found. Returns a mask with 0 if not found. </returns>
|
||||
/// <param name="layerNames">The names of the layers (from Layers settings).</param>
|
||||
/// <returns>A layer mask with the mask set to the layers found. Returns a mask with 0 if not found.</returns>
|
||||
public static LayersMask GetMask(params string[] layerNames)
|
||||
{
|
||||
LayersMask mask = new LayersMask();
|
||||
foreach (var layerName in layerNames)
|
||||
{
|
||||
// Ignore blank entries
|
||||
if (layerName.Length == 0)
|
||||
if (string.IsNullOrEmpty(layerName))
|
||||
continue;
|
||||
int index = Level.GetLayerIndex(layerName);
|
||||
if (index != -1 && !mask.HasLayer(index))
|
||||
{
|
||||
if (index != -1)
|
||||
mask.Mask |= (uint)(1 << index);
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
@@ -40,16 +40,16 @@ public:
|
||||
/// <summary>
|
||||
/// Determines whether the specified layer name is set in the mask.
|
||||
/// </summary>
|
||||
/// <param name="layerName">Name of the layer (from layers settings).</param>
|
||||
/// <param name="layerName">Name of the layer (from Layers settings).</param>
|
||||
/// <returns><c>true</c> if the specified layer is set; otherwise, <c>false</c>.</returns>
|
||||
bool HasLayer(const StringView& layerName);
|
||||
bool HasLayer(const StringView& layerName) const;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a layers mask from a specific layer name.
|
||||
/// </summary>
|
||||
/// <param name="layerNames">The layer names.</param>
|
||||
/// <param name="layerNames">The names of the layers (from Layers settings).</param>
|
||||
/// <returns>A layers mask with the Mask set to the same Mask as the layer name passed in. Returns a LayersMask with a mask of 0 if no layer found.</returns>
|
||||
static LayersMask GetMask(StringView layerNames[]);
|
||||
static LayersMask GetMask(Span<StringView> layerNames);
|
||||
|
||||
operator uint32() const
|
||||
{
|
||||
|
||||
@@ -60,27 +60,22 @@ void LargeWorlds::UpdateOrigin(Vector3& origin, const Vector3& position)
|
||||
}
|
||||
}
|
||||
|
||||
bool LayersMask::HasLayer(const StringView& layerName)
|
||||
bool LayersMask::HasLayer(const StringView& layerName) const
|
||||
{
|
||||
return HasLayer(Level::GetLayerIndex(layerName));
|
||||
}
|
||||
|
||||
LayersMask LayersMask::GetMask(StringView layerNames[])
|
||||
LayersMask LayersMask::GetMask(Span<StringView> layerNames)
|
||||
{
|
||||
LayersMask mask(0);
|
||||
if (layerNames == nullptr)
|
||||
return mask;
|
||||
for (int i = 0; i < layerNames->Length(); i++)
|
||||
for (StringView& layerName : layerNames)
|
||||
{
|
||||
StringView& layerName = layerNames[i];
|
||||
// Ignore blank entries
|
||||
if (layerName.Length() == 0)
|
||||
continue;
|
||||
int index = Level::GetLayerIndex(layerName);
|
||||
if (index != -1 && !mask.HasLayer(index))
|
||||
{
|
||||
mask.Mask |= static_cast<uint32>(1 << index);
|
||||
}
|
||||
int32 index = Level::GetLayerIndex(layerName);
|
||||
if (index != -1)
|
||||
mask.Mask |= (uint32)(1 << index);
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user