]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_models.c
corrected an error message in .lights code
[xonotic/darkplaces.git] / gl_models.c
index 893d9a0b822f9406e6644bc99ced54cb999292b0..38064f11425ccf43dd950384777f89f1e3190e2a 100644 (file)
@@ -203,10 +203,13 @@ void R_AliasLerpVerts(int vertcount,
 skinframe_t *R_FetchSkinFrame(const entity_render_t *ent)
 {
        model_t *model = ent->model;
-       if (model->skinscenes[ent->skinnum].framecount > 1)
-               return &model->skinframes[model->skinscenes[ent->skinnum].firstframe + (int) (cl.time * 10) % model->skinscenes[ent->skinnum].framecount];
+       unsigned int s = (unsigned int) ent->skinnum;
+       if (s >= model->numskins)
+               s = 0;
+       if (model->skinscenes[s].framecount > 1)
+               return &model->skinframes[model->skinscenes[s].firstframe + (int) (cl.time * 10) % model->skinscenes[s].framecount];
        else
-               return &model->skinframes[model->skinscenes[ent->skinnum].firstframe];
+               return &model->skinframes[model->skinscenes[s].firstframe];
 }
 
 void R_SetupMDLMD2Frames(const entity_render_t *ent, float colorr, float colorg, float colorb)
@@ -236,17 +239,19 @@ void R_SetupMDLMD2Frames(const entity_render_t *ent, float colorr, float colorg,
 
 void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
 {
-       int c, pantsfullbright, shirtfullbright, colormapped;
+       int i, c, pantsfullbright, shirtfullbright, colormapped;
        float pantscolor[3], shirtcolor[3];
        float fog;
        vec3_t diff;
        qbyte *bcolor;
-       rmeshbufferinfo_t m;
+       rmeshstate_t m;
        model_t *model;
        skinframe_t *skinframe;
        const entity_render_t *ent = calldata1;
+       int blendfunc1, blendfunc2;
 
 //     softwaretransformforentity(ent);
+       R_Mesh_Matrix(&ent->matrix);
 
        fog = 0;
        if (fogenabled)
@@ -266,48 +271,70 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
        }
 
        model = ent->model;
+       R_Mesh_ResizeCheck(model->numverts, model->numtris);
 
        skinframe = R_FetchSkinFrame(ent);
 
+       if (ent->effects & EF_ADDITIVE)
+       {
+               blendfunc1 = GL_SRC_ALPHA;
+               blendfunc2 = GL_ONE;
+       }
+       else if (ent->alpha != 1.0 || skinframe->fog != NULL)
+       {
+               blendfunc1 = GL_SRC_ALPHA;
+               blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+       }
+       else
+       {
+               blendfunc1 = GL_ONE;
+               blendfunc2 = GL_ZERO;
+       }
+
+       if (!skinframe->base && !skinframe->pants && !skinframe->shirt && !skinframe->glow)
+       {
+               // untextured
+               memset(&m, 0, sizeof(m));
+               m.blendfunc1 = blendfunc1;
+               m.blendfunc2 = blendfunc2;
+               m.wantoverbright = true;
+               m.tex[0] = R_GetTexture(r_notexture);
+               R_Mesh_State(&m);
+
+               c_alias_polys += model->numtris;
+               memcpy(varray_element, model->mdlmd2data_indices, model->numtris * sizeof(int[3]));
+               for (i = 0;i < model->numverts * 2;i++)
+                       varray_texcoord[0][i] = model->mdlmd2data_texcoords[i] * 8.0f;
+               aliasvert = varray_vertex;
+               aliasvertcolor = varray_color;
+               R_SetupMDLMD2Frames(ent, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+               aliasvert = aliasvertbuf;
+               aliasvertcolor = aliasvertcolorbuf;
+               R_Mesh_Draw(model->numverts, model->numtris);
+               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));
-               if (ent->effects & EF_ADDITIVE)
-               {
-                       m.blendfunc1 = GL_SRC_ALPHA;
-                       m.blendfunc2 = GL_ONE;
-               }
-               else if (ent->alpha != 1.0 || skinframe->fog != NULL)
-               {
-                       m.blendfunc1 = GL_SRC_ALPHA;
-                       m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-               }
-               else
-               {
-                       m.blendfunc1 = GL_ONE;
-                       m.blendfunc2 = GL_ZERO;
-               }
-               m.numtriangles = model->numtris;
-               m.numverts = model->numverts;
+               m.blendfunc1 = blendfunc1;
+               m.blendfunc2 = blendfunc2;
+               m.wantoverbright = true;
                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 * (1 - fog), m.colorscale * (1 - fog), m.colorscale * (1 - fog));
-                       aliasvert = aliasvertbuf;
-                       aliasvertcolor = aliasvertcolorbuf;
-
-                       R_Mesh_Render();
-               }
+               R_Mesh_State(&m);
+
+               c_alias_polys += model->numtris;
+               memcpy(varray_element, model->mdlmd2data_indices, model->numtris * sizeof(int[3]));
+               memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+               aliasvert = varray_vertex;
+               aliasvertcolor = varray_color;
+               R_SetupMDLMD2Frames(ent, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+               aliasvert = aliasvertbuf;
+               aliasvertcolor = aliasvertcolorbuf;
+               R_Mesh_Draw(model->numverts, model->numtris);
                return;
        }
 
