DonkeyKong64 grind crash
[carveJwlIkooP6JGAAIwe30JlM.git] / shaders / scene_cubemapped.fs
1 uniform sampler2D uTexGarbage;
2 uniform sampler2D uTexMain;
3 uniform samplerCube uTexCubemap;
4 uniform vec3 uCamera;
5 uniform vec4 uPlane;
6 uniform vec4 uColour;
7
8 #include "common_scene.glsl"
9 #include "motion_vectors_fs.glsl"
10
11 void main()
12 {
13 compute_motion_vectors();
14
15 vec3 vfrag = vec3(0.5,0.5,0.5);
16 vec4 vsamplemain = texture( uTexMain, aUv );
17 vec4 wgarbage = texture( uTexGarbage, aCo.xz * 0.0015 + aCo.yx*0.002 );
18 vec3 qnorm = aNorm.xyz;
19 vfrag = vsamplemain.rgb;
20
21 if( g_light_preview == 1 ){
22 vfrag = vec3(0.5);
23 }
24
25 vfrag = scene_compute_lighting( vfrag, qnorm, aWorldCo );
26 oColour = vec4( vfrag, 1.0 );
27
28 vec3 halfdir = normalize( aWorldCo - uCamera );
29 vec3 reflectdir = reflect( halfdir, qnorm );
30 oColour = mix( oColour,
31 vec4(texture(uTexCubemap,reflectdir).rgb * uColour.rgb, 1.0),
32 uColour.a*wgarbage.b );
33 }