Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Flags]
- enum Sides : byte
- {
- None = 0x00,
- Top = 0x01,
- Bottom = 0x02,
- Left = 0x04,
- Right = 0x08,
- Front = 0x10,
- Back = 0x20
- }
- public static Sides VisibleFacesFor(ChunkInfo chunk, IntVector3 voxel)
- {
- var sides = Sides.None
- voxel.Y += 1;
- if (chunk.GetVoxel(voxel).Weight <= 0)
- sides |= Sides.Top;
- voxel.Y -= 2;
- if (chunk.GetVoxel(voxel).Weight <= 0)
- sides |= Sides.Bottom;
- voxel.Y += 1;
- voxel.X -= 1;
- if (chunk.GetVoxel(voxel).Weight <= 0)
- sides |= Sides.Left;
- voxel.X += 2;
- if (chunk.GetVoxel(voxel).Weight <= 0)
- sides |= Sides.Right;
- voxel.X -= 1;
- voxel.Z -= 1;
- if (chunk.GetVoxel(voxel).Weight <= 0)
- sides |= Sides.Front;
- voxel.Z += 2;
- if (chunk.GetVoxel(voxel).Weight <= 0)
- sides |= Sides.Back;
- voxel.Z -= 1;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment