Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL120/Example_FresnelVp.glsl @ 12319

Last change on this file since 12319 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 1.0 KB
RevLine 
[12115]1#version 120
2
3attribute vec4 uv0;
4attribute vec4 position;
5attribute vec3 normal;
6
7uniform mat4 worldViewProjMatrix;
8uniform vec3 eyePosition; // object space
9uniform float timeVal;
10uniform float scale;  // the amount to scale the noise texture by
11uniform float scroll; // the amount by which to scroll the noise
12uniform float noise;  // the noise perturb as a factor of the time
13
14varying vec3 noiseCoord;
15varying vec4 projectionCoord;
16varying vec3 eyeDir;
17varying vec3 oNormal;
18
19// Vertex program for fresnel reflections / refractions
20void main()
21{
22        gl_Position = worldViewProjMatrix * position;
23        // Projective texture coordinates, adjust for mapping
24        mat4 scalemat = mat4(0.5, 0.0, 0.0, 0.0, 
25                         0.0, -0.5, 0.0, 0.0,
26                         0.0, 0.0, 0.5, 0.0,
27                         0.5, 0.5, 0.5, 1.0);
28        projectionCoord = scalemat * gl_Position;
29
30        // Noise map coords
31        noiseCoord.xy = (uv0.xy + (timeVal * scroll)) * scale;
32        noiseCoord.z = noise * timeVal;
33
34        eyeDir = normalize(position.xyz - eyePosition); 
35        oNormal = normal.rgb;
36}
Note: See TracBrowser for help on using the repository browser.