Game Development Community

TGEA 1.8.1 gfxTextureManager bug (& fix) with DDS file paths

by Konrad Kiss · in Torque Game Engine Advanced · 02/13/2009 (6:28 am) · 2 replies

In gfx/gfxTextureManager.cpp the following line will not work with a filename that has a "double" extension.

Example: base.head.dds - function called with the value base.head without extension.

Around line 618:
// Check to see if there is a .DDS file with this name (if no extension is provided)
      Torque::Path tryDDSPath = pathNoExt;
      tryDDSPath.setExtension( "dds" );

That = will assign a value, while calling Path::_split that will reparse the path and think of "head" as the extension. Then that extension is overwritten by "dds", so the file that will be searched for at the end of the day is "base.dds".

The following fixes this:

// Check to see if there is a .DDS file with this name (if no extension is provided)
      Torque::Path tryDDSPath = pathNoExt;
      if (!tryDDSPath.getExtension().equal("", String::NoCase)) {
            tryDDSPath.setFileName( Torque::Path::Join( tryDDSPath.getFileName(), '.', tryDDSPath.getExtension() ) );
      }
      tryDDSPath.setExtension( "dds" );


#1
02/13/2009 (2:32 pm)
Good catch Konrad!

I spent a long time fixing up that issue for everything *but* DDS...doh!
#2
02/13/2009 (2:49 pm)
Thanks Matt

Actually, you made a check for this at the beginning of the function, I just used my copy / paste skills to solve it. Hehe.