@@ -332,33 +359,22 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
        }
 
        memset(&m, 0, sizeof(m));
-       if (ent->effects & EF_ADDITIVE)
-       {
-               m.blendfunc1 = GL_SRC_ALPHA;
-               m.blendfunc2 = GL_ONE;
-       }
-       else if (ent->alpha != 1.0 || skinframe->fog != NULL)
-       {
-               m.blendfunc1 = GL_SRC_ALPHA;
-               m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       }
-       else
-       {
-               m.blendfunc1 = GL_ONE;
-               m.blendfunc2 = GL_ZERO;
-       }
-       m.numtriangles = model->numtris;
-       m.numverts = model->numverts;
+       m.blendfunc1 = blendfunc1;
+       m.blendfunc2 = blendfunc2;
+       m.wantoverbright = true;
        m.tex[0] = colormapped ? R_GetTexture(skinframe->base) : R_GetTexture(skinframe->merged);
-       m.matrix = ent->matrix;
-       if (R_Mesh_Draw_GetBuffer(&m, true))
+       if (m.tex[0])
        {
-               c_alias_polys += m.numtriangles;
-               R_ModulateColors(aliasvertcolor, m.color, m.numverts, m.colorscale, m.colorscale, m.colorscale);
-               memcpy(m.index, model->mdlmd2data_indices, m.numtriangles * sizeof(int[3]));
-               memcpy(m.vertex, aliasvert, m.numverts * sizeof(float[4]));
-               memcpy(m.texcoords[0], model->mdlmd2data_texcoords, m.numverts * sizeof(float[2]));
-               R_Mesh_Render();
+               R_Mesh_State(&m);
+
+               blendfunc1 = GL_SRC_ALPHA;
+               blendfunc2 = GL_ONE;
+               c_alias_polys += model->numtris;
+               R_ModulateColors(aliasvertcolor, varray_color, model->numverts, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+               memcpy(varray_element, model->mdlmd2data_indices, model->numtris * sizeof(int[3]));
+               memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
+               memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+               R_Mesh_Draw(model->numverts, model->numtris);
        }
 
        if (colormapped)
@@ -366,65 +382,71 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                if (skinframe->pants)
                {
                        memset(&m, 0, sizeof(m));
-                       m.blendfunc1 = GL_SRC_ALPHA;
-                       m.blendfunc2 = GL_ONE;
-                       m.numtriangles = model->numtris;
-                       m.numverts = model->numverts;
+                       m.blendfunc1 = blendfunc1;
+                       m.blendfunc2 = blendfunc2;
+                       m.wantoverbright = true;
                        m.tex[0] = R_GetTexture(skinframe->pants);
-                       m.matrix = ent->matrix;
-                       if (R_Mesh_Draw_GetBuffer(&m, true))
+                       if (m.tex[0])
                        {
-                               c_alias_polys += m.numtriangles;
+                               R_Mesh_State(&m);
+
+                               blendfunc1 = GL_SRC_ALPHA;
+                               blendfunc2 = GL_ONE;
+                               c_alias_polys += model->numtris;
                                if (pantsfullbright)
-                                       R_FillColors(m.color, m.numverts, pantscolor[0] * m.colorscale, pantscolor[1] * m.colorscale, pantscolor[2] * m.colorscale, ent->alpha);
+                                       R_FillColors(varray_color, model->numverts, pantscolor[0] * mesh_colorscale, pantscolor[1] * mesh_colorscale, pantscolor[2] * mesh_colorscale, ent->alpha);
                                else
-                                       R_ModulateColors(aliasvertcolor, m.color, m.numverts, pantscolor[0] * m.colorscale, pantscolor[1] * m.colorscale, pantscolor[2] * m.colorscale);
-                               memcpy(m.index, model->mdlmd2data_indices, m.numtriangles * sizeof(int[3]));
-                               memcpy(m.vertex, aliasvert, m.numverts * sizeof(float[4]));
-                               memcpy(m.texcoords[0], model->mdlmd2data_texcoords, m.numverts * sizeof(float[2]));
-                               R_Mesh_Render();
+                                       R_ModulateColors(aliasvertcolor, varray_color, model->numverts, pantscolor[0] * mesh_colorscale, pantscolor[1] * mesh_colorscale, pantscolor[2] * mesh_colorscale);
+                               memcpy(varray_element, model->mdlmd2data_indices, model->numtris * sizeof(int[3]));
+                               memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
+                               memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+                               R_Mesh_Draw(model->numverts, model->numtris);
                        }
                }
                if (skinframe->shirt)
                {
                        memset(&m, 0, sizeof(m));
-                       m.blendfunc1 = GL_SRC_ALPHA;
-                       m.blendfunc2 = GL_ONE;
-                       m.numtriangles = model->numtris;
-                       m.numverts = model->numverts;
+                       m.blendfunc1 = blendfunc1;
+                       m.blendfunc2 = blendfunc2;
+                       m.wantoverbright = true;
                        m.tex[0] = R_GetTexture(skinframe->shirt);
-                       m.matrix = ent->matrix;
-                       if (R_Mesh_Draw_GetBuffer(&m, true))
+                       if (m.tex[0])
                        {
-                               c_alias_polys += m.numtriangles;
+                               R_Mesh_State(&m);
+
+                               blendfunc1 = GL_SRC_ALPHA;
+                               blendfunc2 = GL_ONE;
+                               c_alias_polys += model->numtris;
                                if (shirtfullbright)
-                                       R_FillColors(m.color, m.numverts, shirtcolor[0] * m.colorscale, shirtcolor[1] * m.colorscale, shirtcolor[2] * m.colorscale, ent->alpha);
+                                       R_FillColors(varray_color, model->numverts, shirtcolor[0] * mesh_colorscale, shirtcolor[1] * mesh_colorscale, shirtcolor[2] * mesh_colorscale, ent->alpha);
                                else
-                                       R_ModulateColors(aliasvertcolor, m.color, m.numverts, shirtcolor[0] * m.colorscale, shirtcolor[1] * m.colorscale, shirtcolor[2] * m.colorscale);
-                               memcpy(m.index, model->mdlmd2data_indices, m.numtriangles * sizeof(int[3]));
-                               memcpy(m.vertex, aliasvert, m.numverts * sizeof(float[4]));
-                               memcpy(m.texcoords[0], model->mdlmd2data_texcoords, m.numverts * sizeof(float[2]));
-                               R_Mesh_Render();
+                                       R_ModulateColors(aliasvertcolor, varray_color, model->numverts, shirtcolor[0] * mesh_colorscale, shirtcolor[1] * mesh_colorscale, shirtcolor[2] * mesh_colorscale);
+                               memcpy(varray_element, model->mdlmd2data_indices, model->numtris * sizeof(int[3]));
+                               memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
+                               memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+                               R_Mesh_Draw(model->numverts, model->numtris);
                        }
                }
        }
        if (skinframe->glow)
        {
                memset(&m, 0, sizeof(m));
-               m.blendfunc1 = GL_SRC_ALPHA;
-               m.blendfunc2 = GL_ONE;
-               m.numtriangles = model->numtris;
-               m.numverts = model->numverts;
+               m.blendfunc1 = blendfunc1;
+               m.blendfunc2 = blendfunc2;
+               m.wantoverbright = true;
                m.tex[0] = R_GetTexture(skinframe->glow);
-               m.matrix = ent->matrix;
-               if (R_Mesh_Draw_GetBuffer(&m, true))
+               if (m.tex[0])
                {
-                       c_alias_polys += m.numtriangles;
-                       R_FillColors(m.color, m.numverts, (1 - fog) * m.colorscale, (1 - fog) * m.colorscale, (1 - fog) * m.colorscale, ent->alpha);
-                       memcpy(m.index, model->mdlmd2data_indices, m.numtriangles * sizeof(int[3]));
-                       memcpy(m.vertex, aliasvert, m.numverts * sizeof(float[4]));
-                       memcpy(m.texcoords[0], model->mdlmd2data_texcoords, m.numverts * sizeof(float[2]));
-                       R_Mesh_Render();
+                       R_Mesh_State(&m);
+
+                       blendfunc1 = GL_SRC_ALPHA;
+                       blendfunc2 = GL_ONE;
+                       c_alias_polys += model->numtris;
+                       R_FillColors(varray_color, model->numverts, (1 - fog) * mesh_colorscale, (1 - fog) * mesh_colorscale, (1 - fog) * mesh_colorscale, ent->alpha);
+                       memcpy(varray_element, model->mdlmd2data_indices, model->numtris * sizeof(int[3]));
+                       memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
+                       memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+                       R_Mesh_Draw(model->numverts, model->numtris);
                }
        }
        if (fog)
