Example #1
0
            internal void cctor > b__7_0(Light[] requests, NativeArray <LightDataGI> lightsOutput)
            {
                DirectionalLight directionalLight = default(DirectionalLight);
                PointLight       pointLight       = default(PointLight);
                SpotLight        spotLight        = default(SpotLight);
                RectangleLight   rectangleLight   = default(RectangleLight);
                DiscLight        discLight        = default(DiscLight);
                Cookie           cookie           = default(Cookie);
                LightDataGI      value            = default(LightDataGI);

                for (int i = 0; i < requests.Length; i++)
                {
                    Light light = requests[i];
                    switch (light.type)
                    {
                    case UnityEngine.LightType.Spot:
                        LightmapperUtils.Extract(light, ref spotLight);
                        LightmapperUtils.Extract(light, out cookie);
                        value.Init(ref spotLight, ref cookie);
                        break;

                    case UnityEngine.LightType.Directional:
                        LightmapperUtils.Extract(light, ref directionalLight);
                        LightmapperUtils.Extract(light, out cookie);
                        value.Init(ref directionalLight, ref cookie);
                        break;

                    case UnityEngine.LightType.Point:
                        LightmapperUtils.Extract(light, ref pointLight);
                        LightmapperUtils.Extract(light, out cookie);
                        value.Init(ref pointLight, ref cookie);
                        break;

                    case UnityEngine.LightType.Area:
                        LightmapperUtils.Extract(light, ref rectangleLight);
                        LightmapperUtils.Extract(light, out cookie);
                        value.Init(ref rectangleLight, ref cookie);
                        break;

                    case UnityEngine.LightType.Disc:
                        LightmapperUtils.Extract(light, ref discLight);
                        LightmapperUtils.Extract(light, out cookie);
                        value.Init(ref discLight, ref cookie);
                        break;

                    default:
                        value.InitNoBake(light.GetInstanceID());
                        break;
                    }
                    lightsOutput[i] = value;
                }
            }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Experimental.GlobalIllumination.SpotLight o;
         o = new UnityEngine.Experimental.GlobalIllumination.SpotLight();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #3
0
 public static void Extract(Light l, ref SpotLight spot)
 {
     spot.instanceID     = l.GetInstanceID();
     spot.mode           = LightmapperUtils.Extract(l.lightmapBakeType);
     spot.shadow         = (l.shadows != LightShadows.None);
     spot.position       = l.transform.position;
     spot.orientation    = l.transform.rotation;
     spot.color          = LinearColor.Convert(l.color, l.intensity);
     spot.indirectColor  = LightmapperUtils.ExtractIndirect(l);
     spot.range          = l.range;
     spot.sphereRadius   = ((l.shadows != LightShadows.Soft) ? 0f : l.shadowRadius);
     spot.coneAngle      = l.spotAngle * 0.0174532924f;
     spot.innerConeAngle = LightmapperUtils.ExtractInnerCone(l);
 }
Example #4
0
 public static void Extract(Light l, ref SpotLight spot)
 {
     spot.instanceID     = l.GetInstanceID();
     spot.mode           = Extract(l.lightmapBakeType);
     spot.shadow         = l.shadows != LightShadows.None;
     spot.position       = l.transform.position;
     spot.orientation    = l.transform.rotation;
     spot.color          = LinearColor.Convert(l.color, l.intensity);
     spot.indirectColor  = ExtractIndirect(l);
     spot.range          = l.range;
     spot.sphereRadius   = l.shadows == LightShadows.Soft ? l.shadowRadius : 0.0f;
     spot.coneAngle      = l.spotAngle * Mathf.Deg2Rad;
     spot.innerConeAngle = ExtractInnerCone(l);
     spot.falloff        = FalloffType.Legacy;
 }
Example #5
0
 public void Init(ref SpotLight light)
 {
     this.instanceID     = light.instanceID;
     this.color          = light.color;
     this.indirectColor  = light.indirectColor;
     this.orientation    = light.orientation;
     this.position       = light.position;
     this.range          = light.range;
     this.coneAngle      = light.coneAngle;
     this.innerConeAngle = light.innerConeAngle;
     this.shape0         = light.sphereRadius;
     this.shape1         = 0f;
     this.type           = LightType.Spot;
     this.mode           = light.mode;
     this.shadow         = ((!light.shadow) ? 0 : 1);
 }
Example #6
0
 public void Init(ref SpotLight light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = light.coneAngle;
     innerConeAngle = light.innerConeAngle;
     shape0         = light.sphereRadius;
     shape1         = 0.0f;
     type           = LightType.Spot;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
 public void Init(ref SpotLight light, ref Cookie cookie)
 {
     this.instanceID     = light.instanceID;
     this.cookieID       = cookie.instanceID;
     this.cookieScale    = cookie.scale;
     this.color          = light.color;
     this.indirectColor  = light.indirectColor;
     this.orientation    = light.orientation;
     this.position       = light.position;
     this.range          = light.range;
     this.coneAngle      = light.coneAngle;
     this.innerConeAngle = light.innerConeAngle;
     this.shape0         = light.sphereRadius;
     this.shape1         = (float)light.angularFalloff;
     this.type           = LightType.Spot;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = light.falloff;
 }
Example #8
0
        public static void Extract(Light l, ref SpotLight spot)
        {
            spot.instanceID  = l.GetInstanceID();
            spot.mode        = LightmapperUtils.Extract(l.lightmapBakeType);
            spot.shadow      = (l.shadows > LightShadows.None);
            spot.position    = l.transform.position;
            spot.orientation = l.transform.rotation;
            Color       cct           = LightmapperUtils.ExtractColorTemperature(l);
            LinearColor color         = LinearColor.Convert(l.color, l.intensity);
            LinearColor indirectColor = LightmapperUtils.ExtractIndirect(l);

            LightmapperUtils.ApplyColorTemperature(cct, ref color);
            LightmapperUtils.ApplyColorTemperature(cct, ref indirectColor);
            spot.color          = color;
            spot.indirectColor  = indirectColor;
            spot.range          = l.range;
            spot.sphereRadius   = ((l.shadows == LightShadows.Soft) ? l.shadowRadius : 0f);
            spot.coneAngle      = l.spotAngle * 0.0174532924f;
            spot.innerConeAngle = LightmapperUtils.ExtractInnerCone(l);
            spot.falloff        = FalloffType.Legacy;
            spot.angularFalloff = AngularFalloffType.LUT;
        }
        public void Init(ref SpotLight light)
        {
            Cookie cookie = Cookie.Defaults();

            this.Init(ref light, ref cookie);
        }