doom3-bfg/neo/renderer/ImageOpts.h

176 lines
4.8 KiB
C
Raw Normal View History

2012-11-26 18:58:24 +00:00
/*
===========================================================================
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
Copyright (C) 2013-2014 Robert Beckebans
2012-11-26 18:58:24 +00:00
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
2012-11-26 18:58:24 +00:00
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
{
2012-11-26 18:58:24 +00:00
TT_DISABLED,
TT_2D,
TT_CUBIC,
// RB begin
TT_2D_ARRAY
// RB end
2012-11-26 18:58:24 +00:00
};
/*
================================================
The internal *Texture Format Types*, ::textureFormat_t, are:
================================================
*/
enum textureFormat_t
{
2012-11-26 18:58:24 +00:00
FMT_NONE,
2012-11-26 18:58:24 +00:00
//------------------------
// Standard color image formats
//------------------------
2012-11-26 18:58:24 +00:00
FMT_RGBA8, // 32 bpp
FMT_XRGB8, // 32 bpp
2012-11-26 18:58:24 +00:00
//------------------------
// Alpha channel only
//------------------------
// Alpha ends up being the same as L8A8 in our current implementation, because straight
2012-11-26 18:58:24 +00:00
// alpha gives 0 for color, but we want 1.
FMT_ALPHA,
2012-11-26 18:58:24 +00:00
//------------------------
// Luminance replicates the value across RGB with a constant A of 255
// Intensity replicates the value across RGBA
//------------------------
2012-11-26 18:58:24 +00:00
FMT_L8A8, // 16 bpp
FMT_LUM8, // 8 bpp
FMT_INT8, // 8 bpp
2012-11-26 18:58:24 +00:00
//------------------------
// Compressed texture formats
//------------------------
2012-11-26 18:58:24 +00:00
FMT_DXT1, // 4 bpp
FMT_DXT5, // 8 bpp
2012-11-26 18:58:24 +00:00
//------------------------
// Depth buffer formats
//------------------------
2012-11-26 18:58:24 +00:00
FMT_DEPTH, // 24 bpp
2012-11-26 18:58:24 +00:00
//------------------------
//
//------------------------
2012-11-26 18:58:24 +00:00
FMT_X16, // 16 bpp
FMT_Y16_X16, // 32 bpp
FMT_RGB565, // 16 bpp
// RB: don't change above for legacy .bimage compatibility
FMT_ETC1_RGB8_OES, // 4 bpp
FMT_SHADOW_ARRAY, // 32 bpp * 6
// RB end
2012-11-26 18:58:24 +00:00
};
int BitsForFormat( textureFormat_t format );
/*
================================================
DXT5 color formats
================================================
*/
enum textureColor_t
{
2012-11-26 18:58:24 +00:00
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
// RB: don't change above for legacy .bimage compatibility
CFM_YCOCG_RGBA8,
// RB end
2012-11-26 18:58:24 +00:00
};
/*
================================================
idImageOpts hold parameters for texture operations.
================================================
*/
class idImageOpts
{
2012-11-26 18:58:24 +00:00
public:
idImageOpts();
bool operator==( const idImageOpts& opts );
2012-11-26 18:58:24 +00:00
//---------------------------------------------------
// these determine the physical memory size and layout
//---------------------------------------------------
2012-11-26 18:58:24 +00:00
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()
{
2012-11-26 18:58:24 +00:00
format = FMT_NONE;
colorFormat = CFM_DEFAULT;
width = 0;
height = 0;
numLevels = 0;
textureType = TT_2D;
gammaMips = false;
readback = false;
2012-11-26 18:58:24 +00:00
};
/*
========================
idImageOpts::operator==
========================
*/
ID_INLINE bool idImageOpts::operator==( const idImageOpts& opts )
{
2012-11-26 18:58:24 +00:00
return ( memcmp( this, &opts, sizeof( *this ) ) == 0 );
}
#endif