Class TextureUtils

java.lang.Object
net.mtrop.doom.util.TextureUtils

public final class TextureUtils extends Object
Graphics utility methods for image types.
Author:
Matthew Tropiano
  • Method Details

    • importTextureSet

      public static TextureSet importTextureSet(Wad wf) throws WadException, IOException
      Imports a TextureSet from a WAD File. This searches for the TEXTURE1/2 lumps and the PNAMES entry, and builds a new TextureSet from them. If the WAD does NOT contain a TEXTUREx entry, the returned set will be empty. If TEXTURE1/2 is present, but NOT PNAMES, a TextureException will be thrown.
      Parameters:
      wf - the WAD file to read from containing the required entries.
      Returns:
      a new texture set equivalent to the parsed data.
      Throws:
      TextureException - if a texture lump was found, but not PNAMES.
      WadException - if the WAD itself cannot be read.
      IOException - if an entry in a WAD file cannot be read.
    • isStrifeTextureData

      public static boolean isStrifeTextureData(byte[] b)
      Scans through texture lump data in order to detect whether it is for Strife or not.
      Parameters:
      b - the texture lump data.
      Returns:
      true if it is Strife texture data, false if not.
    • createTextureCopier

      public static TextureUtils.TextureCopier createTextureCopier(Wad sourceWad, Wad destinationWad) throws IOException
      Creates a texture copier object for moving one or more textures (and associated data) to another Wad.

      NOTE: Make sure you call TextureUtils.TextureCopier.close() on the copier so that the TEXTUREx/PNAMES entries get written properly.

      Parameters:
      sourceWad - the source Wad.
      destinationWad - the destination Wad.
      Returns:
      the new copier.
      Throws:
      TextureException - if the source or destination does not have TEXTUREx or a PNAMES lump.
      IOException - if a read error happens.