#ifndef CUSTOM_LIGHTING_INCLUDED
#define CUSTOM_LIGHTING_INCLUDED
struct CustomLightingData
{
float3 normalWS;
float3 albedo;
};
float3 CustomLightHandling(CustomLightingData d, Light light)
{
float3 radiance = light.color;
float diffuse = saturate(dot(d.normalWS, light.direction));
float3 color = d.albedo * radiance * diffuse;
return color;
}
float3 CalculateCustomLighting(CustomLightingData d)
{
Light mainLight = GetMainLight();
float3 color = 0;
color += CustomLightHandling(d, mainLight);
return color;
}
void CalculateCustomLighting_float(float3 Normal, float3 Albedo, out float3 Color)
{
CustomLightingData data;
data.normalWS = Normal;
data.albedo = Albedo;
Color = CalculateCustomLighting(data);
}
#endifAdd a code snippet to your website: www.paste.org