This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
csce441pine64backup/L07/resources/vert.glsl

21 lines
564 B
Text
Raw Normal View History

2017-02-28 14:06:03 -06:00
#version 120
uniform mat4 P;
uniform mat4 MV;
attribute vec4 aPos; // In object space
attribute vec3 aNor; // In object space
varying vec3 color;
2017-05-02 16:30:58 -05:00
uniform float t;
2017-02-28 14:06:03 -06:00
void main()
{
2017-05-02 16:30:58 -05:00
vec4 temp = aPos;
temp.z = (cos(20*aPos.x + t) + sin(20*aPos.y + t))/20.0;
gl_Position = P * MV * temp;
2017-02-28 14:06:03 -06:00
vec3 l = vec3(0.0, 0.0, 1.0); // In camera space
2017-05-02 16:30:58 -05:00
vec3 tempn = aNor;
tempn.z = (cos(20*aPos.x + t) + sin(20*aPos.y + t))/20.0;
vec4 n = MV * vec4(tempn, 0.0);
2017-02-28 14:06:03 -06:00
color = vec3((n.x*l.x + n.y*l.y + n.z*l.z), (n.x*l.x + n.y*l.y + n.z*l.z), (n.x*l.x + n.y*l.y + n.z*l.z));
}