void WINAPI QERApp_ReloadShaders() { brush_t *b; face_t *f; QERApp_FreeShaders(); // now we must reload the shader information from shaderfiles LoadShaders(); // refresh the map visuals: replace our old shader objects by the new ones // on brush faces we have the shader name in texdef.name // on patches we have the shader name in PatchShaders // while we walk through the map data, we DecRef the old shaders and push the new ones in // if all goes well, most of our old shaders will get deleted on the way // FIXME: bug 104655, when we come accross a patch, we use the above array since the d_texture is lost // NOTE: both face_t and patchMesh_t store pointers to the shader and qtexture_t // in an ideal world they would only store shader and access the qtexture_t through it // reassign all current shaders for (b=active_brushes.next ; b != NULL && b != &active_brushes ; b=b->next) { if (b->patchBrush) SetShader(b->pPatch); else for (f=b->brush_faces ; f ; f=f->next) SetShader(f); } for (b=selected_brushes.next ; b != NULL && b != &selected_brushes ; b=b->next) { if (b->patchBrush) SetShader(b->pPatch); else for (f=b->brush_faces ; f ; f=f->next) SetShader(f); } // current shader // NOTE: we are kinda making it loop on itself, it will update the pShader and scroll the texture window Texture_SetTexture( &g_qeglobals.d_texturewin.texdef, &g_qeglobals.d_texturewin.brushprimit_texdef ); }
void WINAPI QERApp_ReloadShaders () { brush_t *b; brush_t *active_brushes; brush_t *selected_brushes; brush_t *filtered_brushes; QERApp_FreeShaders (); g_DataTable.m_pfnLstSkinCache()->RemoveAll(); //md3 skins active_brushes = g_DataTable.m_pfnActiveBrushes (); selected_brushes = g_DataTable.m_pfnSelectedBrushes (); filtered_brushes = g_DataTable.m_pfnFilteredBrushes (); // now we must reload the shader information from shaderfiles g_ShadersTable.m_pfnBuildShaderList(); g_ShadersTable.m_pfnPreloadShaders(); // refresh the map visuals: replace our old shader objects by the new ones // on brush faces we have the shader name in texdef.name // on patches we have the shader name in PatchShaders // while we walk through the map data, we DecRef the old shaders and push the new ones in // if all goes well, most of our old shaders will get deleted on the way // FIXME: bug 104655, when we come accross a patch, we use the above array since the d_texture is lost // NOTE: both face_t and patchMesh_t store pointers to the shader and qtexture_t // in an ideal world they would only store shader and access the qtexture_t through it // reassign all current shaders for (b = active_brushes->next; b != NULL && b != active_brushes; b = b->next) Brush_RefreshShader(b); for (b = selected_brushes->next; b != NULL && b != selected_brushes; b = b->next) Brush_RefreshShader(b); // do that to the filtered brushes as well (we might have some region compiling going on) for (b = filtered_brushes->next; b != NULL && b != filtered_brushes; b = b->next) Brush_RefreshShader(b); }