mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 11:50:49 +00:00
- do RR's lightning flash as a postprocessing effect.
This commit is contained in:
parent
5330964a7a
commit
a6545788a6
9 changed files with 15 additions and 21 deletions
|
@ -47,7 +47,6 @@ enum {
|
||||||
|
|
||||||
extern float curpolygonoffset;
|
extern float curpolygonoffset;
|
||||||
|
|
||||||
extern int32_t r_scenebrightness;
|
|
||||||
extern int32_t polymostcenterhoriz;
|
extern int32_t polymostcenterhoriz;
|
||||||
|
|
||||||
extern int16_t globalpicnum;
|
extern int16_t globalpicnum;
|
||||||
|
|
|
@ -67,7 +67,6 @@ static float dxb1[MAXWALLSB], dxb2[MAXWALLSB];
|
||||||
#define SOFTROTMAT 0
|
#define SOFTROTMAT 0
|
||||||
|
|
||||||
static int32_t r_pogoDebug = 0;
|
static int32_t r_pogoDebug = 0;
|
||||||
int32_t r_scenebrightness = 0;
|
|
||||||
|
|
||||||
static float gviewxrange;
|
static float gviewxrange;
|
||||||
static float ghoriz, ghoriz2;
|
static float ghoriz, ghoriz2;
|
||||||
|
@ -3066,8 +3065,6 @@ void polymost_drawrooms()
|
||||||
GLInterface.EnableDepthTest(true);
|
GLInterface.EnableDepthTest(true);
|
||||||
GLInterface.SetDepthFunc(Depth_LessEqual);
|
GLInterface.SetDepthFunc(Depth_LessEqual);
|
||||||
|
|
||||||
GLInterface.SetBrightness(r_scenebrightness);
|
|
||||||
|
|
||||||
gvrcorrection = viewingrange*(1.f/65536.f);
|
gvrcorrection = viewingrange*(1.f/65536.f);
|
||||||
//if (glprojectionhacks == 2)
|
//if (glprojectionhacks == 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,8 +137,7 @@ bool PolymostShader::Load(const char * name, const char * vert_prog, const char
|
||||||
Flags.Init(hShader, "u_flags");
|
Flags.Init(hShader, "u_flags");
|
||||||
NPOTEmulationFactor.Init(hShader, "u_npotEmulationFactor");
|
NPOTEmulationFactor.Init(hShader, "u_npotEmulationFactor");
|
||||||
NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset");
|
NPOTEmulationXOffset.Init(hShader, "u_npotEmulationXOffset");
|
||||||
Brightness.Init(hShader, "u_brightness");
|
|
||||||
|
|
||||||
TextureMode.Init(hShader, "uTextureMode");
|
TextureMode.Init(hShader, "uTextureMode");
|
||||||
FogColor.Init(hShader, "uFogColor");
|
FogColor.Init(hShader, "uFogColor");
|
||||||
muFogEnabled.Init(hShader, "uFogEnabled");
|
muFogEnabled.Init(hShader, "uFogEnabled");
|
||||||
|
|
|
@ -29,7 +29,6 @@ public:
|
||||||
FBufferedUniform1i Flags;
|
FBufferedUniform1i Flags;
|
||||||
FBufferedUniform1f NPOTEmulationFactor;
|
FBufferedUniform1f NPOTEmulationFactor;
|
||||||
FBufferedUniform1f NPOTEmulationXOffset;
|
FBufferedUniform1f NPOTEmulationXOffset;
|
||||||
FBufferedUniform1f Brightness;
|
|
||||||
FBufferedUniformPalEntry FogColor;
|
FBufferedUniformPalEntry FogColor;
|
||||||
|
|
||||||
FBufferedUniform1i TextureMode;
|
FBufferedUniform1i TextureMode;
|
||||||
|
|
|
@ -546,7 +546,6 @@ void PolymostRenderState::Apply(PolymostShader* shader, GLState& oldState)
|
||||||
shader->NPOTEmulationFactor.Set(NPOTEmulationFactor);
|
shader->NPOTEmulationFactor.Set(NPOTEmulationFactor);
|
||||||
shader->NPOTEmulationXOffset.Set(NPOTEmulationXOffset);
|
shader->NPOTEmulationXOffset.Set(NPOTEmulationXOffset);
|
||||||
shader->AlphaThreshold.Set(AlphaTest ? AlphaThreshold : -1.f);
|
shader->AlphaThreshold.Set(AlphaTest ? AlphaThreshold : -1.f);
|
||||||
shader->Brightness.Set(Brightness);
|
|
||||||
shader->FogColor.Set((Flags& RF_MapFog)? PalEntry(0x999999) : FogColor);
|
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 };
|
float lightattr[] = { ShadeDiv / (numshades - 2), VisFactor, (Flags & RF_MapFog) ? -5.f : 0.f , ShadeDiv >= 1 / 1000.f? Shade : 0 };
|
||||||
shader->muLightParms.Set(lightattr);
|
shader->muLightParms.Set(lightattr);
|
||||||
|
@ -725,6 +724,8 @@ void DrawRateStuff()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t r_scenebrightness = 0;
|
||||||
|
|
||||||
void videoShowFrame(int32_t w)
|
void videoShowFrame(int32_t w)
|
||||||
{
|
{
|
||||||
static GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };
|
static GLenum buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };
|
||||||
|
@ -742,8 +743,10 @@ void videoShowFrame(int32_t w)
|
||||||
glDrawBuffers(1, buffers);
|
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
|
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
|
GLInterface.Draw2D(&twodpsp); // draws the weapon sprites
|
||||||
});
|
});
|
||||||
screen->Update();
|
screen->Update();
|
||||||
|
|
|
@ -431,11 +431,6 @@ public:
|
||||||
renderState.Flags &= ~RF_MapFog;
|
renderState.Flags &= ~RF_MapFog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBrightness(int brightness)
|
|
||||||
{
|
|
||||||
renderState.Brightness = 8.f / (brightness + 8.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetTinting(int flags, PalEntry color, PalEntry overlayColor)
|
void SetTinting(int flags, PalEntry color, PalEntry overlayColor)
|
||||||
{
|
{
|
||||||
renderState.hictint = color;
|
renderState.hictint = color;
|
||||||
|
|
|
@ -57,8 +57,7 @@ struct PolymostRenderState
|
||||||
int LayerFlags = 0;
|
int LayerFlags = 0;
|
||||||
float NPOTEmulationFactor = 1.f;
|
float NPOTEmulationFactor = 1.f;
|
||||||
float NPOTEmulationXOffset;
|
float NPOTEmulationXOffset;
|
||||||
float Brightness = 1.f;
|
float AlphaThreshold = 0.5f;
|
||||||
float AlphaThreshold = 0.5f;
|
|
||||||
bool AlphaTest = true;
|
bool AlphaTest = true;
|
||||||
float Color[4] = { 1,1,1,1 };
|
float Color[4] = { 1,1,1,1 };
|
||||||
short matrixIndex[NUMMATRICES] = { 0 };
|
short matrixIndex[NUMMATRICES] = { 0 };
|
||||||
|
|
|
@ -35,7 +35,6 @@ uniform int u_flags;
|
||||||
|
|
||||||
uniform float u_npotEmulationFactor;
|
uniform float u_npotEmulationFactor;
|
||||||
uniform float u_npotEmulationXOffset;
|
uniform float u_npotEmulationXOffset;
|
||||||
uniform float u_brightness;
|
|
||||||
|
|
||||||
in vec4 v_color;
|
in vec4 v_color;
|
||||||
in float v_distance;
|
in float v_distance;
|
||||||
|
@ -263,7 +262,6 @@ void main()
|
||||||
if ((iz & 64) == 1) color.b = 0;
|
if ((iz & 64) == 1) color.b = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
color.rgb = pow(color.rgb, vec3(u_brightness));
|
|
||||||
fragColor = color;
|
fragColor = color;
|
||||||
fragFog = vec4(0.0, 0.0, 0.0, 1.0); // Does build have colored fog?
|
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)));
|
vec3 normal = normalize(cross(dFdx(v_eyeCoordPosition.xyz), dFdy(v_eyeCoordPosition.xyz)));
|
||||||
|
|
|
@ -6,8 +6,13 @@ layout(binding=0) uniform sampler2D SceneTexture;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 frag = texture(SceneTexture, TexCoord);
|
vec4 frag = texture(SceneTexture, TexCoord);
|
||||||
float gray = (frag.r * 0.3 + frag.g * 0.56 + frag.b * 0.14);
|
frag.rgb = clamp(pow(frag.rgb, vec3(uFixedColormapStart.a)), 0.0, 1.0);
|
||||||
vec4 cm = uFixedColormapStart + gray * uFixedColormapRange;
|
if (uFixedColormapRange.a == 0)
|
||||||
FragColor = vec4(clamp(cm.rgb, 0.0, 1.0), frag.a);
|
{
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue