Elvas Tower: DDS texture loader - Elvas Tower

Jump to content

Posting Rules

All new threads will be started by members of the Open Rails team, Staff, and/or Admins. Existing threads started in other forums may get moved here when it makes sense to do so.

Once a thread is started any member may post replies to it.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

DDS texture loader Rate Topic: -----

#1 User is offline   gpz 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,772
  • Joined: 27-October 12
  • Gender:Male
  • Location:Budapest
  • Simulator:OpenRails
  • Country:

Posted 02 February 2014 - 10:23 AM

Out of curiosity, I downloaded the DDSLib.cs file freely (with MIT license) available all over the internet, and added it to the project, backported to XNA 3.1, and adapted the Materials.cs file SharedTextureManager.Get to use it. So the loader part of the method looks like this:
            if (!Textures.ContainsKey(path))
            {
                try
                {
                    Texture2D texture;
                    if (Path.GetExtension(path) == ".ace")
                        texture = MSTS.ACEFile.Texture2DFromFile(GraphicsDevice, path);
                    else if (Path.GetExtension(path) == ".dds")
                        DDSLib.DDSFromFile(path, GraphicsDevice, true, out texture);
                    else
                        return SharedMaterialManager.MissingTexture;
                    Textures.Add(path, texture);
                    Thread.Sleep(Viewer.Settings.LoadingDelay);
                    return texture;
                }
                catch (InvalidDataException error)


This way I can load dds textured models. Of course I will not commit this change, just wanted to let you know...

Attached File(s)



#2 User is offline   Eldorado.Railroad 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 983
  • Joined: 31-May 10
  • Gender:Male
  • Country:

Posted 02 February 2014 - 10:50 AM

Peter..you have PM regarding this feature.

Thanks

#3 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 04 February 2014 - 06:10 AM

I've made a small command line ace checker tool in java(so you need java to run it). It can make statistics about the format of the ace textures, (DXT1-3-5, BGR565, BGRA4444/5551), and list the files that are match with the format given by parameter. The source code also supplied in the zip.
small java ace checker tool
usage:
acechecker <path-to-a-directory-that-needs-to-be-checked> The application will search for ace files in infinite subdirectory depth, and returns statistics about the texture formats (how many of which format)
acechecker <format-to-listed> <path-to-a-directory-that-needs-to-be-checked> The application will search for ace files which format matches with the one given in the <format-to-listed> parameter (for example "BGR565"), and list them to output.txt created in the same directory where the app is started. This file can be used in batch scripts to convert specific formatted ace files to other ace formats, or to dds.

When there is a large number of files need to be checked, it may take while in first run.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users