mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-17 17:11:19 +00:00
Merge branch 'master' into vulkan2
# Conflicts: # src/posix/cocoa/i_video.mm
This commit is contained in:
commit
02ed758447
31 changed files with 123 additions and 155 deletions
|
@ -1294,7 +1294,6 @@ void C_FullConsole ()
|
|||
primaryLevel->Music = "";
|
||||
S_Start ();
|
||||
P_FreeLevelData ();
|
||||
V_SetBlend (0,0,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1247,7 +1247,6 @@ void D_DoAdvanceDemo (void)
|
|||
return;
|
||||
}
|
||||
|
||||
V_SetBlend (0,0,0,0);
|
||||
players[consoleplayer].playerstate = PST_LIVE; // not reborn
|
||||
usergame = false; // no save / end game here
|
||||
paused = 0;
|
||||
|
@ -2698,8 +2697,6 @@ void D_DoomMain (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
// let the renderer reinitialize some stuff if needed
|
||||
screen->InitPalette();
|
||||
// These calls from inside V_Init2 are still necessary
|
||||
C_NewModeAdjust();
|
||||
D_StartTitle (); // start up intro loop
|
||||
|
|
|
@ -2100,6 +2100,56 @@ static void PutSaveComment (FSerializer &arc)
|
|||
arc.AddString("Comment", comment);
|
||||
}
|
||||
|
||||
void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown)
|
||||
{
|
||||
PalEntry palette[256];
|
||||
PalEntry modulateColor;
|
||||
auto blend = screen->CalcBlend(viewsector, &modulateColor);
|
||||
int pixelsize = 1;
|
||||
// Apply the screen blend, because the renderer does not provide this.
|
||||
if (ssformat == SS_RGB)
|
||||
{
|
||||
int numbytes = width * height * 3;
|
||||
pixelsize = 3;
|
||||
if (modulateColor != 0xffffffff)
|
||||
{
|
||||
float r = modulateColor.r / 255.f;
|
||||
float g = modulateColor.g / 255.f;
|
||||
float b = modulateColor.b / 255.f;
|
||||
for (int i = 0; i < numbytes; i += 3)
|
||||
{
|
||||
scr[i] = uint8_t(scr[i] * r);
|
||||
scr[i + 1] = uint8_t(scr[i + 1] * g);
|
||||
scr[i + 2] = uint8_t(scr[i + 2] * b);
|
||||
}
|
||||
}
|
||||
float iblendfac = 1.f - blend.W;
|
||||
blend.X *= blend.W;
|
||||
blend.Y *= blend.W;
|
||||
blend.Z *= blend.W;
|
||||
for (int i = 0; i < numbytes; i += 3)
|
||||
{
|
||||
scr[i] = uint8_t(scr[i] * iblendfac + blend.X);
|
||||
scr[i + 1] = uint8_t(scr[i + 1] * iblendfac + blend.Y);
|
||||
scr[i + 2] = uint8_t(scr[i + 2] * iblendfac + blend.Z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply the screen blend to the palette. The colormap related parts get skipped here because these are already part of the image.
|
||||
DoBlending(GPalette.BaseColors, palette, 256, uint8_t(blend.X), uint8_t(blend.Y), uint8_t(blend.Z), uint8_t(blend.W*255));
|
||||
}
|
||||
|
||||
int pitch = width * pixelsize;
|
||||
if (upsidedown)
|
||||
{
|
||||
scr += ((height - 1) * width * pixelsize);
|
||||
pitch *= -1;
|
||||
}
|
||||
|
||||
M_CreatePNG(file, scr, ssformat == SS_PAL? palette : nullptr, ssformat, width, height, pitch, Gamma);
|
||||
}
|
||||
|
||||
static void PutSavePic (FileWriter *file, int width, int height)
|
||||
{
|
||||
if (width <= 0 || height <= 0 || !storesavepic)
|
||||
|
|
|
@ -173,7 +173,7 @@ TArray<uint8_t> FImageSource::GetPalettedPixels(int conversion)
|
|||
int FImageSource::CopyPixels(FBitmap *bmp, int conversion)
|
||||
{
|
||||
if (conversion == luminance) conversion = normal; // luminance images have no use as an RGB source.
|
||||
PalEntry *palette = screen->GetPalette();
|
||||
PalEntry *palette = GPalette.BaseColors;
|
||||
for(int i=1;i<256;i++) palette[i].a = 255; // set proper alpha values
|
||||
auto ppix = CreatePalettedPixels(conversion);
|
||||
bmp->CopyPixelData(0, 0, ppix.Data(), Width, Height, Height, 1, 0, palette, nullptr);
|
||||
|
|
|
@ -211,7 +211,6 @@ int DIntermissionScreenFader::Responder (event_t *ev)
|
|||
{
|
||||
if (ev->type == EV_KeyDown)
|
||||
{
|
||||
V_SetBlend(0,0,0,0);
|
||||
return -1;
|
||||
}
|
||||
return Super::Responder(ev);
|
||||
|
@ -852,7 +851,6 @@ void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, uint8_t s
|
|||
{
|
||||
DIntermissionController::CurrentIntermission->Destroy();
|
||||
}
|
||||
V_SetBlend (0,0,0,0);
|
||||
S_StopAllChannels ();
|
||||
gameaction = ga_nothing;
|
||||
gamestate = GS_FINALE;
|
||||
|
|
|
@ -612,12 +612,6 @@ void M_ScreenShot (const char *filename)
|
|||
auto buffer = screen->GetScreenshotBuffer(pitch, color_type, gamma);
|
||||
if (buffer.Size() > 0)
|
||||
{
|
||||
PalEntry palette[256];
|
||||
|
||||
if (color_type == SS_PAL)
|
||||
{
|
||||
screen->GetFlashedPalette(palette);
|
||||
}
|
||||
file = FileWriter::Open(autoname);
|
||||
if (file == NULL)
|
||||
{
|
||||
|
@ -626,12 +620,12 @@ void M_ScreenShot (const char *filename)
|
|||
}
|
||||
if (writepcx)
|
||||
{
|
||||
WritePCXfile(file, buffer.Data(), palette, color_type,
|
||||
WritePCXfile(file, buffer.Data(), nullptr, color_type,
|
||||
screen->GetWidth(), screen->GetHeight(), pitch);
|
||||
}
|
||||
else
|
||||
{
|
||||
WritePNGfile(file, buffer.Data(), palette, color_type,
|
||||
WritePNGfile(file, buffer.Data(), nullptr, color_type,
|
||||
screen->GetWidth(), screen->GetHeight(), pitch, gamma);
|
||||
}
|
||||
delete file;
|
||||
|
|
|
@ -351,7 +351,6 @@ void player_t::CopyFrom(player_t &p, bool copyPSP)
|
|||
psprites = p.psprites;
|
||||
p.psprites = nullptr;
|
||||
}
|
||||
else psprites = nullptr;
|
||||
}
|
||||
|
||||
size_t player_t::PropagateMark()
|
||||
|
|
|
@ -434,8 +434,6 @@ SystemBaseFrameBuffer::SystemBaseFrameBuffer(void*, const bool fullscreen)
|
|||
, m_hiDPI(false)
|
||||
, m_window(nullptr)
|
||||
{
|
||||
SetFlash(0, 0);
|
||||
|
||||
assert(frameBuffer == nullptr);
|
||||
frameBuffer = this;
|
||||
|
||||
|
|
|
@ -1351,12 +1351,13 @@ void DFrameBuffer::DrawBorder (FTextureID picnum, int x1, int y1, int x2, int y2
|
|||
}
|
||||
}
|
||||
|
||||
///==========================================================================
|
||||
//==========================================================================
|
||||
//
|
||||
// Draws a blend over the entire view
|
||||
//
|
||||
//==========================================================================
|
||||
void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
||||
|
||||
FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector, PalEntry *modulateColor)
|
||||
{
|
||||
float blend[4] = { 0,0,0,0 };
|
||||
PalEntry blendv = 0;
|
||||
|
@ -1366,6 +1367,8 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
|||
player_t *player = nullptr;
|
||||
bool fullbright = false;
|
||||
|
||||
if (modulateColor) *modulateColor = 0xffffffff;
|
||||
|
||||
if (players[consoleplayer].camera != nullptr)
|
||||
{
|
||||
player = players[consoleplayer].camera->player;
|
||||
|
@ -1376,7 +1379,7 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
|||
// don't draw sector based blends when any fullbright screen effect is active.
|
||||
if (!fullbright)
|
||||
{
|
||||
const auto &vpp = r_viewpoint.Pos;
|
||||
const auto &vpp = r_viewpoint.Pos;
|
||||
if (!viewsector->e->XFloor.ffloors.Size())
|
||||
{
|
||||
if (viewsector->GetHeightSec())
|
||||
|
@ -1427,7 +1430,7 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
|||
// black multiplicative blends are ignored
|
||||
if (extra_red || extra_green || extra_blue)
|
||||
{
|
||||
screen->Dim(blendv, 1, 0, 0, screen->GetWidth(), screen->GetHeight(), &LegacyRenderStyles[STYLE_Multiply]);
|
||||
if (modulateColor) *modulateColor = blendv;
|
||||
}
|
||||
blendv = 0;
|
||||
}
|
||||
|
@ -1452,7 +1455,7 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
|||
if (in->IsKindOf(torchtype))
|
||||
{
|
||||
// The software renderer already bakes the torch flickering into its output, so this must be omitted here.
|
||||
float r = vid_rendermode < 4? 1.f : (0.8f + (7 - player->fixedlightlevel) / 70.0f);
|
||||
float r = vid_rendermode < 4 ? 1.f : (0.8f + (7 - player->fixedlightlevel) / 70.0f);
|
||||
if (r > 1.0f) r = 1.0f;
|
||||
int rr = (int)(r * 255);
|
||||
int b = rr;
|
||||
|
@ -1467,9 +1470,9 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (color != 0xffffffff)
|
||||
{
|
||||
screen->Dim(color, 1, 0, 0, screen->GetWidth(), screen->GetHeight(), &LegacyRenderStyles[STYLE_Multiply]);
|
||||
if (modulateColor)
|
||||
{
|
||||
*modulateColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1488,8 +1491,26 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
|||
const float br = clamp(blend[0] * 255.f, 0.f, 255.f);
|
||||
const float bg = clamp(blend[1] * 255.f, 0.f, 255.f);
|
||||
const float bb = clamp(blend[2] * 255.f, 0.f, 255.f);
|
||||
const PalEntry bcolor(255, uint8_t(br), uint8_t(bg), uint8_t(bb));
|
||||
screen->Dim(bcolor, blend[3], 0, 0, screen->GetWidth(), screen->GetHeight());
|
||||
return { br, bg, bb, blend[3] };
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Draws a blend over the entire view
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DrawBlend(sector_t * viewsector)
|
||||
{
|
||||
PalEntry modulateColor;
|
||||
auto blend = CalcBlend(viewsector, &modulateColor);
|
||||
if (modulateColor != 0xffffffff)
|
||||
{
|
||||
Dim(modulateColor, 1, 0, 0, GetWidth(), GetHeight(), &LegacyRenderStyles[STYLE_Multiply]);
|
||||
}
|
||||
|
||||
const PalEntry bcolor(255, uint8_t(blend.X), uint8_t(blend.Y), uint8_t(blend.Z));
|
||||
Dim(bcolor, blend.W, 0, 0, GetWidth(), GetHeight());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,6 +67,8 @@ EXTERN_CVAR(Bool, cl_capfps)
|
|||
|
||||
extern bool NoInterpolateView;
|
||||
|
||||
void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown);
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
|
@ -370,9 +372,11 @@ void FGLRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, i
|
|||
// strictly speaking not needed as the glReadPixels should block until the scene is rendered, but this is to safeguard against shitty drivers
|
||||
glFinish();
|
||||
|
||||
uint8_t * scr = (uint8_t *)M_Malloc(width * height * 3);
|
||||
int numpixels = width * height;
|
||||
uint8_t * scr = (uint8_t *)M_Malloc(numpixels * 3);
|
||||
glReadPixels(0,0,width, height,GL_RGB,GL_UNSIGNED_BYTE,scr);
|
||||
M_CreatePNG (file, scr + ((height-1) * width * 3), NULL, SS_RGB, width, height, -width * 3, Gamma);
|
||||
|
||||
DoWriteSavePic(file, SS_RGB, scr, width, height, viewsector, true);
|
||||
M_Free(scr);
|
||||
|
||||
// Switch back the screen render buffers
|
||||
|
|
|
@ -138,7 +138,7 @@ bool FGLRenderState::ApplyShader()
|
|||
activeShader->muLightIndex.Set(-1);
|
||||
activeShader->muClipSplit.Set(mClipSplit);
|
||||
activeShader->muSpecularMaterial.Set(mGlossiness, mSpecularLevel);
|
||||
activeShader->muAddColor.Set(mAddColor); // Can this be done without a shader?
|
||||
activeShader->muAddColor.Set(mAddColor);
|
||||
|
||||
if (mGlowEnabled)
|
||||
{
|
||||
|
|
|
@ -111,12 +111,12 @@ void FGLRenderer::DrawScene(HWDrawInfo *di, int drawmode)
|
|||
if (vp.camera != nullptr)
|
||||
{
|
||||
ActorRenderFlags savedflags = vp.camera->renderflags;
|
||||
di->CreateScene();
|
||||
di->CreateScene(drawmode == DM_MAINVIEW);
|
||||
vp.camera->renderflags = savedflags;
|
||||
}
|
||||
else
|
||||
{
|
||||
di->CreateScene();
|
||||
di->CreateScene(false);
|
||||
}
|
||||
|
||||
glDepthMask(true);
|
||||
|
|
|
@ -796,7 +796,7 @@ void HWDrawInfo::RenderBSPNode (void *node)
|
|||
DoSubsector ((subsector_t *)((uint8_t *)node - 1));
|
||||
}
|
||||
|
||||
void HWDrawInfo::RenderBSP(void *node)
|
||||
void HWDrawInfo::RenderBSP(void *node, bool drawpsprites)
|
||||
{
|
||||
Bsp.Clock();
|
||||
|
||||
|
@ -829,6 +829,6 @@ void HWDrawInfo::RenderBSP(void *node)
|
|||
// Process all the sprites on the current portal's back side which touch the portal.
|
||||
if (mCurrentPortal != nullptr) mCurrentPortal->RenderAttached(this);
|
||||
|
||||
|
||||
PreparePlayerSprites(Viewpoint.sector, in_area);
|
||||
if (drawpsprites)
|
||||
PreparePlayerSprites(Viewpoint.sector, in_area);
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ GLDecal *HWDrawInfo::AddDecal(bool onmirror)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void HWDrawInfo::CreateScene()
|
||||
void HWDrawInfo::CreateScene(bool drawpsprites)
|
||||
{
|
||||
const auto &vp = Viewpoint;
|
||||
angle_t a1 = FrustumAngle();
|
||||
|
@ -436,7 +436,7 @@ void HWDrawInfo::CreateScene()
|
|||
screen->mVertexData->Map();
|
||||
screen->mLights->Map();
|
||||
|
||||
RenderBSP(Level->HeadNode());
|
||||
RenderBSP(Level->HeadNode(), drawpsprites);
|
||||
|
||||
// And now the crappy hacks that have to be done to avoid rendering anomalies.
|
||||
// These cannot be multithreaded when the time comes because all these depend
|
||||
|
|
|
@ -237,7 +237,7 @@ public:
|
|||
|
||||
HWPortal * FindPortal(const void * src);
|
||||
void RenderBSPNode(void *node);
|
||||
void RenderBSP(void *node);
|
||||
void RenderBSP(void *node, bool drawpsprites);
|
||||
|
||||
static HWDrawInfo *StartDrawInfo(FLevelLocals *lev, HWDrawInfo *parent, FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms);
|
||||
void StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms);
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
void SetViewArea();
|
||||
int SetFullbrightFlags(player_t *player);
|
||||
|
||||
void CreateScene();
|
||||
void CreateScene(bool drawpsprites);
|
||||
void RenderScene(FRenderState &state);
|
||||
void RenderTranslucent(FRenderState &state);
|
||||
void RenderPortal(HWPortal *p, FRenderState &state, bool usestencil);
|
||||
|
|
|
@ -155,7 +155,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
|||
{
|
||||
state.SetTextureMode(TM_FIXEDCOLORMAP);
|
||||
state.SetObjectColor(cmd.mSpecialColormap[0]);
|
||||
state.SetObjectColor2(cmd.mSpecialColormap[1]);
|
||||
state.SetAddColor(cmd.mSpecialColormap[1]);
|
||||
}
|
||||
state.SetFog(cmd.mColor1, 0);
|
||||
state.SetColor(1, 1, 1, 1, cmd.mDesaturate);
|
||||
|
|
|
@ -68,7 +68,7 @@ void PolyRenderer::RenderView(player_t *player, DCanvas *target, void *videobuff
|
|||
RenderTarget = target;
|
||||
RenderToCanvas = false;
|
||||
|
||||
RenderActorView(player->mo, false);
|
||||
RenderActorView(player->mo, true, false);
|
||||
|
||||
Threads.MainThread()->FlushDrawQueue();
|
||||
|
||||
|
@ -102,7 +102,7 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
|||
viewactive = true;
|
||||
|
||||
// Render:
|
||||
RenderActorView(actor, dontmaplines);
|
||||
RenderActorView(actor, false, dontmaplines);
|
||||
Threads.MainThread()->FlushDrawQueue();
|
||||
DrawerThreads::WaitForWorkers();
|
||||
|
||||
|
@ -119,7 +119,7 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
|||
RenderTarget = savedRenderTarget;
|
||||
}
|
||||
|
||||
void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines)
|
||||
void PolyRenderer::RenderActorView(AActor *actor, bool drawpsprites, bool dontmaplines)
|
||||
{
|
||||
PolyTotalBatches = 0;
|
||||
PolyTotalTriangles = 0;
|
||||
|
@ -181,7 +181,9 @@ void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines)
|
|||
mainViewpoint.StencilValue = GetNextStencilValue();
|
||||
Scene.CurrentViewpoint = &mainViewpoint;
|
||||
Scene.Render(&mainViewpoint);
|
||||
PlayerSprites.Render(Threads.MainThread());
|
||||
if (drawpsprites)
|
||||
PlayerSprites.Render(Threads.MainThread());
|
||||
|
||||
Scene.CurrentViewpoint = nullptr;
|
||||
|
||||
if (Viewpoint.camera)
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
FLevelLocals *Level;
|
||||
|
||||
private:
|
||||
void RenderActorView(AActor *actor, bool dontmaplines);
|
||||
void RenderActorView(AActor *actor, bool drawpsprites, bool dontmaplines);
|
||||
void SetSceneViewport();
|
||||
|
||||
RenderPolyPlayerSprites PlayerSprites;
|
||||
|
|
|
@ -208,10 +208,11 @@ void FSoftwareRenderer::RenderView(player_t *player, DCanvas *target, void *vide
|
|||
});
|
||||
}
|
||||
|
||||
void DoWriteSavePic(FileWriter *file, ESSType ssformat, uint8_t *scr, int width, int height, sector_t *viewsector, bool upsidedown);
|
||||
|
||||
void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int width, int height)
|
||||
{
|
||||
DCanvas pic(width, height, false);
|
||||
PalEntry palette[256];
|
||||
|
||||
// Take a snapshot of the player's view
|
||||
if (V_IsPolyRenderer())
|
||||
|
@ -230,8 +231,7 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
|||
r_viewpoint = mScene.MainThread()->Viewport->viewpoint;
|
||||
r_viewwindow = mScene.MainThread()->Viewport->viewwindow;
|
||||
}
|
||||
screen->GetFlashedPalette (palette);
|
||||
M_CreatePNG (file, pic.GetPixels(), palette, SS_PAL, width, height, pic.GetPitch(), Gamma);
|
||||
DoWriteSavePic(file, SS_PAL, pic.GetPixels(), width, height, r_viewpoint.sector, false);
|
||||
}
|
||||
|
||||
void FSoftwareRenderer::DrawRemainingPlayerSprites()
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace swrenderer
|
|||
DrawerThreads::ResetDebugDrawPos();
|
||||
}
|
||||
|
||||
RenderActorView(player->mo);
|
||||
RenderActorView(player->mo, true, false);
|
||||
|
||||
auto copyqueue = std::make_shared<DrawerCommandQueue>(MainThread()->FrameMemory.get());
|
||||
copyqueue->Push<MemcpyCommand>(videobuffer, target->GetPixels(), target->GetWidth(), target->GetHeight(), target->GetPitch(), target->IsBgra() ? 4 : 1);
|
||||
|
@ -140,7 +140,7 @@ namespace swrenderer
|
|||
DrawerWaitCycles.Unclock();
|
||||
}
|
||||
|
||||
void RenderScene::RenderActorView(AActor *actor, bool dontmaplines)
|
||||
void RenderScene::RenderActorView(AActor *actor, bool renderPlayerSprites, bool dontmaplines)
|
||||
{
|
||||
WallCycles.Reset();
|
||||
PlaneCycles.Reset();
|
||||
|
@ -180,7 +180,8 @@ namespace swrenderer
|
|||
if (r_modelscene)
|
||||
MainThread()->Viewport->SetupPolyViewport(MainThread());
|
||||
|
||||
RenderPSprites();
|
||||
if (renderPlayerSprites)
|
||||
RenderPSprites();
|
||||
|
||||
MainThread()->Viewport->viewpoint.camera->renderflags = savedflags;
|
||||
}
|
||||
|
@ -384,7 +385,7 @@ namespace swrenderer
|
|||
PolyTriangleDrawer::ResizeBuffers(viewport->RenderTarget);
|
||||
|
||||
// Render:
|
||||
RenderActorView(actor, dontmaplines);
|
||||
RenderActorView(actor, false, dontmaplines);
|
||||
DrawerWaitCycles.Clock();
|
||||
DrawerThreads::WaitForWorkers();
|
||||
DrawerWaitCycles.Unclock();
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace swrenderer
|
|||
RenderThread *MainThread() { return Threads.front().get(); }
|
||||
|
||||
private:
|
||||
void RenderActorView(AActor *actor, bool dontmaplines = false);
|
||||
void RenderActorView(AActor *actor,bool renderplayersprite, bool dontmaplines);
|
||||
void RenderThreadSlices();
|
||||
void RenderThreadSlice(RenderThread *thread);
|
||||
void RenderPSprites();
|
||||
|
|
|
@ -418,12 +418,12 @@ void VulkanFrameBuffer::DrawScene(HWDrawInfo *di, int drawmode)
|
|||
if (vp.camera != nullptr)
|
||||
{
|
||||
ActorRenderFlags savedflags = vp.camera->renderflags;
|
||||
di->CreateScene();
|
||||
di->CreateScene(drawmode == DM_MAINVIEW);
|
||||
vp.camera->renderflags = savedflags;
|
||||
}
|
||||
else
|
||||
{
|
||||
di->CreateScene();
|
||||
di->CreateScene(false);
|
||||
}
|
||||
|
||||
GetRenderState()->SetDepthMask(true);
|
||||
|
|
|
@ -66,7 +66,7 @@ zip_file_t *zip_fopen(zip_t *zipfile, const char *filename)
|
|||
if (!zipfile || !filename) return NULL;
|
||||
auto lump = zipfile->FindLump(filename);
|
||||
if (!lump) return NULL;
|
||||
return new FileReader(std::move(lump->NewReader()));
|
||||
return new FileReader(lump->NewReader());
|
||||
}
|
||||
|
||||
void zip_fclose(zip_file_t *zippedfile)
|
||||
|
|
|
@ -202,11 +202,6 @@ void DFrameBuffer::DrawRateStuff ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::GetFlashedPalette(PalEntry pal[256])
|
||||
{
|
||||
DoBlending(SourcePalette, pal, 256, Flash.r, Flash.g, Flash.b, Flash.a);
|
||||
}
|
||||
|
||||
void DFrameBuffer::Update()
|
||||
{
|
||||
CheckBench();
|
||||
|
@ -225,24 +220,6 @@ void DFrameBuffer::Update()
|
|||
}
|
||||
}
|
||||
|
||||
PalEntry *DFrameBuffer::GetPalette()
|
||||
{
|
||||
return SourcePalette;
|
||||
}
|
||||
|
||||
bool DFrameBuffer::SetFlash(PalEntry rgb, int amount)
|
||||
{
|
||||
Flash = PalEntry(amount, rgb.r, rgb.g, rgb.b);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DFrameBuffer::GetFlash(PalEntry &rgb, int &amount)
|
||||
{
|
||||
rgb = Flash;
|
||||
rgb.a = 0;
|
||||
amount = Flash.a;
|
||||
}
|
||||
|
||||
void DFrameBuffer::SetClearColor(int color)
|
||||
{
|
||||
PalEntry pe = GPalette.BaseColors[color];
|
||||
|
@ -293,18 +270,6 @@ FTexture *DFrameBuffer::WipeEndScreen()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DFrameBuffer :: InitPalette
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::InitPalette()
|
||||
{
|
||||
memcpy(SourcePalette, GPalette.BaseColors, sizeof(PalEntry) * 256);
|
||||
UpdatePalette();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DFrameBuffer :: GetCaps
|
||||
|
|
|
@ -443,29 +443,6 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in
|
|||
}
|
||||
}
|
||||
|
||||
void V_SetBlend (int blendr, int blendg, int blendb, int blenda)
|
||||
{
|
||||
// Don't do anything if the new blend is the same as the old
|
||||
if (((blenda|BlendA) == 0) ||
|
||||
(blendr == BlendR &&
|
||||
blendg == BlendG &&
|
||||
blendb == BlendB &&
|
||||
blenda == BlendA))
|
||||
return;
|
||||
|
||||
V_ForceBlend (blendr, blendg, blendb, blenda);
|
||||
}
|
||||
|
||||
void V_ForceBlend (int blendr, int blendg, int blendb, int blenda)
|
||||
{
|
||||
BlendR = blendr;
|
||||
BlendG = blendg;
|
||||
BlendB = blendb;
|
||||
BlendA = blenda;
|
||||
|
||||
screen->SetFlash (PalEntry (BlendR, BlendG, BlendB), BlendA);
|
||||
}
|
||||
|
||||
CCMD (testblend)
|
||||
{
|
||||
FString colorstring;
|
||||
|
|
|
@ -77,23 +77,6 @@ void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, in
|
|||
void ReadPalette(int lumpnum, uint8_t *buffer);
|
||||
void InitPalette ();
|
||||
|
||||
// V_SetBlend()
|
||||
// input: blendr: red component of blend
|
||||
// blendg: green component of blend
|
||||
// blendb: blue component of blend
|
||||
// blenda: alpha component of blend
|
||||
//
|
||||
// Applies the blend to all palettes with PALETTEF_BLEND flag
|
||||
void V_SetBlend (int blendr, int blendg, int blendb, int blenda);
|
||||
|
||||
// V_ForceBlend()
|
||||
//
|
||||
// Normally, V_SetBlend() does nothing if the new blend is the
|
||||
// same as the old. This function will perform the blending
|
||||
// even if the blend hasn't changed.
|
||||
void V_ForceBlend (int blendr, int blendg, int blendb, int blenda);
|
||||
|
||||
|
||||
EXTERN_CVAR (Int, paletteflash)
|
||||
enum PaletteFlashFlags
|
||||
{
|
||||
|
|
|
@ -696,9 +696,6 @@ void V_Init (bool restart)
|
|||
// Update screen palette when restarting
|
||||
else
|
||||
{
|
||||
PalEntry *palette = screen->GetPalette ();
|
||||
for (int i = 0; i < 256; ++i)
|
||||
*palette++ = GPalette.BaseColors[i];
|
||||
screen->UpdatePalette();
|
||||
}
|
||||
|
||||
|
|
|
@ -352,9 +352,6 @@ private:
|
|||
protected:
|
||||
int clipleft = 0, cliptop = 0, clipwidth = -1, clipheight = -1;
|
||||
|
||||
PalEntry Flash; // Only needed to support some cruft in the interface that only makes sense for the software renderer
|
||||
PalEntry SourcePalette[256]; // This is where unpaletted textures get their palette from
|
||||
|
||||
public:
|
||||
// Hardware render state that needs to be exposed to the API independent part of the renderer. For ease of access this is stored in the base class.
|
||||
int hwcaps = 0; // Capability flags
|
||||
|
@ -404,26 +401,12 @@ public:
|
|||
// Make the surface visible.
|
||||
virtual void Update ();
|
||||
|
||||
// Return a pointer to 256 palette entries that can be written to.
|
||||
PalEntry *GetPalette ();
|
||||
|
||||
// Stores the palette with flash blended in into 256 dwords
|
||||
void GetFlashedPalette (PalEntry palette[256]);
|
||||
|
||||
// Mark the palette as changed. It will be updated on the next Update().
|
||||
virtual void UpdatePalette() {}
|
||||
|
||||
virtual void SetGamma() {}
|
||||
|
||||
// Sets a color flash. RGB is the color, and amount is 0-256, with 256
|
||||
// being all flash and 0 being no flash. Returns false if the hardware
|
||||
// does not support this. (Always true for now, since palettes can always
|
||||
// be flashed.)
|
||||
bool SetFlash (PalEntry rgb, int amount);
|
||||
|
||||
// Converse of SetFlash
|
||||
void GetFlash (PalEntry &rgb, int &amount);
|
||||
|
||||
// Returns true if running fullscreen.
|
||||
virtual bool IsFullscreen () = 0;
|
||||
virtual void ToggleFullscreen(bool yes) {}
|
||||
|
@ -475,7 +458,6 @@ public:
|
|||
}
|
||||
|
||||
// Report a game restart
|
||||
void InitPalette();
|
||||
void SetClearColor(int color);
|
||||
virtual uint32_t GetCaps();
|
||||
virtual void WriteSavePic(player_t *player, FileWriter *file, int width, int height);
|
||||
|
@ -502,6 +484,7 @@ public:
|
|||
// Dim part of the canvas
|
||||
void Dim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
|
||||
void DoDim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
|
||||
FVector4 CalcBlend(sector_t * viewsector, PalEntry *modulateColor);
|
||||
void DrawBlend(sector_t * viewsector);
|
||||
|
||||
// Fill an area with a texture
|
||||
|
|
|
@ -761,7 +761,6 @@ void WI_Start(wbstartstruct_t *wbstartstruct)
|
|||
}
|
||||
}
|
||||
|
||||
V_SetBlend(0, 0, 0, 0);
|
||||
S_StopAllChannels();
|
||||
for (auto Level : AllLevels())
|
||||
{
|
||||
|
|
|
@ -591,7 +591,7 @@ void main()
|
|||
if (uTextureMode == 7)
|
||||
{
|
||||
float gray = grayscale(frag);
|
||||
vec4 cm = (uObjectColor + gray * (uObjectColor2 - uObjectColor)) * 2;
|
||||
vec4 cm = (uObjectColor + gray * (uAddColor - uObjectColor)) * 2;
|
||||
frag = vec4(clamp(cm.rgb, 0.0, 1.0), frag.a);
|
||||
}
|
||||
frag = frag * ProcessLight(material, vColor);
|
||||
|
|
|
@ -142,6 +142,7 @@ class ConversationMenu : Menu
|
|||
let trade = Stringtable.Localize("$TXT_TRADE");
|
||||
let amount = String.Format("%u", reply.PrintAmount);
|
||||
trade.Replace("%u", amount);
|
||||
ReplyText = ReplyText .. trade;
|
||||
}
|
||||
let ReplyLines = SmallFont.BreakLines (ReplyText, ReplyWidth);
|
||||
|
||||
|
|
Loading…
Reference in a new issue