/usr/share/libwildmagic/Data/CgShaders/LightDirectionalPerPixel.fx is in libwildmagic-common 5.13-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | void v_LightDirectionalPerPixel
(
in float3 modelPosition : POSITION,
in float3 modelNormal : TEXCOORD1,
out float4 clipPosition : POSITION,
out float3 vertexPosition : TEXCOORD0,
out float3 vertexNormal : TEXCOORD1,
uniform float4x4 PVWMatrix
)
{
clipPosition = mul(PVWMatrix, float4(modelPosition,1.0f));
vertexPosition = modelPosition;
vertexNormal = modelNormal;
}
void p_LightDirectionalPerPixel
(
in float3 vertexPosition : TEXCOORD0,
in float3 vertexNormal : TEXCOORD1,
out float4 pixelColor : COLOR,
uniform float3 CameraModelPosition,
uniform float3 MaterialEmissive,
uniform float3 MaterialAmbient,
uniform float4 MaterialDiffuse,
uniform float4 MaterialSpecular,
uniform float3 LightModelDirection,
uniform float3 LightAmbient,
uniform float3 LightDiffuse,
uniform float3 LightSpecular,
uniform float4 LightAttenuation
)
{
// Compute the lighting factors.
float3 normal = normalize(vertexNormal);
float NDotL = -dot(normal, LightModelDirection);
float3 viewVector = normalize(CameraModelPosition - vertexPosition);
float3 halfVector = normalize(viewVector - LightModelDirection);
float NDotH = dot(normal, halfVector);
float4 lighting = lit(NDotL, NDotH, MaterialSpecular.a);
// Compute the lighting color.
float3 color = MaterialAmbient*LightAmbient
+ lighting.y*MaterialDiffuse.rgb*LightDiffuse
+ lighting.z*MaterialSpecular.rgb*LightSpecular;
// Compute the pixel color.
pixelColor.rgb = MaterialEmissive + LightAttenuation.w*color;
pixelColor.a = MaterialDiffuse.a;
}
|