From: divverent Date: Sun, 5 Jun 2011 14:55:41 +0000 (+0000) Subject: initial attempt do do r_trippy in HLSL X-Git-Tag: xonotic-v0.5.0~129 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c65c4384a2196e3e544982ae4cbdd86591034430;p=xonotic%2Fdarkplaces.git initial attempt do do r_trippy in HLSL git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11181 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=06e741c847a22b0510d83629650954cab0834202 --- diff --git a/shader_hlsl.h b/shader_hlsl.h index 5e271ce9..c93d4724 100644 --- a/shader_hlsl.h +++ b/shader_hlsl.h @@ -27,6 +27,32 @@ "#endif\n" "#endif\n" "\n" +"#ifdef VERTEX_SHADER\n" +"#ifdef USETRIPPY\n" +"// LordHavoc: based on shader code linked at: http://www.youtube.com/watch?v=JpksyojwqzE\n" +"// tweaked scale\n" +"float4 TrippyVertex(float4 position)\n" +"(\n" +"uniform float ClientTime : register(c2)\n" +")\n" +"{\n" +" float worldTime = ClientTime;\n" +" // tweaked for Quake\n" +" worldTime *= 10.0;\n" +" position *= 0.125;\n" +" //~tweaked for Quake\n" +" float distanceSquared = (position.x * position.x + position.z * position.z);\n" +" position.y += 5.0*sin(distanceSquared*sin(worldTime/143.0)/1000.0);\n" +" float y = position.y;\n" +" float x = position.x;\n" +" float om = sin(distanceSquared*sin(worldTime/256.0)/5000.0) * sin(worldTime/200.0);\n" +" position.y = x*sin(om)+y*cos(om);\n" +" position.x = x*cos(om)-y*sin(om);\n" +" return position;\n" +"}\n" +"#endif\n" +"#endif\n" +"\n" "#ifdef MODE_DEPTH_OR_SHADOW\n" "#ifdef VERTEX_SHADER\n" "void main\n" @@ -38,6 +64,9 @@ ")\n" "{\n" " gl_Position = mul(ModelViewProjectionMatrix, gl_Vertex);\n" +"#ifdef USETRIPPY\n" +" gl_Position = TrippyVertex(gl_Position);\n" +"#endif\n" " Depth = gl_Position.z;\n" "}\n" "#endif\n" @@ -72,6 +101,9 @@ ")\n" "{\n" " gl_Position = mul(ModelViewProjectionMatrix, gl_Vertex);\n" +"#ifdef USETRIPPY\n" +" gl_Position = TrippyVertex(gl_Position);\n" +"#endif\n" " gl_FrontColor = float4(gl_Position.z, gl_Position.z, gl_Position.z, 1.0);\n" "}\n" "#endif\n" @@ -244,6 +276,9 @@ " TexCoord2 = gl_MultiTexCoord1.xy;\n" "#endif\n" " gl_Position = mul(ModelViewProjectionMatrix, gl_Vertex);\n" +"#ifdef USETRIPPY\n" +" gl_Position = TrippyVertex(gl_Position);\n" +"#endif\n" "}\n" "#endif\n" "\n" @@ -348,6 +383,9 @@ " TexCoord = mul(TexMatrix, gl_MultiTexCoord0).xy;\n" " gl_Position = mul(ModelViewProjectionMatrix, gl_Vertex);\n" " ModelViewProjectionPosition = gl_Position;\n" +"#ifdef USETRIPPY\n" +" gl_Position = TrippyVertex(gl_Position);\n" +"#endif\n" "}\n" "#endif\n" "\n" @@ -415,6 +453,9 @@ " EyeVector.z = dot(EyeVectorModelSpace, gl_MultiTexCoord3.xyz);\n" " gl_Position = mul(ModelViewProjectionMatrix, gl_Vertex);\n" " ModelViewProjectionPosition = gl_Position;\n" +"#ifdef USETRIPPY\n" +" gl_Position = TrippyVertex(gl_Position);\n" +"#endif\n" "}\n" "#endif\n" "\n" @@ -711,6 +752,9 @@ " VectorT = mul(ModelViewMatrix, float4(gl_MultiTexCoord2.xyz, 0)).xyz;\n" " VectorR.xyz = mul(ModelViewMatrix, float4(gl_MultiTexCoord3.xyz, 0)).xyz;\n" " gl_Position = mul(ModelViewProjectionMatrix, gl_Vertex);\n" +"#ifdef USETRIPPY\n" +" gl_Position = TrippyVertex(gl_Position);\n" +"#endif\n" " VectorR.w = gl_Position.z;\n" "}\n" "#endif // VERTEX_SHADER\n" @@ -1053,6 +1097,9 @@ "#ifdef USEREFLECTION\n" " ModelViewProjectionPosition = gl_Position;\n" "#endif\n" +"#ifdef USETRIPPY\n" +" gl_Position = TrippyVertex(gl_Position);\n" +"#endif\n" "}\n" "#endif // VERTEX_SHADER\n" "\n"