diff options
Diffstat (limited to 'src/jake2/qcommon/qfiles.java')
-rw-r--r-- | src/jake2/qcommon/qfiles.java | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/jake2/qcommon/qfiles.java b/src/jake2/qcommon/qfiles.java index bda2233..ae7fdf6 100644 --- a/src/jake2/qcommon/qfiles.java +++ b/src/jake2/qcommon/qfiles.java @@ -2,7 +2,7 @@ * qfiles.java * Copyright (C) 2003 * - * $Id: qfiles.java,v 1.2 2004-07-08 15:58:46 hzi Exp $ + * $Id: qfiles.java,v 1.3 2004-07-08 20:24:48 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -114,6 +114,52 @@ public class qfiles { /* ======================================================================== + TGA files are used for sky planes + + ======================================================================== + */ + public static class tga_t { + + // targa header + public int id_length, colormap_type, image_type; // unsigned char + public int colormap_index, colormap_length; // unsigned short + public int colormap_size; // unsigned char + public int x_origin, y_origin, width, height; // unsigned short + public int pixel_size, attributes; // unsigned char + + public ByteBuffer data; // (un)compressed data + + public tga_t(byte[] dataBytes) { + this(ByteBuffer.wrap(dataBytes)); + } + + public tga_t(ByteBuffer b) { + // is stored as little endian + b.order(ByteOrder.LITTLE_ENDIAN); + + // fill header + id_length = b.get() & 0xFF; + colormap_type = b.get() & 0xFF; + image_type = b.get() & 0xFF; + colormap_index = b.getShort() & 0xFFFF; + colormap_length = b.getShort() & 0xFFFF; + colormap_size = b.get() & 0xFF; + x_origin = b.getShort() & 0xFFFF; + y_origin = b.getShort() & 0xFFFF; + width = b.getShort() & 0xFFFF; + height = b.getShort() & 0xFFFF; + pixel_size = b.get() & 0xFF; + attributes = b.get() & 0xFF; + + // fill data + data = b.slice(); + } + + } + + /* + ======================================================================== + .MD2 triangle model file format ======================================================================== |