- use Doom64 colors on sectors and linedefs.

This commit is contained in:
Christoph Oelckers 2017-01-28 20:44:46 +01:00
parent 12d073a27d
commit ee22a9371b
18 changed files with 62 additions and 35 deletions

View file

@ -1898,6 +1898,7 @@ void AM_drawSubsectors()
double scalex, scaley;
double originx, originy;
FDynamicColormap *colormap;
PalEntry flatcolor;
mpoint_t originpt;
screen->StartSimplePolys();
@ -1941,6 +1942,7 @@ void AM_drawSubsectors()
colormap = sec->ColorMap;
FTextureID maptex = sec->GetTexture(sector_t::floor);
flatcolor = sec->SpecialColors[sector_t::floor];
scalex = sec->GetXScale(sector_t::floor);
scaley = sec->GetYScale(sector_t::floor);
@ -1989,6 +1991,7 @@ void AM_drawSubsectors()
if (roverz < cmpz)
{
maptex = *(rover->top.texture);
flatcolor = *(rover->top.flatcolor);
floorplane = rover->top.plane;
sector_t *model = rover->top.model;
int selector = (rover->flags & FF_INVERTPLANES) ? sector_t::floor : sector_t::ceiling;
@ -2049,6 +2052,7 @@ void AM_drawSubsectors()
scale / scaley,
rotation,
colormap,
flatcolor,
floorlight,
f_y + f_h
);

View file

@ -3875,7 +3875,7 @@ void FParser::SF_SetColor(void)
color.r=intvalue(t_argv[1]);
color.g=intvalue(t_argv[2]);
color.b=intvalue(t_argv[3]);
color.a = (DFraggleThinker::ActiveThinker->setcolormaterial) ? 255 : 0;
color.a = 0;
}
else return;
@ -3891,7 +3891,7 @@ void FParser::SF_SetColor(void)
for (int j = 0; j < 4; j++) level.sectors[i].SpecialColors[j] = color;
// simulates 'nocoloredspritelighting' settings.
int v = (color.r + color.g + color.b) / 3;
level.sectors[i].SpecialColors[4] = (255 + v + v) / 3;
level.sectors[i].SpecialColors[sector_t::sprites] = (255 + v + v) / 3;
}
}
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

View file

@ -169,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)
@ -178,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)
{

View file

@ -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,6 +406,7 @@ 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);
gl_RenderState.SetObjectColor(FlatColor | 0xff000000);
if (!gltexture)
{
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
@ -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)))
{

View file

@ -301,6 +301,7 @@ public:
FMaterial *gltexture;
FColormap Colormap; // light and fog
PalEntry FlatColor;
ERenderStyle renderstyle;
float alpha;

View file

@ -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((seg->frontsector->MoreFlags & SECF_SPECIALCOLORSABSOLUTE)? 255 : lightlevel, rel, Colormap, absalpha);
RenderWall(rflags);
}
else
@ -364,7 +367,7 @@ void GLWall::RenderTextured(int rflags)
FColormap thiscm;
thiscm.FadeColor = Colormap.FadeColor;
thiscm.CopyFrom3DLight(&(*lightlist)[i]);
gl_SetColor(thisll, rel, thiscm, absalpha);
gl_SetColor((seg->frontsector->MoreFlags & SECF_SPECIALCOLORSABSOLUTE) ? 255 : thisll, rel, thiscm, absalpha);
if (type != RENDERWALL_M2SNF) gl_SetFog(thisll, rel, &thiscm, RenderStyle == STYLE_Add);
gl_RenderState.SetSplitPlanes((*lightlist)[i].plane, lowplane);
RenderWall(rflags);
@ -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);
}

View file

@ -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);
}
}

View file

@ -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);

View file

