+#define LERPSPRITES
+
+static int R_SpriteSetup (int type, float org[3], float left[3], float up[3])
+{
+ float matrix1[3][3], matrix2[3][3], matrix3[3][3];
+
+ VectorCopy(currentrenderentity->origin, org);
+ switch(type)
+ {
+ case SPR_VP_PARALLEL_UPRIGHT:
+ // flames and such
+ // vertical beam sprite, faces view plane
+ VectorNegate(vpn, matrix3[0]);
+ matrix3[0][2] = 0;
+ VectorNormalizeFast(matrix3[0]);
+ matrix3[1][0] = matrix3[0][1];
+ matrix3[1][1] = -matrix3[0][0];
+ matrix3[1][2] = 0;
+ matrix3[2][0] = 0;
+ matrix3[2][1] = 0;
+ matrix3[2][2] = 1;
+ break;
+ case SPR_FACING_UPRIGHT:
+ // flames and such
+ // vertical beam sprite, faces viewer's origin (not the view plane)
+ VectorSubtract(currentrenderentity->origin, r_origin, matrix3[0]);
+ matrix3[0][2] = 0;
+ VectorNormalizeFast(matrix3[0]);
+ matrix3[1][0] = matrix3[0][1];
+ matrix3[1][1] = -matrix3[0][0];
+ matrix3[1][2] = 0;
+ matrix3[2][0] = 0;
+ matrix3[2][1] = 0;
+ matrix3[2][2] = 1;
+ break;
+ default:
+ Con_Printf("R_SpriteSetup: unknown sprite type %i\n", type);
+ // fall through to normal sprite
+ case SPR_VP_PARALLEL:
+ // normal sprite
+ // faces view plane
+ VectorCopy(vpn, matrix3[0]);
+ VectorNegate(vright, matrix3[1]);
+ VectorCopy(vup, matrix3[2]);
+ break;
+ case SPR_ORIENTED:
+ // bullet marks on walls
+ // ignores viewer entirely
+ AngleVectorsFLU (currentrenderentity->angles, matrix3[0], matrix3[1], matrix3[2]);
+ // nudge it toward the view, so it will be infront of the wall
+ VectorSubtract(org, vpn, org);
+ break;
+ case SPR_VP_PARALLEL_ORIENTED:
+ // I have no idea what people would use this for
+ // oriented relative to view space
+ // FIXME: test this and make sure it mimicks software
+ AngleVectorsFLU (currentrenderentity->angles, matrix1[0], matrix1[1], matrix1[2]);
+ VectorCopy(vpn, matrix2[0]);
+ VectorNegate(vright, matrix2[1]);
+ VectorCopy(vup, matrix2[2]);
+ R_ConcatRotations (matrix1[0], matrix2[0], matrix3[0]);
+ break;
+ }
+
+ if (currentrenderentity->scale != 1)
+ {
+ VectorScale(matrix3[1], currentrenderentity->scale, left);
+ VectorScale(matrix3[2], currentrenderentity->scale, up);
+ }
+ else
+ {
+ VectorCopy(matrix3[1], left);
+ VectorCopy(matrix3[2], up);
+ }
+ return false;
+}
+
+static int spritepolyindex[6] = {0, 1, 2, 0, 2, 3};
+
+static void GL_DrawSpriteImage (int fog, mspriteframe_t *frame, int texture, vec3_t origin, vec3_t up, vec3_t left, float red, float green, float blue, float alpha)