|
|
@ -481,7 +481,7 @@ static size_t GL_CalcTextureSize( GLenum format, int width, int height, int dept |
|
|
|
return size; |
|
|
|
return size; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int GL_CalcMipmapCount( gl_texture_t *tex, qboolean haveBuffer ) |
|
|
|
static int GL_CalcMipmapCount( gl_texture_t *tex, qboolean haveBuffer ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int width, height; |
|
|
|
int width, height; |
|
|
|
int mipcount; |
|
|
|
int mipcount; |
|
|
@ -494,7 +494,7 @@ static int GL_CalcMipmapCount( gl_texture_t *tex, qboolean haveBuffer ) |
|
|
|
// generate mip-levels by user request
|
|
|
|
// generate mip-levels by user request
|
|
|
|
if( FBitSet( tex->flags, TF_NOMIPMAP )) |
|
|
|
if( FBitSet( tex->flags, TF_NOMIPMAP )) |
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
|
|
// mip-maps can't exceeds 16
|
|
|
|
// mip-maps can't exceeds 16
|
|
|
|
for( mipcount = 0; mipcount < 16; mipcount++ ) |
|
|
|
for( mipcount = 0; mipcount < 16; mipcount++ ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -514,7 +514,7 @@ GL_SetTextureDimensions |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static void GL_SetTextureDimensions( gl_texture_t *tex, int width, int height, int depth ) |
|
|
|
static void GL_SetTextureDimensions( gl_texture_t *tex, int width, int height, int depth ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int maxTextureSize; |
|
|
|
int maxTextureSize = 0; |
|
|
|
int maxDepthSize = 1; |
|
|
|
int maxDepthSize = 1; |
|
|
|
|
|
|
|
|
|
|
|
Assert( tex != NULL ); |
|
|
|
Assert( tex != NULL ); |
|
|
@ -539,6 +539,8 @@ static void GL_SetTextureDimensions( gl_texture_t *tex, int width, int height, i |
|
|
|
maxDepthSize = glConfig.max_3d_texture_size; |
|
|
|
maxDepthSize = glConfig.max_3d_texture_size; |
|
|
|
maxTextureSize = glConfig.max_3d_texture_size; |
|
|
|
maxTextureSize = glConfig.max_3d_texture_size; |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
Assert( false ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// store original sizes
|
|
|
|
// store original sizes
|
|
|
@ -717,7 +719,7 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan |
|
|
|
|
|
|
|
|
|
|
|
switch( GL_CalcTextureSamples( channelMask )) |
|
|
|
switch( GL_CalcTextureSamples( channelMask )) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
if( FBitSet( tex->flags, TF_ALPHACONTRAST )) |
|
|
|
if( FBitSet( tex->flags, TF_ALPHACONTRAST )) |
|
|
|
tex->format = GL_INTENSITY8; |
|
|
|
tex->format = GL_INTENSITY8; |
|
|
|
else tex->format = GL_LUMINANCE8; |
|
|
|
else tex->format = GL_LUMINANCE8; |
|
|
@ -730,7 +732,7 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan |
|
|
|
case 32: tex->format = GL_RGB8; break; |
|
|
|
case 32: tex->format = GL_RGB8; break; |
|
|
|
default: tex->format = GL_RGB; break; |
|
|
|
default: tex->format = GL_RGB; break; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
|
default: |
|
|
|
default: |
|
|
|
switch( bits ) |
|
|
|
switch( bits ) |
|
|
@ -1233,7 +1235,7 @@ do specified actions on pixels |
|
|
|
static void GL_ProcessImage( gl_texture_t *tex, rgbdata_t *pic ) |
|
|
|
static void GL_ProcessImage( gl_texture_t *tex, rgbdata_t *pic ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
float emboss_scale = 0.0f; |
|
|
|
float emboss_scale = 0.0f; |
|
|
|
uint img_flags = 0; |
|
|
|
uint img_flags = 0; |
|
|
|
|
|
|
|
|
|
|
|
// force upload texture as RGB or RGBA (detail textures requires this)
|
|
|
|
// force upload texture as RGB or RGBA (detail textures requires this)
|
|
|
|
if( tex->flags & TF_FORCE_COLOR ) pic->flags |= IMAGE_HAS_COLOR; |
|
|
|
if( tex->flags & TF_FORCE_COLOR ) pic->flags |= IMAGE_HAS_COLOR; |
|
|
@ -1472,7 +1474,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags ) |
|
|
|
SetBits( picFlags, IL_DONTFLIP_TGA ); |
|
|
|
SetBits( picFlags, IL_DONTFLIP_TGA ); |
|
|
|
|
|
|
|
|
|
|
|
if( FBitSet( flags, TF_KEEP_SOURCE ) && !FBitSet( flags, TF_EXPAND_SOURCE )) |
|
|
|
if( FBitSet( flags, TF_KEEP_SOURCE ) && !FBitSet( flags, TF_EXPAND_SOURCE )) |
|
|
|
SetBits( picFlags, IL_KEEP_8BIT ); |
|
|
|
SetBits( picFlags, IL_KEEP_8BIT ); |
|
|
|
|
|
|
|
|
|
|
|
// set some image flags
|
|
|
|
// set some image flags
|
|
|
|
gEngfuncs.Image_SetForceFlags( picFlags ); |
|
|
|
gEngfuncs.Image_SetForceFlags( picFlags ); |
|
|
@ -1615,7 +1617,7 @@ int GL_LoadTextureArray( const char **names, int flags ) |
|
|
|
gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: not all layers were loaded. Texture array is not created\n" ); |
|
|
|
gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: not all layers were loaded. Texture array is not created\n" ); |
|
|
|
if( pic ) gEngfuncs.FS_FreeImage( pic ); |
|
|
|
if( pic ) gEngfuncs.FS_FreeImage( pic ); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// it's multilayer image!
|
|
|
|
// it's multilayer image!
|
|
|
|
SetBits( pic->flags, IMAGE_MULTILAYER ); |
|
|
|
SetBits( pic->flags, IMAGE_MULTILAYER ); |
|
|
@ -1923,7 +1925,7 @@ void R_InitDlightTexture( void ) |
|
|
|
return; // already initialized
|
|
|
|
return; // already initialized
|
|
|
|
|
|
|
|
|
|
|
|
memset( &r_image, 0, sizeof( r_image )); |
|
|
|
memset( &r_image, 0, sizeof( r_image )); |
|
|
|
r_image.width = BLOCK_SIZE; |
|
|
|
r_image.width = BLOCK_SIZE; |
|
|
|
r_image.height = BLOCK_SIZE; |
|
|
|
r_image.height = BLOCK_SIZE; |
|
|
|
r_image.flags = IMAGE_HAS_COLOR; |
|
|
|
r_image.flags = IMAGE_HAS_COLOR; |
|
|
|
r_image.type = PF_RGBA_32; |
|
|
|
r_image.type = PF_RGBA_32; |
|
|
@ -2100,7 +2102,7 @@ void R_TextureList_f( void ) |
|
|
|
case GL_DEPTH_COMPONENT: |
|
|
|
case GL_DEPTH_COMPONENT: |
|
|
|
case GL_DEPTH_COMPONENT24: |
|
|
|
case GL_DEPTH_COMPONENT24: |
|
|
|
gEngfuncs.Con_Printf( "DPTH24" ); |
|
|
|
gEngfuncs.Con_Printf( "DPTH24" ); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case GL_DEPTH_COMPONENT32F: |
|
|
|
case GL_DEPTH_COMPONENT32F: |
|
|
|
gEngfuncs.Con_Printf( "DPTH32" ); |
|
|
|
gEngfuncs.Con_Printf( "DPTH32" ); |
|
|
|
break; |
|
|
|
break; |
|
|
|