improving aspect ratio and window resize/scaling. done for game objects.

This commit is contained in:
Andreas Ortmann 2016-10-02 11:00:03 +02:00
parent 1562dbe8a7
commit 4353609580
14 changed files with 209 additions and 109 deletions

View file

@ -9,11 +9,12 @@ varying vec3 lightDirection;
uniform mat4 model;
uniform vec3 lightPosition;
uniform float aspectRatio;
void main()
{
// TODO: this becomes invalid when projection matrices are used
vec3 p = (model*vec4(in_vertex, 1.0)).xyz;
vec3 p = (model*vec4(in_vertex/vec3(aspectRatio, 1.0, 1.0), 1.0)).xyz;
lightDirection = normalize(lightPosition - p);
vertex = p.xyz;

View file

@ -4,7 +4,6 @@ varying vec3 velocity;
varying float decay;
varying float explCenterDist;
uniform vec3 explCenter;
vec3 hsv2rgb(vec3 c)
{

View file

@ -14,6 +14,8 @@ varying vec3 velocity;
varying vec2 vertex;
varying float explCenterDist;
uniform float aspectRatio;
// TODO: rotate to face the user!
void main()
{
@ -38,5 +40,5 @@ void main()
vertex = base.xy;
velocity = in_velocity;
explCenterDist = length(explCenter-offset);
explCenterDist = length(explCenter - offset);
}