- 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, ent, tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha, false))
+ {
+ GL_UseColorArray();
+ if (gl_mesh_copyarrays.integer)
+ {
+ R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_NORMAL, aliasvert_normal3f);
+ R_LightModel_CalcVertexColors(ambientcolor4f, mesh->num_vertices, varray_vertex3f, aliasvert_normal3f, varray_color4f);
+ }
+ else
+ {
+ // request color4f cache
+ request.data_size = mesh->num_vertices * sizeof(float[4]);
+ request.id_pointer1 = ent;
+ request.id_number2 = 2;
+ request.id_number3 = CRC_Block((void *)ent->frameblend, sizeof(ent->frameblend)) + CRC_Block((void *)&ent->entlightstime, sizeof(ent->entlightstime));
+ if (R_Mesh_CacheArray(&request))
+ {
+ // save off the color pointer before we blow away the request
+ m.pointer_color = request.data;
+ // request normal3f cache
+ request.data_size = mesh->num_vertices * sizeof(float[3]);
+ request.id_pointer1 = NULL;
+ request.id_number2 = 3;
+ request.id_number3 = CRC_Block((void *)ent->frameblend, sizeof(ent->frameblend));
+ if (R_Mesh_CacheArray(&request))
+ R_Model_Alias_GetMesh_Array3f(ent, mesh, MODELARRAY_NORMAL, request.data);
+ R_LightModel_CalcVertexColors(ambientcolor4f, mesh->num_vertices, m.pointer_vertex, request.data, m.pointer_color);
+ }
+ else
+ m.pointer_color = request.data;
+ }
+ }
+ else
+ GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);