+ cr *= r_colorscale;
+ cg *= r_colorscale;
+ cb *= r_colorscale;
+
+ varray_color[ 0] = varray_color[ 4] = varray_color[ 8] = varray_color[12] = cr;
+ varray_color[ 1] = varray_color[ 5] = varray_color[ 9] = varray_color[13] = cg;
+ varray_color[ 2] = varray_color[ 6] = varray_color[10] = varray_color[14] = cb;
+ varray_color[ 3] = varray_color[ 7] = varray_color[11] = varray_color[15] = ca;
+ varray_texcoord[0][0] = tex->s2;varray_texcoord[0][1] = tex->t1;
+ varray_texcoord[0][2] = tex->s1;varray_texcoord[0][3] = tex->t1;
+ varray_texcoord[0][4] = tex->s1;varray_texcoord[0][5] = tex->t2;
+ varray_texcoord[0][6] = tex->s2;varray_texcoord[0][7] = tex->t2;
+
+ if (orientation == PARTICLE_BEAM)
+ {
+ VectorMA(p->org, -p->scaley, p->vel, v);
+ VectorMA(p->org, p->scaley, p->vel, up2);
+ R_CalcBeamVerts(varray_vertex, v, up2, p->scalex);
+ }
+ else if (orientation == PARTICLE_BILLBOARD)
+ {
+ VectorScale(vright, p->scalex, right);
+ VectorScale(vup, p->scaley, up);
+ varray_vertex[ 0] = org[0] + right[0] - up[0];
+ varray_vertex[ 1] = org[1] + right[1] - up[1];
+ varray_vertex[ 2] = org[2] + right[2] - up[2];
+ varray_vertex[ 4] = org[0] - right[0] - up[0];
+ varray_vertex[ 5] = org[1] - right[1] - up[1];
+ varray_vertex[ 6] = org[2] - right[2] - up[2];
+ varray_vertex[ 8] = org[0] - right[0] + up[0];
+ varray_vertex[ 9] = org[1] - right[1] + up[1];
+ varray_vertex[10] = org[2] - right[2] + up[2];
+ varray_vertex[12] = org[0] + right[0] + up[0];
+ varray_vertex[13] = org[1] + right[1] + up[1];
+ varray_vertex[14] = org[2] + right[2] + up[2];
+ }
+ else if (orientation == PARTICLE_ORIENTED_DOUBLESIDED)
+ {
+ // double-sided
+ if (DotProduct(p->vel2, r_origin) > DotProduct(p->vel2, org))
+ {
+ VectorNegate(p->vel2, v);
+ VectorVectors(v, right, up);
+ }
+ else
+ VectorVectors(p->vel2, right, up);
+ VectorScale(right, p->scalex, right);
+ VectorScale(up, p->scaley, up);
+ varray_vertex[ 0] = org[0] + right[0] - up[0];
+ varray_vertex[ 1] = org[1] + right[1] - up[1];
+ varray_vertex[ 2] = org[2] + right[2] - up[2];
+ varray_vertex[ 4] = org[0] - right[0] - up[0];
+ varray_vertex[ 5] = org[1] - right[1] - up[1];
+ varray_vertex[ 6] = org[2] - right[2] - up[2];
+ varray_vertex[ 8] = org[0] - right[0] + up[0];
+ varray_vertex[ 9] = org[1] - right[1] + up[1];
+ varray_vertex[10] = org[2] - right[2] + up[2];
+ varray_vertex[12] = org[0] + right[0] + up[0];
+ varray_vertex[13] = org[1] + right[1] + up[1];
+ varray_vertex[14] = org[2] + right[2] + up[2];
+ }
+ else
+ Host_Error("R_DrawParticles: unknown particle orientation %i\n", orientation);