// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Estimate diffuse incidence on a planned surface // Not compiled or tested in-world // Setup: Use a spare owned prim. Set nonzero NORMAL and TO_LIGHT. Touch for owner-only numeric output. // Stop / restore: Remove/disable; no colors or materials are applied. // Notes: This is a Lambertian angular factor only; real lighting also involves distance, materials, shadows and environment. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Color calculation only. vector NORMAL=<0.0,0.0,1.0>; vector TO_LIGHT=<2.0,1.0,3.0>; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(llVecMag(NORMAL)<0.000001||llVecMag(TO_LIGHT)<0.000001) { llOwnerSay("Nonzero vectors required."); return; } float factor=llVecNorm(NORMAL)*llVecNorm(TO_LIGHT); if(factor<0.0)factor=0.0; llOwnerSay("Diffuse angular factor="+(string)factor); } }