Parallax the parallax skies (bug 2783074).

git-svn-id: https://svn.eduke32.com/eduke32@1374 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2009-05-09 11:04:10 +00:00
parent 72721c1663
commit 3cd91a1832

View file

@ -775,8 +775,9 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
{ {
int16_t cursectnum; int16_t cursectnum;
int32_t i, cursectflorz, cursectceilz; int32_t i, cursectflorz, cursectceilz;
float ang, tiltang; float skyhoriz, ang, tiltang;
float pos[3]; float pos[3];
pthtyp* pth;
if (!rendmode) return; if (!rendmode) return;
@ -809,11 +810,26 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
if (pr_shadows && lightcount && (pr_shadowcount > 0)) if (pr_shadows && lightcount && (pr_shadowcount > 0))
polymer_prepareshadows(); polymer_prepareshadows();
// hack for parallax skies
skyhoriz = horizang;
if (skyhoriz < -180.0f)
skyhoriz += 360.0f;
drawingskybox = 1;
pth = gltexcache(cursky,0,0);
drawingskybox = 0;
// if it's not a skybox, make the sky parallax
// the angle factor is computed from eyeballed values
// need to recompute it if we ever change the max horiz amplitude
if (!pth || !(pth->flags & 4))
skyhoriz /= 4.3027;
bglMatrixMode(GL_MODELVIEW); bglMatrixMode(GL_MODELVIEW);
bglLoadIdentity(); bglLoadIdentity();
bglRotatef(tiltang, 0.0f, 0.0f, -1.0f); bglRotatef(tiltang, 0.0f, 0.0f, -1.0f);
bglRotatef(horizang, 1.0f, 0.0f, 0.0f); bglRotatef(skyhoriz, 1.0f, 0.0f, 0.0f);
bglRotatef(ang, 0.0f, 1.0f, 0.0f); bglRotatef(ang, 0.0f, 1.0f, 0.0f);
bglScalef(1.0f / 1000.0f, 1.0f / 1000.0f, 1.0f / 1000.0f); bglScalef(1.0f / 1000.0f, 1.0f / 1000.0f, 1.0f / 1000.0f);