コード例 #1
0
 public static void Extract(Light l, ref PointLight point)
 {
     point.instanceID    = l.GetInstanceID();
     point.mode          = Extract(l.lightmapBakeType);
     point.shadow        = l.shadows != LightShadows.None;
     point.position      = l.transform.position;
     point.color         = LinearColor.Convert(l.color, l.intensity);
     point.indirectColor = ExtractIndirect(l);
     point.range         = l.range;
     point.sphereRadius  = l.shadows == LightShadows.Soft ? l.shadowRadius : 0.0f;
     point.falloff       = FalloffType.Legacy;
 }
コード例 #2
0
 public static void Extract(Light l, ref DiscLight disc)
 {
     disc.instanceID    = l.GetInstanceID();
     disc.mode          = Extract(l.lightmapBakeType);
     disc.shadow        = l.shadows != LightShadows.None;
     disc.position      = l.transform.position;
     disc.orientation   = l.transform.rotation;
     disc.color         = LinearColor.Convert(l.color, l.intensity);
     disc.indirectColor = ExtractIndirect(l);
     disc.range         = l.range;
     disc.radius        = l.areaSize.x;
 }
コード例 #3
0
 public static void Extract(Light l, ref RectangleLight rect)
 {
     rect.instanceID    = l.GetInstanceID();
     rect.mode          = LightmapperUtils.Extract(l.lightmapBakeType);
     rect.shadow        = (l.shadows != LightShadows.None);
     rect.position      = l.transform.position;
     rect.orientation   = l.transform.rotation;
     rect.color         = LinearColor.Convert(l.color, l.intensity);
     rect.indirectColor = LightmapperUtils.ExtractIndirect(l);
     rect.range         = l.range;
     rect.width         = l.areaSize.x;
     rect.height        = l.areaSize.y;
 }
コード例 #4
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Experimental.GlobalIllumination.LinearColor o;
         o = new UnityEngine.Experimental.GlobalIllumination.LinearColor();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #5
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);
 }
コード例 #6
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;
 }
コード例 #7
0
 public void Init(ref DirectionalLight light)
 {
     this.instanceID    = light.instanceID;
     this.color         = light.color;
     this.indirectColor = light.indirectColor;
     this.orientation.SetLookRotation(light.direction, Vector3.up);
     this.position       = Vector3.zero;
     this.range          = 0f;
     this.coneAngle      = 0f;
     this.innerConeAngle = 0f;
     this.shape0         = light.penumbraWidthRadian;
     this.shape1         = 0f;
     this.type           = LightType.Directional;
     this.mode           = light.mode;
     this.shadow         = ((!light.shadow) ? 0 : 1);
 }
コード例 #8
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);
 }
コード例 #9
0
 public void Init(ref RectangleLight 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      = 0f;
     this.innerConeAngle = 0f;
     this.shape0         = light.width;
     this.shape1         = light.height;
     this.type           = LightType.Rectangle;
     this.mode           = light.mode;
     this.shadow         = ((!light.shadow) ? 0 : 1);
 }
コード例 #10
0
            public static void Extract(Light l, ref DirectionalLight dir)
            {
                dir.instanceID = l.GetInstanceID();
                dir.mode       = Extract(l.lightmapBakeType);
                dir.shadow     = l.shadows != LightShadows.None;
                dir.direction  = l.transform.forward;

                Color       cct           = ExtractColorTemperature(l);
                LinearColor directColor   = LinearColor.Convert(l.color, l.intensity);
                LinearColor indirectColor = ExtractIndirect(l);

                ApplyColorTemperature(cct, ref directColor);
                ApplyColorTemperature(cct, ref indirectColor);
                dir.color               = directColor;
                dir.indirectColor       = indirectColor;
                dir.penumbraWidthRadian = l.shadows == LightShadows.Soft ? (Mathf.Deg2Rad * l.shadowAngle) : 0.0f;
            }
