mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +00:00
- use buffer based rendering for dynamic light pass and horizon portals.
This commit is contained in:
parent
1aaa1b7bad
commit
e6f14b055a
4 changed files with 38 additions and 55 deletions
|
@ -152,7 +152,7 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
|
||||||
gl_RenderState.Apply();
|
gl_RenderState.Apply();
|
||||||
|
|
||||||
// Render the light
|
// Render the light
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||||
for (k = 0, v = sub->firstline; k < sub->numlines; k++, v++)
|
for (k = 0, v = sub->firstline; k < sub->numlines; k++, v++)
|
||||||
{
|
{
|
||||||
vertex_t *vt = v->v1;
|
vertex_t *vt = v->v1;
|
||||||
|
@ -160,12 +160,10 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
|
||||||
|
|
||||||
t1.Set(vt->fx, zc, vt->fy);
|
t1.Set(vt->fx, zc, vt->fy);
|
||||||
Vector nearToVert = t1 - nearPt;
|
Vector nearToVert = t1 - nearPt;
|
||||||
glTexCoord2f((nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f);
|
ptr->Set(vt->fx, zc, vt->fy, (nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f);
|
||||||
|
ptr++;
|
||||||
glVertex3f(vt->fx, zc, vt->fy);
|
|
||||||
}
|
}
|
||||||
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_FAN);
|
||||||
glEnd();
|
|
||||||
node = node->nextLight;
|
node = node->nextLight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -999,26 +999,21 @@ void GLHorizonPortal::DrawContents()
|
||||||
float vy=FIXED2FLOAT(viewy);
|
float vy=FIXED2FLOAT(viewy);
|
||||||
|
|
||||||
// Draw to some far away boundary
|
// 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 x=-32768+vx; x<32768+vx; x+=4096)
|
||||||
{
|
{
|
||||||
for(float y=-32768+vy; y<32768+vy;y+=4096)
|
for(float y=-32768+vy; y<32768+vy;y+=4096)
|
||||||
{
|
{
|
||||||
glBegin(GL_TRIANGLE_FAN);
|
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||||
|
ptr->Set(x, z, y, x / 64, -y / 64);
|
||||||
glTexCoord2f(x/64, -y/64);
|
ptr++;
|
||||||
glVertex3f(x, z, y);
|
ptr->Set(x + 4096, z, y, x / 64 + 64, -y / 64);
|
||||||
|
ptr++;
|
||||||
glTexCoord2f(x/64 + 64, -y/64);
|
ptr->Set(x, z, y + 4096, x / 64, -y / 64 - 64);
|
||||||
glVertex3f(x + 4096, z, y);
|
ptr++;
|
||||||
|
ptr->Set(x + 4096, z, y + 4096, x / 64 + 64, -y / 64 - 64);
|
||||||
glTexCoord2f(x/64 + 64, -y/64 - 64);
|
ptr++;
|
||||||
glVertex3f(x + 4096, z, y + 4096);
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||||
|
|
||||||
glTexCoord2f(x/64, -y/64 - 64);
|
|
||||||
glVertex3f(x, z, y + 4096);
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,34 +1024,28 @@ void GLHorizonPortal::DrawContents()
|
||||||
// Since I can't draw into infinity there can always be a
|
// Since I can't draw into infinity there can always be a
|
||||||
// small gap
|
// small gap
|
||||||
|
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
|
||||||
|
ptr->Set(-32768 + vx, z, -32768 + vy, 512.f, 0);
|
||||||
glTexCoord2f(512.f, 0);
|
ptr++;
|
||||||
glVertex3f(-32768+vx, z, -32768+vy);
|
ptr->Set(-32768 + vx, vz, -32768 + vy, 512.f, tz);
|
||||||
glTexCoord2f(512.f, tz);
|
ptr++;
|
||||||
glVertex3f(-32768+vx, vz, -32768+vy);
|
ptr->Set(-32768 + vx, z, 32768 + vy, -512.f, 0);
|
||||||
|
ptr++;
|
||||||
glTexCoord2f(-512.f, 0);
|
ptr->Set(-32768 + vx, vz, 32768 + vy, -512.f, tz);
|
||||||
glVertex3f(-32768+vx, z, 32768+vy);
|
ptr++;
|
||||||
glTexCoord2f(-512.f, tz);
|
ptr->Set(32768 + vx, z, 32768 + vy, 512.f, 0);
|
||||||
glVertex3f(-32768+vx, vz, 32768+vy);
|
ptr++;
|
||||||
|
ptr->Set(32768 + vx, vz, 32768 + vy, 512.f, tz);
|
||||||
glTexCoord2f(512.f, 0);
|
ptr++;
|
||||||
glVertex3f( 32768+vx, z, 32768+vy);
|
ptr->Set(32768 + vx, z, -32768 + vy, -512.f, 0);
|
||||||
glTexCoord2f(512.f, tz);
|
ptr++;
|
||||||
glVertex3f( 32768+vx, vz, 32768+vy);
|
ptr->Set(32768 + vx, vz, -32768 + vy, -512.f, tz);
|
||||||
|
ptr++;
|
||||||
glTexCoord2f(-512.f, 0);
|
ptr->Set(-32768 + vx, z, -32768 + vy, 512.f, 0);
|
||||||
glVertex3f( 32768+vx, z, -32768+vy);
|
ptr++;
|
||||||
glTexCoord2f(-512.f, tz);
|
ptr->Set(-32768 + vx, vz, -32768 + vy, 512.f, tz);
|
||||||
glVertex3f( 32768+vx, vz, -32768+vy);
|
ptr++;
|
||||||
|
GLRenderer->mVBO->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||||
glTexCoord2f(512.f, 0);
|
|
||||||
glVertex3f(-32768+vx, z, -32768+vy);
|
|
||||||
glTexCoord2f(512.f, tz);
|
|
||||||
glVertex3f(-32768+vx, vz, -32768+vy);
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
|
|
||||||
if (pushed)
|
if (pushed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 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.
|
// This also needs no splits so it's relatively simple.
|
||||||
gl_RenderState.Apply();
|
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, zbottom[0], glseg.y1);
|
||||||
glVertex3f(glseg.x1, ztop[0], glseg.y1);
|
glVertex3f(glseg.x1, ztop[0], glseg.y1);
|
||||||
glColor4fv(fc);
|
glColor4fv(fc);
|
||||||
|
|
|
@ -43,8 +43,4 @@ EXTERN_CVAR(Bool, gl_dynlight_shader)
|
||||||
EXTERN_CVAR(Float, gl_mask_threshold)
|
EXTERN_CVAR(Float, gl_mask_threshold)
|
||||||
EXTERN_CVAR(Float, gl_mask_sprite_threshold)
|
EXTERN_CVAR(Float, gl_mask_sprite_threshold)
|
||||||
|
|
||||||
EXTERN_CVAR(Int, gl_usevbo)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _GL_INTERN_H
|
#endif // _GL_INTERN_H
|
||||||
|
|
Loading…
Reference in a new issue