@ -136,12 +136,14 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
{
ffloor->bottom.plane = &sec2->floorplane;
ffloor->bottom.texture = &sec2->planes[sector_t::floor].Texture;
ffloor->bottom.flatcolor = &sec2->SpecialColors[sector_t::floor];
ffloor->bottom.isceiling = sector_t::floor;
}
else
{
ffloor->bottom.plane = &sec2->ceilingplane;
ffloor->bottom.texture = &sec2->planes[sector_t::ceiling].Texture;
ffloor->bottom.flatcolor = &sec2->SpecialColors[sector_t::ceiling];
ffloor->bottom.isceiling = sector_t::ceiling;
}
@ -149,6 +151,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
{
ffloor->top.plane = &sec2->ceilingplane;
ffloor->top.texture = &sec2->planes[sector_t::ceiling].Texture;
ffloor->top.flatcolor = &sec2->SpecialColors[sector_t::ceiling];
ffloor->toplightlevel = &sec2->lightlevel;
ffloor->top.isceiling = sector_t::ceiling;
}
@ -156,6 +159,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
{
ffloor->top.plane = &sec->floorplane;
ffloor->top.texture = &sec2->planes[sector_t::floor].Texture;
ffloor->top.flatcolor = &sec2->SpecialColors[sector_t::floor];
ffloor->toplightlevel = &sec->lightlevel;
ffloor->top.isceiling = sector_t::floor;
ffloor->top.model = sec;
@ -165,10 +169,7 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
if (flags&FF_INVERTSECTOR)
{
// switch the planes
F3DFloor::planeref sp = ffloor->top;
ffloor->top=ffloor->bottom;
ffloor->bottom=sp;
std::swap(ffloor->top, ffloor->bottom);
if (flags&FF_SWIMMABLE)
{
@ -192,11 +193,10 @@ static void P_Add3DFloor(sector_t* sec, sector_t* sec2, line_t* master, int flag
ffloor->flags &= ~FF_ADDITIVETRANS;
}
if(flags & FF_THISINSIDE) {
if(flags & FF_THISINSIDE)
{
// switch the planes
F3DFloor::planeref sp = ffloor->top;
ffloor->top=ffloor->bottom;
ffloor->bottom=sp;
std::swap(ffloor->top, ffloor->bottom);
}
sec->e->XFloor.ffloors.Push(ffloor);

View file

@ -69,6 +69,7 @@ struct F3DFloor
secplane_t * plane;
const FTextureID * texture;
sector_t * model;
PalEntry * flatcolor;
int isceiling;
int vindex;
bool copied;

View file

@ -1272,7 +1272,7 @@ void DCanvas::FinishSimplePolys()
void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley, DAngle rotation,
FDynamicColormap *colormap, int lightlevel, int bottomclip)
FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip)
{
#ifndef NO_SWRENDER
using namespace swrenderer;

View file

@ -224,7 +224,7 @@ public:
// Fill a simple polygon with a texture
virtual void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley, DAngle rotation,
struct FDynamicColormap *colormap, int lightlevel, int bottomclip);
struct FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip);
// Set an area to a specified color
virtual void Clear (int left, int top, int right, int bottom, int palcolor, uint32 color);

View file

@ -3092,7 +3092,7 @@ void D3DFB::FlatFill(int left, int top, int right, int bottom, FTexture *src, bo
void D3DFB::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)
{
// Use an equation similar to player sprites to determine shade
double fadelevel = clamp((LIGHT2SHADE(lightlevel)/65536. - 12) / NUMCOLORMAPS, 0.0, 1.0);
@ -3113,7 +3113,7 @@ void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
}
if (In2D < 2)
{
Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel, bottomclip);
Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, flatcolor, lightlevel, bottomclip);
return;
}
if (!InScene)

View file

@ -265,7 +265,7 @@ public:
void DrawPixel(int x, int y, int palcolor, uint32 rgbcolor);
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
double originx, double originy, double scalex, double scaley,
DAngle rotation, FDynamicColormap *colormap, int lightlevel, int bottomclip) override;
DAngle rotation, FDynamicColormap *colormap, PalEntry flatcolor, int lightlevel, int bottomclip) override;
bool WipeStartScreen(int type);
void WipeEndScreen();
bool WipeDo(int ticks);

View file

@ -54,10 +54,7 @@ void main()
float bottomatpoint = -((uGlowBottomPlane.w + uGlowBottomPlane.x * worldcoord.x + uGlowBottomPlane.y * worldcoord.z) * uGlowBottomPlane.z);
glowdist.x = topatpoint - worldcoord.y;
glowdist.y = worldcoord.y - bottomatpoint;
glowdist.z = glowdist.x / (topatpoint - bottomatpoint);
return (uGlowTopPlane.w + normal.X*v->fX() + normal.Y*v->fY()) * negiC;
glowdist.z = clamp(glowdist.x / (topatpoint - bottomatpoint), 0.0, 1.0);
if (uSplitBottomPlane.z != 0.0)
{