Package net.mtrop.doom.util
Class TextureUtils
java.lang.Object
net.mtrop.doom.util.TextureUtils
Graphics utility methods for image types.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A texture copying context for copying one or more textures to another Wad. -
Method Summary
Modifier and TypeMethodDescriptionstatic TextureUtils.TextureCopier
createTextureCopier
(Wad sourceWad, Wad destinationWad) Creates a texture copier object for moving one or more textures (and associated data) to another Wad.static TextureSet
importTextureSet
(Wad wf) Imports aTextureSet
from a WAD File.static boolean
isStrifeTextureData
(byte[] b) Scans through texture lump data in order to detect whether it is for Strife or not.
-
Method Details
-
importTextureSet
Imports aTextureSet
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, aTextureException
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.
-