+ rsurface_generatevertex = false;
+ rsurface_generatetangents = false;
+ rsurface_generatenormals = false;
+ rsurface_vertex3f = rsurface_model->surfmesh.data_vertex3f;
+ rsurface_svector3f = rsurface_model->surfmesh.data_svector3f;
+ rsurface_tvector3f = rsurface_model->surfmesh.data_tvector3f;
+ rsurface_normal3f = rsurface_model->surfmesh.data_normal3f;
+ }
+ if (rsurface_texture->textureflags & (Q3TEXTUREFLAG_AUTOSPRITE | Q3TEXTUREFLAG_AUTOSPRITE2))
+ {
+ rsurface_deformvertex = true;
+ rsurface_vertex3f = rsurface_array_vertex3f;
+ rsurface_svector3f = rsurface_array_svector3f;
+ rsurface_tvector3f = rsurface_array_tvector3f;
+ rsurface_normal3f = rsurface_array_normal3f;
+ }
+ else
+ rsurface_deformvertex = false;
+ R_Mesh_VertexPointer(rsurface_vertex3f);
+ rsurface_dynamicvertex = rsurface_generatevertex || rsurface_deformvertex;
+}
+
+void RSurf_PrepareDynamicSurfaceVertices(const msurface_t *surface)
+{
+ float *vertex3f, *svector3f, *tvector3f, *normal3f;
+ model_t *model = rsurface_entity->model;
+ if (!rsurface_dynamicvertex)
+ return;
+ if (rsurface_generatevertex)
+ {
+ Mod_Alias_GetMesh_Vertex3f(model, rsurface_entity->frameblend, rsurface_array_vertex3f);
+ if (rsurface_generatetangents)
+ Mod_BuildTextureVectorsAndNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface_vertex3f, model->surfmesh.data_texcoordtexture2f, model->surfmesh.data_element3i + surface->num_firsttriangle * 3, rsurface_array_svector3f, rsurface_array_tvector3f, rsurface_array_normal3f, r_smoothnormals_areaweighting.integer);
+ else if (rsurface_generatenormals)
+ Mod_BuildNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface_array_vertex3f, model->surfmesh.data_element3i + 3 * surface->num_firsttriangle, rsurface_array_normal3f, r_smoothnormals_areaweighting.integer);