mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-14 21:20:26 +01:00
vk: fix beams per-vertex blending
This commit is contained in:
parent
26ad10483f
commit
f2182bb255
@ -145,13 +145,17 @@ qboolean R_BeamCull( const vec3_t start, const vec3_t end, qboolean pvsOnly )
|
||||
return true;
|
||||
}
|
||||
|
||||
static float clampf(float v, float min, float max) {
|
||||
if (v < min) return min;
|
||||
if (v > max) return max;
|
||||
return v;
|
||||
}
|
||||
|
||||
static void applyBrightness( float brightness, const vec4_t color, vec4_t out )
|
||||
{
|
||||
out[0] = color[0] * color[3] * brightness;
|
||||
out[1] = color[1] * color[3] * brightness;
|
||||
out[2] = color[2] * color[3] * brightness;
|
||||
out[3] = 1.f;
|
||||
static void applyBrightness( float brightness, const vec4_t color, rgba_t out ) {
|
||||
out[0] = clampf(color[0] * color[3] * brightness, 0, 1) * 255.f;
|
||||
out[1] = clampf(color[1] * color[3] * brightness, 0, 1) * 255.f;
|
||||
out[2] = clampf(color[2] * color[3] * brightness, 0, 1) * 255.f;
|
||||
out[3] = 255;
|
||||
}
|
||||
|
||||
static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, float freq, float speed, int segments, int flags, const vec4_t color, int texture, int render_mode )
|
||||
@ -298,8 +302,8 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f
|
||||
dst_vtx->lm_tc[0] = dst_vtx->lm_tc[1] = 0.f;
|
||||
dst_vtx->gl_tc[0] = 0.0f;
|
||||
dst_vtx->gl_tc[1] = curSeg.texcoord;
|
||||
//FIXME VK applyBrightness( brightness, color, dst_vtx->color );
|
||||
// FIXME VK pglNormal3fv( vAveNormal );
|
||||
dst_vtx->flags = 1;
|
||||
applyBrightness( brightness, color, dst_vtx->color );
|
||||
VectorCopy( vPoint1, dst_vtx->pos );
|
||||
VectorCopy( vAveNormal, dst_vtx->normal );
|
||||
++dst_vtx;
|
||||
@ -307,9 +311,10 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f
|
||||
dst_vtx->lm_tc[0] = dst_vtx->lm_tc[1] = 0.f;
|
||||
dst_vtx->gl_tc[0] = 1.0f;
|
||||
dst_vtx->gl_tc[1] = curSeg.texcoord;
|
||||
//FIXME VK applyBrightness( brightness, color, dst_vtx->color );
|
||||
// FIXME VK pglNormal3fv( vAveNormal );
|
||||
dst_vtx->flags = 1;
|
||||
applyBrightness( brightness, color, dst_vtx->color );
|
||||
VectorCopy( vPoint2, dst_vtx->pos );
|
||||
VectorCopy( vAveNormal, dst_vtx->normal );
|
||||
++dst_vtx;
|
||||
}
|
||||
|
||||
@ -339,17 +344,19 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f
|
||||
dst_vtx->lm_tc[0] = dst_vtx->lm_tc[1] = 0.f;
|
||||
dst_vtx->gl_tc[0] = 0.0f;
|
||||
dst_vtx->gl_tc[1] = curSeg.texcoord;
|
||||
//FIXME VK applyBrightness( brightness, color, dst_vtx->color );
|
||||
// FIXME VK pglNormal3fv( vLastNormal );
|
||||
dst_vtx->flags = 1;
|
||||
applyBrightness( brightness, color, dst_vtx->color );
|
||||
VectorCopy( vPoint1, dst_vtx->pos );
|
||||
VectorCopy( vLastNormal, dst_vtx->normal );
|
||||
++dst_vtx;
|
||||
|
||||
dst_vtx->lm_tc[0] = dst_vtx->lm_tc[1] = 0.f;
|
||||
dst_vtx->gl_tc[0] = 1.0f;
|
||||
dst_vtx->gl_tc[1] = curSeg.texcoord;
|
||||
//FIXME VK applyBrightness( brightness, color, dst_vtx->color );
|
||||
// FIXME VK pglNormal3fv( vLastNormal );
|
||||
dst_vtx->flags = 1;
|
||||
applyBrightness( brightness, color, dst_vtx->color );
|
||||
VectorCopy( vPoint2, dst_vtx->pos );
|
||||
VectorCopy( vLastNormal, dst_vtx->normal );
|
||||
++dst_vtx;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user