Here are the examples of the csharp api System.Collections.Generic.List.Contains(VoxelChunk) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
Source : Trees.cs
with MIT License
from Zarbuz
with MIT License
from Zarbuz
private void CreateTree(Vector3 position, ModelSettings tree, int rotation)
{
if (tree == null)
{
return;
}
Vector3 pos = new Vector3();
mTreeChunkRefreshRequests.Clear();
VoxelChunk lastChunk = null;
int modelOneYRow = tree.SizeZ * tree.SizeX;
int modelOneZRow = tree.SizeX;
int halfSizeX = tree.SizeX / 2;
int halfSizeZ = tree.SizeZ / 2;
for (int b = 0; b < tree.Bits.Length; b++)
{
int bitIndex = tree.Bits[b].VoxelIndex;
int py = bitIndex / modelOneYRow;
int remy = bitIndex - py * modelOneYRow;
int pz = remy / modelOneZRow;
int px = remy - pz * modelOneZRow;
// Random rotation
int tmp;
switch (rotation)
{
case 0:
tmp = px;
px = halfSizeZ - pz;
pz = tmp - halfSizeX;
break;
case 1:
tmp = px;
px = pz - halfSizeZ;
pz = tmp - halfSizeX;
break;
case 2:
tmp = px;
px = pz - halfSizeZ;
pz = halfSizeX - tmp;
break;
default:
px -= halfSizeX;
pz -= halfSizeZ;
break;
}
pos.X = position.X + tree.OffsetX + px;
pos.Y = position.Y + tree.OffsetY + py;
pos.Z = position.Z + tree.OffsetZ + pz;
if (GetVoxelIndex(pos, out VoxelChunk chunk, out int voxelIndex))
{
if (chunk.Voxels[voxelIndex].Color != 0)
{
chunk.Voxels[voxelIndex].Color = tree.Bits[b].Color.ColorToUInt();
if (py == 0)
{
if (voxelIndex >= ONE_Y_ROW)
{
if (chunk.Voxels[voxelIndex - ONE_Y_ROW].Color != 0)
{
chunk.Voxels[voxelIndex - ONE_Y_ROW].Color = tree.Bits[b].Color.ColorToUInt();
}
}
else
{
VoxelChunk bottom = chunk.Bottom;
if (bottom != null)
{
int bottomIndex = voxelIndex + (CHUNK_SIZE - 1) * ONE_Y_ROW;
if (bottom.Voxels[bottomIndex].Color != 0)
{
chunk.Voxels[bottomIndex].Color = tree.Bits[b].Color.ColorToUInt();
if (!mTreeChunkRefreshRequests.Contains(bottom))
mTreeChunkRefreshRequests.Add(bottom);
}
}
}
}
if (chunk != lastChunk)
{
lastChunk = chunk;
if (!mTreeChunkRefreshRequests.Contains(chunk))
{
mTreeChunkRefreshRequests.Add(chunk);
}
}
}
}
}
}