Cirno2022/script/sample/SamplePS02_HLSL.txt

86 lines
1.9 KiB
Plaintext
Raw Normal View History

//================================================================
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݒ<EFBFBD><DD92>l
//Texture
sampler sampler0_ : register(s0);
//--------------------------------
//<2F>}<7D>X<EFBFBD>N<EFBFBD>p<EFBFBD>e<EFBFBD>N<EFBFBD>X<EFBFBD>`<60><>
//<2F><><EFBFBD>ʕ<EFBFBD>(<28>}<7D>X<EFBFBD>N<EFBFBD>e<EFBFBD>N<EFBFBD>X<EFBFBD>`<60><><EFBFBD>T<EFBFBD>C<EFBFBD>Y)
const float SCREEN_WIDTH = 640;
const float SCREEN_HEIGHT = 480;
texture textureMask_;
sampler samplerMask_ = sampler_state
{
Texture = <textureMask_>;
};
//================================================================
//--------------------------------
//<2F>s<EFBFBD>N<EFBFBD>Z<EFBFBD><5A><EFBFBD>V<EFBFBD>F<EFBFBD>[<5B>_<EFBFBD><5F><EFBFBD>͒l
struct PS_INPUT
{
float4 diffuse : COLOR0; //<2F>f<EFBFBD>B<EFBFBD>t<EFBFBD><74><EFBFBD>[<5B>Y<EFBFBD>F
float2 texCoord : TEXCOORD0; //<2F>e<EFBFBD>N<EFBFBD>X<EFBFBD>`<60><><EFBFBD><EFBFBD><EFBFBD>W
float2 vPos : VPOS; //<2F>`<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>W
};
//--------------------------------
//<2F>s<EFBFBD>N<EFBFBD>Z<EFBFBD><5A><EFBFBD>V<EFBFBD>F<EFBFBD>[<5B>_<EFBFBD>o<EFBFBD>͒l
struct PS_OUTPUT
{
float4 color : COLOR0; //<2F>o<EFBFBD>͐F
};
//================================================================
// <20>V<EFBFBD>F<EFBFBD>[<5B>_
//--------------------------------
//<2F>s<EFBFBD>N<EFBFBD>Z<EFBFBD><5A><EFBFBD>V<EFBFBD>F<EFBFBD>[<5B>_
PS_OUTPUT PsMask( PS_INPUT In ) : COLOR0
{
PS_OUTPUT Out;
//<2F>e<EFBFBD>N<EFBFBD>X<EFBFBD>`<60><><EFBFBD>̐F
float4 colorTexture = tex2D(sampler0_, In.texCoord);
//<2F><><EFBFBD>_<EFBFBD>f<EFBFBD>B<EFBFBD>t<EFBFBD>[<5B>Y<EFBFBD>F
float4 colorDiffuse = In.diffuse;
//<2F><><EFBFBD><EFBFBD>
float4 color = colorTexture * colorDiffuse;
Out.color = color;
if(color.a > 0)
{
//--------------------------------
//<2F>}<7D>X<EFBFBD>N<EFBFBD>p<EFBFBD>̃e<CC83>N<EFBFBD>X<EFBFBD>`<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F<EFBFBD><46><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//UV<55>ł̈ʒu<CA92>͉摜<CD89>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>̉<EFBFBD><CC89><EFBFBD><EFBFBD>ƍ<EFBFBD><C68D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̊<EFBFBD><CC8A><EFBFBD>
//<2F><EFBFBD>΁A640x480<38>̉摜<CC89>̈ʒu(320,240)<29><>UV<55>ł<EFBFBD>0.5,0.5<EFBFBD>ɂȂ<EFBFBD><EFBFBD>B
float2 maskUV;
//<2F>`<60><><EFBFBD><EFBFBD><E682A9><EFBFBD>}<7D>X<EFBFBD>N<EFBFBD>p<EFBFBD>e<EFBFBD>N<EFBFBD>X<EFBFBD>`<60><><EFBFBD>̈ʒu<CA92><75><EFBFBD>v<EFBFBD>Z
maskUV.x = In.vPos.x / SCREEN_WIDTH;
maskUV.y = In.vPos.y / SCREEN_HEIGHT;
float4 colorMask = tex2D(samplerMask_, maskUV);
//<2F>}<7D>X<EFBFBD>N<EFBFBD><4E>RGB<47>l<EFBFBD><6C><EFBFBD>o<EFBFBD>͌<EFBFBD><CD8C>ʂ̃<CA82><CC83>l<EFBFBD>Ƃ<EFBFBD><C682>č<EFBFBD><C48D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Out.color.a = ( colorMask.r + colorMask.g + colorMask.b ) * 0.3333f * color.a;
}
return Out;
}
//================================================================
//--------------------------------
//technique
technique TecMask
{
pass P0
{
PixelShader = compile ps_3_0 PsMask();
}
}