X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=gl_models.c;h=223be1b81b87af20c877d54b988831638ee23e9e;hb=e2d030eaf3d5c507bce6dd15619973d02f4b9d00;hp=1205ff248b3629eb8225d426b4bcd147d94215a8;hpb=eab50b35822052aad2a31fece513583600e5941f;p=xonotic%2Fdarkplaces.git diff --git a/gl_models.c b/gl_models.c index 1205ff24..223be1b8 100644 --- a/gl_models.c +++ b/gl_models.c @@ -235,14 +235,12 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2) } } m.pointer_vertex = varray_vertex3f; - R_Mesh_State(&m); c_alias_polys += mesh->num_triangles; R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_VERTEX, varray_vertex3f); if (layer->flags & ALIASLAYER_FOG) { colorscale *= fog; - GL_ColorPointer(NULL); GL_Color(fogcolor[0] * colorscale, fogcolor[1] * colorscale, fogcolor[2] * colorscale, ent->alpha); } else @@ -266,26 +264,23 @@ 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)) { - GL_ColorPointer(varray_color4f); + m.pointer_color = 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_ColorPointer(NULL); GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]); - } } } + R_Mesh_State(&m); + GL_LockArrays(0, mesh->num_vertices); R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i); + GL_LockArrays(0, 0); } } @@ -385,7 +380,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, aliasvert_vertex3f, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, relativeeyeorigin, lightcolor2, matrix_modeltolight, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, lightcubemap); + R_Shadow_RenderLighting(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, aliasvert_vertex3f, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, relativeeyeorigin, lightcolor2, matrix_modeltolight, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, layer->texture, lightcubemap, LIGHTING_SPECULAR); } else if (layer->flags & ALIASLAYER_DIFFUSE) { @@ -414,7 +409,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, aliasvert_vertex3f, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, lightcolor2, matrix_modeltolight, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, lightcubemap); + R_Shadow_RenderLighting(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i, aliasvert_vertex3f, aliasvert_svector3f, aliasvert_tvector3f, aliasvert_normal3f, mesh->data_texcoord2f, relativelightorigin, relativeeyeorigin, lightcolor2, matrix_modeltolight, matrix_modeltoattenuationxyz, matrix_modeltoattenuationz, layer->texture, layer->nmap, layer->texture, lightcubemap, LIGHTING_DIFFUSE); } } } @@ -750,7 +745,6 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2) mstate.tex[0] = R_GetTexture(texture); mstate.pointer_texcoord[0] = ent->model->alias.zymdata_texcoords; mstate.pointer_vertex = varray_vertex3f; - R_Mesh_State(&mstate); ZymoticLerpBones(ent->model->alias.zymnum_bones, (zymbonematrix *) ent->model->alias.zymdata_poses, ent->frameblend, ent->model->alias.zymdata_bones); @@ -758,15 +752,15 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2) 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); + mstate.pointer_color = varray_color4f; 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_State(&mstate); + GL_LockArrays(0, numverts); R_Mesh_Draw(numverts, numtriangles, elements); + GL_LockArrays(0, 0); c_alias_polys += numtriangles; if (fog) @@ -782,10 +776,12 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2) mstate.pointer_vertex = varray_vertex3f; R_Mesh_State(&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_State(&mstate); + GL_LockArrays(0, numverts); R_Mesh_Draw(numverts, numtriangles, elements); + GL_LockArrays(0, 0); c_alias_polys += numtriangles; } }