adding camera to 3d render. angles not yet working.

This commit is contained in:
Andreas Ortmann 2016-10-04 16:09:15 +02:00
parent 14e08db4ca
commit 602d0bb342
12 changed files with 197 additions and 29 deletions

View file

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

View file

@ -28,6 +28,8 @@ void main()
//decay = max(decay*decay, sqrt(decay));
decay = ageMod / halfAge;
//vec3 av = vec3(aspectRatio, 1.0, 1.0);
// faster particles are smaller
// TODO: scale by time too! scale down fast after 3 halfAges
float scaleBySpeed = (1.0 - 0.95*length(in_velocity)/maxVelocity);
@ -39,6 +41,7 @@ void main()
if (md > in_maxDist) {
move *= in_maxDist / md;
}
vec3 offset = move + in_position;
p += offset;