mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
- Backend update from Raze
This commit is contained in:
parent
08f66585b7
commit
b225a910a0
4 changed files with 59 additions and 17 deletions
|
@ -55,6 +55,7 @@ protected:
|
|||
{
|
||||
NOSOUNDCUTOFF = 1,
|
||||
FIXEDVIEWPORT = 2, // Forces fixed 640x480 screen size like for Blood's intros.
|
||||
NOMUSICCUTOFF = 4,
|
||||
};
|
||||
|
||||
int flags;
|
||||
|
|
|
@ -67,6 +67,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
{
|
||||
|
||||
int filter = sysCallbacks.DisableTextureFilter && sysCallbacks.DisableTextureFilter() ? 0 : gl_texture_filter;
|
||||
bool anisoAvailable = gles.anistropicFilterAvailable && (!sysCallbacks.DisableTextureFilter || !sysCallbacks.DisableTextureFilter());
|
||||
|
||||
glActiveTexture(GL_TEXTURE0 + texunit);
|
||||
switch (num)
|
||||
|
@ -78,7 +79,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
|
||||
}
|
||||
break;
|
||||
|
@ -90,7 +91,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
|
||||
}
|
||||
break;
|
||||
|
@ -102,7 +103,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
|
||||
}
|
||||
break;
|
||||
|
@ -114,7 +115,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].minfilter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_filter_anisotropic);
|
||||
}
|
||||
break;
|
||||
|
@ -124,7 +125,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
||||
break;
|
||||
|
||||
|
@ -133,7 +134,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
||||
break;
|
||||
|
||||
|
@ -142,7 +143,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
||||
break;
|
||||
|
||||
|
@ -151,7 +152,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
||||
break;
|
||||
|
||||
|
@ -160,7 +161,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
||||
break;
|
||||
|
||||
|
@ -169,7 +170,7 @@ uint8_t FSamplerManager::Bind(int texunit, int num, int lastval)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, TexFilter[filter].magfilter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, TexFilter[filter].magfilter);
|
||||
if (gles.anistropicFilterAvailable)
|
||||
if (anisoAvailable)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -91,16 +91,27 @@ inline double DEG2RAD(double deg)
|
|||
return deg * (M_PI / 180.0);
|
||||
}
|
||||
|
||||
inline float RAD2DEG(float deg)
|
||||
inline float RAD2DEG(float rad)
|
||||
{
|
||||
return deg * float(180. / M_PI);
|
||||
return rad * float(180. / M_PI);
|
||||
}
|
||||
|
||||
inline double RAD2DEG(double deg)
|
||||
inline double RAD2DEG(double rad)
|
||||
{
|
||||
return deg * (180. / M_PI);
|
||||
return rad * (180. / M_PI);
|
||||
}
|
||||
|
||||
inline angle_t RAD2BAM(float rad)
|
||||
{
|
||||
return angle_t(rad * float(0x80000000u / M_PI));
|
||||
}
|
||||
|
||||
inline angle_t RAD2BAM(double rad)
|
||||
{
|
||||
return angle_t(rad * (0x80000000u / M_PI));
|
||||
}
|
||||
|
||||
|
||||
// This is needed in common code, despite being Doom specific.
|
||||
enum EStateUseFlags
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <string.h>
|
||||
#include "xs_Float.h"
|
||||
#include "math/cmath.h"
|
||||
#include "basics.h"
|
||||
|
||||
|
||||
#define EQUAL_EPSILON (1/65536.)
|
||||
|
@ -307,6 +308,8 @@ template<class vec_t>
|
|||
struct TVector3
|
||||
{
|
||||
typedef TVector2<vec_t> Vector2;
|
||||
// this does not compile - should be true on all relevant hardware.
|
||||
//static_assert(myoffsetof(TVector3, X) == myoffsetof(Vector2, X) && myoffsetof(TVector3, Y) == myoffsetof(Vector2, Y), "TVector2 and TVector3 are not aligned");
|
||||
|
||||
vec_t X, Y, Z;
|
||||
|
||||
|
@ -343,7 +346,7 @@ struct TVector3
|
|||
return X == 0 && Y == 0 && Z == 0;
|
||||
}
|
||||
|
||||
TVector3 plusZ(double z)
|
||||
TVector3 plusZ(double z) const
|
||||
{
|
||||
return { X, Y, Z + z };
|
||||
}
|
||||
|
@ -491,9 +494,14 @@ struct TVector3
|
|||
}
|
||||
|
||||
// returns the XY fields as a 2D-vector.
|
||||
Vector2 XY() const
|
||||
const Vector2& XY() const
|
||||
{
|
||||
return{ X, Y };
|
||||
return *reinterpret_cast<const Vector2*>(this);
|
||||
}
|
||||
|
||||
Vector2& XY()
|
||||
{
|
||||
return *reinterpret_cast<Vector2*>(this);
|
||||
}
|
||||
|
||||
// Add a 3D vector and a 2D vector.
|
||||
|
@ -1212,6 +1220,11 @@ public:
|
|||
return TAngle(bang * (90. / 512));
|
||||
}
|
||||
|
||||
static constexpr TAngle fromBuildf(double bang)
|
||||
{
|
||||
return TAngle(bang * (90. / 512));
|
||||
}
|
||||
|
||||
static constexpr TAngle fromQ16(int bang)
|
||||
{
|
||||
return TAngle(bang * (90. / 16384));
|
||||
|
@ -1334,6 +1347,11 @@ public:
|
|||
return int(Degrees_ * (512 / 90.0));
|
||||
}
|
||||
|
||||
constexpr double Buildfang() const
|
||||
{
|
||||
return Degrees_ * (512 / 90.0);
|
||||
}
|
||||
|
||||
constexpr int Q16() const
|
||||
{
|
||||
return int(Degrees_ * (16384 / 90.0));
|
||||
|
@ -1364,6 +1382,12 @@ public:
|
|||
{
|
||||
return clamp(Tan(), -max, max);
|
||||
}
|
||||
|
||||
int Sgn() const
|
||||
{
|
||||
const auto normalized = (signed int)BAMs();
|
||||
return (normalized > 0) - (normalized < 0);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
@ -1611,6 +1635,11 @@ typedef TAngle<double> DAngle;
|
|||
constexpr DAngle nullAngle = DAngle::fromDeg(0.);
|
||||
constexpr FAngle nullFAngle = FAngle::fromDeg(0.);
|
||||
|
||||
constexpr DAngle DAngle90 = DAngle::fromBam(ANGLE_90);
|
||||
constexpr DAngle DAngle180 = DAngle::fromBam(ANGLE_180);
|
||||
constexpr DAngle DAngle270 = DAngle::fromBam(ANGLE_270);
|
||||
constexpr DAngle DAngle360 = DAngle::fromBam(ANGLE_MAX);
|
||||
|
||||
class Plane
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue