static void fshader_select (int select_in) { FShader* s; Env* e; fshader_selected = select_in - FSHADER_BASE; if (fshader_selected == -1 || !CVarUtils::GetCVar<bool> ("render.textured")) { cgGLDisableProfile (cgp_fragment); return; } if (!CVarUtils::GetCVar<bool> ("render.shaders")) return; s = &fshader_list[fshader_selected]; e = EnvGet (); cgGLEnableProfile (cgp_fragment); cgGLBindProgram (s->program); if (select_in == FSHADER_CLOUDS) { GLrgba c = (e->color[ENV_COLOR_SKY] + e->color[ENV_COLOR_HORIZON]) / 2.0f; cgGLSetParameter3f (s->fogcolor, c.red, c.green, c.blue); } else cgGLSetParameter3f (s->fogcolor, e->color[ENV_COLOR_FOG].red, e->color[ENV_COLOR_FOG].green, e->color[ENV_COLOR_FOG].blue); cgGLSetTextureParameter (s->texture, TextureIdFromName ("clouds.png")); cgGLSetParameter4f (s->data, wind, e->cloud_cover, 1 - e->star_fade, 0); cgGLEnableTextureParameter (s->texture); }
static void vshader_select (int select) { VShader* s; GLvector p; Env* e; GLrgba c; float val1, val2; vshader_selected = select; if (!CVarUtils::GetCVar<bool> ("render.shaders")) return; if (select == VSHADER_NONE) { cgGLDisableProfile (cgp_vertex); return; } val1 = val2 = 0.0f; if (select == VSHADER_TREES || select == VSHADER_GRASS) val1 = wind; if (select == VSHADER_CLOUDS) val1 = wind / 5; s = &vshader_list[select]; e = EnvGet (); cgGLEnableProfile (cgp_vertex); cgGLBindProgram (s->program); cgGLSetParameter3f (s->lightpos, -e->light.x, -e->light.y, -e->light.z); c = e->color[ENV_COLOR_LIGHT]; cgGLSetParameter3f (s->lightcol, c.red, c.green, c.blue); c = e->color[ENV_COLOR_AMBIENT] * glRgba (0.2f, 0.2f, 1.0f); cgGLSetParameter3f (s->ambientcol, c.red, c.green, c.blue); p = AvatarCameraPosition (); cgGLSetParameter3f (s->eyepos, p.x, p.y, p.z); cgGLSetStateMatrixParameter(s->matrix, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MODELVIEW_MATRIX); cgGLSetParameter2f (s->fog, e->fog.rmin, e->fog.rmax); cgGLSetParameter4f (s->data, SceneVisibleRange (), SceneVisibleRange () * 0.05, val1, val2); glColor3f (1,1,1); }
void inithome () { register char *s; if (s = EnvGet ("HOME")) home = s; }