8,303
社区成员
发帖
与我相关
我的任务
分享
/// <summary>The brightness offset.</summary>
/// <minValue>-1</minValue>
/// <maxValue>1</maxValue>
/// <defaultValue>0</defaultValue>
float Brightness : register(c1);
/// <summary>The contrast multiplier.</summary>
/// <minValue>0</minValue>
/// <maxValue>2</maxValue>
/// <defaultValue>1.5</defaultValue>
float Contrast : register(c2);
float top : register(c4);
float left : register(c5);
float bottom : register(c6);
float right : register(c7);
struct PS_INPUT
{
float4 Position : POSITION;
float2 Texture : TEXCOORD;
};
sampler2D Samp : register(S0);
float4 ApplyAdjustments(float4 color)
{
color.rgb /= color.a;
// Apply contrast.
color.rgb =((color.rgb - 0.5f) * max(Contrast, 0)) + 0.5f;
// Apply brightness.
color.rgb += Brightness;
// Return final pixel color.
color.rgb *= color.a;
return color;
}
//float4 main(float2 uv : TEXCOORD) : COLOR
float4 ps_main( in PS_INPUT In ) : COLOR0
{
float2 samplePoint;
samplePoint = In.Texture.xy;
float4 color = tex2D(Samp, samplePoint);
if (samplePoint.y < top)
{
return color;
}
if (samplePoint.x < left)
{
return color;
}
if (samplePoint.y > bottom)
{
return color;
}
if (samplePoint.x > right)
{
return color;
}
color = ApplyAdjustments(color);
return color;
}