@@ -432,19 +454,16 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                memset(&m, 0, sizeof(m));
                m.blendfunc1 = GL_SRC_ALPHA;
                m.blendfunc2 = GL_ONE;
-               m.numtriangles = model->numtris;
-               m.numverts = model->numverts;
+               m.wantoverbright = false;
                m.tex[0] = R_GetTexture(skinframe->fog);
-               m.matrix = ent->matrix;
-               if (R_Mesh_Draw_GetBuffer(&m, false))
-               {
-                       c_alias_polys += m.numtriangles;
-                       R_FillColors(m.color, m.numverts, fog * m.colorscale, fog * m.colorscale, fog * m.colorscale, ent->alpha);
-                       memcpy(m.index, model->mdlmd2data_indices, m.numtriangles * sizeof(int[3]));
-                       memcpy(m.vertex, aliasvert, m.numverts * sizeof(float[4]));
-                       memcpy(m.texcoords[0], model->mdlmd2data_texcoords, m.numverts * sizeof(float[2]));
-                       R_Mesh_Render();
-               }
+               R_Mesh_State(&m);
+
+               c_alias_polys += model->numtris;
+               R_FillColors(varray_color, model->numverts, fogcolor[0] * fog * mesh_colorscale, fogcolor[1] * fog * mesh_colorscale, fogcolor[2] * fog * mesh_colorscale, ent->alpha);
+               memcpy(varray_element, model->mdlmd2data_indices, model->numtris * sizeof(int[3]));
+               memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
+               memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+               R_Mesh_Draw(model->numverts, model->numtris);
        }
 }
 
@@ -730,9 +749,12 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
        int i, *renderlist;
        zymtype1header_t *m;
        rtexture_t *texture;
-       rmeshbufferinfo_t mbuf;
+       rmeshstate_t mstate;
        const entity_render_t *ent = calldata1;
        int shadernum = calldata2;
+       int numverts, numtriangles;
+
+       R_Mesh_Matrix(&ent->matrix);
 
        // find the vertex index list and texture
        m = ent->model->zymdata_header;
@@ -741,6 +763,10 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                renderlist += renderlist[0] * 3 + 1;
        texture = ((rtexture_t **)(m->lump_shaders.start + (int) m))[shadernum];
 
+       numverts = m->numverts;
+       numtriangles = renderlist[0];
+       R_Mesh_ResizeCheck(numverts, numtriangles);
+
        fog = 0;
        if (fogenabled)
        {
@@ -759,61 +785,54 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
        }
 
        ZymoticLerpBones(m->numbones, (zymbonematrix *)(m->lump_poses.start + (int) m), ent->frameblend, (zymbone_t *)(m->lump_bones.start + (int) m));
-       ZymoticTransformVerts(m->numverts, (int *)(m->lump_vertbonecounts.start + (int) m), (zymvertex_t *)(m->lump_verts.start + (int) m));
-       ZymoticCalcNormals(m->numverts, m->numshaders, (int *)(m->lump_render.start + (int) m));
+       ZymoticTransformVerts(numverts, (int *)(m->lump_vertbonecounts.start + (int) m), (zymvertex_t *)(m->lump_verts.start + (int) m));
+       ZymoticCalcNormals(numverts, m->numshaders, (int *)(m->lump_render.start + (int) m));
 
