Пример #1
0
        public void Cubemap(Cubemap texture)
        {
            var resourceName           = EvaluateCubemapName(texture);
            var assetGuid              = texture.GetKey();
            var sourceFileTimestampUtc = ExportUtils.GetLastWriteTimeUtc(texture);

            if (_engine.IsUpToDate(assetGuid, resourceName, sourceFileTimestampUtc))
            {
                return;
            }

            if (!EnsureReadableTexture(texture))
            {
                return;
            }

            using (var writer =
                       _engine.TryCreateXml(assetGuid, resourceName, sourceFileTimestampUtc))
            {
                if (writer != null)
                {
                    WriteCubemap(texture, resourceName, writer);
                }
            }
        }
Пример #2
0
        public void Cubemap(Cubemap texture)
        {
            if (!EnsureReadableTexture(texture))
            {
                return;
            }

            var resourceName = EvaluateCubemapName(texture);

            using (var writer =
                       _engine.TryCreateXml(texture.GetKey(), resourceName, ExportUtils.GetLastWriteTimeUtc(texture)))
            {
                if (writer != null)
                {
                    var ddsName = resourceName.Replace(".xml", ".dds");
                    var srgb    = true;
                    DDS.SaveAsRgbaDds(texture, _engine.GetTargetFilePath(ddsName), srgb);
                    writer.WriteStartElement("cubemap");
                    writer.WriteWhitespace(Environment.NewLine);
                    writer.WriteStartElement("srgb");
                    writer.WriteAttributeString("enable", srgb ? "true" : "false");
                    writer.WriteEndElement();
                    writer.WriteStartElement("image");
                    writer.WriteAttributeString("name", Path.GetFileName(ddsName));
                    writer.WriteEndElement();
                    writer.WriteWhitespace(Environment.NewLine);
                    writer.WriteEndElement();
                }
            }
        }