mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- moved two MAPINFO settings that are not exclusively used by the OpenGL renderer to the common code.
This commit is contained in:
parent
e1cd034698
commit
d86bd470e5
12 changed files with 40 additions and 63 deletions
|
@ -239,6 +239,7 @@ enum ELevelFlags : unsigned int
|
|||
LEVEL3_FORCEFAKECONTRAST = 0x00000001, // forces fake contrast even with fog enabled
|
||||
LEVEL3_REMOVEITEMS = 0x00000002, // kills all INVBAR items on map change.
|
||||
LEVEL3_ATTENUATE = 0x00000004, // attenuate lights?
|
||||
LEVEL3_NOLIGHTFADE = 0x00000008, // no light fading to black.
|
||||
};
|
||||
|
||||
|
||||
|
@ -303,9 +304,9 @@ struct level_info_t
|
|||
int cluster;
|
||||
int partime;
|
||||
int sucktime;
|
||||
uint32_t flags;
|
||||
uint32_t flags2;
|
||||
uint32_t flags3;
|
||||
int32_t flags;
|
||||
uint32_t flags2;
|
||||
uint32_t flags3;
|
||||
|
||||
FString Music;
|
||||
FString LevelName;
|
||||
|
@ -315,26 +316,27 @@ struct level_info_t
|
|||
TArray<acsdefered_t> deferred;
|
||||
float skyspeed1;
|
||||
float skyspeed2;
|
||||
uint32_t fadeto;
|
||||
uint32_t outsidefog;
|
||||
uint32_t fadeto;
|
||||
uint32_t outsidefog;
|
||||
int cdtrack;
|
||||
unsigned int cdid;
|
||||
double gravity;
|
||||
double aircontrol;
|
||||
int WarpTrans;
|
||||
int airsupply;
|
||||
uint32_t compatflags, compatflags2;
|
||||
uint32_t compatmask, compatmask2;
|
||||
uint32_t compatflags, compatflags2;
|
||||
uint32_t compatmask, compatmask2;
|
||||
FString Translator; // for converting Doom-format linedef and sector types.
|
||||
int DefaultEnvironment; // Default sound environment for the map.
|
||||
FName Intermission;
|
||||
FName deathsequence;
|
||||
FName slideshow;
|
||||
uint32_t hazardcolor;
|
||||
uint32_t hazardflash;
|
||||
uint32_t hazardcolor;
|
||||
uint32_t hazardflash;
|
||||
int fogdensity;
|
||||
int outsidefogdensity;
|
||||
int skyfog;
|
||||
float pixelstretch;
|
||||
|
||||
// Redirection: If any player is carrying the specified item, then
|
||||
// you go to the RedirectMap instead of this one.
|
||||
|
|
|
@ -275,6 +275,11 @@ void level_info_t::Reset()
|
|||
teamdamage = 0.f;
|
||||
hazardcolor = 0xff004200;
|
||||
hazardflash = 0xff00ff00;
|
||||
fogdensity = 0;
|
||||
outsidefogdensity = 0;
|
||||
skyfog = 0;
|
||||
pixelstretch = 1.2f;
|
||||
|
||||
specialactions.Clear();
|
||||
DefaultEnvironment = 0;
|
||||
PrecacheSounds.Clear();
|
||||
|
@ -1237,6 +1242,13 @@ DEFINE_MAP_OPTION(skyfog, false)
|
|||
info->skyfog = parse.sc.Number;
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(pixelratio, false)
|
||||
{
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetFloat();
|
||||
info->pixelstretch = (float)parse.sc.Float;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -1344,6 +1356,7 @@ MapFlagHandlers[] =
|
|||
{ "unfreezesingleplayerconversations",MITYPE_SETFLAG2, LEVEL2_CONV_SINGLE_UNFREEZE, 0 },
|
||||
{ "spawnwithweaponraised", MITYPE_SETFLAG2, LEVEL2_PRERAISEWEAPON, 0 },
|
||||
{ "forcefakecontrast", MITYPE_SETFLAG3, LEVEL3_FORCEFAKECONTRAST, 0 },
|
||||
{ "nolightfade", MITYPE_SETFLAG3, LEVEL3_NOLIGHTFADE, 0 },
|
||||
{ "nobotnodes", MITYPE_IGNORE, 0, 0 }, // Skulltag option: nobotnodes
|
||||
{ "compat_shorttex", MITYPE_COMPATFLAG, COMPATF_SHORTTEX, 0 },
|
||||
{ "compat_stairs", MITYPE_COMPATFLAG, COMPATF_STAIRINDEX, 0 },
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
|
||||
GLRenderSettings glset;
|
||||
long gl_frameMS;
|
||||
long gl_frameCount;
|
||||
|
||||
EXTERN_CVAR(Int, gl_lightmode)
|
||||
EXTERN_CVAR(Bool, gl_brightfog)
|
||||
|
@ -193,11 +192,9 @@ struct FGLROptions : public FOptionalMapinfoData
|
|||
brightfog = false;
|
||||
lightmode = -1;
|
||||
nocoloredspritelighting = -1;
|
||||
nolightfade = false;
|
||||
notexturefill = -1;
|
||||
skyrotatevector = FVector3(0,0,1);
|
||||
skyrotatevector2 = FVector3(0,0,1);
|
||||
pixelstretch = 1.2f;
|
||||
lightadditivesurfaces = false;
|
||||
}
|
||||
virtual FOptionalMapinfoData *Clone() const
|
||||
|
@ -206,11 +203,9 @@ struct FGLROptions : public FOptionalMapinfoData
|
|||
newopt->identifier = identifier;
|
||||
newopt->lightmode = lightmode;
|
||||
newopt->nocoloredspritelighting = nocoloredspritelighting;
|
||||
newopt->nolightfade = nolightfade;
|
||||
newopt->notexturefill = notexturefill;
|
||||
newopt->skyrotatevector = skyrotatevector;
|
||||
newopt->skyrotatevector2 = skyrotatevector2;
|
||||
newopt->pixelstretch = pixelstretch;
|
||||
newopt->lightadditivesurfaces = lightadditivesurfaces;
|
||||
return newopt;
|
||||
}
|
||||
|
@ -219,10 +214,8 @@ struct FGLROptions : public FOptionalMapinfoData
|
|||
int8_t lightadditivesurfaces;
|
||||
int8_t nocoloredspritelighting;
|
||||
int8_t notexturefill;
|
||||
bool nolightfade;
|
||||
FVector3 skyrotatevector;
|
||||
FVector3 skyrotatevector2;
|
||||
float pixelstretch;
|
||||
};
|
||||
|
||||
DEFINE_MAP_OPTION(brightfog, false)
|
||||
|
@ -255,20 +248,6 @@ DEFINE_MAP_OPTION(nocoloredspritelighting, false)
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(nolightfade, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
if (parse.CheckAssign())
|
||||
{
|
||||
parse.sc.MustGetNumber();
|
||||
opt->nolightfade = !!parse.sc.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
opt->nolightfade = true;
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(notexturefill, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
|
@ -329,15 +308,6 @@ DEFINE_MAP_OPTION(skyrotate2, false)
|
|||
opt->skyrotatevector2.MakeUnit();
|
||||
}
|
||||
|
||||
DEFINE_MAP_OPTION(pixelratio, false)
|
||||
{
|
||||
FGLROptions *opt = info->GetOptData<FGLROptions>("gl_renderer");
|
||||
|
||||
parse.ParseAssign();
|
||||
parse.sc.MustGetFloat();
|
||||
opt->pixelstretch = (float)parse.sc.Float;
|
||||
}
|
||||
|
||||
bool IsLightmodeValid()
|
||||
{
|
||||
return (glset.map_lightmode >= 0 && glset.map_lightmode <= 4) || glset.map_lightmode == 8;
|
||||
|
@ -370,8 +340,6 @@ void InitGLRMapinfoData()
|
|||
glset.map_notexturefill = opt->notexturefill;
|
||||
glset.skyrotatevector = opt->skyrotatevector;
|
||||
glset.skyrotatevector2 = opt->skyrotatevector2;
|
||||
glset.pixelstretch = opt->pixelstretch;
|
||||
glset.nolightfade = opt->nolightfade;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -382,8 +350,6 @@ void InitGLRMapinfoData()
|
|||
glset.map_notexturefill = -1;
|
||||
glset.skyrotatevector = FVector3(0, 0, 1);
|
||||
glset.skyrotatevector2 = FVector3(0, 0, 1);
|
||||
glset.pixelstretch = 1.2f;
|
||||
glset.nolightfade = false;
|
||||
}
|
||||
ResetOpts();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ struct GLRenderSettings
|
|||
{
|
||||
int8_t lightmode;
|
||||
bool nocoloredspritelighting;
|
||||
bool nolightfade;
|
||||
bool notexturefill;
|
||||
bool brightfog;
|
||||
bool lightadditivesurfaces;
|
||||
|
@ -23,9 +22,6 @@ struct GLRenderSettings
|
|||
|
||||
FVector3 skyrotatevector;
|
||||
FVector3 skyrotatevector2;
|
||||
|
||||
float pixelstretch;
|
||||
|
||||
};
|
||||
|
||||
extern GLRenderSettings glset;
|
||||
|
|
|
@ -1055,7 +1055,7 @@ void gl_RenderModel(GLSprite * spr)
|
|||
gl_RenderState.mModelMatrix.rotate(-smf->rolloffset, 1, 0, 0);
|
||||
|
||||
// consider the pixel stretching. For non-voxels this must be factored out here
|
||||
float stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor() : 1.f) / glset.pixelstretch;
|
||||
float stretch = (smf->modelIDs[0] != -1 ? Models[smf->modelIDs[0]]->getAspectFactor() : 1.f) / level.info->pixelstretch;
|
||||
gl_RenderState.mModelMatrix.scale(1, stretch, 1);
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "g_level.h"
|
||||
#include "colormatcher.h"
|
||||
#include "textures/bitmap.h"
|
||||
#include "g_levellocals.h"
|
||||
//#include "gl/gl_intern.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
|
@ -429,7 +430,7 @@ int FVoxelModel::FindFrame(const char * name)
|
|||
|
||||
float FVoxelModel::getAspectFactor()
|
||||
{
|
||||
return glset.pixelstretch;
|
||||
return level.info->pixelstretch;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -290,7 +290,7 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
|
|||
else if ((fogcolor.d & 0xffffff) == 0)
|
||||
{
|
||||
// case 2: black fog
|
||||
if (glset.lightmode != 8 && !glset.nolightfade)
|
||||
if (glset.lightmode != 8 && !(level.flags3 & LEVEL3_NOLIGHTFADE))
|
||||
{
|
||||
density = distfogtable[glset.lightmode != 0][gl_ClampLight(lightlevel)];
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ void GLSceneDrawer::SetProjection(VSMatrix matrix)
|
|||
void GLSceneDrawer::SetViewMatrix(float vx, float vy, float vz, bool mirror, bool planemirror)
|
||||
{
|
||||
float mult = mirror? -1:1;
|
||||
float planemult = planemirror? -glset.pixelstretch : glset.pixelstretch;
|
||||
float planemult = planemirror? -level.info->pixelstretch : level.info->pixelstretch;
|
||||
|
||||
gl_RenderState.mViewMatrix.loadIdentity();
|
||||
gl_RenderState.mViewMatrix.rotate(GLRenderer->mAngles.Roll.Degrees, 0.0f, 0.0f, 1.0f);
|
||||
|
@ -796,7 +796,7 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, f
|
|||
// We have to scale the pitch to account for the pixel stretching, because the playsim doesn't know about this and treats it as 1:1.
|
||||
double radPitch = r_viewpoint.Angles.Pitch.Normalized180().Radians();
|
||||
double angx = cos(radPitch);
|
||||
double angy = sin(radPitch) * glset.pixelstretch;
|
||||
double angy = sin(radPitch) * level.info->pixelstretch;
|
||||
double alen = sqrt(angx*angx + angy*angy);
|
||||
|
||||
GLRenderer->mAngles.Pitch = (float)RAD2DEG(asin(angy / alen));
|
||||
|
@ -869,7 +869,6 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, f
|
|||
}
|
||||
stereo3dMode.TearDown();
|
||||
|
||||
gl_frameCount++; // This counter must be increased right before the interpolations are restored.
|
||||
interpolator.RestoreInterpolations ();
|
||||
return lviewsector;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ class FSimpleVertexBuffer;
|
|||
class FGLDebug;
|
||||
|
||||
extern long gl_frameMS;
|
||||
extern long gl_frameCount;
|
||||
#ifdef _WIN32
|
||||
class OpenGLFrameBuffer : public Win32GLFrameBuffer
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "d_net.h"
|
||||
#include "po_man.h"
|
||||
#include "st_stuff.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "swrenderer/scene/r_scene.h"
|
||||
#include "swrenderer/scene/r_light.h"
|
||||
#include "swrenderer/drawers/r_draw_rgba.h"
|
||||
|
@ -196,7 +197,7 @@ void PolyRenderer::SetupPerspectiveMatrix()
|
|||
const auto &viewwindow = Thread.Viewport->viewwindow;
|
||||
double radPitch = viewpoint.Angles.Pitch.Normalized180().Radians();
|
||||
double angx = cos(radPitch);
|
||||
double angy = sin(radPitch) * glset.pixelstretch;
|
||||
double angy = sin(radPitch) * level.info->pixelstretch;
|
||||
double alen = sqrt(angx*angx + angy*angy);
|
||||
float adjustedPitch = (float)asin(angy / alen);
|
||||
float adjustedViewAngle = (float)(viewpoint.Angles.Yaw - 90).Radians();
|
||||
|
@ -208,7 +209,7 @@ void PolyRenderer::SetupPerspectiveMatrix()
|
|||
TriMatrix worldToView =
|
||||
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
||||
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
||||
TriMatrix::scale(1.0f, glset.pixelstretch, 1.0f) *
|
||||
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
||||
TriMatrix::swapYZ() *
|
||||
TriMatrix::translate((float)-viewpoint.Pos.X, (float)-viewpoint.Pos.Y, (float)-viewpoint.Pos.Z);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void PolyDrawSectorPortal::Render(int portalDepth)
|
|||
const auto &viewwindow = PolyRenderer::Instance()->Thread.Viewport->viewwindow;
|
||||
double radPitch = viewpoint.Angles.Pitch.Normalized180().Radians();
|
||||
double angx = cos(radPitch);
|
||||
double angy = sin(radPitch) * glset.pixelstretch;
|
||||
double angy = sin(radPitch) * level.info->pixelstretch;
|
||||
double alen = sqrt(angx*angx + angy*angy);
|
||||
float adjustedPitch = (float)asin(angy / alen);
|
||||
float adjustedViewAngle = (float)(viewpoint.Angles.Yaw - 90).Radians();
|
||||
|
@ -61,7 +61,7 @@ void PolyDrawSectorPortal::Render(int portalDepth)
|
|||
TriMatrix worldToView =
|
||||
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
||||
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
||||
TriMatrix::scale(1.0f, glset.pixelstretch, 1.0f) *
|
||||
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
||||
TriMatrix::swapYZ() *
|
||||
TriMatrix::translate((float)-viewpoint.Pos.X, (float)-viewpoint.Pos.Y, (float)-viewpoint.Pos.Z);
|
||||
TriMatrix worldToClip = TriMatrix::perspective(fovy, ratio, 5.0f, 65535.0f) * worldToView;
|
||||
|
@ -160,7 +160,7 @@ void PolyDrawLinePortal::Render(int portalDepth)
|
|||
const auto &viewwindow = PolyRenderer::Instance()->Thread.Viewport->viewwindow;
|
||||
double radPitch = viewpoint.Angles.Pitch.Normalized180().Radians();
|
||||
double angx = cos(radPitch);
|
||||
double angy = sin(radPitch) * glset.pixelstretch;
|
||||
double angy = sin(radPitch) * level.info->pixelstretch;
|
||||
double alen = sqrt(angx*angx + angy*angy);
|
||||
float adjustedPitch = (float)asin(angy / alen);
|
||||
float adjustedViewAngle = (float)(viewpoint.Angles.Yaw - 90).Radians();
|
||||
|
@ -170,7 +170,7 @@ void PolyDrawLinePortal::Render(int portalDepth)
|
|||
TriMatrix worldToView =
|
||||
TriMatrix::rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
|
||||
TriMatrix::rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *
|
||||
TriMatrix::scale(1.0f, glset.pixelstretch, 1.0f) *
|
||||
TriMatrix::scale(1.0f, level.info->pixelstretch, 1.0f) *
|
||||
TriMatrix::swapYZ() *
|
||||
TriMatrix::translate((float)-viewpoint.Pos.X, (float)-viewpoint.Pos.Y, (float)-viewpoint.Pos.Z);
|
||||
if (Mirror)
|
||||
|
|
|
@ -140,12 +140,12 @@ namespace swrenderer
|
|||
|
||||
TiltVisibility = float(vis * viewport->viewwindow.FocalTangent * (16.f * 320.f) / viewwidth);
|
||||
|
||||
NoLightFade = glset.nolightfade;
|
||||
NoLightFade = !!(level.flags3 & LEVEL3_NOLIGHTFADE);
|
||||
}
|
||||
|
||||
fixed_t LightVisibility::LightLevelToShade(int lightlevel, bool foggy)
|
||||
{
|
||||
bool nolightfade = !foggy && (glset.nolightfade);
|
||||
bool nolightfade = !foggy && ((level.flags3 & LEVEL3_NOLIGHTFADE));
|
||||
if (nolightfade)
|
||||
{
|
||||
return (MAX(255 - lightlevel, 0) * NUMCOLORMAPS) << (FRACBITS - 8);
|
||||
|
|
Loading…
Reference in a new issue