-       R_LightModel(ent, m->numverts, 1 - fog, 1 - fog, 1 - fog, false);
+       R_LightModel(ent, numverts, 1 - fog, 1 - fog, 1 - fog, false);
 
-       memset(&mbuf, 0, sizeof(mbuf));
-       mbuf.numverts = m->numverts;
-       mbuf.numtriangles = renderlist[0];
+       memset(&mstate, 0, sizeof(mstate));
+       mstate.wantoverbright = true;
        if (ent->effects & EF_ADDITIVE)
        {
-               mbuf.blendfunc1 = GL_SRC_ALPHA;
-               mbuf.blendfunc2 = GL_ONE;
+               mstate.blendfunc1 = GL_SRC_ALPHA;
+               mstate.blendfunc2 = GL_ONE;
        }
        else if (ent->alpha != 1.0 || R_TextureHasAlpha(texture))
        {
-               mbuf.blendfunc1 = GL_SRC_ALPHA;
-               mbuf.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+               mstate.blendfunc1 = GL_SRC_ALPHA;
+               mstate.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
        }
        else
        {
-               mbuf.blendfunc1 = GL_ONE;
-               mbuf.blendfunc2 = GL_ZERO;
-       }
-       mbuf.tex[0] = R_GetTexture(texture);
-       mbuf.matrix = ent->matrix;
-       if (R_Mesh_Draw_GetBuffer(&mbuf, true))
-       {
-               c_alias_polys += mbuf.numtriangles;
-               memcpy(mbuf.index, renderlist + 1, mbuf.numtriangles * sizeof(int[3]));
-               memcpy(mbuf.vertex, aliasvert, mbuf.numverts * sizeof(float[4]));
-               R_ModulateColors(aliasvertcolor, mbuf.color, mbuf.numverts, mbuf.colorscale, mbuf.colorscale, mbuf.colorscale);
-               //memcpy(mbuf.color, aliasvertcolor, mbuf.numverts * sizeof(float[4]));
-               memcpy(mbuf.texcoords[0], (float *)(m->lump_texcoords.start + (int) m), mbuf.numverts * sizeof(float[2]));
-               R_Mesh_Render();
+               mstate.blendfunc1 = GL_ONE;
+               mstate.blendfunc2 = GL_ZERO;
        }
