public TerrainCreator(Map map, IProjection projection, Elevation elevation, Point offset, string modDir) : base(map, projection, elevation) { this.offset = offset; this.modDir = modDir; satAbsoluteOutputDir = Path.Combine(modDir, satOutputDir); Utils.DeleteDirectoryContents(satAbsoluteOutputDir); ir = new ImageRetrieval { ImageFormat = MagickFormat.Dds, Labeled = false }; writeDefines = new DdsWriteDefines { Mipmaps = 1, FastMipmaps = true, }; satMat = MatFile.Open("Assets/sat_image_tmpl.mat"); satMat.Attributes["aux[0]"][0] = XSize; satMat.Attributes["aux[0]"][1] = YSize; satTobj = Tobj.Open("Assets/sat_image_tmpl.tobj"); }
public static void ConvertToDds(string path, bool delSource = false) { MagickImage img = IOUtils.ReadImage(path); if (img == null) { return; } img.Format = MagickFormat.Dds; DdsCompression compression = DdsCompression.None; if (Config.Get("ddsCompressionType").Contains("BC1")) { compression = DdsCompression.Dxt1; } int mips = 0; if (Config.GetBool("ddsEnableMips")) { mips = 8; } var defines = new DdsWriteDefines { Compression = compression, Mipmaps = mips, FastMipmaps = true }; img.Settings.SetDefines(defines); string outPath = Path.ChangeExtension(path, null) + ".dds"; PreProcessing(path); img.Write(outPath); PostProcessing(img, path, outPath, delSource); }
static async Task ConvertToDdsNative(string path) { MagickImage img = IOUtils.ReadImage(path); if (img == null) { return; } img.Format = MagickFormat.Dds; DdsCompression compression = DdsCompression.None; if ((await Config.Get("ddsCompressionType")).Contains("BC1")) { compression = DdsCompression.Dxt1; } int mips = 0; if (await Config.GetBool("ddsEnableMips")) { mips = await Config.GetInt("mipCount"); } var defines = new DdsWriteDefines { Compression = compression, Mipmaps = mips, FastMipmaps = true }; img.Settings.SetDefines(defines); string outPath = Path.ChangeExtension(path, null) + ".dds"; IOUtils.SaveImage(img, outPath); }
public void Compression_NotSet_DefineIsNotSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines(); image.Settings.SetDefines(defines); Assert.AreEqual(null, defines.Compression); Assert.AreEqual(null, image.Settings.GetDefine(MagickFormat.Dds, "compression")); } }
public void WeightByAlpha_NotSet_DefineIsNotSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines(); image.Settings.SetDefines(defines); Assert.AreEqual(null, defines.WeightByAlpha); Assert.AreEqual(null, image.Settings.GetDefine(MagickFormat.Dds, "weight-by-alpha")); } }
public void ClusterFit_NotSet_DefineIsNotSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines(); image.Settings.SetDefines(defines); Assert.AreEqual(null, defines.ClusterFit); Assert.AreEqual(null, image.Settings.GetDefine(MagickFormat.Dds, "cluster-fit")); } }
public void MipMapsFromCollection_NotSet_DefineIsNotSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines(); image.Settings.SetDefines(defines); Assert.AreEqual(null, defines.Mipmaps); Assert.AreEqual(null, image.Settings.GetDefine(MagickFormat.Dds, "mipmaps")); } }
public void Compression_IsSet_DefineIsSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines { Compression = DdsCompression.Dxt1, }; image.Settings.SetDefines(defines); Assert.AreEqual("Dxt1", image.Settings.GetDefine(MagickFormat.Dds, "compression")); } }
public void ShouldSetTheDefine() { using (var image = new MagickImage()) { var defines = new DdsWriteDefines { WeightByAlpha = false, }; image.Settings.SetDefines(defines); Assert.Equal("false", image.Settings.GetDefine(MagickFormat.Dds, "weight-by-alpha")); } }
public void WeightByAlpha_IsSet_DefineIsSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines { WeightByAlpha = false, }; image.Settings.SetDefines(defines); Assert.AreEqual("False", image.Settings.GetDefine(MagickFormat.Dds, "weight-by-alpha")); } }
public void MipMaps_IsSet_DefineIsSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines { Mipmaps = 2, }; image.Settings.SetDefines(defines); Assert.AreEqual("2", image.Settings.GetDefine(MagickFormat.Dds, "mipmaps")); } }
public void ShouldSetTheDefine() { using (var image = new MagickImage()) { var defines = new DdsWriteDefines { FastMipmaps = true, }; image.Settings.SetDefines(defines); Assert.AreEqual("true", image.Settings.GetDefine(MagickFormat.Dds, "fast-mipmaps")); } }
public void ShouldSetTheDefine() { using (var image = new MagickImage()) { var defines = new DdsWriteDefines { ClusterFit = true, }; image.Settings.SetDefines(defines); Assert.Equal("true", image.Settings.GetDefine(MagickFormat.Dds, "cluster-fit")); } }
public void ShouldSetTheDefine() { using (var image = new MagickImage()) { var defines = new DdsWriteDefines { Compression = DdsCompression.Dxt1, }; image.Settings.SetDefines(defines); Assert.Equal("Dxt1", image.Settings.GetDefine(MagickFormat.Dds, "compression")); } }
public void ShouldSetTheDefine() { using (var image = new MagickImage()) { var defines = new DdsWriteDefines { Mipmaps = 2, }; image.Settings.SetDefines(defines); Assert.Equal("2", image.Settings.GetDefine(MagickFormat.Dds, "mipmaps")); } }
public void ClusterFit_IsSet_DefineIsSet() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines { ClusterFit = true, }; image.Settings.SetDefines(defines); Assert.AreEqual("True", image.Settings.GetDefine(MagickFormat.Dds, "cluster-fit")); } }
public void ShouldSetTheDefine() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines { Raw = true, }; image.Settings.SetDefines(defines); Assert.AreEqual("True", image.Settings.GetDefine(MagickFormat.Dds, "raw")); } }
public void ShouldSetTheDefine() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines { MipmapsFromCollection = true, Mipmaps = 4, // this is ignored }; image.Settings.SetDefines(defines); Assert.AreEqual("fromlist", image.Settings.GetDefine(MagickFormat.Dds, "mipmaps")); } }
public void ShouldBeIgnoredWhenSetToFalse() { using (IMagickImage image = new MagickImage()) { var defines = new DdsWriteDefines { MipmapsFromCollection = false, Mipmaps = 4, }; image.Settings.SetDefines(defines); Assert.AreEqual("4", image.Settings.GetDefine(MagickFormat.Dds, "mipmaps")); } }
public void Test_ClusterFit_Mipmaps_WeightByAlpha() { DdsWriteDefines defines = new DdsWriteDefines() { ClusterFit = true, Mipmaps = 0, WeightByAlpha = false, }; using (MagickImage image = new MagickImage(Files.Builtin.Logo)) { image.Settings.SetDefines(defines); Assert.AreEqual("True", image.Settings.GetDefine(MagickFormat.Dds, "cluster-fit")); Assert.AreEqual("0", image.Settings.GetDefine(MagickFormat.Dds, "mipmaps")); Assert.AreEqual("False", image.Settings.GetDefine(MagickFormat.Dds, "weight-by-alpha")); } }
public void Test_Compression() { DdsWriteDefines defines = new DdsWriteDefines() { Compression = DdsCompression.None }; using (MagickImage input = new MagickImage(Files.Builtin.Logo)) { using (MagickImage output = WriteDds(input)) { Assert.AreEqual(CompressionMethod.DXT1, output.CompressionMethod); } input.Settings.SetDefines(defines); using (MagickImage output = WriteDds(input)) { Assert.AreEqual(CompressionMethod.NoCompression, output.CompressionMethod); } } }