mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
- moved ViewActor variable into FRenderViewpoint.
This commit is contained in:
parent
87dfa34f1f
commit
eddb179e36
6 changed files with 20 additions and 25 deletions
|
@ -93,7 +93,6 @@ public:
|
|||
int mMirrorCount;
|
||||
int mPlaneMirrorCount;
|
||||
float mCurrentFoV;
|
||||
AActor *mViewActor;
|
||||
FShaderManager *mShaderManager;
|
||||
FSamplerManager *mSamplerManager;
|
||||
unsigned int mFBID;
|
||||
|
|
|
@ -267,14 +267,13 @@ bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo **pDi)
|
|||
|
||||
// save viewpoint
|
||||
savedviewpoint = r_viewpoint;
|
||||
savedviewactor=GLRenderer->mViewActor;
|
||||
savedvisibility = r_viewpoint.camera ? r_viewpoint.camera->renderflags & RF_MAYBEINVISIBLE : ActorRenderFlags::FromInt(0);
|
||||
|
||||
|
||||
PrevPortal = GLRenderer->mCurrentPortal;
|
||||
GLRenderer->mCurrentPortal = this;
|
||||
|
||||
if (PrevPortal != NULL) PrevPortal->PushState();
|
||||
if (PrevPortal != nullptr) PrevPortal->PushState();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -317,7 +316,7 @@ void GLPortal::End(bool usestencil)
|
|||
bool needdepth = NeedDepthBuffer();
|
||||
|
||||
Clocker c(PortalAll);
|
||||
if (PrevPortal != NULL) PrevPortal->PopState();
|
||||
if (PrevPortal != nullptr) PrevPortal->PopState();
|
||||
GLRenderer->mCurrentPortal = PrevPortal;
|
||||
|
||||
if (usestencil)
|
||||
|
@ -326,7 +325,6 @@ void GLPortal::End(bool usestencil)
|
|||
|
||||
// Restore the old view
|
||||
r_viewpoint = savedviewpoint;
|
||||
GLRenderer->mViewActor=savedviewactor;
|
||||
if (r_viewpoint.camera != nullptr) r_viewpoint.camera->renderflags = (r_viewpoint.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
|
||||
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
|
||||
|
||||
|
@ -381,7 +379,6 @@ void GLPortal::End(bool usestencil)
|
|||
}
|
||||
// Restore the old view
|
||||
r_viewpoint = savedviewpoint;
|
||||
GLRenderer->mViewActor=savedviewactor;
|
||||
if (r_viewpoint.camera != nullptr) r_viewpoint.camera->renderflags |= savedvisibility;
|
||||
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||
|
||||
|
@ -458,7 +455,7 @@ void GLPortal::EndFrame()
|
|||
|
||||
// Only use occlusion query if there are more than 2 portals.
|
||||
// Otherwise there's too much overhead.
|
||||
// (And don't forget to consider the separating NULL pointers!)
|
||||
// (And don't forget to consider the separating nullptr pointers!)
|
||||
bool usequery = portals.Size() > 2 + (unsigned)renderdepth;
|
||||
|
||||
while (portals.Pop(p) && p)
|
||||
|
@ -494,13 +491,13 @@ void GLPortal::EndFrame()
|
|||
bool GLPortal::RenderFirstSkyPortal(int recursion)
|
||||
{
|
||||
GLPortal * p;
|
||||
GLPortal * best = NULL;
|
||||
GLPortal * best = nullptr;
|
||||
unsigned bestindex=0;
|
||||
|
||||
// Find the one with the highest amount of lines.
|
||||
// Normally this is also the one that saves the largest amount
|
||||
// of time by drawing it before the scene itself.
|
||||
for(int i = portals.Size()-1; i >= 0 && portals[i] != NULL; --i)
|
||||
for(int i = portals.Size()-1; i >= 0 && portals[i] != nullptr; --i)
|
||||
{
|
||||
p=portals[i];
|
||||
if (p->lines.Size() > 0 && p->IsSky())
|
||||
|
@ -538,7 +535,7 @@ GLPortal * GLPortal::FindPortal(const void * src)
|
|||
int i=portals.Size()-1;
|
||||
|
||||
while (i>=0 && portals[i] && portals[i]->GetSource()!=src) i--;
|
||||
return i>=0? portals[i]:NULL;
|
||||
return i>=0? portals[i]:nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -587,7 +584,7 @@ void GLSkyboxPortal::DrawContents(FDrawInfo *di)
|
|||
if (r_viewpoint.Pos.Z < floorh + 4) r_viewpoint.Pos.Z = floorh + 4;
|
||||
if (r_viewpoint.Pos.Z > ceilh - 4) r_viewpoint.Pos.Z = ceilh - 4;
|
||||
|
||||
GLRenderer->mViewActor = origin;
|
||||
r_viewpoint.ViewActor = origin;
|
||||
|
||||
inskybox = true;
|
||||
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
|
||||
|
@ -625,7 +622,7 @@ void GLSkyboxPortal::DrawContents(FDrawInfo *di)
|
|||
|
||||
GLSectorStackPortal *FSectorPortalGroup::GetRenderState()
|
||||
{
|
||||
if (glportal == NULL) glportal = new GLSectorStackPortal(this);
|
||||
if (glportal == nullptr) glportal = new GLSectorStackPortal(this);
|
||||
return glportal;
|
||||
}
|
||||
|
||||
|
@ -633,9 +630,9 @@ GLSectorStackPortal *FSectorPortalGroup::GetRenderState()
|
|||
|
||||
GLSectorStackPortal::~GLSectorStackPortal()
|
||||
{
|
||||
if (origin != NULL && origin->glportal == this)
|
||||
if (origin != nullptr && origin->glportal == this)
|
||||
{
|
||||
origin->glportal = NULL;
|
||||
origin->glportal = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,7 +689,7 @@ void GLSectorStackPortal::DrawContents(FDrawInfo *di)
|
|||
|
||||
r_viewpoint.Pos += origin->mDisplacement;
|
||||
r_viewpoint.ActorPos += origin->mDisplacement;
|
||||
GLRenderer->mViewActor = NULL;
|
||||
r_viewpoint.ViewActor = nullptr;
|
||||
|
||||
// avoid recursions!
|
||||
if (origin->plane != -1) screen->instack[origin->plane]++;
|
||||
|
@ -748,7 +745,7 @@ void GLPlaneMirrorPortal::DrawContents(FDrawInfo *di)
|
|||
|
||||
double planez = origin->ZatPoint(r_viewpoint.Pos);
|
||||
r_viewpoint.Pos.Z = 2 * planez - r_viewpoint.Pos.Z;
|
||||
GLRenderer->mViewActor = NULL;
|
||||
r_viewpoint.ViewActor = nullptr;
|
||||
PlaneMirrorMode = origin->fC() < 0 ? -1 : 1;
|
||||
|
||||
PlaneMirrorFlag++;
|
||||
|
@ -919,7 +916,7 @@ void GLMirrorPortal::DrawContents(FDrawInfo *di)
|
|||
}
|
||||
r_viewpoint.Angles.Yaw = linedef->Delta().Angle() * 2. - StartAngle;
|
||||
|
||||
GLRenderer->mViewActor = NULL;
|
||||
r_viewpoint.ViewActor = nullptr;
|
||||
|
||||
MirrorFlag++;
|
||||
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||
|
@ -998,7 +995,7 @@ void GLLineToLinePortal::DrawContents(FDrawInfo *di)
|
|||
di->CurrentMapSections.Set(sub->mapsection);
|
||||
}
|
||||
|
||||
GLRenderer->mViewActor = nullptr;
|
||||
r_viewpoint.ViewActor = nullptr;
|
||||
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||
|
||||
ClearClipper(di);
|
||||
|
|
|
@ -236,7 +236,6 @@ void GLSceneDrawer::CreateScene(FDrawInfo *di)
|
|||
validcount++; // used for processing sidedefs only once by the renderer.
|
||||
|
||||
di->mAngles = GLRenderer->mAngles;
|
||||
di->mViewActor = GLRenderer->mViewActor;
|
||||
di->mShadowMap = &GLRenderer->mShadowMap;
|
||||
|
||||
di->RenderBSPNode (level.HeadNode());
|
||||
|
@ -633,14 +632,14 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, IntRect * bounds, fl
|
|||
GLRenderer->mAngles.Pitch = (float)RAD2DEG(asin(angy / alen));
|
||||
GLRenderer->mAngles.Roll.Degrees = r_viewpoint.Angles.Roll.Degrees;
|
||||
|
||||
if (camera->player && camera->player-players==consoleplayer &&
|
||||
((camera->player->cheats & CF_CHASECAM) || (r_deathcamera && camera->health <= 0)) && camera==camera->player->mo)
|
||||
if (camera->player && camera->player - players == consoleplayer &&
|
||||
((camera->player->cheats & CF_CHASECAM) || (r_deathcamera && camera->health <= 0)) && camera == camera->player->mo)
|
||||
{
|
||||
GLRenderer->mViewActor=NULL;
|
||||
r_viewpoint.ViewActor = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
GLRenderer->mViewActor=camera;
|
||||
r_viewpoint.ViewActor = camera;
|
||||
}
|
||||
|
||||
// 'viewsector' will not survive the rendering so it cannot be used anymore below.
|
||||
|
|
|
@ -84,7 +84,6 @@ struct HWDrawInfo
|
|||
std::atomic<int> spriteindex;
|
||||
IPortal *mClipPortal;
|
||||
FRotator mAngles;
|
||||
AActor *mViewActor;
|
||||
IShadowMap *mShadowMap;
|
||||
Clipper *mClipper;
|
||||
|
||||
|
|
|
@ -461,7 +461,7 @@ void GLSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
// don't draw first frame of a player missile
|
||||
if (thing->flags&MF_MISSILE)
|
||||
{
|
||||
if (!(thing->flags7 & MF7_FLYCHEAT) && thing->target == di->mViewActor && di->mViewActor != nullptr)
|
||||
if (!(thing->flags7 & MF7_FLYCHEAT) && thing->target == vp.ViewActor && vp.ViewActor != nullptr)
|
||||
{
|
||||
double speed = thing->Vel.Length();
|
||||
if (speed >= thing->target->radius / 2)
|
||||
|
|
|
@ -22,6 +22,7 @@ struct FRenderViewpoint
|
|||
DVector3 ActorPos; // Camera actor's position
|
||||
DRotator Angles; // Camera angles
|
||||
DVector2 ViewVector; // HWR only: direction the camera is facing.
|
||||
AActor *ViewActor; // either the same as camera or nullptr
|
||||
|
||||
DVector3 Path[2]; // View path for portal calculations
|
||||
double Cos; // cos(Angles.Yaw)
|
||||
|
|
Loading…
Reference in a new issue