本文整理汇总了C#中Voxel.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Voxel.GetLength方法的具体用法?C# Voxel.GetLength怎么用?C# Voxel.GetLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voxel
的用法示例。
在下文中一共展示了Voxel.GetLength方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InBounds
/// <summary>
/// Determines if the given IntVector3 is within the bounds of the given voxel array
/// </summary>
/// <param name="voxels">the array</param>
/// <param name="pos">the IntVector3</param>
/// <returns></returns>
public static bool InBounds(Voxel[, ,] voxels, IntVector3 pos)
{
return (pos.X >= 0 && pos.Y >= 0 && pos.Z >= 0) &&
(pos.X < voxels.GetLength(0) && pos.Y < voxels.GetLength(1) && pos.Z < voxels.GetLength(2));
}
示例2: IsVisibleFace
/// <summary>
///
/// </summary>
/// <param name="voxels"></param>
/// <param name="index"></param>
/// <param name="face"></param>
/// <returns></returns>
public static bool IsVisibleFace(Voxel[, ,] voxels, IntVector3 index, Face face)
{
if (IsActive(voxels, index))
{
switch (face)
{
case Face.Top: // Visibility rules for faces are ...
if (index.Y == voxels.GetLength(1) - 1 || // active volume edge block (assume edge of volume is visible)
voxels[index.X, index.Y + 1, index.Z].Weight < 0) // adjacent block is empty
{
return true;
}
break;
case Face.Bottom:
if (index.Y == 0 || voxels[index.X, index.Y - 1, index.Z].Weight < 0)
{
return true;
}
break;
case Face.Front:
if (index.Z == 0 || voxels[index.X, index.Y, index.Z - 1].Weight < 0)
{
return true;
}
break;
case Face.Back:
if (index.Z == voxels.GetLength(2) - 1 || voxels[index.X, index.Y, index.Z + 1].Weight < 0)
{
return true;
}
break;
case Face.Left:
if (index.X == 0 || voxels[index.X - 1, index.Y, index.Z].Weight < 0)
{
return true;
}
break;
case Face.Right:
if (index.X == voxels.GetLength(0) - 1 || voxels[index.X + 1, index.Y, index.Z].Weight < 0)
{
return true;
}
break;
}
}
return false;
}