//----------------------------------------------------------------------------- // // // //----------------------------------------------------------------------------- void GLSkyPortal::DrawContents() { bool drawBoth = false; int CM_Index; PalEntry FadeColor(0,0,0,0); // We have no use for Doom lighting special handling here, so disable it for this function. int oldlightmode = glset.lightmode; if (glset.lightmode == 8) glset.lightmode = 2; if (gl_fixedcolormap) { CM_Index=gl_fixedcolormap<CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size()? gl_fixedcolormap:CM_DEFAULT; } else { CM_Index=CM_DEFAULT; FadeColor=origin->fadecolor; } gl_RenderState.EnableFog(false); gl_RenderState.EnableAlphaTest(false); gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glMatrixMode(GL_MODELVIEW); glPushMatrix(); GLRenderer->SetupView(0, 0, 0, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1)); if (origin->texture[0] && origin->texture[0]->tex->gl_info.bSkybox) { if (gl_fixedcolormap != CM_DEFAULT) { float rr,gg,bb; gl_GetLightColor(255, 0, NULL, &rr, &gg, &bb); R=rr; G=gg; B=bb; } else R=G=B=1.f; RenderBox(origin->skytexno1, origin->texture[0], origin->x_offset[0], CM_Index, origin->sky2); gl_RenderState.EnableAlphaTest(true); } else { if (origin->texture[0]==origin->texture[1] && origin->doublesky) origin->doublesky=false; if (origin->texture[0]) { gl_RenderState.SetTextureMode(TM_OPAQUE); RenderDome(origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->y_offset, origin->mirrored, CM_Index); gl_RenderState.SetTextureMode(TM_MODULATE); } gl_RenderState.EnableAlphaTest(true); gl_RenderState.AlphaFunc(GL_GEQUAL,0.05f); if (origin->doublesky && origin->texture[1]) { secondlayer=true; RenderDome(FNullTextureID(), origin->texture[1], origin->x_offset[1], origin->y_offset, false, CM_Index); secondlayer=false; } if (skyfog>0 && (FadeColor.r ||FadeColor.g || FadeColor.b)) { gl_RenderState.EnableTexture(false); foglayer=true; glColor4f(FadeColor.r/255.0f,FadeColor.g/255.0f,FadeColor.b/255.0f,skyfog/255.0f); RenderDome(FNullTextureID(), NULL, 0, 0, false, CM_DEFAULT); gl_RenderState.EnableTexture(true); foglayer=false; } } glPopMatrix(); glset.lightmode = oldlightmode; }
//----------------------------------------------------------------------------- // // // //----------------------------------------------------------------------------- void GLSkyPortal::DrawContents() { bool drawBoth = false; int CM_Index; PalEntry FadeColor(0,0,0,0); if (gl_fixedcolormap) { CM_Index=gl_fixedcolormap<CM_LIMIT? gl_fixedcolormap:CM_DEFAULT; } else { CM_Index=CM_DEFAULT; FadeColor=origin->fadecolor; } gl_EnableFog(false); gl.Disable(GL_ALPHA_TEST); gl.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gl.PushMatrix(); gl_SetupView(0, 0, 0, viewangle, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1), true); if (origin->texture[0] && origin->texture[0]->bSkybox) { if (fixedcolormap) { float rr,gg,bb; gl_GetLightColor(255, 0, NULL, &rr, &gg, &bb); R=rr; G=gg; B=bb; } else R=G=B=1.f; RenderBox(origin->skytexno1, origin->texture[0], origin->x_offset[0], CM_Index); gl.Enable(GL_ALPHA_TEST); } else { if (origin->texture[0]==origin->texture[1] && origin->doublesky) origin->doublesky=false; gl.Translatef(0.f, -1000.f, 0.f); if (origin->texture[0]) { gl_SetTextureMode(TM_OPAQUE); RenderDome(origin->skytexno1, origin->texture[0], origin->x_offset[0], origin->y_offset, CM_Index); gl_SetTextureMode(TM_MODULATE); } gl.Enable(GL_ALPHA_TEST); gl.AlphaFunc(GL_GEQUAL,0.05f); if (origin->doublesky && origin->texture[1]) { secondlayer=true; RenderDome(0, origin->texture[1], origin->x_offset[1], origin->y_offset, CM_Index); secondlayer=false; } if (skyfog>0 && (FadeColor.r ||FadeColor.g || FadeColor.b)) { gl_EnableTexture(false); foglayer=true; gl.Color4f(FadeColor.r/255.0f,FadeColor.g/255.0f,FadeColor.b/255.0f,skyfog/255.0f); RenderDome(0, NULL, 0, 0, CM_DEFAULT); gl_EnableTexture(true); foglayer=false; } } gl.PopMatrix(); }