mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-11-24 21:12:03 +00:00
157 lines
4.5 KiB
C
157 lines
4.5 KiB
C
|
/*
|
||
|
===========================================================================
|
||
|
|
||
|
Doom 3 BFG Edition GPL Source Code
|
||
|
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||
|
|
||
|
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||
|
|
||
|
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||
|
|
||
|
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||
|
|
||
|
===========================================================================
|
||
|
*/
|
||
|
|
||
|
#ifndef __IMAGEOPTS_H__
|
||
|
#define __IMAGEOPTS_H__
|
||
|
|
||
|
enum textureType_t {
|
||
|
TT_DISABLED,
|
||
|
TT_2D,
|
||
|
TT_CUBIC
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
================================================
|
||
|
The internal *Texture Format Types*, ::textureFormat_t, are:
|
||
|
================================================
|
||
|
*/
|
||
|
enum textureFormat_t {
|
||
|
FMT_NONE,
|
||
|
|
||
|
//------------------------
|
||
|
// Standard color image formats
|
||
|
//------------------------
|
||
|
|
||
|
FMT_RGBA8, // 32 bpp
|
||
|
FMT_XRGB8, // 32 bpp
|
||
|
|
||
|
//------------------------
|
||
|
// Alpha channel only
|
||
|
//------------------------
|
||
|
|
||
|
// Alpha ends up being the same as L8A8 in our current implementation, because straight
|
||
|
// alpha gives 0 for color, but we want 1.
|
||
|
FMT_ALPHA,
|
||
|
|
||
|
//------------------------
|
||
|
// Luminance replicates the value across RGB with a constant A of 255
|
||
|
// Intensity replicates the value across RGBA
|
||
|
//------------------------
|
||
|
|
||
|
FMT_L8A8, // 16 bpp
|
||
|
FMT_LUM8, // 8 bpp
|
||
|
FMT_INT8, // 8 bpp
|
||
|
|
||
|
//------------------------
|
||
|
// Compressed texture formats
|
||
|
//------------------------
|
||
|
|
||
|
FMT_DXT1, // 4 bpp
|
||
|
FMT_DXT5, // 8 bpp
|
||
|
|
||
|
//------------------------
|
||
|
// Depth buffer formats
|
||
|
//------------------------
|
||
|
|
||
|
FMT_DEPTH, // 24 bpp
|
||
|
|
||
|
//------------------------
|
||
|
//
|
||
|
//------------------------
|
||
|
|
||
|
FMT_X16, // 16 bpp
|
||
|
FMT_Y16_X16, // 32 bpp
|
||
|
FMT_RGB565, // 16 bpp
|
||
|
};
|
||
|
|
||
|
int BitsForFormat( textureFormat_t format );
|
||
|
|
||
|
/*
|
||
|
================================================
|
||
|
DXT5 color formats
|
||
|
================================================
|
||
|
*/
|
||
|
enum textureColor_t {
|
||
|
CFM_DEFAULT, // RGBA
|
||
|
CFM_NORMAL_DXT5, // XY format and use the fast DXT5 compressor
|
||
|
CFM_YCOCG_DXT5, // convert RGBA to CoCg_Y format
|
||
|
CFM_GREEN_ALPHA // Copy the alpha channel to green
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
================================================
|
||
|
idImageOpts hold parameters for texture operations.
|
||
|
================================================
|
||
|
*/
|
||
|
class idImageOpts {
|
||
|
public:
|
||
|
idImageOpts();
|
||
|
|
||
|
bool operator==( const idImageOpts & opts );
|
||
|
|
||
|
//---------------------------------------------------
|
||
|
// these determine the physical memory size and layout
|
||
|
//---------------------------------------------------
|
||
|
|
||
|
textureType_t textureType;
|
||
|
textureFormat_t format;
|
||
|
textureColor_t colorFormat;
|
||
|
int width;
|
||
|
int height; // not needed for cube maps
|
||
|
int numLevels; // if 0, will be 1 for NEAREST / LINEAR filters, otherwise based on size
|
||
|
bool gammaMips; // if true, mips will be generated with gamma correction
|
||
|
bool readback; // 360 specific - cpu reads back from this texture, so allocate with cached memory
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
========================
|
||
|
idImageOpts::idImageOpts
|
||
|
========================
|
||
|
*/
|
||
|
ID_INLINE idImageOpts::idImageOpts() {
|
||
|
format = FMT_NONE;
|
||
|
colorFormat = CFM_DEFAULT;
|
||
|
width = 0;
|
||
|
height = 0;
|
||
|
numLevels = 0;
|
||
|
textureType = TT_2D;
|
||
|
gammaMips = false;
|
||
|
readback = false;
|
||
|
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
========================
|
||
|
idImageOpts::operator==
|
||
|
========================
|
||
|
*/
|
||
|
ID_INLINE bool idImageOpts::operator==( const idImageOpts & opts ) {
|
||
|
return ( memcmp( this, &opts, sizeof( *this ) ) == 0 );
|
||
|
}
|
||
|
|
||
|
#endif
|