Wraps gl_Position in a macro to avoid duplication for different versions.
This was SVN commit r27198.
This commit is contained in:
parent
eea6c21d40
commit
e2f433db8c
@ -1,5 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform vec4 transform;
|
||||
uniform vec2 translation;
|
||||
|
||||
@ -11,5 +13,5 @@ varying vec2 v_uv;
|
||||
void main()
|
||||
{
|
||||
v_uv = a_uv0;
|
||||
gl_Position = vec4(mat2(transform.xy, transform.zw) * a_vertex + translation, 0.0, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(vec4(mat2(transform.xy, transform.zw) * a_vertex + translation, 0.0, 1.0));
|
||||
}
|
||||
|
7
binaries/data/mods/mod/shaders/glsl/common/vertex.h
Normal file
7
binaries/data/mods/mod/shaders/glsl/common/vertex.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef INCLUDED_COMMON_VERTEX
|
||||
#define INCLUDED_COMMON_VERTEX
|
||||
|
||||
#define OUTPUT_VERTEX_POSITION(position) \
|
||||
gl_Position = position;
|
||||
|
||||
#endif // INCLUDED_COMMON_VERTEX
|
@ -1,13 +1,15 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
varying vec2 v_tex;
|
||||
|
||||
attribute vec3 a_vertex;
|
||||
attribute vec2 a_uv0;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(a_vertex, 1.0);
|
||||
{
|
||||
OUTPUT_VERTEX_POSITION(vec4(a_vertex, 1.0));
|
||||
|
||||
v_tex = a_uv0;
|
||||
v_tex = a_uv0;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
#if DEBUG_TEXTURED
|
||||
uniform mat4 textureTransform;
|
||||
@ -18,5 +20,5 @@ void main()
|
||||
#if DEBUG_TEXTURED
|
||||
v_tex = (textureTransform * vec4(a_uv0, 1.0)).xy;
|
||||
#endif
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
attribute vec3 a_vertex;
|
||||
|
||||
uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
|
||||
varying vec2 v_tex;
|
||||
@ -9,6 +11,6 @@ attribute vec2 a_uv0;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
v_tex = a_uv0;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform vec2 losTransform;
|
||||
|
||||
@ -12,8 +14,8 @@ attribute vec2 a_uv0;
|
||||
varying vec2 v_los;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(a_vertex, 1.0);
|
||||
{
|
||||
OUTPUT_VERTEX_POSITION(vec4(a_vertex, 1.0));
|
||||
|
||||
v_tex = a_uv0;
|
||||
v_tex = a_uv0;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform vec4 transform;
|
||||
uniform vec4 translation;
|
||||
uniform vec4 textureTransform;
|
||||
@ -44,5 +46,5 @@ void main()
|
||||
color = a_color;
|
||||
#endif // MINIMAP_POINT
|
||||
|
||||
gl_Position = vec4(mat2(transform.xy, transform.zw) * position + translation.xy, 0.0, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(vec4(mat2(transform.xy, transform.zw) * position + translation.xy, 0.0, 1.0));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/shadows_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform vec3 cameraPos;
|
||||
@ -132,7 +133,7 @@ void main()
|
||||
#endif
|
||||
|
||||
|
||||
gl_Position = transform * position;
|
||||
OUTPUT_VERTEX_POSITION(transform * position);
|
||||
|
||||
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX
|
||||
v_normal.xyz = normal;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/shadows_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform vec3 cameraPos;
|
||||
@ -38,5 +39,5 @@ void main()
|
||||
|
||||
calculateLOSCoordinates(worldPos.xz);
|
||||
|
||||
gl_Position = transform * worldPos;
|
||||
OUTPUT_VERTEX_POSITION(transform * worldPos);
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/shadows_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform vec3 cameraPos;
|
||||
@ -43,5 +44,5 @@ void main()
|
||||
v_normal = normalMatrix * a_normal;
|
||||
v_lighting = max(0.0, dot(v_normal, -sunDir)) * sunColor;
|
||||
|
||||
gl_Position = transform * worldPos;
|
||||
OUTPUT_VERTEX_POSITION(transform * worldPos);
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 120
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform mat4 instancingTransform;
|
||||
|
||||
@ -8,5 +10,5 @@ attribute vec3 a_vertex;
|
||||
void main()
|
||||
{
|
||||
vec4 worldPos = instancingTransform * vec4(a_vertex, 1.0);
|
||||
gl_Position = transform * worldPos;
|
||||
OUTPUT_VERTEX_POSITION(transform * worldPos);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#version 120
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
|
||||
@ -21,5 +22,5 @@ void main()
|
||||
#if !USE_OBJECTCOLOR
|
||||
v_color = a_color;
|
||||
#endif
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform mat4 modelViewMatrix;
|
||||
@ -21,7 +22,7 @@ void main()
|
||||
|
||||
vec3 position = axis1*offset.x + axis1*offset.y + axis2*offset.x + axis2*-offset.y + a_vertex;
|
||||
|
||||
gl_Position = transform * vec4(position, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(position, 1.0));
|
||||
|
||||
calculateLOSCoordinates(position.xz);
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
varying vec3 v_tex;
|
||||
attribute vec3 a_vertex;
|
||||
attribute vec3 a_uv0;
|
||||
@ -8,6 +10,6 @@ uniform mat4 transform;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
v_tex = a_uv0.xyz;
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
v_tex = a_uv0.xyz;
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
|
||||
attribute vec3 a_vertex;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/shadows_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 transform;
|
||||
uniform vec3 cameraPos;
|
||||
@ -45,7 +46,7 @@ void main()
|
||||
{
|
||||
vec4 position = vec4(a_vertex, 1.0);
|
||||
|
||||
gl_Position = transform * position;
|
||||
OUTPUT_VERTEX_POSITION(transform * position);
|
||||
|
||||
v_lighting = clamp(-dot(a_normal, sunDir), 0.0, 1.0) * sunColor;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/shadows_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
uniform mat4 reflectionMatrix;
|
||||
uniform mat4 refractionMatrix;
|
||||
@ -68,5 +69,5 @@ void main()
|
||||
// Fix the waviness for local wind strength
|
||||
fwaviness = waviness * (0.15 + a_waterInfo.r / 1.15);
|
||||
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/los_vertex.h"
|
||||
#include "common/vertex.h"
|
||||
|
||||
attribute vec3 a_vertex;
|
||||
|
||||
@ -18,5 +19,5 @@ void main()
|
||||
|
||||
v_coords = a_vertex.xz / repeatPeriod + vec2(tx, tz);
|
||||
calculateLOSCoordinates(a_vertex.xz);
|
||||
gl_Position = transform * vec4(a_vertex, 1.0);
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(a_vertex, 1.0));
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#version 110
|
||||
|
||||
#include "common/vertex.h"
|
||||
|
||||
attribute vec2 a_uv0;
|
||||
|
||||
attribute vec2 a_normal;
|
||||
@ -22,13 +24,13 @@ void main()
|
||||
{
|
||||
normal = a_normal;
|
||||
gl_TexCoord[0].xy = a_uv0.xy;
|
||||
|
||||
|
||||
float tttime = mod(time + translation ,10.0);
|
||||
ttime = tttime;
|
||||
|
||||
|
||||
vec3 pos = mix(a_basePosition,a_apexPosition, clamp(ttime/3.0,0.0,1.0));
|
||||
pos = mix (pos, a_splashPosition, clamp(sin((min(ttime,6.1415926536)-3.0)/2.0),0.0,1.0));
|
||||
pos = mix (pos, a_retreatPosition, clamp( 1.0 - cos(max(0.0,ttime-6.1415926536)/2.0) ,0.0,1.0));
|
||||
|
||||
gl_Position = transform * vec4(pos, 1.0);
|
||||
|
||||
OUTPUT_VERTEX_POSITION(transform * vec4(pos, 1.0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user