C,
pasted
on Dec 20:
|
// This is HLSL Script
float2 ScreenSize; // {width, height } 1024x800等
float2 ScreenToViewport( float2 screenPos )
{
screenPos -= 0.5f;
float2 result = screenPos.xy / ScreenSize.xy * 2 - 1;
result.y = -result.y;
return result;
}
void NonProjectionVS(
float3 position : POSITION0, // pixcel座標系 Z値有効
float2 texCoord : TEXCOORD0, // 一枚全てなら0..1
float4 color : COLOR0, // 頂点カラー
out float4 outputPosition : POSITION0, //View座標系
out float2 outputTexCoord : TEXCOORD0,
out float4 outputColor : COLOR0 )
{
float2 pos = ScreenToViewport( position.xy );
outputPosition = float4( pos.x, pos.y, position.z, 1 );
outputTexCoord = texCoord;
outputColor = color;
}
void PS( inout float4 color : COLOR0, float2 texCoord : TEXCOORD0 )
{
color *= tex2D(TextureSampler, texCoord);
}
technique NonProjection
{
pass Pass1
{
VertexShader = compile vs_1_1 NonProjectionVS();
PixelShader = compile ps_1_1 PS();
}
}
|
Output:
|
Line 2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ScreenSize'
Line 3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ScreenToViewport'
Line 11: error: expected ')' before 'position'
Line 24: error: expected ')' before 'float4'
Line 28: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'NonProjection'
|
|