Browse Source

ref_soft: fix particles

pull/2/head
mittorn 6 years ago
parent
commit
2efdf56317
  1. 6
      r_image.c
  2. 15
      r_main.c
  3. 17
      r_part.c

6
r_image.c

@ -571,9 +571,9 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) @@ -571,9 +571,9 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
//GL_TextureImageRAW( tex, i, j, width, height, tex->depth, pic->type, data );
// increase size to workaround triangle renderer bugs
// it seems to assume memory readable. maybe it was pointed to WAD?
tex->pixels[j] = (byte*)Mem_Malloc( r_temppool, width * height * sizeof(pixel_t) + 1024 ) + 512;
memset( (byte*)tex->pixels[j] - 512, 0xFF, 512 );
memset( (byte*)tex->pixels[j] + width * height * sizeof(pixel_t), 0xFF, 512 );
tex->pixels[j] = (byte*)Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 1024 ) + 512;
//memset( (byte*)tex->pixels[j] - 512, 0xFF, 512 );
//memset( (byte*)tex->pixels[j] + width * height * sizeof(pixel_t), 0xFF, 512 );
if( j == 0 && tex->flags & TF_HAS_ALPHA )
tex->alpha_pixels = (byte*)Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 256 ) + 128;

15
r_main.c

@ -478,20 +478,19 @@ R_SetupFrustum @@ -478,20 +478,19 @@ R_SetupFrustum
*/
void R_SetupFrustum( void )
{
AngleVectors( RI.viewangles, RI.vforward, RI.vright, RI.vup );
#if 0
#if 1
ref_overview_t *ov = gEngfuncs.GetOverviewParms();
if( RP_NORMALPASS() && ( gEngfuncs.GetWaterLevel() >= 3 ))
/*if( RP_NORMALPASS() && ( ENGINE_GET_PARM( PARM_WATER_LEVEL ) >= 3 ))
{
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
}
}*/
// build the transformation matrix for the given view angles
AngleVectors( RI.viewangles, RI.vforward, RI.vright, RI.vup );
if( !r_lockfrustum->value )
//if( !r_lockfrustum->value )
{
VectorCopy( RI.vieworg, RI.cullorigin );
VectorCopy( RI.vforward, RI.cull_vforward );
@ -499,9 +498,9 @@ void R_SetupFrustum( void ) @@ -499,9 +498,9 @@ void R_SetupFrustum( void )
VectorCopy( RI.vup, RI.cull_vup );
}
if( RI.drawOrtho )
GL_FrustumInitOrtho( &RI.frustum, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
else GL_FrustumInitProj( &RI.frustum, 0.0f, R_GetFarClip(), RI.fov_x, RI.fov_y ); // NOTE: we ignore nearplane here (mirrors only)
// if( RI.drawOrtho )
// GL_FrustumInitOrtho( &RI.frustum, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
// else GL_FrustumInitProj( &RI.frustum, 0.0f, R_GetFarClip(), RI.fov_x, RI.fov_y ); // NOTE: we ignore nearplane here (mirrors only)
#endif
}

17
r_part.c

@ -66,8 +66,6 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float @@ -66,8 +66,6 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
//pglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
//pglDepthMask( GL_FALSE );
TriBegin( TRI_QUADS );
for( p = cl_active_particles; p; p = p->next )
{
if(( p->type != pt_blob ) || ( p->packedColor == 255 ))
@ -93,10 +91,13 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float @@ -93,10 +91,13 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
if( alpha > 255 || p->type == pt_static )
alpha = 255;
TriColor4ub( gEngfuncs.LightToTexGamma( pColor->r ),
gEngfuncs.LightToTexGamma( pColor->g ),
gEngfuncs.LightToTexGamma( pColor->b ), alpha );
//TriColor4ub( gEngfuncs.LightToTexGamma( pColor->r ),
// gEngfuncs.LightToTexGamma( pColor->g ),
// gEngfuncs.LightToTexGamma( pColor->b ), alpha );
//TriBrightness( alpha / 255.0f );
_TriColor4f(1.0f*alpha/255/255*pColor->r,1.0f*alpha/255/255*pColor->g,1.0f*alpha/255/255* pColor->b,1.0f );
TriBegin( TRI_QUADS );
TriTexCoord2f( 0.0f, 1.0f );
TriVertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
TriTexCoord2f( 0.0f, 0.0f );
@ -105,6 +106,7 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float @@ -105,6 +106,7 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles, float
TriVertex3f( p->org[0] + right[0] - up[0], p->org[1] + right[1] - up[1], p->org[2] + right[2] - up[2] );
TriTexCoord2f( 1.0f, 1.0f );
TriVertex3f( p->org[0] - right[0] - up[0], p->org[1] - right[1] - up[1], p->org[2] - right[2] - up[2] );
TriEnd();
r_stats.c_particle_count++;
}
@ -211,6 +213,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers ) @@ -211,6 +213,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
vec3_t verts[4], tmp2;
vec3_t tmp, normal;
color24 *pColor;
short alpha = p->packedColor;
// Transform point into screen space
TriWorldToScreen( start, screen );
@ -241,7 +244,9 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers ) @@ -241,7 +244,9 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
}
pColor = &gTracerColors[p->color];
TriColor4ub( pColor->r, pColor->g, pColor->b, p->packedColor );
//TriColor4ub( pColor->r, pColor->g, pColor->b, p->packedColor );
_TriColor4f(1.0f*alpha/255/255*pColor->r,1.0f*alpha/255/255*pColor->g,1.0f*alpha/255/255* pColor->b,1.0f );
TriBegin( TRI_QUADS );
TriTexCoord2f( 0.0f, 0.8f );

Loading…
Cancel
Save