mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- r_viewpoint reduction in hwrenderer
This commit is contained in:
parent
548ccb1df4
commit
22b8d0a8d7
3 changed files with 7 additions and 6 deletions
|
@ -353,6 +353,7 @@ void HWDrawInfo::RenderThings(subsector_t * sub, sector_t * sector)
|
||||||
SetupSprite.Clock();
|
SetupSprite.Clock();
|
||||||
sector_t * sec=sub->sector;
|
sector_t * sec=sub->sector;
|
||||||
// Handle all things in sector.
|
// Handle all things in sector.
|
||||||
|
auto &vp = r_viewpoint;
|
||||||
for (auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext)
|
for (auto p = sec->touching_renderthings; p != nullptr; p = p->m_snext)
|
||||||
{
|
{
|
||||||
auto thing = p->m_thing;
|
auto thing = p->m_thing;
|
||||||
|
@ -362,7 +363,7 @@ void HWDrawInfo::RenderThings(subsector_t * sub, sector_t * sector)
|
||||||
FIntCVar *cvar = thing->GetInfo()->distancecheck;
|
FIntCVar *cvar = thing->GetInfo()->distancecheck;
|
||||||
if (cvar != nullptr && *cvar >= 0)
|
if (cvar != nullptr && *cvar >= 0)
|
||||||
{
|
{
|
||||||
double dist = (thing->Pos() - r_viewpoint.Pos).LengthSquared();
|
double dist = (thing->Pos() - vp.Pos).LengthSquared();
|
||||||
double check = (double)**cvar;
|
double check = (double)**cvar;
|
||||||
if (dist >= check * check)
|
if (dist >= check * check)
|
||||||
{
|
{
|
||||||
|
@ -383,7 +384,7 @@ void HWDrawInfo::RenderThings(subsector_t * sub, sector_t * sector)
|
||||||
FIntCVar *cvar = thing->GetInfo()->distancecheck;
|
FIntCVar *cvar = thing->GetInfo()->distancecheck;
|
||||||
if (cvar != nullptr && *cvar >= 0)
|
if (cvar != nullptr && *cvar >= 0)
|
||||||
{
|
{
|
||||||
double dist = (thing->Pos() - r_viewpoint.Pos).LengthSquared();
|
double dist = (thing->Pos() - vp.Pos).LengthSquared();
|
||||||
double check = (double)**cvar;
|
double check = (double)**cvar;
|
||||||
if (dist >= check * check)
|
if (dist >= check * check)
|
||||||
{
|
{
|
||||||
|
|
|
@ -383,7 +383,7 @@ public:
|
||||||
|
|
||||||
void SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
void SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
||||||
void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight);
|
void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight);
|
||||||
bool CalculateVertices(HWDrawInfo *di, FVector3 *v);
|
bool CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ EXTERN_CVAR(Float, transsouls)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool GLSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v)
|
bool GLSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp)
|
||||||
{
|
{
|
||||||
if (actor != nullptr && (actor->renderflags & RF_SPRITETYPEMASK) == RF_FLATSPRITE)
|
if (actor != nullptr && (actor->renderflags & RF_SPRITETYPEMASK) == RF_FLATSPRITE)
|
||||||
{
|
{
|
||||||
|
@ -146,8 +146,8 @@ bool GLSprite::CalculateVertices(HWDrawInfo *di, FVector3 *v)
|
||||||
{
|
{
|
||||||
// [CMB] Rotate relative to camera XY position, not just camera direction,
|
// [CMB] Rotate relative to camera XY position, not just camera direction,
|
||||||
// which is nicer in VR
|
// which is nicer in VR
|
||||||
float xrel = xcenter - r_viewpoint.Pos.X;
|
float xrel = xcenter - vp->X;
|
||||||
float yrel = ycenter - r_viewpoint.Pos.Y;
|
float yrel = ycenter - vp->Y;
|
||||||
float absAngleDeg = RAD2DEG(atan2(-yrel, xrel));
|
float absAngleDeg = RAD2DEG(atan2(-yrel, xrel));
|
||||||
float counterRotationDeg = 270. - di->mAngles.Yaw.Degrees; // counteracts existing sprite rotation
|
float counterRotationDeg = 270. - di->mAngles.Yaw.Degrees; // counteracts existing sprite rotation
|
||||||
float relAngleDeg = counterRotationDeg + absAngleDeg;
|
float relAngleDeg = counterRotationDeg + absAngleDeg;
|
||||||
|
|
Loading…
Reference in a new issue