X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=gl_models.c;h=f7afd47d6f0a808b905e5a44291c56e227ffa8ab;hb=4418c8f7875bb156eea684b5a52cc76ab52a66db;hp=80d6e1e8f4a414d09a200cefa31bb214e12193da;hpb=4512baff458796ff63522a2ee8af3ac22a996195;p=xonotic%2Fdarkplaces.git diff --git a/gl_models.c b/gl_models.c index 80d6e1e8..f7afd47d 100644 --- a/gl_models.c +++ b/gl_models.c @@ -13,6 +13,7 @@ int aliasvertmax = 0; void *aliasvertarrays = NULL; float *aliasvertcolor4fbuf = NULL; float *aliasvertcolor4f = NULL; // this may point at aliasvertcolorbuf or at vertex arrays in the mesh backend +float *aliasvert_vertex3f = NULL; float *aliasvert_svector3f = NULL; float *aliasvert_tvector3f = NULL; float *aliasvert_normal3f = NULL; @@ -31,10 +32,11 @@ void gl_models_allocarrays(int newmax) aliasvertmax = newmax; if (aliasvertarrays != NULL) Mem_Free(aliasvertarrays); - aliasvertarrays = Mem_Alloc(gl_models_mempool, aliasvertmax * (sizeof(float[4+4+3+3+3]) + sizeof(int[3]))); + aliasvertarrays = Mem_Alloc(gl_models_mempool, aliasvertmax * (sizeof(float[4+4+3+3+3+3]) + sizeof(int[3]))); data = aliasvertarrays; aliasvertcolor4f = aliasvertcolor4fbuf = (void *)data;data += aliasvertmax * sizeof(float[4]); aliasvertcolor2_4f = (void *)data;data += aliasvertmax * sizeof(float[4]); // used temporarily for tinted coloring + aliasvert_vertex3f = (void *)data;data += aliasvertmax * sizeof(float[3]); aliasvert_svector3f = (void *)data;data += aliasvertmax * sizeof(float[3]); aliasvert_tvector3f = (void *)data;data += aliasvertmax * sizeof(float[3]); aliasvert_normal3f = (void *)data;data += aliasvertmax * sizeof(float[3]); @@ -49,6 +51,7 @@ void gl_models_freearrays(void) aliasvertarrays = NULL; aliasvertcolor4f = aliasvertcolor4fbuf = NULL; aliasvertcolor2_4f = NULL; + aliasvert_vertex3f = NULL; aliasvert_svector3f = NULL; aliasvert_tvector3f = NULL; aliasvert_normal3f = NULL; @@ -83,7 +86,7 @@ void GL_Models_Init(void) #define MODELARRAY_TVECTOR 2 #define MODELARRAY_NORMAL 3 -void R_Model_Alias_GetMesh_Array3f(const entity_render_t *ent, aliasmesh_t *mesh, int whicharray, float *out3f) +void R_Model_Alias_GetMesh_Array3f(const entity_render_t *ent, const aliasmesh_t *mesh, int whicharray, float *out3f) { int i, vertcount; float lerp1, lerp2, lerp3, lerp4; @@ -158,12 +161,12 @@ aliasskin_t *R_FetchAliasSkin(const entity_render_t *ent, const aliasmesh_t *mes void R_DrawAliasModelCallback (const void *calldata1, int calldata2) { int c, fullbright, layernum, firstpass; - float tint[3], fog, ifog, colorscale; + float tint[3], fog, ifog, colorscale, ambientcolor4f[4], diffusecolor[3], diffusenormal[3]; vec3_t diff; qbyte *bcolor; rmeshstate_t m; const entity_render_t *ent = calldata1; - aliasmesh_t *mesh = ent->model->aliasdata_meshes + calldata2; + aliasmesh_t *mesh = ent->model->alias.aliasdata_meshes + calldata2; aliaslayer_t *layer; aliasskin_t *skin; @@ -172,7 +175,7 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2) fog = 0; if (fogenabled) { - VectorSubtract(ent->origin, r_origin, diff); + VectorSubtract(ent->origin, r_vieworigin, diff); fog = DotProduct(diff,diff); if (fog < 0.01f) fog = 0.01f; @@ -188,7 +191,6 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2) ifog = 1 - fog; firstpass = true; - memset(&m, 0, sizeof(m)); skin = R_FetchAliasSkin(ent, mesh); for (layernum = 0, layer = skin->data_layers;layernum < skin->num_layers;layernum++, layer++) { @@ -203,42 +205,53 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2) } if (!firstpass || (ent->effects & EF_ADDITIVE)) { - m.blendfunc1 = GL_SRC_ALPHA; - m.blendfunc2 = GL_ONE; + GL_BlendFunc(GL_SRC_ALPHA, GL_ONE); + GL_DepthMask(false); } else if ((skin->flags & ALIASSKIN_TRANSPARENT) || ent->alpha != 1.0) { - m.blendfunc1 = GL_SRC_ALPHA; - m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA; + GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + GL_DepthMask(false); } else { - m.blendfunc1 = GL_ONE; - m.blendfunc2 = GL_ZERO; + GL_BlendFunc(GL_ONE, GL_ZERO); + GL_DepthMask(true); } + GL_DepthTest(true); firstpass = false; expandaliasvert(mesh->num_vertices); - colorscale = r_colorscale; - m.texrgbscale[0] = 1; - m.tex[0] = R_GetTexture(layer->texture); - if (gl_combine.integer && layer->flags & (ALIASLAYER_DIFFUSE | ALIASLAYER_SPECULAR)) + colorscale = 1.0f; + + memset(&m, 0, sizeof(m)); + if (layer->texture != NULL) { - colorscale *= 0.25f; - m.texrgbscale[0] = 4; + m.tex[0] = R_GetTexture(layer->texture); + m.pointer_texcoord[0] = mesh->data_texcoord2f; + if (gl_combine.integer && layer->flags & (ALIASLAYER_DIFFUSE | ALIASLAYER_SPECULAR)) + { + colorscale *= 0.25f; + m.texrgbscale[0] = 4; + } } - R_Mesh_State(&m); + R_Mesh_State_Texture(&m); + c_alias_polys += mesh->num_triangles; - R_Mesh_GetSpace(mesh->num_vertices); - if (layer->texture != NULL) - R_Mesh_CopyTexCoord2f(0, mesh->data_texcoord2f, mesh->num_vertices); + GL_VertexPointer(varray_vertex3f); + R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f); if (layer->flags & ALIASLAYER_FOG) { colorscale *= fog; - R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f); GL_Color(fogcolor[0] * colorscale, fogcolor[1] * colorscale, fogcolor[2] * colorscale, ent->alpha); } else { + fullbright = !(layer->flags & ALIASLAYER_DIFFUSE) || r_fullbright.integer || (ent->effects & EF_FULLBRIGHT); + if (r_shadow_realtime_world.integer && !fullbright) + { + colorscale *= r_ambient.value * (2.0f / 128.0f); + fullbright = true; + } if (layer->flags & (ALIASLAYER_COLORMAP_PANTS | ALIASLAYER_COLORMAP_SHIRT)) { // 128-224 are backwards ranges @@ -248,27 +261,24 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2) c = (ent->colormap & 0xF0); c += (c >= 128 && c < 224) ? 4 : 12; bcolor = (qbyte *) (&palette_complete[c]); - fullbright = c >= 224; + fullbright = fullbright || c >= 224; VectorScale(bcolor, (1.0f / 255.0f), tint); } else - { tint[0] = tint[1] = tint[2] = 1; - fullbright = false; - } colorscale *= ifog; - R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f); - if (fullbright || !(layer->flags & ALIASLAYER_DIFFUSE) || r_fullbright.integer || (ent->effects & EF_FULLBRIGHT)) - GL_Color(tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha); - else if (r_shadow_realtime_world.integer) - { - colorscale *= r_ambient.value * (2.0f / 128.0f); + if (fullbright) GL_Color(tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha); - } else { - R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_NORMAL, aliasvert_normal3f); - R_LightModel(ent, mesh->num_vertices, varray_vertex3f, aliasvert_normal3f, varray_color4f, tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, false); + if (R_LightModel(ambientcolor4f, diffusecolor, diffusenormal, ent, tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha, false)) + { + GL_ColorPointer(varray_color4f); + R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_NORMAL, varray_normal3f); + R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, mesh->num_vertices, varray_vertex3f, varray_normal3f, varray_color4f); + } + else + GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]); } } R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i); @@ -284,7 +294,7 @@ void R_Model_Alias_Draw(entity_render_t *ent) c_models++; - for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++, mesh++) + for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++, mesh++) { if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_FetchAliasSkin(ent, mesh)->flags & ALIASSKIN_TRANSPARENT) R_MeshQueue_AddTransparent(ent->origin, R_DrawAliasModelCallback, ent, meshnum); @@ -293,66 +303,6 @@ void R_Model_Alias_Draw(entity_render_t *ent) } } -void R_Model_Alias_DrawFakeShadow (entity_render_t *ent) -{ - int i, meshnum; - aliasmesh_t *mesh; - aliasskin_t *skin; - rmeshstate_t m; - float *v, planenormal[3], planedist, dist, projection[3], floororigin[3], surfnormal[3], lightdirection[3], v2[3]; - - if ((ent->effects & EF_ADDITIVE) || ent->alpha < 1) - return; - - lightdirection[0] = 0.5; - lightdirection[1] = 0.2; - lightdirection[2] = -1; - VectorNormalizeFast(lightdirection); - - VectorMA(ent->origin, 65536.0f, lightdirection, v2); - if (CL_TraceLine(ent->origin, v2, floororigin, surfnormal, 0, false, NULL) == 1) - return; - - R_Mesh_Matrix(&ent->matrix); - - memset(&m, 0, sizeof(m)); - m.blendfunc1 = GL_SRC_ALPHA; - m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA; - R_Mesh_State(&m); - GL_Color(0, 0, 0, 0.5); - - // put a light direction in the entity's coordinate space - Matrix4x4_Transform3x3(&ent->inversematrix, lightdirection, projection); - VectorNormalizeFast(projection); - - // put the plane's normal in the entity's coordinate space - Matrix4x4_Transform3x3(&ent->inversematrix, surfnormal, planenormal); - VectorNormalizeFast(planenormal); - - // put the plane's distance in the entity's coordinate space - VectorSubtract(floororigin, ent->origin, floororigin); - planedist = DotProduct(floororigin, surfnormal) + 2; - - dist = -1.0f / DotProduct(projection, planenormal); - VectorScale(projection, dist, projection); - for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++) - { - skin = R_FetchAliasSkin(ent, mesh); - if (skin->flags & ALIASSKIN_TRANSPARENT) - continue; - R_Mesh_GetSpace(mesh->num_vertices); - R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f); - for (i = 0, v = varray_vertex3f;i < mesh->num_vertices;i++, v += 3) - { - dist = DotProduct(v, planenormal) - planedist; - if (dist > 0) - VectorMA(v, dist, projection, v); - } - c_alias_polys += mesh->num_triangles; - R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i); - } -} - void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightorigin, float lightradius) { int meshnum; @@ -365,14 +315,13 @@ void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightor if (projectdistance > 0.1) { R_Mesh_Matrix(&ent->matrix); - for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++, mesh++) + for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++, mesh++) { skin = R_FetchAliasSkin(ent, mesh); if (skin->flags & ALIASSKIN_TRANSPARENT) continue; - R_Mesh_GetSpace(mesh->num_vertices * 2); R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f); - R_Shadow_Volume(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, mesh->data_neighbor3i, relativelightorigin, lightradius, projectdistance); + R_Shadow_Volume(mesh->num_vertices, mesh->num_triangles, varray_vertex3f, mesh->data_element3i, mesh->data_neighbor3i, relativelightorigin, lightradius, projectdistance); } } } @@ -380,7 +329,7 @@ void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightor void R_Model_Alias_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, vec3_t relativeeyeorigin, float lightradius, float *lightcolor, const matrix4x4_t *matrix_modeltofilter, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz) { int c, meshnum, layernum; - float fog, ifog, lightcolor2[3], *vertices; + float fog, ifog, lightcolor2[3]; vec3_t diff; qbyte *bcolor; aliasmesh_t *mesh; @@ -395,7 +344,7 @@ void R_Model_Alias_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, v fog = 0; if (fogenabled) { - VectorSubtract(ent->origin, r_origin, diff); + VectorSubtract(ent->origin, r_vieworigin, diff); fog = DotProduct(diff,diff); if (fog < 0.01f) fog = 0.01f; @@ -410,14 +359,13 @@ void R_Model_Alias_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, v } ifog = 1 - fog; - for (meshnum = 0, mesh = ent->model->aliasdata_meshes;meshnum < ent->model->aliasnum_meshes;meshnum++, mesh++) + for (meshnum = 0, mesh = ent->model->alias.aliasdata_meshes;meshnum < ent->model->alias.aliasnum_meshes;meshnum++, mesh++) { skin = R_FetchAliasSkin(ent, mesh); if (skin->flags & ALIASSKIN_TRANSPARENT) continue; expandaliasvert(mesh->num_vertices); - vertices = R_Shadow_VertexBuffer(mesh->num_vertices); - R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, vertices); + R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, aliasvert_vertex3f); R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_SVECTOR, aliasvert_svector3f); R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_TVECTOR, aliasvert_tvector3f); R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_NORMAL, aliasvert_normal3f); @@ -433,7 +381,7 @@ void R_Model_Alias_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, v if (layer->flags & ALIASLAYER_SPECULAR) { c_alias_polys += mesh->num_triangles; - R_Shadow_SpecularLighting(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, vertices, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, relativeeyeorigin, lightradius, lightcolor2, matrix_modeltofilter, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, NULL); + R_Shadow_SpecularLighting(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, aliasvert_vertex3f, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, relativeeyeorigin, lightradius, lightcolor2, matrix_modeltofilter, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, NULL); } else if (layer->flags & ALIASLAYER_DIFFUSE) { @@ -462,7 +410,7 @@ void R_Model_Alias_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, v lightcolor2[2] *= bcolor[2] * (1.0f / 255.0f); } c_alias_polys += mesh->num_triangles; - R_Shadow_DiffuseLighting(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, vertices, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, lightradius, lightcolor2, matrix_modeltofilter, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, NULL); + R_Shadow_DiffuseLighting(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, aliasvert_vertex3f, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, lightradius, lightcolor2, matrix_modeltofilter, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, NULL); } } } @@ -730,7 +678,7 @@ void ZymoticCalcNormal3f(int vertcount, float *vertex3f, float *normal3f, int sh void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2) { - float fog, ifog, colorscale; + float fog, ifog, colorscale, ambientcolor4f[4], diffusecolor[3], diffusenormal[3]; vec3_t diff; int i, *renderlist, *elements; rtexture_t *texture; @@ -742,12 +690,12 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2) R_Mesh_Matrix(&ent->matrix); // find the vertex index list and texture - renderlist = ent->model->zymdata_renderlist; + renderlist = ent->model->alias.zymdata_renderlist; for (i = 0;i < shadernum;i++) renderlist += renderlist[0] * 3 + 1; - texture = ent->model->zymdata_textures[shadernum]; + texture = ent->model->alias.zymdata_textures[shadernum]; - numverts = ent->model->zymnum_verts; + numverts = ent->model->alias.zymnum_verts; numtriangles = *renderlist++; elements = renderlist; @@ -756,7 +704,7 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2) fog = 0; if (fogenabled) { - VectorSubtract(ent->origin, r_origin, diff); + VectorSubtract(ent->origin, r_vieworigin, diff); fog = DotProduct(diff,diff); if (fog < 0.01f) fog = 0.01f; @@ -771,51 +719,64 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2) } ifog = 1 - fog; - memset(&mstate, 0, sizeof(mstate)); if (ent->effects & EF_ADDITIVE) { - mstate.blendfunc1 = GL_SRC_ALPHA; - mstate.blendfunc2 = GL_ONE; + GL_BlendFunc(GL_SRC_ALPHA, GL_ONE); + GL_DepthMask(false); } else if (ent->alpha != 1.0 || R_TextureHasAlpha(texture)) { - mstate.blendfunc1 = GL_SRC_ALPHA; - mstate.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA; + GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + GL_DepthMask(false); } else { - mstate.blendfunc1 = GL_ONE; - mstate.blendfunc2 = GL_ZERO; + GL_BlendFunc(GL_ONE, GL_ZERO); + GL_DepthMask(true); } - colorscale = r_colorscale; + GL_DepthTest(true); + GL_VertexPointer(varray_vertex3f); + + memset(&mstate, 0, sizeof(mstate)); + colorscale = 1.0f; if (gl_combine.integer) { mstate.texrgbscale[0] = 4; colorscale *= 0.25f; } mstate.tex[0] = R_GetTexture(texture); - R_Mesh_State(&mstate); - ZymoticLerpBones(ent->model->zymnum_bones, (zymbonematrix *) ent->model->zymdata_poses, ent->frameblend, ent->model->zymdata_bones); - - R_Mesh_GetSpace(numverts); - ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->zymdata_vertbonecounts, ent->model->zymdata_verts); - R_Mesh_CopyTexCoord2f(0, ent->model->zymdata_texcoords, ent->model->zymnum_verts); - ZymoticCalcNormal3f(numverts, varray_vertex3f, aliasvert_normal3f, ent->model->zymnum_shaders, ent->model->zymdata_renderlist); - R_LightModel(ent, numverts, varray_vertex3f, aliasvert_normal3f, varray_color4f, ifog * colorscale, ifog * colorscale, ifog * colorscale, false); + mstate.pointer_texcoord[0] = ent->model->alias.zymdata_texcoords; + R_Mesh_State_Texture(&mstate); + + ZymoticLerpBones(ent->model->alias.zymnum_bones, (zymbonematrix *) ent->model->alias.zymdata_poses, ent->frameblend, ent->model->alias.zymdata_bones); + + ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts); + ZymoticCalcNormal3f(numverts, varray_vertex3f, aliasvert_normal3f, ent->model->alias.zymnum_shaders, ent->model->alias.zymdata_renderlist); + if (R_LightModel(ambientcolor4f, diffusecolor, diffusenormal, ent, ifog * colorscale, ifog * colorscale, ifog * colorscale, ent->alpha, false)) + { + GL_ColorPointer(varray_color4f); + R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, numverts, varray_vertex3f, aliasvert_normal3f, varray_color4f); + } + else + GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]); R_Mesh_Draw(numverts, numtriangles, elements); c_alias_polys += numtriangles; if (fog) { + GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + GL_DepthMask(false); + GL_DepthTest(true); + GL_VertexPointer(varray_vertex3f); + memset(&mstate, 0, sizeof(mstate)); - mstate.blendfunc1 = GL_SRC_ALPHA; - mstate.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA; // FIXME: need alpha mask for fogging... //mstate.tex[0] = R_GetTexture(texture); - R_Mesh_State(&mstate); - GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, ent->alpha * fog); - R_Mesh_GetSpace(numverts); - ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->zymdata_vertbonecounts, ent->model->zymdata_verts); + //mstate.pointer_texcoord = ent->model->alias.zymdata_texcoords; + R_Mesh_State_Texture(&mstate); + + GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha * fog); + ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts); R_Mesh_Draw(numverts, numtriangles, elements); c_alias_polys += numtriangles; } @@ -830,20 +791,15 @@ void R_Model_Zymotic_Draw(entity_render_t *ent) c_models++; - for (i = 0;i < ent->model->zymnum_shaders;i++) + for (i = 0;i < ent->model->alias.zymnum_shaders;i++) { - if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_TextureHasAlpha(ent->model->zymdata_textures[i])) + if (ent->effects & EF_ADDITIVE || ent->alpha != 1.0 || R_TextureHasAlpha(ent->model->alias.zymdata_textures[i])) R_MeshQueue_AddTransparent(ent->origin, R_DrawZymoticModelMeshCallback, ent, i); else R_DrawZymoticModelMeshCallback(ent, i); } } -void R_Model_Zymotic_DrawFakeShadow(entity_render_t *ent) -{ - // FIXME -} - void R_Model_Zymotic_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, float lightradius2, float lightdistbias, float lightsubtract, float *lightcolor) { // FIXME