+       mstate.tex[0] = R_GetTexture(texture);
+       R_Mesh_State(&mstate);
+
+       c_alias_polys += numtriangles;
+       memcpy(varray_element, renderlist + 1, numtriangles * sizeof(int[3]));
+       memcpy(varray_vertex, aliasvert, numverts * sizeof(float[4]));
+       R_ModulateColors(aliasvertcolor, varray_color, numverts, mesh_colorscale, mesh_colorscale, mesh_colorscale);
+       memcpy(varray_texcoord[0], (float *)(m->lump_texcoords.start + (int) m), numverts * sizeof(float[2]));
+       R_Mesh_Draw(numverts, numtriangles);
 
        if (fog)
        {
-               memset(&mbuf, 0, sizeof(mbuf));
-               mbuf.numverts = m->numverts;
-               mbuf.numtriangles = renderlist[0];
-               mbuf.blendfunc1 = GL_SRC_ALPHA;
-               mbuf.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
+               memset(&mstate, 0, sizeof(mstate));
+               mstate.wantoverbright = false;
+               mstate.blendfunc1 = GL_SRC_ALPHA;
+               mstate.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
                // FIXME: need alpha mask for fogging...
-               //mbuf.tex[0] = R_GetTexture(texture);
-               mbuf.matrix = ent->matrix;
-               if (R_Mesh_Draw_GetBuffer(&mbuf, false))
-               {
-                       c_alias_polys += mbuf.numtriangles;
-                       memcpy(mbuf.index, renderlist + 1, mbuf.numtriangles * sizeof(int[3]));
-                       memcpy(mbuf.vertex, aliasvert, mbuf.numverts * sizeof(float[4]));
-                       R_FillColors(mbuf.color, mbuf.numverts, fogcolor[0] * mbuf.colorscale, fogcolor[1] * mbuf.colorscale, fogcolor[2] * mbuf.colorscale, ent->alpha * fog);
-                       //memcpy(mbuf.texcoords[0], (float *)(m->lump_texcoords.start + (int) m), mbuf.numverts * sizeof(float[2]));
-                       R_Mesh_Render();
-               }
+               //mstate.tex[0] = R_GetTexture(texture);
+               R_Mesh_State(&mstate);
+
+               c_alias_polys += numtriangles;
+               memcpy(varray_element, renderlist + 1, numtriangles * sizeof(int[3]));
+               memcpy(varray_vertex, aliasvert, numverts * sizeof(float[4]));
+               R_FillColors(varray_color, numverts, fogcolor[0] * mesh_colorscale, fogcolor[1] * mesh_colorscale, fogcolor[2] * mesh_colorscale, ent->alpha * fog);
+               //memcpy(mesh_texcoord[0], (float *)(m->lump_texcoords.start + (int) m), numverts * sizeof(float[2]));
+               R_Mesh_Draw(numverts, numtriangles);
        }
 }
 
@@ -835,7 +854,7 @@ void R_DrawZymoticModel (entity_render_t *ent)
                if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_TextureHasAlpha(texture))
                        R_MeshQueue_AddTransparent(ent->origin, R_DrawZymoticModelMeshCallback, ent, i);
                else
-                       R_MeshQueue_Add(R_DrawZymoticModelMeshCallback, ent, i);
+                       R_DrawZymoticModelMeshCallback(ent, i);
        }
 }
 
@@ -849,6 +868,6 @@ void R_DrawQ1Q2AliasModel(entity_render_t *ent)
        if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_FetchSkinFrame(ent)->fog != NULL)
                R_MeshQueue_AddTransparent(ent->origin, R_DrawQ1Q2AliasModelCallback, ent, 0);
        else
-               R_MeshQueue_Add(R_DrawQ1Q2AliasModelCallback, ent, 0);
+               R_DrawQ1Q2AliasModelCallback(ent, 0);
 }