- char identifier[64];
- int texnum; // GL texture slot number
- int texeldatasize; // computed memory usage of this texture (including mipmaps, expansion to 32bit, etc)
- byte *inputtexels; // copy of the original texture supplied to the upload function, for re-uploading or deferred uploads (non-precached)
- int inputtexeldatasize; // size of the original texture
- unsigned short width, height;
-// LordHavoc: CRC to identify cache mismatchs
- unsigned short crc;
- int flags; // the requested flags when the texture was supplied to the upload function
- int internalflags; // internal notes (lerped, etc)
-} gltexture_t;
+ int textype;
+ int inputbytesperpixel;
+ int internalbytesperpixel;
+ int glformat;
+ int glinternalformat;
+}
+textypeinfo_t;
+
+static textypeinfo_t textype_palette = {TEXTYPE_PALETTE, 1, 4, GL_RGBA , 3};
+static textypeinfo_t textype_rgb = {TEXTYPE_RGB , 3, 3, GL_RGB , 3};
+static textypeinfo_t textype_rgba = {TEXTYPE_RGBA , 4, 4, GL_RGBA , 3};
+static textypeinfo_t textype_palette_alpha = {TEXTYPE_PALETTE, 1, 4, GL_RGBA , 4};
+static textypeinfo_t textype_rgba_alpha = {TEXTYPE_RGBA , 4, 4, GL_RGBA , 4};
+static textypeinfo_t textype_dsdt = {TEXTYPE_DSDT , 2, 2, GL_DSDT_NV, GL_DSDT8_NV};
+
+// a tiling texture (most common type)
+#define GLIMAGETYPE_TILE 0
+// a fragments texture (contains one or more fragment textures)
+#define GLIMAGETYPE_FRAGMENTS 1
+
+#define GLTEXTURETYPE_1D 0
+#define GLTEXTURETYPE_2D 1
+#define GLTEXTURETYPE_3D 2
+#define GLTEXTURETYPE_CUBEMAP 3
+
+static int gltexturetypeenums[4] = {GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP_ARB};
+static int gltexturetypebindingenums[4] = {GL_TEXTURE_BINDING_1D, GL_TEXTURE_BINDING_2D, GL_TEXTURE_BINDING_3D, GL_TEXTURE_BINDING_CUBE_MAP_ARB};
+static int gltexturetypedimensions[4] = {1, 2, 3, 2};
+static int cubemapside[6] =
+{
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
+};
+
+// a gltextureimage can have one (or more if fragments) gltextures inside
+typedef struct gltextureimage_s
+{
+ struct gltextureimage_s *imagechain;
+ int texturecount;
+ int type; // one of the GLIMAGETYPE_ values
+ int texturetype; // one of the GLTEXTURETYPE_ values
+ int sides; // 1 or 6 depending on texturetype
+ int texnum; // GL texture slot number
+ int width, height, depth; // 3D texture support
+ int bytesperpixel; // bytes per pixel
+ int glformat; // GL_RGB or GL_RGBA
+ int glinternalformat; // 3 or 4
+ int flags;
+ short *blockallocation; // fragment allocation (2D only)
+}
+gltextureimage_t;