Created
December 16, 2015 04:09
-
-
Save ItsSpyce/3bc95643abdffb4ab1f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float4x4 World; | |
float4x4 View; | |
float4x4 Projection; | |
float3 CameraPosition; | |
float WaveTime; | |
Texture Texture1; | |
sampler Texture1Sampler = sampler_state { | |
texture = <Texture1>; | |
magfilter = POINT; | |
minfilter = POINT; | |
mipfilter = POINT; | |
AddressU = WRAP; | |
AddressV = WRAP; | |
}; | |
struct VertexShaderInput { | |
float4 Position : POSITION0; | |
float2 TexCoords : TEXCOORD0; | |
float SunLight : COLOR0; | |
float3 LocalLight : COLOR1; | |
}; | |
struct VertexShaderOutput { | |
float4 Position : POSITION0; | |
float2 TexCoords : TEXCOORD0; | |
float3 CameraView : TEXCOORD1; | |
float Distance : TEXCOORD2; | |
}; | |
VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { | |
VertexShaderOutput output; | |
float4 worldPosition = mul(input.Position, World); | |
float4 viewPosition = mul(worldPosition, View); | |
output.Position = mul(viewPosition, Projection); | |
output.CameraView = normalize(CameraPosition - worldPosition); | |
output.Distance = length(CameraPosition - worldPosition); | |
output.Position.x += (0.2f * sin(WaveTime + input.Position.z * 2)) - 0.2f; | |
output.TexCoords = input.TexCoords; | |
return output; | |
} | |
technique BlockTechnique { | |
pass Pass1 { | |
VertexShader = compile vs_4_0 VertexShaderFunction(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment