/usr/share/libwildmagic/Data/CgShaders/LightPointPerVertex.fx is in libwildmagic-common 5.13-1ubuntu3.
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 50 51 52 53 54 55 56 | void v_LightPointPerVertex
(
in float3 modelPosition : POSITION,
in float3 modelNormal : TEXCOORD1,
out float4 clipPosition : POSITION,
out float4 vertexColor : COLOR,
uniform float4x4 PVWMatrix,
uniform float4x4 WMatrix,
uniform float3 CameraModelPosition,
uniform float3 MaterialEmissive,
uniform float3 MaterialAmbient,
uniform float4 MaterialDiffuse,
uniform float4 MaterialSpecular,
uniform float3 LightModelPosition,
uniform float3 LightAmbient,
uniform float3 LightDiffuse,
uniform float3 LightSpecular,
uniform float4 LightAttenuation
)
{
// Transform the position from model space to clip space.
clipPosition = mul(PVWMatrix, float4(modelPosition,1.0f));
// Compute the lighting factors.
float3 modelLightDiff = modelPosition - LightModelPosition;
float3 vertexDirection = normalize(modelLightDiff);
float NDotL = -dot(modelNormal, vertexDirection);
float3 viewVector = normalize(CameraModelPosition - modelPosition);
float3 halfVector = normalize(viewVector - vertexDirection);
float NDotH = dot(modelNormal, halfVector);
float4 lighting = lit(NDotL, NDotH, MaterialSpecular.a);
// Compute the distance-based attenuation.
float3 worldLightDiff = mul((float3x3)WMatrix, modelLightDiff);
float distance = length(worldLightDiff);
float attenuation = LightAttenuation.w/(LightAttenuation.x + distance *
(LightAttenuation.y + distance*LightAttenuation.z));
// Compute the lighting color.
float3 color = MaterialAmbient*LightAmbient
+ lighting.y*MaterialDiffuse.rgb*LightDiffuse
+ lighting.z*MaterialSpecular.rgb*LightSpecular;
// Compute the vertex color.
vertexColor.rgb = MaterialEmissive + attenuation*color;
vertexColor.a = MaterialDiffuse.a;
}
void p_LightPointPerVertex
(
in float4 vertexColor : COLOR,
out float4 pixelColor : COLOR
)
{
pixelColor = vertexColor;
}
|