<commit_before>#include "reconstructPositionHF.hlsli"
#include "tangentComputeHF.hlsli"
#include "packHF.hlsli"

//Texture2D<float> xSceneDepthMap:register(t1);
//Texture2D<float4> xTexture:register(t2);
//Texture2D<float4> xNormal:register(t3);

// texture_0	: texture map
// texture_1	: normal map

struct VertexToPixel{
	float4 pos			: SV_POSITION;
	float4 pos2D		: POSITION2D;
};
struct PixelOutputType
{
	float4 col	: SV_TARGET0;
	//float4 nor	: SV_TARGET1;
};

CBUFFER(DecalCB, CBSLOT_RENDERER_DECAL)
{
	float4x4 xDecalVP;
	int hasTexNor;
	float3 eye;
	float opacity;
	float3 front;
}

PixelOutputType main(VertexToPixel PSIn)
{
	PixelOutputType Out = (PixelOutputType)0;

	float2 screenPos = PSIn.pos2D.xy / PSIn.pos2D.w * float2(0.5f,-0.5f) + 0.5f;
	float depth = texture_depth.Load(int3(PSIn.pos.xy,0)).r;
	float3 pos3D = getPosition(screenPos,depth);

	float3 clipSpace = mul(float4(pos3D, 1), xDecalVP).xyz;
	float3 projTex = clipSpace.xyz*float3(0.5f, -0.5f, 0.5f) + 0.5f;
	
	clip( ((saturate(projTex.x) == projTex.x) && (saturate(projTex.y) == projTex.y) && (saturate(projTex.z) == projTex.z))?1:-1 );

	//if (hasTexNor & 0x0000010){
	//	float3 normal = normalize(cross(ddx(pos3D), ddy(pos3D)));
	//	//clip( dot(normal,front)>-0.2?-1:1 ); //clip at oblique angle
	//	float4 nortex=texture_1.Sample(sampler_aniso_clamp,projTex.xy);
	//	float3 eyevector = normalize( eye - pos3D );
	//	if(nortex.a>0){
	//		float3 T, B;
	//		float3x3 tangentFrame = compute_tangent_frame(normal, eyevector, -projTex.xy, T, B);
	//		float3 bumpColor = 2.0f * nortex.rgb - 1.0f;
	//		//bumpColor.g*=-1;
	//		normal = normalize(mul(bumpColor, tangentFrame));
	//	}
	//	Out.nor.a=min(nortex.b,nortex.a);
	//	Out.nor.xyz=normal;
	//}
	if(hasTexNor & 0x0000001){
		Out.col=texture_0.Sample(sampler_objectshader,projTex.xy);
		Out.col.a*=opacity;
		float3 edgeBlend = clipSpace.xyz;
		edgeBlend = abs(edgeBlend);
		Out.col.a *= 1 - pow(max(max(edgeBlend.x, edgeBlend.y), edgeBlend.z), 8);
		//Out.col.a *= pow(saturate(-dot(normal,front)), 4);
		ALPHATEST(Out.col.a)
		//if(hasTexNor & 0x0000010)
		//	Out.nor.a=Out.col.a;
	}

	//Out.nor = float4(encode(Out.nor.xyz), 0, Out.nor.a);

	return Out;
}<commit_msg>removed deferred decal alpha test<commit_after>#include "reconstructPositionHF.hlsli"
#include "tangentComputeHF.hlsli"
#include "packHF.hlsli"

//Texture2D<float> xSceneDepthMap:register(t1);
//Texture2D<float4> xTexture:register(t2);
//Texture2D<float4> xNormal:register(t3);

// texture_0	: texture map
// texture_1	: normal map

struct VertexToPixel{
	float4 pos			: SV_POSITION;
	float4 pos2D		: POSITION2D;
};
struct PixelOutputType
{
	float4 col	: SV_TARGET0;
	//float4 nor	: SV_TARGET1;
};

CBUFFER(DecalCB, CBSLOT_RENDERER_DECAL)
{
	float4x4 xDecalVP;
	int hasTexNor;
	float3 eye;
	float opacity;
	float3 front;
}

PixelOutputType main(VertexToPixel PSIn)
{
	PixelOutputType Out = (PixelOutputType)0;

	float2 screenPos = PSIn.pos2D.xy / PSIn.pos2D.w * float2(0.5f,-0.5f) + 0.5f;
	float depth = texture_depth.Load(int3(PSIn.pos.xy,0)).r;
	float3 pos3D = getPosition(screenPos,depth);

	float3 clipSpace = mul(float4(pos3D, 1), xDecalVP).xyz;
	float3 projTex = clipSpace.xyz*float3(0.5f, -0.5f, 0.5f) + 0.5f;
	
	clip( ((saturate(projTex.x) == projTex.x) && (saturate(projTex.y) == projTex.y) && (saturate(projTex.z) == projTex.z))?1:-1 );

	//if (hasTexNor & 0x0000010){
	//	float3 normal = normalize(cross(ddx(pos3D), ddy(pos3D)));
	//	//clip( dot(normal,front)>-0.2?-1:1 ); //clip at oblique angle
	//	float4 nortex=texture_1.Sample(sampler_aniso_clamp,projTex.xy);
	//	float3 eyevector = normalize( eye - pos3D );
	//	if(nortex.a>0){
	//		float3 T, B;
	//		float3x3 tangentFrame = compute_tangent_frame(normal, eyevector, -projTex.xy, T, B);
	//		float3 bumpColor = 2.0f * nortex.rgb - 1.0f;
	//		//bumpColor.g*=-1;
	//		normal = normalize(mul(bumpColor, tangentFrame));
	//	}
	//	Out.nor.a=min(nortex.b,nortex.a);
	//	Out.nor.xyz=normal;
	//}
	if(hasTexNor & 0x0000001){
		Out.col=texture_0.Sample(sampler_objectshader,projTex.xy);
		Out.col.a*=opacity;
		float3 edgeBlend = clipSpace.xyz;
		edgeBlend = abs(edgeBlend);
		Out.col.a *= 1 - pow(max(max(edgeBlend.x, edgeBlend.y), edgeBlend.z), 8);
		//Out.col.a *= pow(saturate(-dot(normal,front)), 4);
		//ALPHATEST(Out.col.a)
		//if(hasTexNor & 0x0000010)
		//	Out.nor.a=Out.col.a;
	}

	//Out.nor = float4(encode(Out.nor.xyz), 0, Out.nor.a);

	return Out;
}
{'fraction_non_alphanumeric': 0.17617753623188406, 'fraction_numerical': 0.04755434782608696, 'mean_word_length': 4.166081871345029, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3917093', 'n_tokens_mistral': 2098, 'n_tokens_neox': 1950, 'n_words': 308}