+void R_CalcBeam_Vertex3f (float *vert, const vec3_t org1, const vec3_t org2, float width)
+{
+ vec3_t right1, right2, diff, normal;
+
+ VectorSubtract (org2, org1, normal);
+ VectorNormalizeFast (normal);
+
+ // calculate 'right' vector for start
+ VectorSubtract (r_vieworigin, org1, diff);
+ VectorNormalizeFast (diff);
+ CrossProduct (normal, diff, right1);
+
+ // calculate 'right' vector for end
+ VectorSubtract (r_vieworigin, org2, diff);
+ VectorNormalizeFast (diff);
+ CrossProduct (normal, diff, right2);
+
+ vert[ 0] = org1[0] + width * right1[0];
+ vert[ 1] = org1[1] + width * right1[1];
+ vert[ 2] = org1[2] + width * right1[2];
+ vert[ 3] = org1[0] - width * right1[0];
+ vert[ 4] = org1[1] - width * right1[1];
+ vert[ 5] = org1[2] - width * right1[2];
+ vert[ 6] = org2[0] - width * right2[0];
+ vert[ 7] = org2[1] - width * right2[1];
+ vert[ 8] = org2[2] - width * right2[2];
+ vert[ 9] = org2[0] + width * right2[0];
+ vert[10] = org2[1] + width * right2[1];
+ vert[11] = org2[2] + width * right2[2];
+}
+
+float spritetexcoord2f[4*2] = {0, 1, 0, 0, 1, 0, 1, 1};
+
+void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, int depthdisable, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca)
+{
+ float diff[3];
+ rmeshstate_t m;
+
+ if (fogenabled)
+ {
+ VectorSubtract(origin, r_vieworigin, diff);
+ ca *= 1 - exp(fogdensity/DotProduct(diff,diff));
+ }
+
+ R_Mesh_Matrix(&r_identitymatrix);
+ GL_Color(cr, cg, cb, ca);
+ GL_VertexPointer(varray_vertex3f);
+ GL_BlendFunc(blendfunc1, blendfunc2);
+ GL_DepthMask(false);
+ GL_DepthTest(!depthdisable);
+
+ memset(&m, 0, sizeof(m));
+ m.tex[0] = R_GetTexture(texture);
+ m.pointer_texcoord[0] = spritetexcoord2f;
+ R_Mesh_State_Texture(&m);
+
+ varray_vertex3f[ 0] = origin[0] + left[0] * scalex2 + up[0] * scaley1;
+ varray_vertex3f[ 1] = origin[1] + left[1] * scalex2 + up[1] * scaley1;
+ varray_vertex3f[ 2] = origin[2] + left[2] * scalex2 + up[2] * scaley1;
+ varray_vertex3f[ 3] = origin[0] + left[0] * scalex2 + up[0] * scaley2;
+ varray_vertex3f[ 4] = origin[1] + left[1] * scalex2 + up[1] * scaley2;
+ varray_vertex3f[ 5] = origin[2] + left[2] * scalex2 + up[2] * scaley2;
+ varray_vertex3f[ 6] = origin[0] + left[0] * scalex1 + up[0] * scaley2;
+ varray_vertex3f[ 7] = origin[1] + left[1] * scalex1 + up[1] * scaley2;
+ varray_vertex3f[ 8] = origin[2] + left[2] * scalex1 + up[2] * scaley2;
+ varray_vertex3f[ 9] = origin[0] + left[0] * scalex1 + up[0] * scaley1;
+ varray_vertex3f[10] = origin[1] + left[1] * scalex1 + up[1] * scaley1;
+ varray_vertex3f[11] = origin[2] + left[2] * scalex1 + up[2] * scaley1;
+ R_Mesh_Draw(4, 2, polygonelements);
+}
+