Merge remote-tracking branch 'origin/hardware_cull'

This commit is contained in:
Rachael Alexanderson 2018-06-02 05:23:19 -04:00
commit 4dec08cacb
7 changed files with 38 additions and 10 deletions

View file

@ -13,7 +13,7 @@ Please see license files for individual contributor licenses
Special thanks to Coraline of the 3DGE team for allowing us to use her README.md as a template for this one.
### Licensed under the GPL v3 (or greater)
### Licensed under the GPL v3
##### https://www.gnu.org/licenses/quick-guide-gplv3.en.html
---

View file

@ -249,10 +249,7 @@ void FFlatVertexBuffer::Unmap()
void FFlatVertexBuffer::CreateVBO()
{
vbo_shadowdata.Resize(mNumReserved);
if (!gl.legacyMode)
{
FFlatVertexGenerator::CreateVertices();
}
FFlatVertexGenerator::CreateVertices();
mCurIndex = mIndex = vbo_shadowdata.Size();
Map();
memcpy(map, &vbo_shadowdata[0], vbo_shadowdata.Size() * sizeof(FFlatVertex));

View file

@ -207,11 +207,15 @@ void FDrawInfo::ProcessLights(GLFlat *flat, bool istrans)
void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool istrans)
{
int dli = flat->dynlightindex;
auto vcount = flat->sector->ibocount;
gl_RenderState.Apply();
if (gl.legacyMode) processlights = false;
if (gl.legacyMode)
{
processlights = false;
goto legacy;
}
auto vcount = flat->sector->ibocount;
if (vcount > 0 && !gl_RenderState.GetClipLineShouldBeActive())
{
if (processlights) SetupSectorLights(flat, GLPASS_ALL, &dli);
@ -243,6 +247,7 @@ void FDrawInfo::DrawSubsectors(GLFlat *flat, int pass, bool processlights, bool
}
else
{
legacy:
// Draw the subsectors belonging to this sector
for (int i=0; i<flat->sector->subsectorcount; i++)
{

View file

@ -75,6 +75,21 @@ void HWDrawInfo::UnclipSubsector(subsector_t *sub)
//
//==========================================================================
CVAR(Float, gl_line_distance_cull, 0.0, 0 /*CVAR_ARCHIVE|CVAR_GLOBALCONFIG*/) // this is deactivated, for now
inline bool IsDistanceCulled(seg_t *line)
{
double dist3 = gl_line_distance_cull * gl_line_distance_cull;
if (dist3 <= 0.0)
return false;
double dist1 = (line->v1->fPos() - r_viewpoint.Pos).LengthSquared();
double dist2 = (line->v2->fPos() - r_viewpoint.Pos).LengthSquared();
if ((dist1 > dist3) && (dist2 > dist3))
return true;
return false;
}
void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
{
#ifdef _DEBUG
@ -123,6 +138,8 @@ void HWDrawInfo::AddLine (seg_t *seg, bool portalclip)
uint8_t ispoly = uint8_t(seg->sidedef->Flags & WALLF_POLYOBJ);
if (IsDistanceCulled(seg)) { clipper.SafeAddClipRange(startAngle, endAngle); return; }
if (!seg->backsector)
{
clipper.SafeAddClipRange(startAngle, endAngle);

View file

@ -1522,7 +1522,7 @@ void GLWall::Process(HWDrawInfo *di, seg_t *seg, sector_t * frontsector, sector_
}
v1 = seg->v1;
v2 = seg->v2;
flags |= GLWF_NOSPLITLOWER | GLWF_NOSPLITLOWER; // seg-splitting not needed for single segs.
flags |= GLWF_NOSPLITUPPER | GLWF_NOSPLITLOWER; // seg-splitting not needed for single segs.
}

View file

@ -94,8 +94,16 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s
if (smf->flags & MDL_ROTATING)
{
double turns = (I_GetTime() % 200 + I_GetTimeFrac()) / 200.0;
rotateOffset = turns * 360.0;
if (smf->rotationSpeed > 0.0000000001)
{
double turns = (I_GetTime() + I_GetTimeFrac()) / (200.0 / smf->rotationSpeed);
turns -= floor(turns);
rotateOffset = turns * 360.0;
}
else
{
rotateOffset = 0.0;
}
}
// Added MDL_USEACTORPITCH and MDL_USEACTORROLL flags processing.

View file

@ -1060,6 +1060,7 @@ FxExpression *FxFloatCast::Resolve(FCompileContext &ctx)
if (basex->IsFloat())
{
FxExpression *x = basex;
x->ValueType = ValueType;
basex = nullptr;
delete this;
return x;