Shader *generateshader(const char *name, const char *fmt, ...) { if(!loadedshaders) return NULL; Shader *s = name ? lookupshaderbyname(name) : NULL; if(!s) { defvformatstring(cmd, fmt, fmt); standardshaders = true; execute(cmd); standardshaders = false; s = name ? lookupshaderbyname(name) : NULL; if(!s) s = nullshader; } return s; }
void addglare() { if(!glare || renderpath==R_FIXEDFUNCTION) return; glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); static Shader *glareshader = NULL; if(!glareshader) glareshader = lookupshaderbyname("glare"); glareshader->set(); glBindTexture(GL_TEXTURE_2D, glaretex.rendertex); setlocalparamf("glarescale", SHPARAM_PIXEL, 0, glarescale, glarescale, glarescale); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(-1, -1, 0); glTexCoord2f(1, 0); glVertex3f( 1, -1, 0); glTexCoord2f(1, 1); glVertex3f( 1, 1, 0); glTexCoord2f(0, 1); glVertex3f(-1, 1, 0); glEnd(); glDisable(GL_BLEND); }
void loadshaders() { standardshaders = true; execfile("data/glsl.cfg"); standardshaders = false; nullshader = lookupshaderbyname("null"); hudshader = lookupshaderbyname("hud"); hudnotextureshader = lookupshaderbyname("hudnotexture"); stdworldshader = lookupshaderbyname("stdworld"); if(!nullshader || !hudshader || !hudnotextureshader || !stdworldshader) fatal("cannot find shader definitions"); dummyslot.shader = stdworldshader; textureshader = lookupshaderbyname("texture"); notextureshader = lookupshaderbyname("notexture"); nocolorshader = lookupshaderbyname("nocolor"); foggedshader = lookupshaderbyname("fogged"); foggednotextureshader = lookupshaderbyname("foggednotexture"); nullshader->set(); loadedshaders = true; }
void mdlshader(char *shader) { checkmdl; loadingmodel->setshader(lookupshaderbyname(shader)); }
void mdlshader(char *shader) { if (!shader) return; checkmdl; loadingmodel->setshader(lookupshaderbyname(shader)); }