static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Experimental.Rendering.VisibleLight o;
         o = new UnityEngine.Experimental.Rendering.VisibleLight();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #2
0
    public uint      type;          // 1 * 4 bytes

    public LightSource(UnityEngine.Experimental.Rendering.VisibleLight light, Matrix4x4 worldToVoxel)
    {
        color         = (Vector4)light.finalColor;
        direction     = light.localToWorld.GetColumn(2);
        worldPosition = light.localToWorld.GetColumn(3);
        voxelPosition = worldToVoxel * new Vector4(worldPosition.x, worldPosition.y, worldPosition.z, 1f);
        range         = light.range;
        spotCos       = 0f;
        spotFactor    = 0f;
        type          = (uint)light.lightType;

        if (light.lightType == LightType.Spot)
        {
            float halfSpotRadian = .5f * light.spotAngle * Mathf.Deg2Rad;

            spotCos = Mathf.Cos(halfSpotRadian);

            if (light.spotAngle > 0f)
            {
                spotFactor = 1f / (Mathf.Cos(Mathf.Atan(Mathf.Tan(halfSpotRadian) * 46f / 64f)) - spotCos);
            }
        }
    }