blob: 54fc0aaeacc3b9954d3597379406b5fe8e215263 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "shaderCommon.h"
cbuffer constBuf : register(b0)
{
FluidShaderConst gParams;
};
float4 pointThicknessPS(FluidGeoOut input) : SV_TARGET
{
float4 gl_FragColor;
float4 gl_TexCoord[1];
//[unroll]
//for (int i = 0; i < 2; i++)
// gl_TexCoord[i] = input.texCoord[i];
gl_TexCoord[0] = input.invQ0;
// calculate normal from texture coordinates
float3 normal;
normal.xy = gl_TexCoord[0].xy * float2(2.0, -2.0) + float2(-1.0, 1.0);
float mag = dot(normal.xy, normal.xy);
if (mag > 1.0) discard; // kill pixels outside circle
normal.z = sqrt(1.0 - mag);
float tmp = normal.z * 0.005;
gl_FragColor = float4(tmp, tmp, tmp, tmp);
return gl_FragColor;
}
|