mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 13:41:05 +00:00
- removed gl dependencies from gl_sky.cpp by moving some data into other places.
This commit is contained in:
parent
59477362d9
commit
cc926dec1e
9 changed files with 21 additions and 24 deletions
|
@ -155,8 +155,6 @@ public:
|
|||
FTextureID glPart;
|
||||
FTextureID mirrorTexture;
|
||||
|
||||
float mSky1Pos, mSky2Pos;
|
||||
|
||||
FRotator mAngles;
|
||||
FVector2 mViewVector;
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ int GLPortal::renderdepth;
|
|||
int GLPortal::PlaneMirrorMode;
|
||||
GLuint GLPortal::QueryObject;
|
||||
|
||||
int GLPortal::instack[2];
|
||||
bool GLPortal::inskybox;
|
||||
|
||||
UniqueList<GLSkyInfo> UniqueSkies;
|
||||
|
@ -442,7 +441,7 @@ void GLPortal::StartFrame()
|
|||
if (renderdepth==0)
|
||||
{
|
||||
inskybox=false;
|
||||
instack[sector_t::floor]=instack[sector_t::ceiling]=0;
|
||||
screen->instack[sector_t::floor] = screen->instack[sector_t::ceiling] = 0;
|
||||
}
|
||||
renderdepth++;
|
||||
}
|
||||
|
@ -743,7 +742,7 @@ void GLSectorStackPortal::DrawContents()
|
|||
GLRenderer->mViewActor = NULL;
|
||||
|
||||
// avoid recursions!
|
||||
if (origin->plane != -1) instack[origin->plane]++;
|
||||
if (origin->plane != -1) screen->instack[origin->plane]++;
|
||||
|
||||
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||
SaveMapSection();
|
||||
|
@ -762,7 +761,7 @@ void GLSectorStackPortal::DrawContents()
|
|||
drawer->DrawScene(DM_PORTAL);
|
||||
RestoreMapSection();
|
||||
|
||||
if (origin->plane != -1) instack[origin->plane]--;
|
||||
if (origin->plane != -1) screen->instack[origin->plane]--;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -789,7 +788,7 @@ void GLPlaneMirrorPortal::DrawContents()
|
|||
return;
|
||||
}
|
||||
// A plane mirror needs to flip the portal exclusion logic because inside the mirror, up is down and down is up.
|
||||
std::swap(instack[sector_t::floor], instack[sector_t::ceiling]);
|
||||
std::swap(screen->instack[sector_t::floor], screen->instack[sector_t::ceiling]);
|
||||
|
||||
int old_pm = PlaneMirrorMode;
|
||||
|
||||
|
@ -810,7 +809,7 @@ void GLPlaneMirrorPortal::DrawContents()
|
|||
gl_RenderState.SetClipHeight(0.f, 0.f);
|
||||
PlaneMirrorFlag--;
|
||||
PlaneMirrorMode = old_pm;
|
||||
std::swap(instack[sector_t::floor], instack[sector_t::ceiling]);
|
||||
std::swap(screen->instack[sector_t::floor], screen->instack[sector_t::ceiling]);
|
||||
}
|
||||
|
||||
void GLPlaneMirrorPortal::PushState()
|
||||
|
|
|
@ -64,7 +64,6 @@ public:
|
|||
static GLSceneDrawer *drawer;
|
||||
static int PlaneMirrorMode;
|
||||
static int inupperstack;
|
||||
static int instack[2];
|
||||
static bool inskybox;
|
||||
|
||||
private:
|
||||
|
|
|
@ -672,12 +672,6 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, f
|
|||
GLRenderer->mAngles.Pitch = (float)RAD2DEG(asin(angy / alen));
|
||||
GLRenderer->mAngles.Roll.Degrees = r_viewpoint.Angles.Roll.Degrees;
|
||||
|
||||
// Scroll the sky
|
||||
GLRenderer->mSky1Pos = (double)fmod((double)screen->FrameTime * (double)level.skyspeed1, 1024.f) * 90./256.;
|
||||
GLRenderer->mSky2Pos = (double)fmod((double)screen->FrameTime * (double)level.skyspeed2, 1024.f) * 90./256.;
|
||||
|
||||
|
||||
|
||||
if (camera->player && camera->player-players==consoleplayer &&
|
||||
((camera->player->cheats & CF_CHASECAM) || (r_deathcamera && camera->health <= 0)) && camera==camera->player->mo)
|
||||
{
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
#include "hwrenderer/utility/hw_lighting.h"
|
||||
#include "hwrenderer/textures/hw_material.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/scene/gl_portal.h"
|
||||
|
||||
CVAR(Bool,gl_noskyboxes, false, 0)
|
||||
|
||||
//==========================================================================
|
||||
|
@ -76,7 +73,7 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
|
|||
if (level.flags&LEVEL_DOUBLESKY)
|
||||
{
|
||||
texture[1] = FMaterial::ValidateTexture(sky1texture, false, true);
|
||||
x_offset[1] = GLRenderer->mSky1Pos;
|
||||
x_offset[1] = hw_sky1pos;
|
||||
doublesky = true;
|
||||
}
|
||||
|
||||
|
@ -86,13 +83,13 @@ void GLSkyInfo::init(int sky1, PalEntry FadeColor)
|
|||
texture[0] = FMaterial::ValidateTexture(sky2texture, false, true);
|
||||
skytexno1 = sky2texture;
|
||||
sky2 = true;
|
||||
x_offset[0] = GLRenderer->mSky2Pos;
|
||||
x_offset[0] = hw_sky2pos;
|
||||
}
|
||||
else if (!doublesky)
|
||||
{
|
||||
texture[0] = FMaterial::ValidateTexture(sky1texture, false, true);
|
||||
skytexno1 = sky1texture;
|
||||
x_offset[0] = GLRenderer->mSky1Pos;
|
||||
x_offset[0] = hw_sky1pos;
|
||||
}
|
||||
}
|
||||
if (level.skyfog > 0)
|
||||
|
@ -124,7 +121,8 @@ void GLWall::SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowref
|
|||
GLSkyInfo skyinfo;
|
||||
skyinfo.init(sector->sky, Colormap.FadeColor);
|
||||
ptype = PORTALTYPE_SKY;
|
||||
sky = UniqueSkies.Get(&skyinfo);
|
||||
sky = &skyinfo;
|
||||
PutPortal(di, ptype);
|
||||
}
|
||||
else if (sportal != nullptr)
|
||||
{
|
||||
|
@ -139,7 +137,7 @@ void GLWall::SkyPlane(HWDrawInfo *di, sector_t *sector, int plane, bool allowref
|
|||
{
|
||||
if (sector->PortalBlocksView(plane)) return;
|
||||
|
||||
if (GLPortal::instack[1 - plane]) return;
|
||||
if (screen->instack[1 - plane]) return;
|
||||
ptype = PORTALTYPE_SECTORSTACK;
|
||||
portal = glport;
|
||||
}
|
||||
|
@ -192,7 +190,7 @@ void GLWall::SkyLine(HWDrawInfo *di, sector_t *fs, line_t *line)
|
|||
{
|
||||
skyinfo.init(fs->sky, Colormap.FadeColor);
|
||||
ptype = PORTALTYPE_SKY;
|
||||
sky = UniqueSkies.Get(&skyinfo);
|
||||
sky = &skyinfo;
|
||||
}
|
||||
ztop[0] = zceil[0];
|
||||
ztop[1] = zceil[1];
|
||||
|
|
|
@ -463,6 +463,7 @@ void FDrawInfo::AddPortal(GLWall *wall, int ptype)
|
|||
break;
|
||||
|
||||
case PORTALTYPE_SKY:
|
||||
wall->sky = UniqueSkies.Get(wall->sky);
|
||||
portal = GLPortal::FindPortal(wall->sky);
|
||||
if (!portal) portal = new GLSkyPortal(wall->sky);
|
||||
portal->AddLine(wall);
|
||||
|
|
|
@ -51,6 +51,7 @@ bool skystretch;
|
|||
|
||||
fixed_t sky1cyl, sky2cyl;
|
||||
double sky1pos, sky2pos;
|
||||
float hw_sky1pos, hw_sky2pos;
|
||||
|
||||
CUSTOM_CVAR(Int, testskyoffset, 0, 0)
|
||||
{
|
||||
|
@ -170,5 +171,10 @@ void R_UpdateSky (uint64_t mstime)
|
|||
double ms = (double)mstime * FRACUNIT;
|
||||
sky1pos = ms * level.skyspeed1;
|
||||
sky2pos = ms * level.skyspeed2;
|
||||
|
||||
// The hardware renderer uses a different value range and clamps it to a single rotation
|
||||
hw_sky1pos = (float)(fmod((double(mstime) * level.skyspeed1), 1024.) * (90. / 256.));
|
||||
hw_sky2pos = (float)(fmod((double(mstime) * level.skyspeed2), 1024.) * (90. / 256.));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ extern FTextureID skyflatnum;
|
|||
extern fixed_t sky1cyl, sky2cyl;
|
||||
extern FTextureID sky1texture, sky2texture;
|
||||
extern double sky1pos, sky2pos;
|
||||
extern float hw_sky1pos, hw_sky2pos;
|
||||
extern double skytexturemid;
|
||||
extern float skyiscale;
|
||||
extern double skyscale;
|
||||
|
|
|
@ -327,6 +327,7 @@ protected:
|
|||
|
||||
public:
|
||||
int hwcaps = 0;
|
||||
int instack[2] = { 0,0 }; // this is globally maintained state for portal recursion avoidance.
|
||||
|
||||
public:
|
||||
DFrameBuffer (int width, int height, bool bgra);
|
||||
|
|
Loading…
Reference in a new issue