Beispiel #1
0
        public Texture Load(Device device, String filename)
        {
            String rawFilename    = Content.Content.ContentPath + filename;
            String cachedFilename = Content.Content.ContentCachePath + filename + ".dds";

            if (File.Exists(cachedFilename) && (File.GetLastWriteTime(cachedFilename) - File.GetLastWriteTime(rawFilename)).Ticks > 0)
            {
                return(Texture.FromFile(device, cachedFilename));
            }
            else
            {
                Texture heightmap = Texture.FromFile(device, rawFilename,
                                                     0, 0, 0, Usage.None, Format.A32B32G32R32F, Pool.Managed, Filter.Default,
                                                     Filter.Default, 0);
                FixupHeightmap(heightmap, heightmap.GetLevelDescription(0).Width);
                Texture.ToFile(heightmap, cachedFilename, ImageFileFormat.Dds);
                return(heightmap);
            }
        }