- VBO implementation for flats working except updating after change.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@456 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2009-09-15 21:47:49 +00:00
parent d6be392046
commit eed463dffc
10 changed files with 236 additions and 136 deletions

View file

@ -1,4 +1,8 @@
September 15, 2009 (Changes by Graf Zahl)
- added thing activation types for BUMPSPECIAL and USESPECIAL. Also added
a new ClearSpecial flag to the activation type.
- added MBF's code for dogs jumping down, controlled by the MF6_JUMPDOWN
flag.
- fixed: The Dehacked flags parser fix from May 31 (r1624) was undone by
yesterday's additions. Changed it so that the parser first checks for
the presence of a '-' sign before deciding whether to use strtol or

View file

@ -327,6 +327,8 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
{
dest->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false);
dest->SetPlaneTexZ(sector_t::floor, s->GetPlaneTexZ(sector_t::floor));
dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::vbo_fakefloor];
dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor];
}
else if (s->MoreFlags & SECF_FAKEFLOORONLY)
{
@ -350,6 +352,9 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
{
dest->SetPlaneTexZ(sector_t::floor, s->GetPlaneTexZ(sector_t::floor));
dest->floorplane = s->floorplane;
dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::vbo_fakefloor];
dest->vboheight[sector_t::floor] = s->vboheight[sector_t::floor];
}
if (!(s->MoreFlags&SECF_FAKEFLOORONLY))
@ -360,12 +365,16 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
{
dest->SetTexture(sector_t::ceiling, s->GetTexture(sector_t::ceiling), false);
dest->SetPlaneTexZ(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling));
dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakeceiling];
dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling];
}
}
else
{
dest->ceilingplane = s->ceilingplane;
dest->SetPlaneTexZ(sector_t::ceiling, s->GetPlaneTexZ(sector_t::ceiling));
dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakeceiling];
dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::ceiling];
}
}
@ -378,6 +387,12 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
dest->ceilingplane=s->floorplane;
dest->ceilingplane.FlipVert();
dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::floor];
dest->vboheight[sector_t::floor] = sec->vboheight[sector_t::floor];
dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::vbo_fakefloor];
dest->vboheight[sector_t::ceiling] = s->vboheight[sector_t::floor];
if (!back)
{
dest->SetTexture(sector_t::floor, diffTex ? sec->GetTexture(sector_t::floor) : s->GetTexture(sector_t::floor), false);
@ -419,6 +434,12 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
dest->floorplane = s->ceilingplane;
dest->floorplane.FlipVert();
dest->vboindex[sector_t::floor] = sec->vboindex[sector_t::vbo_fakeceiling];
dest->vboheight[sector_t::floor] = s->vboheight[sector_t::ceiling];
dest->vboindex[sector_t::ceiling] = sec->vboindex[sector_t::ceiling];
dest->vboheight[sector_t::ceiling] = sec->vboheight[sector_t::ceiling];
if (!back)
{
dest->SetTexture(sector_t::ceiling, diffTex ? sec->GetTexture(sector_t::ceiling) : s->GetTexture(sector_t::ceiling), false);
@ -427,7 +448,6 @@ sector_t * gl_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool bac
if (s->GetTexture(sector_t::floor) != skyflatnum)
{
dest->ceilingplane = sec->ceilingplane;
dest->SetTexture(sector_t::floor, s->GetTexture(sector_t::floor), false);
dest->planes[sector_t::floor].xform = s->planes[sector_t::floor].xform;
}

View file

@ -689,48 +689,133 @@ static void PrepareSegs()
//==========================================================================
//
// creates a VBO for flat geometry - just a rough test for now.
// creates a VBO for flat geometry
// Vertices are ordered by sector plane (i.e. all attached sectors are
// calculated along with the master so that changing the height of a
// plane doesn't result in multiple ranges of the VBO to become invalid)
//
//==========================================================================
unsigned int gl_vbo;
TArray<FVBOVertex> vbo_data;
static void SetVertex(int idx, vertex_t *vt, secplane_t & plane)
{
vbo_data[idx].x = vt->fx;
vbo_data[idx].y = vt->fy;
vbo_data[idx].z = plane.ZatPoint(vt->fx, vt->fy);
vbo_data[idx].u = vt->fx/64.f;
vbo_data[idx].v = -vt->fy/64.f;
}
static F3DFloor *Find3DFloor(sector_t *target, sector_t *model)
{
for(unsigned i=0; i<target->e->XFloor.ffloors.Size(); i++)
{
F3DFloor *ffloor = target->e->XFloor.ffloors[i];
if (ffloor->model == model) return ffloor;
}
return NULL;
}
static void CreateFlatVBO()
{
for (int h=0;h<2;h++)
for (int h = sector_t::floor; h <= sector_t::ceiling; h++)
{
for(int i=0; i<numsectors;i++)
{
sector_t *sec = &sectors[i];
sec->vboheight[h] = sec->GetPlaneTexZ(h? sector_t::floor:sector_t::ceiling);
sec->vboindex[h] = vbo_data.Size();
sec->vboheight[h] = sec->GetPlaneTexZ(h);
// First calculate the vertices for the sector itself
for(int j=0; j<sec->subsectorcount; j++)
{
subsector_t *sub = sec->subsectors[j];
sub->vboindex[h] = vbo_data.Size();
int idx = vbo_data.Reserve(sub->numvertices);
for(int k=0; k<sub->numvertices; k++, idx++)
int idx = vbo_data.Reserve(sub->numlines);
for(int k=0; k<sub->numlines; k++, idx++)
{
seg_t *seg = &segs[sub->firstline+k];
vertex_t *vt = seg->v1;
SetVertex(idx, segs[sub->firstline+k].v1, sec->GetSecPlane(h));
if (sec->transdoor && h == sector_t::floor) vbo_data[idx].z -= 1.f;
}
}
vbo_data[idx].x = vt->fx;
vbo_data[idx].y = vt->fy;
vbo_data[idx].u = vt->fx/64.f;
vbo_data[idx].v = -vt->fy/64.f;
vbo_data[idx].z = float( h==0?
sec->ceilingplane.ZatPoint(vt->fx, vt->fy) :
sec->floorplane.ZatPoint(vt->fx, vt->fy));
// Next are all sectors using this one as heightsec
TArray<sector_t *> &fakes = sec->e->FakeFloor.Sectors;
for (unsigned g=0; g<fakes.Size(); g++)
{
sector_t *fsec = fakes[g];
fsec->vboindex[2+h] = vbo_data.Size(); // set the index info in the attached sector
for(int j=0; j<fsec->subsectorcount; j++)
{
subsector_t *sub = fsec->subsectors[j];
int idx = vbo_data.Reserve(sub->numlines);
for(int k=0; k<sub->numlines; k++, idx++)
{
SetVertex(idx, segs[sub->firstline+k].v1, sec->GetSecPlane(h));
}
}
}
// and finally all attached 3D floors
TArray<sector_t *> &xf = sec->e->XFloor.attached;
for (unsigned g=0; g<xf.Size(); g++)
{
sector_t *fsec = xf[g];
F3DFloor *ffloor = Find3DFloor(fsec, sec);
if (ffloor != NULL && ffloor->flags & FF_RENDERPLANES)
{
bool dotop = (ffloor->top.model == sec) && (ffloor->top.isceiling == h);
bool dobottom = (ffloor->bottom.model == sec) && (ffloor->bottom.isceiling == h);
if (dotop || dobottom)
{
if (dotop) ffloor->top.vindex = vbo_data.Size();
if (dobottom) ffloor->bottom.vindex = vbo_data.Size();
for(int j=0; j<fsec->subsectorcount; j++)
{
subsector_t *sub = fsec->subsectors[j];
int idx = vbo_data.Reserve(sub->numlines);
for(int k=0; k<sub->numlines; k++, idx++)
{
SetVertex(idx, segs[sub->firstline+k].v1, sec->GetSecPlane(h));
}
}
}
}
}
sec->vbocount[h] = vbo_data.Size() - sec->vboindex[h];
}
}
// We need to do a final check for Vavoom water and FF_FIX sectors.
// No new vertices are needed here. The planes come from the actual sector
for(int i=0; i<numsectors;i++)
{
for(unsigned j=0;j<sectors[i].e->XFloor.ffloors.Size(); j++)
{
F3DFloor *ff = sectors[i].e->XFloor.ffloors[j];
if (ff->top.model == &sectors[i])
{
ff->top.vindex = sectors[i].vboindex[ff->top.isceiling];
}
if (ff->bottom.model == &sectors[i])
{
ff->bottom.vindex = sectors[i].vboindex[ff->top.isceiling];
}
}
}
if (gl_vbo <= 0) gl.GenBuffers(1, &gl_vbo);
gl.BindBuffer(GL_ARRAY_BUFFER, gl_vbo);
gl.BufferData(GL_ARRAY_BUFFER, vbo_data.Size() * sizeof(FVBOVertex), &vbo_data[0], GL_DYNAMIC_DRAW);

View file

@ -17,25 +17,16 @@ struct GLSectorPlane
fixed_t xscale, yscale;
angle_t angle;
void GetFromSector(sector_t * sec, bool ceiling)
void GetFromSector(sector_t * sec, int ceiling)
{
xoffs = sec->GetXOffset(ceiling);
yoffs = sec->GetYOffset(ceiling);
xscale = sec->GetXScale(ceiling);
yscale = sec->GetYScale(ceiling);
angle = sec->GetAngle(ceiling);
if (ceiling)
{
texture = sec->GetTexture(sector_t::ceiling);
plane = sec->ceilingplane;
texheight = plane.d;
}
else
{
texture = sec->GetTexture(sector_t::floor);
plane = sec->floorplane;
texheight = -plane.d;
}
texture = sec->GetTexture(ceiling);
plane = sec->GetSecPlane(ceiling);
texheight = (ceiling = sector_t::ceiling)? plane.d : -plane.d;
}
};

View file

@ -102,9 +102,9 @@ void gl_SetPlaneTextureRotation(const GLSectorPlane * secplane, FGLTexture * glt
void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
{
Plane p;
Vector nearPt, up, right;
Vector nearPt, up, right, t1;
float scale;
int k;
int k, v;
FLightNode * node = sub->lighthead[pass==GLPASS_LIGHT_ADDITIVE];
gl_DisableShader();
@ -137,17 +137,18 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
// Render the light
gl.Begin(GL_TRIANGLE_FAN);
for(k = 0; k < sub->numvertices; k++)
for(k = 0, v = sub->firstline; k < sub->numlines; k++, v++)
{
Vector t1;
GLVertex * vt = &gl_vertices[sub->firstvertex + k];
vertex_t *vt = segs[v].v1;
float zc = plane.plane.ZatPoint(vt->fx, vt->fy) + z;
float z = plane.plane.ZatPoint(vt->x, vt->y);
t1.Set(vt->x, z, vt->y);
t1.Set(vt->fx, zc, vt->fy);
Vector nearToVert = t1 - nearPt;
gl.TexCoord2f( (nearToVert.Dot(right) * scale) + 0.5f, (nearToVert.Dot(up) * scale) + 0.5f);
gl.Vertex3f(vt->x, z, vt->y);
gl.Vertex3f(vt->fx, zc, vt->fy);
}
gl.End();
node = node->nextLight;
}
@ -161,19 +162,18 @@ void GLFlat::DrawSubsectorLights(subsector_t * sub, int pass)
void GLFlat::DrawSubsector(subsector_t * sub)
{
int k;
int v;
gl.Begin(GL_TRIANGLE_FAN);
for(k = 0, v = sub->firstvertex; k < sub->numvertices; k++, v++)
for(int k=0; k<sub->numlines; k++)
{
gl.TexCoord2f(gl_vertices[v].u, gl_vertices[v].v);
float z = plane.plane.ZatPoint(gl_vertices[v].x, gl_vertices[v].y);
gl.Vertex3f(gl_vertices[v].x, z, gl_vertices[v].y);
vertex_t *vt = segs[sub->firstline+k].v1;
gl.TexCoord2f(vt->fx/64.f, -vt->fy/64.f);
float zc = plane.plane.ZatPoint(vt->fx, vt->fy);// + z;
gl.Vertex3f(vt->fx, zc, vt->fy);
}
gl.End();
flatvertices += sub->numvertices;
flatvertices += sub->numlines;
flatprimitives++;
}
@ -194,18 +194,21 @@ void GLFlat::DrawSubsectors(bool istrans)
}
else
{
if (gl_usevbo && (gl.flags&RFL_VBO) && !(renderflags&SSRF_RENDER3DPLANES) &&
sector->GetPlaneTexZ(this->ceiling? sector_t::ceiling:sector_t::floor) == sector->vboheight[!ceiling])
if (gl_usevbo && (gl.flags&RFL_VBO) && vboindex >= 0)
{
//gl.Color3f( 1.f,.5f,.5f);
int index = vboindex;
for (int i=0; i<sector->subsectorcount; i++)
{
subsector_t * sub = sector->subsectors[i];
// This is just a quick hack to make translucent 3D floors and portals work.
if (gl_drawinfo->ss_renderflags[sub-subsectors]&renderflags || istrans)
{
gl.DrawArrays(GL_TRIANGLE_FAN, sub->vboindex[!ceiling], sub->numlines);
gl.DrawArrays(GL_TRIANGLE_FAN, index, sub->numlines);
flatvertices += sub->numlines;
flatprimitives++;
}
index += sub->numlines;
}
}
else
@ -411,7 +414,7 @@ inline void GLFlat::PutFlat(bool fog)
//
//==========================================================================
void GLFlat::Process(sector_t * sector, bool whichplane, bool fog)
void GLFlat::Process(sector_t * sector, int whichplane, bool fog)
{
plane.GetFromSector(sector, whichplane);
@ -434,14 +437,42 @@ void GLFlat::Process(sector_t * sector, bool whichplane, bool fog)
}
// get height from vplane
z=TO_GL(plane.texheight);
if (!whichplane && sector->transdoor) z -= 1;
if (whichplane == sector_t::floor && sector->transdoor) z = -1;
else z = 0;
PutFlat(fog);
rendered_flats++;
}
//==========================================================================
//
// Sets 3D floor info. Common code for all 4 cases
//
//==========================================================================
void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
{
F3DFloor::planeref & plane = top? rover->top : rover->bottom;
// FF_FOG requires an inverted logic where to get the light from
lightlist_t *light = P_GetPlaneLight(sector, plane.plane, underside);
lightlevel = *light->p_lightlevel;
if (rover->flags & FF_FOG) Colormap.LightColor = (*light->p_extra_colormap)->Fade;
else Colormap.CopyLightColor(*light->p_extra_colormap);
alpha = rover->alpha/255.0f;
renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent;
if (plane.model->VBOHeightcheck(plane.isceiling))
{
vboindex = plane.vindex;
}
else
{
vboindex = -1;
}
}
//==========================================================================
//
// Process a sector's flats for rendering
@ -498,6 +529,14 @@ void GLFlat::ProcessSector(sector_t * frontsector, subsector_t * sub)
Colormap=frontsector->ColorMap;
stack = frontsector->FloorSkyBox && frontsector->FloorSkyBox->bAlways;
alpha= stack ? frontsector->FloorSkyBox->PlaneAlpha/65536.0f : 1.0f-frontsector->GetFloorReflect();
if (frontsector->VBOHeightcheck(sector_t::floor))
{
vboindex = frontsector->vboindex[sector_t::floor];
}
else
{
vboindex = -1;
}
ceiling=false;
renderflags=SSRF_RENDERFLOOR;
@ -537,6 +576,14 @@ void GLFlat::ProcessSector(sector_t * frontsector, subsector_t * sub)
Colormap=frontsector->ColorMap;
stack = frontsector->CeilingSkyBox && frontsector->CeilingSkyBox->bAlways;
alpha=stack ? frontsector->CeilingSkyBox->PlaneAlpha/65536.0f : 1.0f-frontsector->GetCeilingReflect();
if (frontsector->VBOHeightcheck(sector_t::ceiling))
{
vboindex = frontsector->vboindex[sector_t::ceiling];
}
else
{
vboindex = -1;
}
ceiling=true;
renderflags=SSRF_RENDERCEILING;
@ -596,17 +643,8 @@ void GLFlat::ProcessSector(sector_t * frontsector, subsector_t * sub)
{
if (TO_GL(viewz) <= rover->top.plane->ZatPoint(TO_GL(viewx), TO_GL(viewy)))
{
// FF_FOG requires an inverted logic where to get the light from
light=P_GetPlaneLight(sector, rover->top.plane,!!(rover->flags&FF_FOG));
lightlevel=*light->p_lightlevel;
if (rover->flags&FF_FOG) Colormap.LightColor = (*light->p_extra_colormap)->Fade;
else Colormap.CopyLightColor(*light->p_extra_colormap);
SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG));
Colormap.FadeColor=frontsector->ColorMap->Fade;
alpha=rover->alpha/255.0f;
renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent;
Process(rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
}
lastceilingheight=ff_top;
@ -619,16 +657,8 @@ void GLFlat::ProcessSector(sector_t * frontsector, subsector_t * sub)
{
if (TO_GL(viewz)<=rover->bottom.plane->ZatPoint(TO_GL(viewx), TO_GL(viewy)))
{
light=P_GetPlaneLight(sector, rover->bottom.plane,!(rover->flags&FF_FOG));
lightlevel=*light->p_lightlevel;
if (rover->flags&FF_FOG) Colormap.LightColor = (*light->p_extra_colormap)->Fade;
else Colormap.CopyLightColor(*light->p_extra_colormap);
SetFrom3DFloor(rover, false, !(rover->flags&FF_FOG));
Colormap.FadeColor=frontsector->ColorMap->Fade;
alpha=rover->alpha/255.0f;
renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent;
Process(rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
}
lastceilingheight=ff_bottom;
@ -653,24 +683,15 @@ void GLFlat::ProcessSector(sector_t * frontsector, subsector_t * sub)
{
if (TO_GL(viewz) >= rover->bottom.plane->ZatPoint(TO_GL(viewx), TO_GL(viewy)))
{
SetFrom3DFloor(rover, false, !(rover->flags&FF_FOG));
Colormap.FadeColor=frontsector->ColorMap->Fade;
if (rover->flags&FF_FIX)
{
lightlevel = rover->model->lightlevel;
Colormap = rover->model->ColorMap;
}
else
{
light=P_GetPlaneLight(sector, rover->bottom.plane,!(rover->flags&FF_FOG));
lightlevel=*light->p_lightlevel;
if (rover->flags&FF_FOG) Colormap.LightColor = (*light->p_extra_colormap)->Fade;
else Colormap.CopyLightColor(*light->p_extra_colormap);
Colormap.FadeColor=frontsector->ColorMap->Fade;
}
alpha=rover->alpha/255.0f;
renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent;
Process(rover->bottom.model, rover->bottom.isceiling, !!(rover->flags&FF_FOG));
}
lastfloorheight=ff_bottom;
@ -683,16 +704,8 @@ void GLFlat::ProcessSector(sector_t * frontsector, subsector_t * sub)
{
if (TO_GL(viewz) >= rover->top.plane->ZatPoint(TO_GL(viewx), TO_GL(viewy)))
{
light=P_GetPlaneLight(sector, rover->top.plane,!!(rover->flags&FF_FOG));
lightlevel=*light->p_lightlevel;
if (rover->flags&FF_FOG) Colormap.LightColor = (*light->p_extra_colormap)->Fade;
else Colormap.CopyLightColor(*light->p_extra_colormap);
SetFrom3DFloor(rover, true, !!(rover->flags&FF_FOG));
Colormap.FadeColor=frontsector->ColorMap->Fade;
alpha=rover->alpha/255.0f;
renderstyle = rover->flags&FF_ADDITIVETRANS? STYLE_Add : STYLE_Translucent;
Process(rover->top.model, rover->top.isceiling, !!(rover->flags&FF_FOG));
}
lastfloorheight=ff_top;

View file

@ -232,39 +232,8 @@ unsigned char *GL1Renderer::GetTextureBuffer(FTexture *tex, int &w, int &h)
//
//===========================================================================
TArray<GLVertex> gl_vertices(1024);
void GL1Renderer::SetupLevel()
{
int i,j;
gl_vertices.Resize(100);
gl_vertices.Clear();
// Create the flat vertex array
for (i=0; i<numsubsectors; i++)
{
subsector_t * ssector = &subsectors[i];
if (ssector->numlines<=2) continue;
ssector->numvertices = ssector->numlines;
ssector->firstvertex = gl_vertices.Size();
for(j = 0; j < (int)ssector->numlines; j++)
{
seg_t * seg = &segs[ssector->firstline + j];
vertex_t * vtx = seg->v1;
GLVertex * vt=&gl_vertices[gl_vertices.Reserve(1)];
vt->u = vtx->fx/64.0f;
vt->v = -vtx->fy/64.0f;
vt->x = vtx->fx;
vt->y = vtx->fy;
vt->z = 0.0f;
vt->vt = vtx;
}
}
mAngles.Pitch = 0.0f;
}

View file

@ -111,13 +111,16 @@ public:
bool foggy;
bool ceiling;
BYTE renderflags;
int vboindex;
int vboheight;
void DrawSubsector(subsector_t * sub);
void DrawSubsectorLights(subsector_t * sub, int pass);
void DrawSubsectors(bool istrans);
void PutFlat(bool fog = false);
void Process(sector_t * sector, bool whichplane, bool notexture);
void Process(sector_t * sector, int whichplane, bool notexture);
void SetFrom3DFloor(F3DFloor *rover, bool top, bool underside);
void ProcessSector(sector_t * frontsector, subsector_t * sub);
void Draw(int pass);
};

View file

@ -74,14 +74,14 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
ffloor->bottom.plane = &sec2->floorplane;
ffloor->bottom.texture = &sec2->planes[sector_t::floor].Texture;
ffloor->bottom.texheight = &sec2->planes[sector_t::floor].TexZ;
ffloor->bottom.isceiling = false;
ffloor->bottom.isceiling = sector_t::floor;
}
else
{
ffloor->bottom.plane = &sec2->ceilingplane;
ffloor->bottom.texture = &sec2->planes[sector_t::ceiling].Texture;
ffloor->bottom.texheight = &sec2->planes[sector_t::ceiling].TexZ;
ffloor->bottom.isceiling = true;
ffloor->bottom.isceiling = sector_t::ceiling;
}
if (!(flags&FF_FIX))
@ -90,7 +90,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
ffloor->top.texture = &sec2->planes[sector_t::ceiling].Texture;
ffloor->top.texheight = &sec2->planes[sector_t::ceiling].TexZ;
ffloor->toplightlevel = &sec2->lightlevel;
ffloor->top.isceiling = true;
ffloor->top.isceiling = sector_t::ceiling;
}
else // FF_FIX is a special case to patch rendering holes
{
@ -98,7 +98,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
ffloor->top.texture = &sec2->planes[sector_t::floor].Texture;
ffloor->top.texheight = &sec2->planes[sector_t::floor].TexZ;
ffloor->toplightlevel = &sec->lightlevel;
ffloor->top.isceiling = false;
ffloor->top.isceiling = sector_t::floor;
ffloor->top.model = sec;
}
@ -117,12 +117,14 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
// fortunately this plane won't be rendered - otherwise this wouldn't work...
ffloor->bottom.plane=&sec->floorplane;
ffloor->bottom.model=sec;
ffloor->bottom.isceiling = sector_t::floor;
}
}
ffloor->flags = flags;
ffloor->master = master;
ffloor->alpha = transluc;
ffloor->top.vindex = ffloor->bottom.vindex = -1;
// The engine cannot handle sloped translucent floors. Sorry
if (ffloor->top.plane->a || ffloor->top.plane->b || ffloor->bottom.plane->a || ffloor->bottom.plane->b)

View file

@ -69,7 +69,8 @@ struct F3DFloor
const FTextureID * texture;
const fixed_t * texheight;
sector_t * model;
bool isceiling;
int isceiling;
int vindex;
};
planeref bottom;

