mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-04 00:56:39 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			51 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
void main_vp(
 | 
						|
	float4 position : POSITION,
 | 
						|
	float2 uv : TEXCOORD0,
 | 
						|
 | 
						|
	out float4 oPosition : POSITION,
 | 
						|
	out float2 oDepth : TEXCOORD0,
 | 
						|
	out float2 oUv : TEXCOORD1,
 | 
						|
 | 
						|
	uniform float4x4 wvpMat)
 | 
						|
{
 | 
						|
	// this is the view space position
 | 
						|
	oPosition = mul(wvpMat, position);
 | 
						|
 | 
						|
	// depth info for the fragment.
 | 
						|
	oDepth.x = oPosition.z;
 | 
						|
	oDepth.y = oPosition.w;
 | 
						|
 | 
						|
	// clamp z to zero. seem to do the trick. :-/
 | 
						|
	oPosition.z = max(oPosition.z, 0);
 | 
						|
 | 
						|
	oUv = uv;
 | 
						|
}
 | 
						|
 | 
						|
void main_fp(
 | 
						|
	float2 depth : TEXCOORD0,
 | 
						|
	float2 uv : TEXCOORD1,
 | 
						|
    uniform sampler2D texture1 : register(s0),
 | 
						|
 | 
						|
	out float4 oColour : COLOR)
 | 
						|
{
 | 
						|
	float finalDepth = depth.x / depth.y;
 | 
						|
 | 
						|
    // use alpha channel of the first texture
 | 
						|
    float alpha = tex2D(texture1, uv).a;
 | 
						|
 | 
						|
    // discard if alpha is less than 0.5
 | 
						|
    clip((alpha >= 0.5) ? 1 : -1);
 | 
						|
 | 
						|
	oColour = float4(finalDepth, finalDepth, finalDepth, 1);
 | 
						|
}
 | 
						|
 | 
						|
void main_fp_noalpha(
 | 
						|
	float2 depth : TEXCOORD0,
 | 
						|
	float2 uv : TEXCOORD1,
 | 
						|
 | 
						|
	out float4 oColour : COLOR)
 | 
						|
{
 | 
						|
	float finalDepth = depth.x / depth.y;
 | 
						|
 | 
						|
	oColour = float4(finalDepth, finalDepth, finalDepth, 1);
 | 
						|
}
 |