47 lines
		
	
	
		
			898 B
		
	
	
	
		
			HLSL
		
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			898 B
		
	
	
	
		
			HLSL
		
	
	
| #include "Macros.fxh"
 | |
| 
 | |
| BEGIN_CONSTANTS
 | |
| 
 | |
| MATRIX_CONSTANTS
 | |
| 
 | |
|     float4x4 World             _vs(c0)             _cb(c0);
 | |
|     float4x4 ViewProjection    _vs(c4)             _cb(c4);
 | |
| 
 | |
| END_CONSTANTS
 | |
| 
 | |
| struct VertexShaderInput
 | |
| {
 | |
|     float4 Position : POSITION;
 | |
| };
 | |
| 
 | |
| struct VertexShaderOutput
 | |
| {
 | |
|     float4 Position : SV_POSITION;
 | |
|     float Depth : TEXCOORD0;
 | |
| };
 | |
| 
 | |
| VertexShaderOutput main_vs(VertexShaderInput input)
 | |
| {
 | |
|     VertexShaderOutput output;
 | |
| 
 | |
|     float4x4 worldViewProjection = mul(World, ViewProjection);
 | |
|     output.Position = mul(input.Position, worldViewProjection);
 | |
|     output.Depth = output.Position.z / output.Position.w;
 | |
| 
 | |
|     return output;
 | |
| }
 | |
| 
 | |
| float4 main_ps(VertexShaderOutput input) : SV_TARGET0
 | |
| {
 | |
|     return float4(input.Depth, 0.0, 0.0, 0.0);
 | |
| }
 | |
| 
 | |
| Technique SimpleDepth
 | |
| {
 | |
|     Pass
 | |
|     {
 | |
|         VertexShader = compile vs_3_0 main_vs();
 | |
|         PixelShader  = compile ps_3_0 main_ps();
 | |
|     }
 | |
| }
 |