/* * R_BatchCoronaSurf */ void R_BatchCoronaSurf( const entity_t *e, const shader_t *shader, const mfog_t *fog, drawSurfaceType_t *drawSurf ) { int i; vec3_t origin, point; vec3_t v_left, v_up; dlight_t *light = rsc.dlights + (drawSurf - r_coronaSurfs); float radius = light->intensity, colorscale; float up = radius, down = -radius, left = -radius, right = radius; vec4_t xyz[4] = { {0,0,0,1}, {0,0,0,1}, {0,0,0,1}, {0,0,0,1} }; vec4_t normals[4] = { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }; byte_vec4_t colors[4]; vec2_t texcoords[4] = { {0, 1}, {0, 0}, {1,0}, {1,1} }; mesh_t mesh; VectorCopy( light->origin, origin ); VectorCopy( &rn.viewAxis[AXIS_RIGHT], v_left ); VectorCopy( &rn.viewAxis[AXIS_UP], v_up ); if( rn.renderFlags & RF_MIRRORVIEW ) VectorInverse( v_left ); VectorMA( origin, down, v_up, point ); VectorMA( point, left, v_left, xyz[0] ); VectorMA( point, right, v_left, xyz[3] ); VectorMA( origin, up, v_up, point ); VectorMA( point, left, v_left, xyz[1] ); VectorMA( point, right, v_left, xyz[2] ); colorscale = 255.0 * bound( 0, r_coronascale->value, 1.0 ); Vector4Set( colors[0], bound( 0, light->color[0] * colorscale, 255 ), bound( 0, light->color[1] * colorscale, 255 ), bound( 0, light->color[2] * colorscale, 255 ), 255 ); for( i = 1; i < 4; i++ ) Vector4Copy( colors[0], colors[i] ); // backend knows how to count elements for quads memset( &mesh, 0, sizeof( mesh ) ); mesh.numVerts = 4; mesh.xyzArray = xyz; mesh.normalsArray = normals; mesh.stArray = texcoords; mesh.colorsArray[0] = colors; RB_BatchMesh( &mesh ); }
/* * R_BatchPolySurf */ void R_BatchPolySurf( const entity_t *e, const shader_t *shader, const mfog_t *fog, drawSurfacePoly_t *poly ) { mesh_t mesh; // backend knows how to count elements for quads mesh.elems = NULL; mesh.numElems = 0; mesh.numVerts = poly->numVerts; mesh.xyzArray = poly->xyzArray; mesh.normalsArray = poly->normalsArray; mesh.lmstArray[0] = NULL; mesh.stArray = poly->stArray; mesh.colorsArray[0] = poly->colorsArray; mesh.colorsArray[1] = NULL; RB_BatchMesh( &mesh ); }
/* * R_DrawStretchPoly */ void R_DrawStretchPoly( const poly_t *poly, float x_offset, float y_offset ) { mesh_t mesh; if( !poly || !poly->shader ) { return; } R_BeginStretchBatch( poly->shader, x_offset, y_offset ); memset( &mesh, 0, sizeof( mesh ) ); mesh.numVerts = poly->numverts; mesh.xyzArray = poly->verts; mesh.normalsArray = poly->normals; mesh.stArray = poly->stcoords; mesh.colorsArray[0] = poly->colors; RB_BatchMesh( &mesh ); }