- // untextured
- memset(&m, 0, sizeof(m));
- m.blendfunc1 = blendfunc1;
- m.blendfunc2 = blendfunc2;
- m.numtriangles = model->numtris;
- m.numverts = model->numverts;
- m.tex[0] = R_GetTexture(r_notexture);
- m.matrix = ent->matrix;
-
- c_alias_polys += m.numtriangles;
- if (R_Mesh_Draw_GetBuffer(&m, true))
- {
- memcpy(m.index, model->mdlmd2data_indices, m.numtriangles * sizeof(int[3]));
- for (i = 0;i < m.numverts * 2;i++)
- m.texcoords[0][i] = model->mdlmd2data_texcoords[i] * 8.0f;
-
- aliasvert = m.vertex;
- aliasvertcolor = m.color;
- R_SetupMDLMD2Frames(ent, m.colorscale, m.colorscale, m.colorscale);
- aliasvert = aliasvertbuf;
- aliasvertcolor = aliasvertcolorbuf;
-
- R_Mesh_Render();
- }
- return;
- }
-
-
- colormapped = !skinframe->merged || (ent->colormap >= 0 && skinframe->base && (skinframe->pants || skinframe->shirt));
- if (!colormapped && !fog && !skinframe->glow && !skinframe->fog)
- {
- // fastpath for the normal situation (one texture)
- memset(&m, 0, sizeof(m));
- m.blendfunc1 = blendfunc1;
- m.blendfunc2 = blendfunc2;
- m.numtriangles = model->numtris;
- m.numverts = model->numverts;
- m.tex[0] = R_GetTexture(skinframe->merged);
- m.matrix = ent->matrix;
-
- c_alias_polys += m.numtriangles;
- if (R_Mesh_Draw_GetBuffer(&m, true))
- {
- memcpy(m.index, model->mdlmd2data_indices, m.numtriangles * sizeof(int[3]));
- memcpy(m.texcoords[0], model->mdlmd2data_texcoords, m.numverts * sizeof(float[2]));
-
- aliasvert = m.vertex;
- aliasvertcolor = m.color;
- R_SetupMDLMD2Frames(ent, m.colorscale, m.colorscale, m.colorscale);
- aliasvert = aliasvertbuf;
- aliasvertcolor = aliasvertcolorbuf;
-
- R_Mesh_Render();
- }
- return;
- }
-
- R_SetupMDLMD2Frames(ent, 1 - fog, 1 - fog, 1 - fog);
-
- if (colormapped)
- {
- // 128-224 are backwards ranges
- c = (ent->colormap & 0xF) << 4;c += (c >= 128 && c < 224) ? 4 : 12;
- bcolor = (qbyte *) (&d_8to24table[c]);
- pantsfullbright = c >= 224;
- VectorScale(bcolor, (1.0f / 255.0f), pantscolor);
- c = (ent->colormap & 0xF0);c += (c >= 128 && c < 224) ? 4 : 12;
- bcolor = (qbyte *) (&d_8to24table[c]);
- shirtfullbright = c >= 224;
- VectorScale(bcolor, (1.0f / 255.0f), shirtcolor);