GodRay use correct screencoord
This commit is contained in:
parent
419b96c068
commit
26b38a3afe
@ -1,11 +1,12 @@
|
|||||||
uniform sampler2D tex;
|
uniform sampler2D tex;
|
||||||
uniform vec3 col;
|
uniform vec3 col;
|
||||||
|
|
||||||
in vec2 uv;
|
|
||||||
out vec4 FragColor;
|
out vec4 FragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
// Use quarter resolution
|
||||||
|
vec2 uv = 4. * gl_FragCoord.xy / screen;
|
||||||
vec4 res = texture(tex, uv);
|
vec4 res = texture(tex, uv);
|
||||||
|
|
||||||
// Keep the sun fully bright, but fade the sky
|
// Keep the sun fully bright, but fade the sky
|
||||||
|
@ -5,11 +5,11 @@ uniform vec2 sunpos;
|
|||||||
|
|
||||||
const float decaystep = 0.88;
|
const float decaystep = 0.88;
|
||||||
|
|
||||||
in vec2 uv;
|
|
||||||
out vec4 FragColor;
|
out vec4 FragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
vec2 uv = 4. * gl_FragCoord.xy / screen;
|
||||||
vec2 texc = uv;
|
vec2 texc = uv;
|
||||||
vec2 tosun = sunpos - texc;
|
vec2 tosun = sunpos - texc;
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
in vec2 Position;
|
|
||||||
in vec2 Texcoord;
|
|
||||||
|
|
||||||
out vec4 offset[2];
|
|
||||||
out vec2 uv;
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
gl_Position = vec4(Position, 0., 1.);
|
|
||||||
vec4 invy = vec4(Texcoord, Texcoord);
|
|
||||||
// invy.y = 1.0 - invy.y;
|
|
||||||
uv = invy.st;
|
|
||||||
|
|
||||||
offset[0] = invy.xyxy + vec4(-1.0, 0.0, 0.0, 1.0) / screen.xyxy;
|
|
||||||
offset[1] = invy.xyxy + vec4( 1.0, 0.0, 0.0, -1.0) / screen.xyxy;
|
|
||||||
}
|
|
@ -554,22 +554,14 @@ void PostProcessing::renderMotionBlur(unsigned , FrameBuffer &in_fbo, FrameBuffe
|
|||||||
|
|
||||||
static void renderGodFade(GLuint tex, const SColor &col)
|
static void renderGodFade(GLuint tex, const SColor &col)
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::GodFadeShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::GodFadeShader::getInstance()->vao);
|
|
||||||
FullScreenShader::GodFadeShader::getInstance()->SetTextureUnits(tex);
|
FullScreenShader::GodFadeShader::getInstance()->SetTextureUnits(tex);
|
||||||
FullScreenShader::GodFadeShader::getInstance()->setUniforms(col);
|
DrawFullScreenEffect<FullScreenShader::GodFadeShader>(col);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void renderGodRay(GLuint tex, const core::vector2df &sunpos)
|
static void renderGodRay(GLuint tex, const core::vector2df &sunpos)
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::GodRayShader::getInstance()->Program);
|
|
||||||
glBindVertexArray(FullScreenShader::GodRayShader::getInstance()->vao);
|
|
||||||
FullScreenShader::GodRayShader::getInstance()->SetTextureUnits(tex);
|
FullScreenShader::GodRayShader::getInstance()->SetTextureUnits(tex);
|
||||||
FullScreenShader::GodRayShader::getInstance()->setUniforms(sunpos);
|
DrawFullScreenEffect<FullScreenShader::GodRayShader>(sunpos);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void toneMap(FrameBuffer &fbo, GLuint rtt, float vignette_weight)
|
static void toneMap(FrameBuffer &fbo, GLuint rtt, float vignette_weight)
|
||||||
|
@ -1978,7 +1978,6 @@ namespace FullScreenShader
|
|||||||
AssignUniforms("col");
|
AssignUniforms("col");
|
||||||
|
|
||||||
AssignSamplerNames(Program, 0, "tex");
|
AssignSamplerNames(Program, 0, "tex");
|
||||||
vao = createVAO(Program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GodRayShader::GodRayShader()
|
GodRayShader::GodRayShader()
|
||||||
@ -1989,7 +1988,6 @@ namespace FullScreenShader
|
|||||||
|
|
||||||
AssignUniforms("sunpos");
|
AssignUniforms("sunpos");
|
||||||
AssignSamplerNames(Program, 0, "tex");
|
AssignSamplerNames(Program, 0, "tex");
|
||||||
vao = createVAO(Program);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MLAAColorEdgeDetectionSHader::MLAAColorEdgeDetectionSHader()
|
MLAAColorEdgeDetectionSHader::MLAAColorEdgeDetectionSHader()
|
||||||
|
@ -619,16 +619,12 @@ public:
|
|||||||
class GodFadeShader : public ShaderHelperSingleton<GodFadeShader, video::SColorf>, public TextureRead<Bilinear_Filtered>
|
class GodFadeShader : public ShaderHelperSingleton<GodFadeShader, video::SColorf>, public TextureRead<Bilinear_Filtered>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
GodFadeShader();
|
GodFadeShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
class GodRayShader : public ShaderHelperSingleton<GodRayShader, core::vector2df>, public TextureRead<Bilinear_Filtered>
|
class GodRayShader : public ShaderHelperSingleton<GodRayShader, core::vector2df>, public TextureRead<Bilinear_Filtered>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint vao;
|
|
||||||
|
|
||||||
GodRayShader();
|
GodRayShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user