Changes to GLSL files for OpenGL

This commit is contained in:
LuisAntonRebollo 2014-04-13 19:48:51 +02:00
parent 2142d452d4
commit 6aea37b407
98 changed files with 3366 additions and 2686 deletions

View file

@ -23,8 +23,10 @@
#include "../terrain.glsl"
#include "../../gl/hlslCompat.glsl"
varying vec2 layerCoord;
varying vec2 texCoord;
in vec2 layerCoord;
#define IN_layerCoord layerCoord
in vec2 texCoord;
#define IN_texCoord texCoord
uniform sampler2D layerTex;
uniform sampler2D textureMap;
@ -33,12 +35,12 @@ uniform float layerSize;
void main()
{
vec4 layerSample = round(texture2D( layerTex, layerCoord ) * 255.0);
vec4 layerSample = round(texture( layerTex, IN_layerCoord ) * 255.0);
float blend = calcBlend( texId, layerCoord, layerSize, layerSample );
float blend = calcBlend( texId, IN_layerCoord, layerSize, layerSample );
if(blend - 0.0001 < 0.0)
discard;
gl_FragColor = vec4( texture2D( textureMap, texCoord ).rgb, blend );
OUT_FragColor0 = vec4( texture( textureMap, IN_texCoord ).rgb, blend );
}

View file

@ -23,14 +23,19 @@
/// The vertex shader used in the generation and caching of the
/// base terrain texture.
varying vec2 layerCoord;
varying vec2 texCoord;
in vec4 vPosition;
in vec2 vTexCoord0;
out vec2 layerCoord;
out vec2 texCoord;
uniform vec2 texScale;
void main()
{
gl_Position = vec4(gl_Vertex.xyz, 1.0);
layerCoord = gl_MultiTexCoord0.st;
texCoord = gl_MultiTexCoord0.st * texScale;
gl_Position = vec4(vPosition.xyz, 1.0);
layerCoord = vTexCoord0.st;
texCoord = vTexCoord0.st * texScale;
gl_Position.y *= -1;
}