コード例 #11
0
 public void Init(ref SpotLightBoxShape light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.width;
     shape1         = light.height;
     type           = LightType.SpotBoxShape;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #12
0
 public void Init(ref RectangleLight light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.width;
     shape1         = light.height;
     type           = LightType.Rectangle;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
コード例 #13
0
        public static void Extract(Light l, ref DirectionalLight dir)
        {
            dir.instanceID  = l.GetInstanceID();
            dir.mode        = LightmapperUtils.Extract(l.lightmapBakeType);
            dir.shadow      = (l.shadows > LightShadows.None);
            dir.position    = l.transform.position;
            dir.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);
            dir.color               = color;
            dir.indirectColor       = indirectColor;
            dir.penumbraWidthRadian = ((l.shadows == LightShadows.Soft) ? (0.0174532924f * l.shadowAngle) : 0f);
        }
コード例 #14
0
 public void Init(ref DirectionalLight light)
 {
     instanceID    = light.instanceID;
     color         = light.color;
     indirectColor = light.indirectColor;
     orientation.SetLookRotation(light.direction, Vector3.up);
     position       = Vector3.zero;
     range          = 0.0f;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.penumbraWidthRadian;
     shape1         = 0.0f;
     type           = LightType.Directional;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #15
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;
 }
コード例 #16
0
 public void Init(ref DiscLight light)
 {
     instanceID     = light.instanceID;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.radius;
     shape1         = 0.0f;
     type           = LightType.Disc;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #17
0
        public static void Extract(Light l, ref PointLight point)
        {
            point.instanceID = l.GetInstanceID();
            point.mode       = LightmapperUtils.Extract(l.lightmapBakeType);
            point.shadow     = (l.shadows > LightShadows.None);
            point.position   = l.transform.position;
            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);
            point.color         = color;
            point.indirectColor = indirectColor;
            point.range         = l.range;
            point.sphereRadius  = ((l.shadows == LightShadows.Soft) ? l.shadowRadius : 0f);
            point.falloff       = FalloffType.Legacy;
        }
コード例 #18
0
        public static void Extract(Light l, ref DiscLight disc)
        {
            disc.instanceID  = l.GetInstanceID();
            disc.mode        = LightmapperUtils.Extract(l.lightmapBakeType);
            disc.shadow      = (l.shadows > LightShadows.None);
            disc.position    = l.transform.position;
            disc.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);
            disc.color         = color;
            disc.indirectColor = indirectColor;
            disc.range         = l.range;
            disc.radius        = l.areaSize.x;
            disc.falloff       = FalloffType.Legacy;
        }
コード例 #19
0
 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;
 }
コード例 #20
0
 public void Init(ref PointLight 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    = Quaternion.identity;
     this.position       = light.position;
     this.range          = light.range;
     this.coneAngle      = 0f;
     this.innerConeAngle = 0f;
     this.shape0         = light.sphereRadius;
     this.shape1         = 0f;
     this.type           = LightType.Point;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = light.falloff;
 }
コード例 #21
0
 public void Init(ref DirectionalLight 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          = 0f;
     this.coneAngle      = cookie.sizes.x;
     this.innerConeAngle = cookie.sizes.y;
     this.shape0         = light.penumbraWidthRadian;
     this.shape1         = 0f;
     this.type           = LightType.Directional;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = FalloffType.Undefined;
 }
コード例 #22
0
 public void Init(ref SpotLightPyramidShape 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.angle;
     this.innerConeAngle = 0f;
     this.shape0         = light.aspectRatio;
     this.shape1         = 0f;
     this.type           = LightType.SpotPyramidShape;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = light.falloff;
 }
コード例 #23
0
 public void Init(ref SpotLightBoxShape 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      = 0f;
     this.innerConeAngle = 0f;
     this.shape0         = light.width;
     this.shape1         = light.height;
     this.type           = LightType.SpotBoxShape;
     this.mode           = light.mode;
     this.shadow         = (light.shadow ? 1 : 0);
     this.falloff        = FalloffType.Undefined;
 }
