- use buffer based rendering for dynamic light pass and horizon portals.

This commit is contained in:
Christoph Oelckers 2014-06-15 20:28:23 +02:00
parent 1aaa1b7bad
commit e6f14b055a
4 changed files with 38 additions and 55 deletions

View file

@ -152,7 +152,7 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
gl_RenderState.Apply();
// Render the light
glBegin(GL_TRIANGLE_FAN);
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
for (k = 0, v = sub->firstline; k < sub->numlines; k++, v++)
{
vertex_t *vt = v->v1;
@ -160,12 +160,10 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
t1.Set(vt->fx, zc, vt->fy);
Vector nearToVert = t1 - nearPt;
glTexCoord2f((nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f);
glVertex3f(vt->fx, zc, vt->fy);
ptr->Set(vt->fx, zc, vt->fy, (nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f);
ptr++;
}
glEnd();
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
node = node->nextLight;
}
}

View file

@ -999,26 +999,21 @@ void GLHorizonPortal::DrawContents()
float vy=FIXED2FLOAT(viewy);
// Draw to some far away boundary
// This is not drawn as larher strips because it causes visual glitches.
for(float x=-32768+vx; x<32768+vx; x+=4096)
{
for(float y=-32768+vy; y<32768+vy;y+=4096)
{
glBegin(GL_TRIANGLE_FAN);
glTexCoord2f(x/64, -y/64);
glVertex3f(x, z, y);
glTexCoord2f(x/64 + 64, -y/64);
glVertex3f(x + 4096, z, y);
glTexCoord2f(x/64 + 64, -y/64 - 64);
glVertex3f(x + 4096, z, y + 4096);
glTexCoord2f(x/64, -y/64 - 64);
glVertex3f(x, z, y + 4096);
glEnd();
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
ptr->Set(x, z, y, x / 64, -y / 64);
ptr++;
ptr->Set(x + 4096, z, y, x / 64 + 64, -y / 64);
ptr++;
ptr->Set(x, z, y + 4096, x / 64, -y / 64 - 64);
ptr++;
ptr->Set(x + 4096, z, y + 4096, x / 64 + 64, -y / 64 - 64);
ptr++;
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
}
}
@ -1029,34 +1024,28 @@ void GLHorizonPortal::DrawContents()
// Since I can't draw into infinity there can always be a
// small gap
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(512.f, 0);
glVertex3f(-32768+vx, z, -32768+vy);
glTexCoord2f(512.f, tz);
glVertex3f(-32768+vx, vz, -32768+vy);
glTexCoord2f(-512.f, 0);
glVertex3f(-32768+vx, z, 32768+vy);
glTexCoord2f(-512.f, tz);
glVertex3f(-32768+vx, vz, 32768+vy);
glTexCoord2f(512.f, 0);
glVertex3f( 32768+vx, z, 32768+vy);
glTexCoord2f(512.f, tz);
glVertex3f( 32768+vx, vz, 32768+vy);
glTexCoord2f(-512.f, 0);
glVertex3f( 32768+vx, z, -32768+vy);
glTexCoord2f(-512.f, tz);
glVertex3f( 32768+vx, vz, -32768+vy);
glTexCoord2f(512.f, 0);
glVertex3f(-32768+vx, z, -32768+vy);
glTexCoord2f(512.f, tz);
glVertex3f(-32768+vx, vz, -32768+vy);
glEnd();
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
ptr->Set(-32768 + vx, z, -32768 + vy, 512.f, 0);
ptr++;
ptr->Set(-32768 + vx, vz, -32768 + vy, 512.f, tz);
ptr++;
ptr->Set(-32768 + vx, z, 32768 + vy, -512.f, 0);
ptr++;
ptr->Set(-32768 + vx, vz, 32768 + vy, -512.f, tz);
ptr++;
ptr->Set(32768 + vx, z, 32768 + vy, 512.f, 0);
ptr++;
ptr->Set(32768 + vx, vz, 32768 + vy, 512.f, tz);
ptr++;
ptr->Set(32768 + vx, z, -32768 + vy, -512.f, 0);
ptr++;
ptr->Set(32768 + vx, vz, -32768 + vy, -512.f, tz);
ptr++;
ptr->Set(-32768 + vx, z, -32768 + vy, 512.f, 0);
ptr++;
ptr->Set(-32768 + vx, vz, -32768 + vy, 512.f, tz);
ptr++;
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
if (pushed)
{

View file

@ -331,7 +331,7 @@ void GLWall::RenderFogBoundary()
// this case is special because it needs to change the color in the middle of the polygon so it cannot use the standard function
// This also needs no splits so it's relatively simple.
gl_RenderState.Apply();
glBegin(GL_TRIANGLE_FAN);
glBegin(GL_TRIANGLE_FAN); // only used on GL 2.x!
glVertex3f(glseg.x1, zbottom[0], glseg.y1);
glVertex3f(glseg.x1, ztop[0], glseg.y1);
glColor4fv(fc);

View file

@ -43,8 +43,4 @@ EXTERN_CVAR(Bool, gl_dynlight_shader)
EXTERN_CVAR(Float, gl_mask_threshold)
EXTERN_CVAR(Float, gl_mask_sprite_threshold)
EXTERN_CVAR(Int, gl_usevbo)
#endif // _GL_INTERN_H