File: core.vert

package info (click to toggle)
performous 0.7.0%2Bgit20140715-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,900 kB
  • ctags: 3,470
  • sloc: cpp: 16,647; sh: 2,495; ansic: 2,015; python: 431; xml: 407; objc: 245; makefile: 12
file content (34 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#version 120

//DEFINES

uniform mat4 projMatrix;
uniform mat4 mvMatrix;
uniform mat3 normalMatrix;

attribute vec3 vertPos;
attribute vec2 vertTexCoord;
attribute vec3 vertNormal;
attribute vec4 vertColor;

varying vec3 lightDir;
varying vec3 vLightDir;
varying vec2 texCoord;
varying vec2 vTexCoord;
varying vec3 normal;
varying vec3 vNormal;
varying vec4 color;
varying vec4 vColor;

void main() {
	//const vec3 lightPos = vec3(0.0, -2.94, 1.0);
	const vec3 lightPos = vec3(-10.0, 2.0, 15.0);

	vec4 posEye = mvMatrix * vec4(vertPos, 1.0);  // Vertex position in eye space
	gl_Position = projMatrix * posEye;  // Vertex position in normalized device coordinates
	vLightDir = lightDir = lightPos - posEye.xyz / posEye.w;  // Light position relative to vertex
	vTexCoord = texCoord = vertTexCoord;
	vNormal = normal = normalize(normalMatrix * vertNormal);
	vColor = color = vertColor;
}