UltimateZoneBuilder/Source/Core/Resources/world3d_skybox.vp
2019-12-21 01:26:58 +01:00

22 lines
552 B
Text

in vec3 AttrPosition;
in vec2 AttrUV;
out vec3 Tex;
out vec4 viewpos;
uniform mat4 world;
uniform mat4 view;
uniform mat4 projection;
uniform vec4 campos; //w is set to fade factor (distance, at wich fog color completely overrides pixel color)
void main()
{
viewpos = view * world * vec4(AttrPosition, 1.0);
gl_Position = projection * viewpos;
vec3 worldpos = (world * vec4(AttrPosition, 1.0)).xyz;
vec4 skynormal = vec4(0.0, 1.0, 0.0, 0.0);
vec3 normal = normalize((world * skynormal).xyz);
Tex = reflect(worldpos - campos.xyz, normal);
}