View file

@ -645,6 +645,11 @@ struct sector_t
return lightlevel;
}
secplane_t &GetSecPlane(int pos)
{
return pos == floor? floorplane:ceilingplane;
}
// Member variables
fixed_t CenterFloor () const { return floorplane.ZatPoint (soundorg[0], soundorg[1]); }
@ -746,10 +751,20 @@ struct sector_t
fixed_t transdoorheight; // for transparent door hacks
int subsectorcount; // list of subsectors
subsector_t ** subsectors;
fixed_t vboheight[2];
enum
{
vbo_fakefloor = floor+2,
vbo_fakeceiling = ceiling+2,
};
int vboindex[4]; // VBO indices of the 4 planes this sector uses during rendering
fixed_t vboheight[2]; // Last calculated height for the 2 planes of this actual sector
int vbocount[2]; // Total count of vertices belonging to this sector's planes
float GetFloorReflect() { return gl_plane_reflection_i? floor_reflect : 0; }
float GetCeilingReflect() { return gl_plane_reflection_i? ceiling_reflect : 0; }
bool VBOHeightcheck(int pos) const { return vboheight[pos] == GetPlaneTexZ(pos); }
enum
{
@ -1009,14 +1024,11 @@ struct subsector_t
FGLSection * section; // section this subsector belongs to
FLightNode * lighthead[2]; // Light nodes (blended and additive)
sector_t * render_sector; // The sector this belongs to for rendering
int firstvertex; // index into the gl_vertices array
int numvertices;
int validcount2; // Second v
fixed_t bbox[4]; // Bounding box
bool degenerate;
char hacked; // 1: is part of a render hack
// 2: has one-sided walls
int vboindex[2];
};
//