static inline void GL_AddGenericFace( mface_t *face ) { if( face->drawflags & SURF_SKY ) { R_AddSkySurface( face ); return; } if( face->drawflags & (SURF_TRANS33|SURF_TRANS66) ) { GL_AddAlphaFace( face ); return; } GL_AddSolidFace( face ); }
/* * @brief */ void R_DrawSkyBox(void) { const int32_t sky_order[6] = { 0, 2, 1, 3, 4, 5 }; r_bsp_surfaces_t *surfs; uint32_t i, j; surfs = &r_model_state.world->bsp->sorted_surfaces->sky; j = 0; // first add all visible sky surfaces to the sky bounds for (i = 0; i < surfs->count; i++) { if (surfs->surfaces[i]->frame == r_locals.frame) { R_AddSkySurface(surfs->surfaces[i]); j++; } } if (!j) // no visible sky surfaces return; R_ResetArrayState(); glPushMatrix(); glTranslatef(r_view.origin[0], r_view.origin[1], r_view.origin[2]); if (r_state.fog_enabled) glFogf(GL_FOG_END, FOG_END * 8); r_sky.texcoord_index = r_sky.vert_index = 0; for (i = 0; i < 6; i++) { if (r_sky.st_mins[0][i] >= r_sky.st_maxs[0][i] || r_sky.st_mins[1][i] >= r_sky.st_maxs[1][i]) continue; // nothing on this plane R_BindTexture(r_sky.images[sky_order[i]]->texnum); R_MakeSkyVec(r_sky.st_mins[0][i], r_sky.st_mins[1][i], i); R_MakeSkyVec(r_sky.st_mins[0][i], r_sky.st_maxs[1][i], i); R_MakeSkyVec(r_sky.st_maxs[0][i], r_sky.st_maxs[1][i], i); R_MakeSkyVec(r_sky.st_maxs[0][i], r_sky.st_mins[1][i], i); glDrawArrays(GL_QUADS, 0, r_sky.vert_index / 3); r_sky.texcoord_index = r_sky.vert_index = 0; } if (r_state.fog_enabled) glFogf(GL_FOG_END, FOG_END); glPopMatrix(); }