Add this to syntax highlighter to high light "numbers" in 3 format :
- 0x204080FF
- 3.14159f
- 7
Texture2D g_NSZTexture;
Texture2D g_LitTexture;
float4x4 g_mWorld;
float4x4 g_mWorldViewProjection;
VtxNormalPass VSNormalPass(
float4 pos : POSITION,
float3 nor : NORMAL,
float2 tex : TEXCOORD0)
{
VtxNormalPass output;
output.spos = mul(pos, g_mWorldViewProjection);
output.wpos = mul(pos, g_mWorld);
output.wnor = mul(nor, g_mWorld);
return output;
}
PixOutput PSNormalPass(VtxNormalPass input)
{
float3 nor = normalize(input.wnor);
float phi = acos(nor.y);
float len = sin(phi);
float the = acos(clamp(nor.x / len, -1.0f, 1.0f));
if (nor.z <= 0.0f)
the = 6.283125f - the;
float z = length((input.wpos - g_vEyePos).xyz);
PixOutput output;
output.color = float4(the, phi, z, 4.0);
return output;
}
technique10 NormalPass
{
pass P0
{
SetVertexShader(CompileShader(vs_4_0, VSNormalPass()));
SetGeometryShader(NULL);
SetPixelShader(CompileShader(ps_4_0, PSNormalPass()));
SetRasterizerState(CullBack);
SetDepthStencilState(EnableDepth, 1);
SetBlendState(BSOverWrite, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
}
}
float3 nor = normalize(input.wnor);
float phi = acos(nor.y);
float len = sin(phi);
float the = acos(nor.x / len);
float the = acos(clamp(nor.x / len, -1.0f, 1.0f));