switch to glsl 1.2

actorid
scrawl 13 years ago
parent b2dcf5adcd
commit f0b3142966

2
extern/shiny vendored

@ -1 +1 @@
Subproject commit fdc92a4243c98f5d86a33cbdf2ed0fbb94dad3f6
Subproject commit 2408fda3e226dda1a1aa7bafd07a769324419b37

@ -6,7 +6,7 @@
SH_BEGIN_PROGRAM
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
shColourInput(float4)
shOutput(float4, colourPassthrough)

@ -11,6 +11,7 @@
#define shUniform(type, name) , uniform type name
#define shVertexInput(type, name) , in type name : TEXCOORD@shCounter(1)
#define shInput(type, name) , in type name : TEXCOORD@shCounter(1)
#define shOutput(type, name) , out type name : TEXCOORD@shCounter(2)
@ -52,7 +53,8 @@
#endif
#if SH_GLSL == 1
@version 130
@version 120
#define float2 vec2
#define float3 vec3
@ -61,7 +63,7 @@
#define int3 ivec3
#define int4 ivec4/
#define shTexture2D sampler2D
#define shSample(tex, coord) texture(tex, coord)
#define shSample(tex, coord) texture2D(tex, coord)
#define shLerp(a, b, t) mix(a, b, t)
#define shSaturate(a) clamp(a, 0.0, 1.0)
@ -71,13 +73,19 @@
#define shMatrixMult(m, v) (m * v)
#define shOutputPosition gl_Position
#define float4x4 mat4
// GLSL 1.3
#if 0
// automatically recognized by ogre when the input name equals this
#define shInputPosition vertex
#define shOutputPosition gl_Position
#define shOutputColour(num) oColor##num
#define float4x4 mat4
#define shInput(type, name) in type name;
#define shOutput(type, name) out type name;
@ -105,5 +113,47 @@
void main(void)
#endif
#endif
// GLSL 1.2
#if 1
// automatically recognized by ogre when the input name equals this
#define shInputPosition gl_Vertex
#define shOutputColour(num) gl_FragData[num]
#define shVertexInput(type, name) attribute type name;
#define shInput(type, name) varying type name;
#define shOutput(type, name) varying type name;
// automatically recognized by ogre when the input name equals this
#define shNormalInput(type) attribute type normal;
#define shColourInput(type) attribute type colour;
#ifdef SH_VERTEX_SHADER
#define SH_BEGIN_PROGRAM
#define SH_START_PROGRAM \
void main(void)
#endif
#ifdef SH_FRAGMENT_SHADER
#define shDeclareMrtOutput(num)
#define SH_BEGIN_PROGRAM
#define SH_START_PROGRAM \
void main(void)
#endif
#endif
#endif

@ -7,7 +7,7 @@
SH_BEGIN_PROGRAM
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
SH_START_PROGRAM

@ -28,7 +28,7 @@
SH_BEGIN_PROGRAM
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
shNormalInput(float4)
#ifdef NEED_DEPTH
@ -207,6 +207,7 @@
float3 waterEyePos = float3(1,1,1);
if (worldPos.y < waterLevel && waterEnabled == 1)
{
// NOTE: this calculation would be wrong for non-uniform scaling
float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0));
waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel);
caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed);

@ -3,7 +3,7 @@
#ifdef SH_VERTEX_SHADER
SH_BEGIN_PROGRAM
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
SH_START_PROGRAM

@ -6,7 +6,7 @@
SH_BEGIN_PROGRAM
#if ALPHA
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
#endif
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)

@ -7,7 +7,7 @@
SH_BEGIN_PROGRAM
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
shOutput(float, fade)

@ -7,7 +7,7 @@
SH_BEGIN_PROGRAM
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
SH_START_PROGRAM

@ -54,8 +54,8 @@
shUniform(float2, lodMorph) @shAutoConstant(lodMorph, custom, 1001)
shInput(float2, uv0)
shInput(float2, delta) // lodDelta, lodThreshold
shVertexInput(float2, uv0)
shVertexInput(float2, delta) // lodDelta, lodThreshold
#if SHADOWS
shUniform(float4x4, texViewProjMatrix0) @shAutoConstant(texViewProjMatrix0, texture_viewproj_matrix)
@ -226,6 +226,7 @@
float3 waterEyePos = float3(1,1,1);
if (worldPos.y < waterLevel)
{
// NOTE: this calculation would be wrong for non-uniform scaling
float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0));
waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel);
caustics = getCaustics(causticMap, worldPos, waterEyePos.xyz, worldNormal.xyz, lightDirectionWS0.xyz, waterLevel, waterTimer, windDir_windSpeed);

@ -15,7 +15,7 @@
SH_BEGIN_PROGRAM
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
shOutput(float, depth)
@ -67,7 +67,7 @@
SH_BEGIN_PROGRAM
shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix)
shInput(float2, uv0)
shVertexInput(float2, uv0)
shOutput(float2, UV)
shOutput(float3, screenCoordsPassthrough)

Loading…
Cancel
Save