# Conflicts: # src/r_bsp.cpp # src/r_main.cpp # src/r_segs.cpp # src/r_things.cpp # wadsrc/static/language.enu # wadsrc/static/menudef.txt
This commit is contained in:
commit
0c101102dc
41 changed files with 187 additions and 86 deletions
|
|
@ -174,7 +174,7 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
|||
|
||||
void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel)
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel)
|
||||
{
|
||||
FMaterial *gltexture = FMaterial::ValidateTexture(texture, false);
|
||||
|
||||
|
|
@ -191,6 +191,7 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
|||
poly.mLightLevel = lightlevel;
|
||||
poly.mVertCount = npoints;
|
||||
poly.mVertIndex = (int)mVertices.Reserve(npoints);
|
||||
poly.mFlatColor = flatcolor;
|
||||
|
||||
bool dorotate = rotation != 0;
|
||||
|
||||
|
|
@ -438,8 +439,10 @@ void F2DDrawer::Draw()
|
|||
cm = dsp->mColormap;
|
||||
gl_SetColor(dsp->mLightLevel, 0, cm, 1.f);
|
||||
gl_RenderState.SetMaterial(dsp->mTexture, CLAMP_NONE, 0, -1, false);
|
||||
gl_RenderState.SetObjectColor(dsp->mFlatColor|0xff000000);
|
||||
gl_RenderState.Apply();
|
||||
glDrawArrays(GL_TRIANGLE_FAN, dsp->mVertIndex, dsp->mVertCount);
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class F2DDrawer : public FSimpleVertexBuffer
|
|||
FMaterial *mTexture;
|
||||
int mLightLevel;
|
||||
FDynamicColormap *mColormap;
|
||||
PalEntry mFlatColor;
|
||||
};
|
||||
|
||||
TArray<FSimpleVertex> mVertices;
|
||||
|
|
@ -61,7 +62,7 @@ public:
|
|||
|
||||
void AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel);
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel);
|
||||
|
||||
void AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32 color);
|
||||
void AddPixel(int x1, int y1, int palcolor, uint32 color);
|
||||
|
|
|
|||
|
|
@ -304,6 +304,11 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
|
|||
// uses approximations of Legacy's default settings.
|
||||
density = fogdensity ? fogdensity : 18;
|
||||
}
|
||||
else if (sectorfogdensity != 0)
|
||||
{
|
||||
// case 2: Sector has an explicit fog density set.
|
||||
density = sectorfogdensity;
|
||||
}
|
||||
else if ((fogcolor.d & 0xffffff) == 0)
|
||||
{
|
||||
// case 1: black fog
|
||||
|
|
@ -316,11 +321,6 @@ float gl_GetFogDensity(int lightlevel, PalEntry fogcolor, int sectorfogdensity)
|
|||
density = 0;
|
||||
}
|
||||
}
|
||||
else if (sectorfogdensity != 0)
|
||||
{
|
||||
// case 2: Sector has an explicit fog density set.
|
||||
density = sectorfogdensity;
|
||||
}
|
||||
else if (outsidefogdensity != 0 && outsidefogcolor.a != 0xff && (fogcolor.d & 0xffffff) == (outsidefogcolor.d & 0xffffff))
|
||||
{
|
||||
// case 3. outsidefogdensity has already been set as needed
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ public:
|
|||
|
||||
void FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip);
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip);
|
||||
|
||||
int PTM_BestColor (const uint32 *pal_in, int r, int g, int b, int first, int num);
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ void FRenderState::Reset()
|
|||
mModelMatrixEnabled = false;
|
||||
mTextureMatrixEnabled = false;
|
||||
mObjectColor = 0xffffffff;
|
||||
mObjectColor2 = 0;
|
||||
mVertexBuffer = mCurrentVertexBuffer = NULL;
|
||||
mColormapState = CM_DEFAULT;
|
||||
mSoftLight = 0;
|
||||
|
|
@ -141,10 +142,11 @@ bool FRenderState::ApplyShader()
|
|||
fogset = -gl_fogmode;
|
||||
}
|
||||
}
|
||||
glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec);
|
||||
|
||||
glVertexAttrib4fv(VATTR_COLOR, mColor.vec);
|
||||
activeShader->muObjectColor.Set(mObjectColor);
|
||||
glVertexAttrib4fv(VATTR_NORMAL, mNormal.vec);
|
||||
//activeShader->muObjectColor2.Set(mObjectColor2);
|
||||
activeShader->muObjectColor2.Set(mObjectColor2);
|
||||
|
||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||
activeShader->muFogEnabled.Set(fogset);
|
||||
|
|
@ -153,6 +155,7 @@ bool FRenderState::ApplyShader()
|
|||
activeShader->muCameraPos.Set(mCameraPos.vec);
|
||||
activeShader->muLightParms.Set(mLightParms);
|
||||
activeShader->muFogColor.Set(mFogColor);
|
||||
activeShader->muObjectColor.Set(mObjectColor);
|
||||
activeShader->muDynLightColor.Set(mDynColor.vec);
|
||||
activeShader->muInterpolationFactor.Set(mInterpolationFactor);
|
||||
activeShader->muClipHeight.Set(mClipHeight);
|
||||
|
|
@ -166,8 +169,6 @@ bool FRenderState::ApplyShader()
|
|||
{
|
||||
activeShader->muGlowTopColor.Set(mGlowTop.vec);
|
||||
activeShader->muGlowBottomColor.Set(mGlowBottom.vec);
|
||||
activeShader->muGlowTopPlane.Set(mGlowTopPlane.vec);
|
||||
activeShader->muGlowBottomPlane.Set(mGlowBottomPlane.vec);
|
||||
activeShader->currentglowstate = 1;
|
||||
}
|
||||
else if (activeShader->currentglowstate)
|
||||
|
|
@ -175,10 +176,13 @@ bool FRenderState::ApplyShader()
|
|||
// if glowing is on, disable it.
|
||||
activeShader->muGlowTopColor.Set(nulvec);
|
||||
activeShader->muGlowBottomColor.Set(nulvec);
|
||||
activeShader->muGlowTopPlane.Set(nulvec);
|
||||
activeShader->muGlowBottomPlane.Set(nulvec);
|
||||
activeShader->currentglowstate = 0;
|
||||
}
|
||||
if (mGlowEnabled || mObjectColor2.a != 0)
|
||||
{
|
||||
activeShader->muGlowTopPlane.Set(mGlowTopPlane.vec);
|
||||
activeShader->muGlowBottomPlane.Set(mGlowBottomPlane.vec);
|
||||
}
|
||||
|
||||
if (mSplitEnabled)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ class FRenderState
|
|||
FStateVec4 mClipLine;
|
||||
PalEntry mFogColor;
|
||||
PalEntry mObjectColor;
|
||||
PalEntry mObjectColor2;
|
||||
FStateVec4 mDynColor;
|
||||
float mClipSplit[2];
|
||||
|
||||
|
|
@ -381,6 +382,11 @@ public:
|
|||
mObjectColor = pe;
|
||||
}
|
||||
|
||||
void SetObjectColor2(PalEntry pe)
|
||||
{
|
||||
mObjectColor2 = pe;
|
||||
}
|
||||
|
||||
void SetFog(PalEntry c, float d)
|
||||
{
|
||||
const float LOG2E = 1.442692f; // = 1/log(2)
|
||||
|
|
|
|||
|
|
@ -379,6 +379,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
case GLPASS_ALL: // Same, but also creates the dynlight data.
|
||||
gl_SetColor(lightlevel, rel, Colormap,1.0f);
|
||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
|
||||
if (sector->special != GLSector_Skybox)
|
||||
{
|
||||
gl_RenderState.SetMaterial(gltexture, CLAMP_NONE, 0, -1, false);
|
||||
|
|
@ -391,6 +392,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
gl_RenderState.SetMaterial(gltexture, CLAMP_XY, 0, -1, false);
|
||||
DrawSkyboxSector(pass, (pass == GLPASS_ALL || dynlightindex > -1));
|
||||
}
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
break;
|
||||
|
||||
case GLPASS_LIGHTSONLY:
|
||||
|
|
@ -404,7 +406,8 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
gl_SetColor(lightlevel, rel, Colormap, alpha);
|
||||
gl_SetFog(lightlevel, rel, &Colormap, false);
|
||||
if (!gltexture)
|
||||
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
|
||||
if (!gltexture)
|
||||
{
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderState.EnableTexture(false);
|
||||
|
|
@ -421,6 +424,7 @@ void GLFlat::Draw(int pass, bool trans) // trans only has meaning for GLPASS_LIG
|
|||
gl_RenderState.EnableTextureMatrix(false);
|
||||
}
|
||||
if (renderstyle==STYLE_Add) gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
break;
|
||||
|
||||
case GLPASS_LIGHTTEX:
|
||||
|
|
@ -546,8 +550,16 @@ void GLFlat::SetFrom3DFloor(F3DFloor *rover, bool top, bool underside)
|
|||
lightlist_t *light = P_GetPlaneLight(sector, plane.plane, underside);
|
||||
lightlevel = gl_ClampLight(*light->p_lightlevel);
|
||||
|
||||
if (rover->flags & FF_FOG) Colormap.LightColor = (light->extra_colormap)->Fade;
|
||||
else Colormap.CopyFrom3DLight(light);
|
||||
if (rover->flags & FF_FOG)
|
||||
{
|
||||
Colormap.LightColor = (light->extra_colormap)->Fade;
|
||||
FlatColor = 0xffffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
Colormap.CopyFrom3DLight(light);
|
||||
FlatColor = *plane.flatcolor;
|
||||
}
|
||||
|
||||
|
||||
alpha = rover->alpha/255.0f;
|
||||
|
|
@ -604,6 +616,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
|
|||
|
||||
lightlevel = gl_ClampLight(frontsector->GetFloorLight());
|
||||
Colormap = frontsector->ColorMap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::floor];
|
||||
port = frontsector->ValidatePortal(sector_t::floor);
|
||||
if ((stack = (port != NULL)))
|
||||
{
|
||||
|
|
@ -663,6 +676,7 @@ void GLFlat::ProcessSector(sector_t * frontsector)
|
|||
|
||||
lightlevel = gl_ClampLight(frontsector->GetCeilingLight());
|
||||
Colormap = frontsector->ColorMap;
|
||||
FlatColor = frontsector->SpecialColors[sector_t::ceiling];
|
||||
port = frontsector->ValidatePortal(sector_t::ceiling);
|
||||
if ((stack = (port != NULL)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@ void GLSprite::Draw(int pass)
|
|||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
gl_RenderState.SetColor(0.2f,0.2f,0.2f,fuzzalpha, Colormap.desaturation);
|
||||
additivefog = true;
|
||||
lightlist = nullptr; // the fuzz effect does not use the sector's light level so splitting is not needed.
|
||||
}
|
||||
else if (RenderStyle.BlendOp == STYLEOP_Add && RenderStyle.DestAlpha == STYLEALPHA_One)
|
||||
{
|
||||
|
|
@ -319,15 +320,21 @@ void GLSprite::Draw(int pass)
|
|||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -128.0f);
|
||||
}
|
||||
if (RenderStyle.BlendOp!=STYLEOP_Shadow)
|
||||
if (RenderStyle.BlendOp != STYLEOP_Shadow)
|
||||
{
|
||||
if (gl_lights && GLRenderer->mLightCount && !gl_fixedcolormap && !fullbright)
|
||||
{
|
||||
gl_SetDynSpriteLight(gl_light_sprites ? actor : NULL, gl_light_particles ? particle : NULL);
|
||||
}
|
||||
PalEntry finalcol(ThingColor.a,
|
||||
ThingColor.r * actor->Sector->SpecialColors[sector_t::sprites].r / 255,
|
||||
ThingColor.g * actor->Sector->SpecialColors[sector_t::sprites].g / 255,
|
||||
ThingColor.b * actor->Sector->SpecialColors[sector_t::sprites].b / 255);
|
||||
|
||||
gl_RenderState.SetObjectColor(finalcol);
|
||||
gl_SetColor(lightlevel, rel, Colormap, trans);
|
||||
}
|
||||
gl_RenderState.SetObjectColor(ThingColor);
|
||||
|
||||
|
||||
if (gl_isBlack(Colormap.FadeColor)) foglevel=lightlevel;
|
||||
|
||||
|
|
|
|||
|
|
@ -301,6 +301,7 @@ public:
|
|||
FMaterial *gltexture;
|
||||
|
||||
FColormap Colormap; // light and fog
|
||||
PalEntry FlatColor;
|
||||
ERenderStyle renderstyle;
|
||||
|
||||
float alpha;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "p_local.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
|
|
@ -326,9 +327,9 @@ void GLWall::RenderTextured(int rflags)
|
|||
if (flags & GLWF_GLOW)
|
||||
{
|
||||
gl_RenderState.EnableGlow(true);
|
||||
gl_RenderState.SetGlowPlanes(topplane, bottomplane);
|
||||
gl_RenderState.SetGlowParams(topglowcolor, bottomglowcolor);
|
||||
}
|
||||
gl_RenderState.SetGlowPlanes(topplane, bottomplane);
|
||||
gl_RenderState.SetMaterial(gltexture, flags & 3, 0, -1, false);
|
||||
|
||||
if (type == RENDERWALL_M2SNF)
|
||||
|
|
@ -339,12 +340,14 @@ void GLWall::RenderTextured(int rflags)
|
|||
}
|
||||
gl_SetFog(255, 0, NULL, false);
|
||||
}
|
||||
gl_RenderState.SetObjectColor(seg->frontsector->SpecialColors[sector_t::walltop] | 0xff000000);
|
||||
gl_RenderState.SetObjectColor2(seg->frontsector->SpecialColors[sector_t::wallbottom] | 0xff000000);
|
||||
|
||||
float absalpha = fabsf(alpha);
|
||||
if (lightlist == NULL)
|
||||
{
|
||||
gl_SetColor(lightlevel, rel, Colormap, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) gl_SetFog(lightlevel, rel, &Colormap, RenderStyle == STYLE_Add);
|
||||
gl_SetColor(lightlevel, rel, Colormap, absalpha);
|
||||
RenderWall(rflags);
|
||||
}
|
||||
else
|
||||
|
|
@ -374,6 +377,8 @@ void GLWall::RenderTextured(int rflags)
|
|||
|
||||
gl_RenderState.EnableSplit(false);
|
||||
}
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
gl_RenderState.SetObjectColor2(0);
|
||||
gl_RenderState.SetTextureMode(tmode);
|
||||
gl_RenderState.EnableGlow(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,7 +370,12 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
|
||||
// now draw the different layers of the weapon
|
||||
gl_RenderState.EnableBrightmap(true);
|
||||
gl_RenderState.SetObjectColor(ThingColor);
|
||||
PalEntry finalcol(ThingColor.a,
|
||||
ThingColor.r * viewsector->SpecialColors[sector_t::sprites].r / 255,
|
||||
ThingColor.g * viewsector->SpecialColors[sector_t::sprites].g / 255,
|
||||
ThingColor.b * viewsector->SpecialColors[sector_t::sprites].b / 255);
|
||||
|
||||
gl_RenderState.SetObjectColor(finalcol);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
|
||||
// hack alert! Rather than changing everything in the underlying lighting code let's just temporarily change
|
||||
|
|
|
|||
|
|
@ -225,6 +225,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muFogColor.Init(hShader, "uFogColor");
|
||||
muDynLightColor.Init(hShader, "uDynLightColor");
|
||||
muObjectColor.Init(hShader, "uObjectColor");
|
||||
muObjectColor2.Init(hShader, "uObjectColor2");
|
||||
muGlowBottomColor.Init(hShader, "uGlowBottomColor");
|
||||
muGlowTopColor.Init(hShader, "uGlowTopColor");
|
||||
muGlowBottomPlane.Init(hShader, "uGlowBottomPlane");
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ class FShader
|
|||
FBufferedUniformPE muFogColor;
|
||||
FBufferedUniform4f muDynLightColor;
|
||||
FBufferedUniformPE muObjectColor;
|
||||
FBufferedUniformPE muObjectColor2;
|
||||
FUniform4f muGlowBottomColor;
|
||||
FUniform4f muGlowTopColor;
|
||||
FUniform4f muGlowBottomPlane;
|
||||
|
|
|
|||
|
|
@ -470,11 +470,11 @@ void OpenGLFrameBuffer::Clear(int left, int top, int right, int bottom, int palc
|
|||
|
||||
void OpenGLFrameBuffer::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip)
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
|
||||
{
|
||||
if (GLRenderer != nullptr && GLRenderer->m2DDrawer != nullptr && npoints >= 3)
|
||||
{
|
||||
GLRenderer->m2DDrawer->AddPoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel);
|
||||
GLRenderer->m2DDrawer->AddPoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, flatcolor, lightlevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public:
|
|||
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip);
|
||||
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip);
|
||||
|
||||
FNativePalette *CreatePalette(FRemapTable *remap);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue