- do RR's lightning flash as a postprocessing effect.

This commit is contained in:
Christoph Oelckers 2020-06-07 22:06:47 +02:00
parent 5330964a7a
commit a6545788a6
9 changed files with 15 additions and 21 deletions

View file

@ -47,7 +47,6 @@ enum {
extern float curpolygonoffset;
extern int32_t r_scenebrightness;
extern int32_t polymostcenterhoriz;
extern int16_t globalpicnum;

View file

@ -67,7 +67,6 @@ static float dxb1[MAXWALLSB], dxb2[MAXWALLSB];
#define SOFTROTMAT 0
static int32_t r_pogoDebug = 0;
int32_t r_scenebrightness = 0;
static float gviewxrange;
static float ghoriz, ghoriz2;
@ -3066,8 +3065,6 @@ void polymost_drawrooms()
GLInterface.EnableDepthTest(true);
GLInterface.SetDepthFunc(Depth_LessEqual);
GLInterface.SetBrightness(r_scenebrightness);
gvrcorrection = viewingrange*(1.f/65536.f);
//if (glprojectionhacks == 2)
{

View file

@ -137,7 +137,6 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
Flags.Init(hShader, "u_flags");
NPOTEmulationFactor.Init(hShader, "u_npotEmulationFactor");
NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset");
Brightness.Init(hShader, "u_brightness");
TextureMode.Init(hShader, "uTextureMode");
FogColor.Init(hShader, "uFogColor");

View file

@ -29,7 +29,6 @@ public:
FBufferedUniform1i Flags;
FBufferedUniform1f NPOTEmulationFactor;
FBufferedUniform1f NPOTEmulationXOffset;
FBufferedUniform1f Brightness;
FBufferedUniformPalEntry FogColor;
FBufferedUniform1i TextureMode;

View file

@ -546,7 +546,6 @@ void PolymostRenderState::Apply(PolymostShader* shader, GLState& oldState)
shader->NPOTEmulationFactor.Set(NPOTEmulationFactor);
shader->NPOTEmulationXOffset.Set(NPOTEmulationXOffset);
shader->AlphaThreshold.Set(AlphaTest ? AlphaThreshold : -1.f);
shader->Brightness.Set(Brightness);
shader->FogColor.Set((Flags& RF_MapFog)? PalEntry(0x999999) : FogColor);
float lightattr[] = { ShadeDiv / (numshades - 2), VisFactor, (Flags & RF_MapFog) ? -5.f : 0.f , ShadeDiv >= 1 / 1000.f? Shade : 0 };
shader->muLightParms.Set(lightattr);
@ -725,6 +724,8 @@ void DrawRateStuff()
}
}
int32_t r_scenebrightness = 0;
void videoShowFrame(int32_t w)
{
static GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };
@ -742,8 +743,10 @@ void videoShowFrame(int32_t w)
glDrawBuffers(1, buffers);
}
float Brightness = 8.f / (r_scenebrightness + 8.f);
OpenGLRenderer::GLRenderer->mBuffers->BlitSceneToTexture(); // Copy the resulting scene to the current post process texture
screen->PostProcessScene(false, 0, 1.f, []() {
screen->PostProcessScene(false, 0, Brightness, []() {
GLInterface.Draw2D(&twodpsp); // draws the weapon sprites
});
screen->Update();

View file

@ -431,11 +431,6 @@ public:
renderState.Flags &= ~RF_MapFog;
}
void SetBrightness(int brightness)
{
renderState.Brightness = 8.f / (brightness + 8.f);
}
void SetTinting(int flags, PalEntry color, PalEntry overlayColor)
{
renderState.hictint = color;

View file

@ -57,8 +57,7 @@ struct PolymostRenderState
int LayerFlags = 0;
float NPOTEmulationFactor = 1.f;
float NPOTEmulationXOffset;
float Brightness = 1.f;
float AlphaThreshold = 0.5f;
float AlphaThreshold = 0.5f;
bool AlphaTest = true;
float Color[4] = { 1,1,1,1 };
short matrixIndex[NUMMATRICES] = { 0 };

View file

@ -35,7 +35,6 @@ uniform int u_flags;
uniform float u_npotEmulationFactor;
uniform float u_npotEmulationXOffset;
uniform float u_brightness;
in vec4 v_color;
in float v_distance;
@ -263,7 +262,6 @@ void main()
if ((iz & 64) == 1) color.b = 0;
*/
color.rgb = pow(color.rgb, vec3(u_brightness));
fragColor = color;
fragFog = vec4(0.0, 0.0, 0.0, 1.0); // Does build have colored fog?
vec3 normal = normalize(cross(dFdx(v_eyeCoordPosition.xyz), dFdy(v_eyeCoordPosition.xyz)));

View file

@ -6,8 +6,13 @@ layout(binding=0) uniform sampler2D SceneTexture;
void main()
{
vec4 frag = texture(SceneTexture, TexCoord);
float gray = (frag.r * 0.3 + frag.g * 0.56 + frag.b * 0.14);
vec4 cm = uFixedColormapStart + gray * uFixedColormapRange;
FragColor = vec4(clamp(cm.rgb, 0.0, 1.0), frag.a);
frag.rgb = clamp(pow(frag.rgb, vec3(uFixedColormapStart.a)), 0.0, 1.0);
if (uFixedColormapRange.a == 0)
{
float gray = (frag.r * 0.3 + frag.g * 0.56 + frag.b * 0.14);
vec4 cm = uFixedColormapStart + gray * uFixedColormapRange;
frag.rgb = clamp(cm.rgb, 0.0, 1.0);
}
FragColor = frag;
}