]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_models.c
GL_Color no longer interacts with GL_ColorPointer (so be sure to set GL_ColorPointer...
[xonotic/darkplaces.git] / gl_models.c
index ca8bdb7de8e09e92583935de7e6dfdfa01252322..17e1f2bf749d25e9e23ba78464f495fb2d8078f2 100644 (file)
@@ -242,6 +242,7 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                if (layer->flags & ALIASLAYER_FOG)
                {
                        colorscale *= fog;
+                       GL_ColorPointer(NULL);
                        GL_Color(fogcolor[0] * colorscale, fogcolor[1] * colorscale, fogcolor[2] * colorscale, ent->alpha);
                }
                else
@@ -265,7 +266,10 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                                VectorScale(tint, r_shadow_realtime_world_lightmaps.value, tint);
                        colorscale *= ifog;
                        if (fullbright)
+                       {
+                               GL_ColorPointer(NULL);
                                GL_Color(tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha);
+                       }
                        else
                        {
                                if (R_LightModel(ambientcolor4f, diffusecolor, diffusenormal, ent, tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha, false))
@@ -275,7 +279,10 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                                        R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, mesh->num_vertices, varray_vertex3f, varray_normal3f, varray_color4f);
                                }
                                else
+                               {
+                                       GL_ColorPointer(NULL);
                                        GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
+                               }
                        }
                }
                R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
@@ -308,7 +315,7 @@ void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightor
        float projectdistance;
        if (ent->effects & EF_ADDITIVE || ent->alpha < 1)
                return;
-       projectdistance = lightradius + ent->model->radius - sqrt(DotProduct(relativelightorigin, relativelightorigin));
+       projectdistance = lightradius + ent->model->radius;// - sqrt(DotProduct(relativelightorigin, relativelightorigin));
        if (projectdistance > 0.1)
        {
                R_Mesh_Matrix(&ent->matrix);
@@ -318,7 +325,7 @@ void R_Model_Alias_DrawShadowVolume(entity_render_t *ent, vec3_t relativelightor
                        if (skin->flags & ALIASSKIN_TRANSPARENT)
                                continue;
                        R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f);
-                       R_Shadow_Volume(mesh->num_vertices, mesh->num_triangles, varray_vertex3f, mesh->data_element3i, mesh->data_neighbor3i, relativelightorigin, lightradius, projectdistance);
+                       R_Shadow_VolumeFromSphere(mesh->num_vertices, mesh->num_triangles, varray_vertex3f, mesh->data_element3i, mesh->data_neighbor3i, relativelightorigin, projectdistance, lightradius);
                }
        }
 }
@@ -755,7 +762,10 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, numverts, varray_vertex3f, aliasvert_normal3f, varray_color4f);
        }
        else
+       {
+               GL_ColorPointer(NULL);
                GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
+       }
        R_Mesh_Draw(numverts, numtriangles, elements);
        c_alias_polys += numtriangles;
 
@@ -772,6 +782,7 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                //mstate.pointer_texcoord = ent->model->alias.zymdata_texcoords;
                R_Mesh_State_Texture(&mstate);
 
+               GL_ColorPointer(NULL);
                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);