📄 qpaintengine_d3d.fx
字号:
{ VS_NORMAL Output; Output.Position = mul(In.Position, g_mTransformation); Output.Position = mul(Output.Position, g_mViewProjection); Output.Diffuse = In.Diffuse; Output.TexCoords = In.TexCoords; return Output;}VS_NORMAL AliasedLinesVS(VS_NORMAL In){ VS_NORMAL Output; float4 start = float4(In.Position.x, In.Position.y, 0.5, In.Position.w); float4 end = float4(In.TexCoords.z, In.TexCoords.w, 0.5, In.Position.w); if (g_mCosmeticPen) { start = mul(start, g_mTransformation); end = mul(end, g_mTransformation); } float2 line_vec = end - start; float2 vec = normalize(line_vec); float2 norm = float2(-vec.y, vec.x); float pen_width = In.Position.z; norm = norm * pen_width * 0.5; vec = vec * pen_width * 0.5; Output.Position.w = In.Position.w; Output.Position.x = start.x + (vec.x * In.TexCoords.x); Output.Position.x = Output.Position.x + (norm.x * In.TexCoords.y); Output.Position.x = Output.Position.x + (line_vec.x * step(0, In.TexCoords.x)); Output.Position.y = start.y + (vec.y * In.TexCoords.x); Output.Position.y = Output.Position.y + (norm.y * In.TexCoords.y); Output.Position.y = Output.Position.y + (line_vec.y * step(0, In.TexCoords.x)); Output.Position.z = 0.5; if (!g_mCosmeticPen) { Output.Position = mul(Output.Position, g_mTransformation); } Output.Position = mul(Output.Position, g_mViewProjection); Output.Diffuse = In.Diffuse; Output.TexCoords = In.TexCoords; return Output;}technique Antialiased{ pass PASS_AA_CREATEMASK { StencilEnable = False; ZWriteEnable = False; ColorWriteEnable = 0x0f; ZEnable = False; SrcBlend = One; DestBlend = One; VertexShader = compile vs_3_0 TrapezoidVS(); PixelShader = compile ps_3_0 TrapezoidPS(); } pass PASS_AA_DRAW { StencilEnable = False; ZFunc = Greater; ZWriteEnable = False; ZEnable = True; ColorWriteEnable = 0x0f; VertexShader = compile vs_3_0 ViewProjectionVS(); PixelShader = compile ps_3_0 MaskPS(); } pass PASS_AA_DRAW_DIRECT { StencilEnable = False; ZFunc = Greater; ZEnable = True; ZWriteEnable = False; ColorWriteEnable = 0x0f; VertexShader = compile vs_3_0 ViewProjectionVS(); PixelShader = compile ps_3_0 DirectMaskPS(); }}technique Aliased{ pass PASS_STENCIL_ODDEVEN { TwoSidedStencilMode = False; StencilEnable = True; StencilPass = Invert; StencilFunc = Always; ColorWriteEnable = 0; ZEnable = False; ZWriteEnable = False; VertexShader = compile vs_1_1 NoTxAliasedVS(); PixelShader = compile ps_2_0 DirectSimplePS(); } pass PASS_STENCIL_WINDING { TwoSidedStencilMode = True; StencilEnable = True; StencilRef = 0; StencilMask = 0xFFFFFFFF; CCW_StencilPass = Incr; CCW_StencilFunc = Always; StencilPass = Decr; StencilFunc = Always; ColorWriteEnable = 0; ZEnable = False; ZWriteEnable = False; VertexShader = compile vs_1_1 NoTxAliasedVS(); PixelShader = compile ps_2_0 DirectSimplePS(); } pass PASS_STENCIL_DRAW { TwoSidedStencilMode = False; StencilEnable = True; StencilFunc = NotEqual; StencilMask = 0xFFFFFFFF; StencilRef = 0; StencilPass = Zero; StencilFail = Zero; StencilZFail = Zero; ColorWriteEnable = 0x0f; ZEnable = True; ZWriteEnable = False; ZFunc = Greater; VertexShader = compile vs_1_1 AliasedVS(); PixelShader = compile ps_2_0 SimplePS(); } pass PASS_STENCIL_DRAW_DIRECT { TwoSidedStencilMode = False; StencilEnable = True; StencilFunc = NotEqual; StencilMask = 0xFFFFFFFF; StencilRef = 0; StencilPass = Zero; StencilFail = Zero; StencilZFail = Zero; ColorWriteEnable = 0x0f; ZEnable = True; ZWriteEnable = False; ZFunc = Greater; VertexShader = compile vs_1_1 AliasedVS(); PixelShader = compile ps_2_0 DirectSimplePS(); } pass PASS_STENCIL_CLIP { TwoSidedStencilMode = False; StencilEnable = True; StencilFunc = NotEqual; StencilMask = 0xFFFFFFFF; StencilRef = 0; StencilPass = Zero; StencilFail = Zero; StencilZFail = Zero; ColorWriteEnable = 0; ZEnable = True; ZWriteEnable = True; ZFunc = Always; VertexShader = compile vs_1_1 NoTxAliasedVS(); PixelShader = compile ps_2_0 DirectSimplePS(); } pass PASS_STENCIL_NOSTENCILCHECK { StencilEnable = False; ZEnable = True; ZWriteEnable = False; ZFunc = Greater; ColorWriteEnable = 0x0f; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; VertexShader = compile vs_1_1 AliasedVS(); PixelShader = compile ps_2_0 SimplePS(); } pass PASS_STENCIL_NOSTENCILCHECK_DIRECT { StencilEnable = False; ZEnable = True; ZWriteEnable = False; ZFunc = Greater; ColorWriteEnable = 0x0f; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; VertexShader = compile vs_1_1 AliasedVS(); PixelShader = compile ps_2_0 DirectSimplePS(); } pass PASS_TEXT { StencilEnable = False; ZEnable = True; ZWriteEnable = False; ZFunc = Greater; ColorWriteEnable = 0x0f; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; VertexShader = compile vs_1_1 AliasedVS(); PixelShader = compile ps_2_0 TextPS(); } pass PASS_CLEARTYPE_TEXT { StencilEnable = False; ZEnable = True; ZWriteEnable = False; ZFunc = Greater; ColorWriteEnable = 0x0f;// SrcBlend = SrcAlpha;// DestBlend = InvSrcAlpha;// SrcBlend = DestColor;// DestBlend = Zero; SrcBlend = BlendFactor; DestBlend = InvSrcColor;// SrcBlend = Zero;// DestBlend = SrcColor;// SrcBlend = One;// DestBlend = Zero; VertexShader = compile vs_3_0 AliasedVS(); PixelShader = compile ps_3_0 ClearTypePS(); } pass PASS_ALIASED_LINES { TwoSidedStencilMode = False; StencilEnable = True; StencilPass = Invert; StencilFunc = Always; ColorWriteEnable = 0; ZEnable = False; ZWriteEnable = False; VertexShader = compile vs_1_1 AliasedLinesVS(); PixelShader = compile ps_2_0 DirectSimplePS(); } pass PASS_ALIASED_LINES_DIRECT { StencilEnable = False; ZEnable = True; ZWriteEnable = False; ZFunc = Greater; ColorWriteEnable = 0x0f; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; VertexShader = compile vs_1_1 AliasedLinesVS(); PixelShader = compile ps_2_0 DirectSimplePS(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -