void R_FogLightningBeam_Vertex3f_Color4f(const float *v, float *c, int numverts, float r, float g, float b, float a)
{
int i;
- float ifog;
+ float fog;
for (i = 0;i < numverts;i++, v += 3, c += 4)
{
- ifog = 1 - VERTEXFOGTABLE(VectorDistance(v, r_view.origin));
- c[0] = r * ifog;
- c[1] = g * ifog;
- c[2] = b * ifog;
+ fog = FogPoint_World(v);
+ c[0] = r * fog;
+ c[1] = g * fog;
+ c[2] = b * fog;
c[3] = a;
}
}
R_Mesh_Matrix(&identitymatrix);
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
+ GL_DepthRange(0, 1);
GL_DepthTest(true);
if (r_lightningbeam_qmbtexture.integer && r_lightningbeamqmbtexture == NULL)
r_lightningbeams_setupqmbtexture();
if (!r_lightningbeam_qmbtexture.integer && r_lightningbeamtexture == NULL)
r_lightningbeams_setuptexture();
- R_Mesh_VertexPointer(vertex3f);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ // FIXME: fixed function path can't properly handle r_view.colorscale > 1
if (r_refdef.fogenabled)
{
// per vertex colors if fog is used
- R_Mesh_ColorPointer(color4f);
- R_FogLightningBeam_Vertex3f_Color4f(vertex3f, color4f, 12, r_lightningbeam_color_red.value, r_lightningbeam_color_green.value, r_lightningbeam_color_blue.value, 1);
+ R_Mesh_ColorPointer(color4f, 0, 0);
+ R_FogLightningBeam_Vertex3f_Color4f(vertex3f, color4f, 12, r_lightningbeam_color_red.value * r_view.colorscale, r_lightningbeam_color_green.value * r_view.colorscale, r_lightningbeam_color_blue.value * r_view.colorscale, 1);
}
else
{
// solid color if fog is not used
- R_Mesh_ColorPointer(NULL);
- GL_Color(r_lightningbeam_color_red.value, r_lightningbeam_color_green.value, r_lightningbeam_color_blue.value, 1);
+ R_Mesh_ColorPointer(NULL, 0, 0);
+ GL_Color(r_lightningbeam_color_red.value * r_view.colorscale, r_lightningbeam_color_green.value * r_view.colorscale, r_lightningbeam_color_blue.value * r_view.colorscale, 1);
}
memset(&m, 0, sizeof(m));
if (r_lightningbeam_qmbtexture.integer)
const beam_t *b = cl.beams + surfacelist[surfacelistindex];
vec3_t beamdir, right, up, offset, start, end;
float length, t1, t2;
-
+
CL_Beam_CalculatePositions(b, start, end);
// calculate beam direction (beamdir) vector and beam length
// draw the 3 polygons as one batch of 6 triangles using the 12 vertices
GL_LockArrays(0, 12);
- R_Mesh_Draw(0, 12, 6, r_lightningbeamelements);
+ R_Mesh_Draw(0, 12, 6, r_lightningbeamelements, 0, 0);
GL_LockArrays(0, 0);
}
}