public void VoxelMaterialAssets_FilledVolume() { SpaceEngineersCore.LoadDefinitions(); var materials = SpaceEngineersCore.Resources.GetMaterialList(); Assert.IsTrue(materials.Count > 0, "Materials should exist. Has the developer got Space Engineers installed?"); const string fileNew = @".\TestOutput\test_filledvolume.vx2"; const int length = 64; var size = new Vector3I(length, length, length); var action = (Action <MyVoxelBuilderArgs>) delegate(MyVoxelBuilderArgs e) { e.Volume = 0xFF; }; var voxelMap = MyVoxelBuilder.BuildAsteroid(true, size, materials[06].Id.SubtypeId, null, action); voxelMap.Save(fileNew); var lengthNew = new FileInfo(fileNew).Length; Assert.AreEqual(163, lengthNew, "New file size must match."); Assert.AreEqual(64, voxelMap.Size.X, "Voxel Bounding size must match."); Assert.AreEqual(64, voxelMap.Size.Y, "Voxel Bounding size must match."); Assert.AreEqual(64, voxelMap.Size.Z, "Voxel Bounding size must match."); }
public void VoxelRebuild1() { SpaceEngineersCore.LoadDefinitions(); var materials = SpaceEngineersCore.Resources.GetMaterialList(); Assert.IsTrue(materials.Count > 0, "Materials should exist. Has the developer got Space Engineers installed?"); var fileNew = @".\TestOutput\test_spike_cube1024.vx2"; var length = 1024; var min = 4; var max = length - 4; var size = new Vector3I(length, length, length); var buildparams = new int[][] { new[] { min, 0 }, new[] { min + 1, 1 }, new[] { max, 0 }, new[] { max - 1, -1 } }; var action = (Action <MyVoxelBuilderArgs>) delegate(MyVoxelBuilderArgs e) { e.Volume = 0x00; if (e.CoordinatePoint.X > 0 && e.CoordinatePoint.Y > 0 && e.CoordinatePoint.Z > 0 && e.CoordinatePoint.X < size.X - 1 && e.CoordinatePoint.Y < size.Y - 1 && e.CoordinatePoint.Z < size.Z - 1 && e.CoordinatePoint.X >= min && e.CoordinatePoint.Y >= min && e.CoordinatePoint.Z >= min && e.CoordinatePoint.X <= max && e.CoordinatePoint.Y <= max && e.CoordinatePoint.Z <= max) { foreach (int[] t in buildparams) { if (e.CoordinatePoint.X == t[0] && ((e.CoordinatePoint.Z + t[1]) % 2 == 0) && ((e.CoordinatePoint.Y + t[1]) % 2 == 0)) { e.Volume = 0x92; } if (e.CoordinatePoint.Y == t[0] && ((e.CoordinatePoint.X + t[1]) % 2 == 0) && ((e.CoordinatePoint.Z + t[1]) % 2 == 0)) { e.Volume = 0x92; } if (e.CoordinatePoint.Z == t[0] && ((e.CoordinatePoint.X + t[1]) % 2 == 0) && ((e.CoordinatePoint.Y + t[1]) % 2 == 0)) { e.Volume = 0x92; } } } }; var voxelMap = MyVoxelBuilder.BuildAsteroid(true, size, materials[0].Id.SubtypeId, null, action); voxelMap.Save(fileNew); }
public void VoxelGenerateSpikeWall() { SpaceEngineersCore.LoadDefinitions(); var materials = SpaceEngineersCore.Resources.GetMaterialList(); Assert.IsTrue(materials.Count > 0, "Materials should exist. Has the developer got Space Engineers installed?"); const string fileNew = @".\TestOutput\test_spike_wall.vx2"; var size = new Vector3I(1024, 1024, 64); var action = (Action <MyVoxelBuilderArgs>) delegate(MyVoxelBuilderArgs e) { e.Volume = 0x00; if (e.CoordinatePoint.X > 0 && e.CoordinatePoint.Y > 0 && e.CoordinatePoint.Z > 0 && e.CoordinatePoint.X < size.X - 1 && e.CoordinatePoint.Y < size.Y - 1 && e.CoordinatePoint.Z < size.Z - 1) { if (e.CoordinatePoint.Z == 5 && (e.CoordinatePoint.X % 2 == 0) && (e.CoordinatePoint.Y % 2 == 0)) { e.Volume = 0x92; } if (e.CoordinatePoint.Z == 6 && ((e.CoordinatePoint.X + 1) % 2 == 0) && ((e.CoordinatePoint.Y + 1) % 2 == 0)) { e.Volume = 0x92; } } }; var voxelMap = MyVoxelBuilder.BuildAsteroid(true, size, materials[0].Id.SubtypeId, null, action); voxelMap.Save(fileNew); var lengthNew = new FileInfo(fileNew).Length; Assert.AreEqual(49809, lengthNew, "New file size must match."); Assert.AreEqual(1024, voxelMap.Size.X, "Voxel Bounding size must match."); Assert.AreEqual(1024, voxelMap.Size.Y, "Voxel Bounding size must match."); Assert.AreEqual(64, voxelMap.Size.Z, "Voxel Bounding size must match."); Assert.AreEqual(1022, voxelMap.BoundingContent.SizeInt().X + 1, "Voxel Content size must match."); Assert.AreEqual(1022, voxelMap.BoundingContent.SizeInt().Y + 1, "Voxel Content size must match."); Assert.AreEqual(2, voxelMap.BoundingContent.SizeInt().Z + 1, "Voxel Content size must match."); // Centered in the middle of the 512x512x512 cell. Assert.AreEqual(511.5, voxelMap.BoundingContent.Center.X, "Voxel Center must match."); Assert.AreEqual(511.5, voxelMap.BoundingContent.Center.Y, "Voxel Center must match."); Assert.AreEqual(5.5, voxelMap.BoundingContent.Center.Z, "Voxel Center must match."); }
public void VoxelGenerateSpikeCube() { SpaceEngineersCore.LoadDefinitions(); var materials = SpaceEngineersCore.Resources.GetMaterialList(); Assert.IsTrue(materials.Count > 0, "Materials should exist. Has the developer got Space Engineers installed?"); var fileNew = @".\TestOutput\test_spike_cube256.vx2"; var length = 256; var min = 4; var max = length - 4; var size = new Vector3I(length, length, length); var buildparams = new int[][] { new[] { min, 0 }, new[] { min + 1, 1 }, new[] { max, 0 }, new[] { max - 1, -1 } }; var action = (Action <MyVoxelBuilderArgs>) delegate(MyVoxelBuilderArgs e) { e.Volume = 0x00; if (e.CoordinatePoint.X > 0 && e.CoordinatePoint.Y > 0 && e.CoordinatePoint.Z > 0 && e.CoordinatePoint.X < size.X - 1 && e.CoordinatePoint.Y < size.Y - 1 && e.CoordinatePoint.Z < size.Z - 1 && e.CoordinatePoint.X >= min && e.CoordinatePoint.Y >= min && e.CoordinatePoint.Z >= min && e.CoordinatePoint.X <= max && e.CoordinatePoint.Y <= max && e.CoordinatePoint.Z <= max) { foreach (int[] t in buildparams) { if (e.CoordinatePoint.X == t[0] && ((e.CoordinatePoint.Z + t[1]) % 2 == 0) && ((e.CoordinatePoint.Y + t[1]) % 2 == 0)) { e.Volume = 0x92; } if (e.CoordinatePoint.Y == t[0] && ((e.CoordinatePoint.X + t[1]) % 2 == 0) && ((e.CoordinatePoint.Z + t[1]) % 2 == 0)) { e.Volume = 0x92; } if (e.CoordinatePoint.Z == t[0] && ((e.CoordinatePoint.X + t[1]) % 2 == 0) && ((e.CoordinatePoint.Y + t[1]) % 2 == 0)) { e.Volume = 0x92; } } } }; var voxelMap = MyVoxelBuilder.BuildAsteroid(true, size, materials[0].Id.SubtypeId, null, action); voxelMap.Save(fileNew); var lengthNew = new FileInfo(fileNew).Length; Assert.AreEqual(22542, lengthNew, "New file size must match."); Assert.AreEqual(256, voxelMap.Size.X, "Voxel Bounding size must match."); Assert.AreEqual(256, voxelMap.Size.Y, "Voxel Bounding size must match."); Assert.AreEqual(256, voxelMap.Size.Z, "Voxel Bounding size must match."); Assert.AreEqual(249, voxelMap.BoundingContent.SizeInt().X + 1, "Voxel Content size must match."); Assert.AreEqual(249, voxelMap.BoundingContent.SizeInt().Y + 1, "Voxel Content size must match."); Assert.AreEqual(249, voxelMap.BoundingContent.SizeInt().Z + 1, "Voxel Content size must match."); // Centered in the middle of the 256x256x256 cell. Assert.AreEqual(128, voxelMap.BoundingContent.Center.X, "Voxel Center must match."); Assert.AreEqual(128, voxelMap.BoundingContent.Center.Y, "Voxel Center must match."); Assert.AreEqual(128, voxelMap.BoundingContent.Center.Z, "Voxel Center must match."); }