コード例 #24
0
 public void Init(ref SpotLightPyramidShape light, ref Cookie cookie)
 {
     instanceID     = light.instanceID;
     cookieID       = cookie.instanceID;
     cookieScale    = cookie.scale;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = light.angle;
     innerConeAngle = 0.0f;
     shape0         = light.aspectRatio;
     shape1         = 0.0f;
     type           = LightType.SpotPyramidShape;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
コード例 #25
0
 public void Init(ref DiscLight light, ref Cookie cookie)
 {
     instanceID     = light.instanceID;
     cookieID       = cookie.instanceID;
     cookieScale    = cookie.scale;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = light.range;
     coneAngle      = 0.0f;
     innerConeAngle = 0.0f;
     shape0         = light.radius;
     shape1         = 0.0f;
     type           = LightType.Disc;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = light.falloff;
 }
コード例 #26
0
 public void Init(ref DirectionalLight light, ref Cookie cookie)
 {
     instanceID     = light.instanceID;
     cookieID       = cookie.instanceID;
     cookieScale    = cookie.scale;
     color          = light.color;
     indirectColor  = light.indirectColor;
     orientation    = light.orientation;
     position       = light.position;
     range          = 0.0f;
     coneAngle      = cookie.sizes.x;
     innerConeAngle = cookie.sizes.y;
     shape0         = light.penumbraWidthRadian;
     shape1         = 0.0f;
     type           = LightType.Directional;
     mode           = light.mode;
     shadow         = (byte)(light.shadow ? 1 : 0);
     falloff        = FalloffType.Undefined;
 }
コード例 #27
0
            public static LinearColor Convert(UnityEngine.Color color, float intensity)
            {
                var   lc  = GraphicsSettings.lightsUseLinearIntensity ? color.linear.RGBMultiplied(intensity) : color.RGBMultiplied(intensity).linear;
                float mcc = lc.maxColorComponent;

                if (mcc <= 0.0f)
                {
                    return(LinearColor.Black());
                }

                float       mcc_rcp = 1.0f / lc.maxColorComponent;
                LinearColor c;

                c.m_red       = lc.r * mcc_rcp;
                c.m_green     = lc.g * mcc_rcp;
                c.m_blue      = lc.b * mcc_rcp;
                c.m_intensity = mcc;
                return(c);
            }
コード例 #28
0
        public static void Extract(Light l, ref RectangleLight rect)
        {
            rect.instanceID  = l.GetInstanceID();
            rect.mode        = LightmapperUtils.Extract(l.lightmapBakeType);
            rect.shadow      = (l.shadows > LightShadows.None);
            rect.position    = l.transform.position;
            rect.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);
            rect.color         = color;
            rect.indirectColor = indirectColor;
            rect.range         = l.range;
            rect.width         = l.areaSize.x;
            rect.height        = l.areaSize.y;
            rect.falloff       = FalloffType.Legacy;
        }
コード例 #29
0
ファイル: LinearColor.cs プロジェクト: yaoya/UnityDecompiled
        public static LinearColor Convert(Color color, float intensity)
        {
            Color       color2            = (!GraphicsSettings.lightsUseLinearIntensity) ? color.RGBMultiplied(intensity).linear : color.linear.RGBMultiplied(intensity);
            float       maxColorComponent = color2.maxColorComponent;
            LinearColor result;

            if (maxColorComponent <= 0f)
            {
                result = LinearColor.Black();
            }
            else
            {
                float       num = 1f / color2.maxColorComponent;
                LinearColor linearColor;
                linearColor.m_red       = color2.r * num;
                linearColor.m_green     = color2.g * num;
                linearColor.m_blue      = color2.b * num;
                linearColor.m_intensity = maxColorComponent;
                result = linearColor;
            }
            return(result);
        }
コード例 #30
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;
        }