Fix SpriteTexture

This commit is contained in:
mittorn 2019-03-17 23:41:11 +07:00
parent c55b7dcda7
commit 0a22040c6e
5 changed files with 25 additions and 5 deletions

View File

@ -519,7 +519,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
// scale for screen sizes
SPR_AdjustSize( &x, &y, &width, &height );
texnum = ref.dllFuncs.SpriteTexture( clgame.ds.pSprite, frame );
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
}
@ -3238,6 +3238,26 @@ void TriColor4fRendermode( float r, float g, float b, float a, int rendermode )
else ref.dllFuncs.Color4f( r * a, g * a, b * a, 1.0f );
}
/*
=============
TriSpriteTexture
bind current texture
=============
*/
int TriSpriteTexture( model_t *pSpriteModel, int frame )
{
int gl_texturenum;
if(( gl_texturenum = ref.dllFuncs.R_GetSpriteTexture( pSpriteModel, frame )) <= 0 )
return 0;
ref.dllFuncs.GL_Bind( XASH_TEXTURE0, gl_texturenum );
return 1;
}
/*
=================
DemoApi implementation

View File

@ -420,7 +420,7 @@ static void CL_FillTriAPIFromRef( triangleapi_t *dst, const ref_interface_t *src
dst->Vertex3fv = src->Vertex3fv;
dst->Brightness = TriBrightness;
dst->CullFace = TriCullFace;
dst->SpriteTexture = src->SpriteTexture;
dst->SpriteTexture = TriSpriteTexture;
dst->WorldToScreen = TriWorldToScreen;
dst->Fog = src->Fog;
dst->ScreenToWorld = src->ScreenToWorld;

View File

@ -507,6 +507,7 @@ typedef struct ref_interface_s
// sprites
void (*R_GetSpriteParms)( int *frameWidth, int *frameHeight, int *numFrames, int currentFrame, const model_t *pSprite );
int (*R_GetSpriteTexture)( const model_t *m_pSpriteModel, int frame );
// model management
// flags ignored for everything except spritemodels
@ -592,7 +593,6 @@ typedef struct ref_interface_s
void (*TexCoord2f)( float u, float v );
void (*Vertex3fv)( const float *worldPnt );
void (*Vertex3f)( float x, float y, float z );
int (*SpriteTexture)( struct model_s *pSpriteModel, int frame );
int (*WorldToScreen)( const float *world, float *screen ); // Returns 1 if it's z clipped
void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.
void (*ScreenToWorld)( const float *screen, float *world );

View File

@ -446,6 +446,7 @@ ref_interface_t gReffuncs =
CL_RunLightStyles,
R_GetSpriteParms,
R_GetSpriteTexture,
Mod_LoadMapSprite,
Mod_ProcessRenderData,
@ -511,7 +512,6 @@ ref_interface_t gReffuncs =
TriTexCoord2f,
TriVertex3fv,
TriVertex3f,
TriSpriteTexture,
TriWorldToScreen,
TriFog,
R_ScreenToWorld,

View File

@ -237,7 +237,7 @@ int TriSpriteTexture( model_t *pSpriteModel, int frame )
GL_Bind( XASH_TEXTURE0, gl_texturenum );
return gl_texturenum;
return 1;
}
/*