Skip to content

Commit

Permalink
Renderer|FX|LensFlares: Aspect correction in view space
Browse files Browse the repository at this point in the history
Calculate the appropriate view unit vector. This is dependent on the
GL viewport.
  • Loading branch information
skyjake committed Nov 18, 2013
1 parent 314e57a commit 8d7b84c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions doomsday/client/data/shaders/lensflares.vsh
Expand Up @@ -7,8 +7,6 @@ varying highp vec2 vUV;

void main(void) {
gl_Position = uMvpMatrix * aVertex;
gl_Position.xyz /= gl_Position.w;
gl_Position.w = 1.0;
gl_Position.xy += aUV2 * uViewUnit;
gl_Position.xy += aUV2 * uViewUnit * vec2(gl_Position.w);
vUV = aUV;
}
5 changes: 3 additions & 2 deletions doomsday/client/src/render/fx/lensflares.cpp
Expand Up @@ -246,9 +246,10 @@ void fx::LensFlares::beginFrame()

void LensFlares::draw()
{
//Rectanglef const rect = viewRect();
Rectanglef const rect = viewRect();
float const aspect = rect.height() / rect.width();

d->uViewUnit = Vector2f(1, 1);
d->uViewUnit = Vector2f(aspect, 1.f);
d->uMvpMatrix = GL_GetProjectionMatrix() * Rend_GetModelViewMatrix(console());

GLState::push()
Expand Down

0 comments on commit 8d7b84c

Please sign in to comment.