]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
initial attempt do do r_trippy in HLSL
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Jun 2011 14:55:41 +0000 (14:55 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 8 Jun 2011 19:22:58 +0000 (21:22 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11181 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=06e741c847a22b0510d83629650954cab0834202

shader_hlsl.h

index 5e271ce942029f8cc21066878cce4ae298ef54dd..c93d4724ddcf2934344e261e34ccac0a2aa1af2a 100644 (file)
 "#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"
 ")\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"
 "      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"
 "      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"
 "      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"
 "      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"
 "#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"