Browse Source

ref_soft: Fix windows build

pull/2/head
mittorn 6 years ago
parent
commit
3d8fe065b5
  1. 2
      r_context.c
  2. 6
      r_image.c
  3. 5
      r_triapi.c

2
r_context.c

@ -708,7 +708,7 @@ ref_interface_t gReffuncs =
VGUI_GenerateTexture, VGUI_GenerateTexture,
}; };
int GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ) int EXPORT GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals )
{ {
if( version != REF_API_VERSION ) if( version != REF_API_VERSION )
return 0; return 0;

6
r_image.c

@ -493,6 +493,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
uint offset = 0; uint offset = 0;
qboolean normalMap; qboolean normalMap;
const byte *bufend; const byte *bufend;
int mipCount;
tex->fogParams[0] = pic->fogParams[0]; tex->fogParams[0] = pic->fogParams[0];
tex->fogParams[1] = pic->fogParams[1]; tex->fogParams[1] = pic->fogParams[1];
@ -511,7 +512,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
buf = pic->buffer; buf = pic->buffer;
int mipCount = 4;//GL_CalcMipmapCount( tex, ( buf != NULL )); mipCount = 4;//GL_CalcMipmapCount( tex, ( buf != NULL ));
// NOTE: only single uncompressed textures can be resamples, no mips, no layers, no sides // NOTE: only single uncompressed textures can be resamples, no mips, no layers, no sides
if(( tex->depth == 1 ) && ( pic->width != tex->width ) || ( pic->height != tex->height )) if(( tex->depth == 1 ) && ( pic->width != tex->width ) || ( pic->height != tex->height ))
@ -524,6 +525,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
// mips will be auto-generated if desired // mips will be auto-generated if desired
for( j = 0; j < mipCount; j++ ) for( j = 0; j < mipCount; j++ )
{ {
int x, y;
width = Q_max( 1, ( tex->width >> j )); width = Q_max( 1, ( tex->width >> j ));
height = Q_max( 1, ( tex->height >> j )); height = Q_max( 1, ( tex->height >> j ));
texsize = GL_CalcTextureSize( width, height, tex->depth ); texsize = GL_CalcTextureSize( width, height, tex->depth );
@ -532,7 +534,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
tex->pixels[j] = Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 64 ); tex->pixels[j] = Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 64 );
if( j == 0 && tex->flags & TF_HAS_ALPHA ) if( j == 0 && tex->flags & TF_HAS_ALPHA )
tex->alpha_pixels = Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 64 ); tex->alpha_pixels = Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 64 );
int x, y;
for(i = 0; i < height * width; i++ ) for(i = 0; i < height * width; i++ )
{ {

5
r_triapi.c

@ -134,6 +134,7 @@ void _TriColor4f( float rr, float gg, float bb, float aa )
{ {
//pglColor4f( r, g, b, a ); //pglColor4f( r, g, b, a );
unsigned short r,g,b; unsigned short r,g,b;
unsigned int major, minor;
vid.alpha = aa * 7; vid.alpha = aa * 7;
@ -150,10 +151,10 @@ void _TriColor4f( float rr, float gg, float bb, float aa )
r = rr * 31, g = gg * 63, b = bb * 31; r = rr * 31, g = gg * 63, b = bb * 31;
unsigned int major = (((r >> 2) & MASK(3)) << 5) |( (( (g >> 3) & MASK(3)) << 2 ) )| (((b >> 3) & MASK(2))); major = (((r >> 2) & MASK(3)) << 5) |( (( (g >> 3) & MASK(3)) << 2 ) )| (((b >> 3) & MASK(2)));
// save minor GBRGBRGB // save minor GBRGBRGB
unsigned int minor = MOVE_BIT(r,1,5) | MOVE_BIT(r,0,2) | MOVE_BIT(g,2,7) | MOVE_BIT(g,1,4) | MOVE_BIT(g,0,1) | MOVE_BIT(b,2,6)| MOVE_BIT(b,1,3)|MOVE_BIT(b,0,0); minor = MOVE_BIT(r,1,5) | MOVE_BIT(r,0,2) | MOVE_BIT(g,2,7) | MOVE_BIT(g,1,4) | MOVE_BIT(g,0,1) | MOVE_BIT(b,2,6)| MOVE_BIT(b,1,3)|MOVE_BIT(b,0,0);
vid.color = major << 8 | (minor & 0xFF); vid.color = major << 8 | (minor & 0xFF);
} }

Loading…
Cancel
Save