Ejemplo n.º 1
0
        protected override void ReadFromImpl(object obj)
        {
            base.ReadFromImpl(obj);
            Light uo = (Light)obj;

            shadows                  = uo.shadows;
            shadowStrength           = uo.shadowStrength;
            shadowResolution         = uo.shadowResolution;
            layerShadowCullDistances = uo.layerShadowCullDistances;
            cookieSize               = uo.cookieSize;
            cookie                 = ToID(uo.cookie);
            renderMode             = uo.renderMode;
            areaSize               = uo.areaSize;
            lightmapBakeType       = uo.lightmapBakeType;
            type                   = uo.type;
            spotAngle              = uo.spotAngle;
            color                  = uo.color;
            colorTemperature       = uo.colorTemperature;
            intensity              = uo.intensity;
            bounceIntensity        = uo.bounceIntensity;
            shadowCustomResolution = uo.shadowCustomResolution;
            shadowBias             = uo.shadowBias;
            shadowNormalBias       = uo.shadowNormalBias;
            shadowNearPlane        = uo.shadowNearPlane;
            range                  = uo.range;
            flare                  = ToID(uo.flare);
            bakingOutput           = uo.bakingOutput;
            cullingMask            = uo.cullingMask;
            lightShadowCasterMode  = uo.lightShadowCasterMode;
            shadowRadius           = uo.shadowRadius;
            shadowAngle            = uo.shadowAngle;
        }
Ejemplo n.º 2
0
 public void SetProp(LightRenderMode renderMode)
 {
     foreach (Light temp in lights)
     {
         temp.renderMode = renderMode;
     }
 }
Ejemplo n.º 3
0
        public void UpdateWidget(Light light)
        {
            if (!light)
            {
                //Debug.LogWarning(this.name + " [Light is Null]");
                ResetToDefaults();
                return;
            }


            type      = light.type;
            range     = light.range;
            spotAngle = light.spotAngle;
            color     = light.color;

            intensity       = light.intensity;
            bounceIntensity = light.bounceIntensity;

            // shadows
            shadows.shadows = light.shadows;
            shadows.shadowCustomResolution = light.shadowCustomResolution;
            shadows.shadowBias             = light.shadowBias;
            shadows.shadowNormalBias       = light.shadowNormalBias;
            shadows.shadowNearPlane        = light.shadowNearPlane;
            shadows.shadowResolution       = light.shadowResolution;
            shadows.shadowStrength         = light.shadowStrength;

            cookieSize  = light.cookieSize;
            renderMode  = light.renderMode;
            cullingMask = light.cullingMask;
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="binaryReader"></param>
        public override void Deserialize(BinaryReader binaryReader)
        {
            base.Deserialize(binaryReader);
#if UNITY_2019_1_OR_NEWER
            lightShape          = (LightShape)binaryReader.ReadInt32();
            colorTemperature    = binaryReader.ReadSingle();
            useColorTemperature = binaryReader.ReadBoolean();
            renderingLayerMask  = binaryReader.ReadInt32();
#endif
            lightType         = (LightType)binaryReader.ReadInt32();
            range             = binaryReader.ReadSingle();
            spotAngle         = binaryReader.ReadSingle();
            innerSpotAngle    = binaryReader.ReadSingle();
            cookieSize        = binaryReader.ReadSingle();
            m_colorKun        = SerializerKun.DesirializeObject <ColorKun>(binaryReader);
            intensity         = binaryReader.ReadSingle();
            bounceIntensity   = binaryReader.ReadSingle();
            cookie            = binaryReader.ReadString();
            shadowsType       = (LightShadows)binaryReader.ReadInt32();
            shadowsStrength   = binaryReader.ReadSingle();
            shadowsResolution = (UnityEngine.Rendering.LightShadowResolution)binaryReader.ReadInt32();
            shadowsBias       = binaryReader.ReadSingle();
            shadowsNormalBias = binaryReader.ReadSingle();
            shadowsNearPlane  = binaryReader.ReadSingle();
            halo        = binaryReader.ReadBoolean();
            flare       = binaryReader.ReadString();
            renderMode  = (LightRenderMode)binaryReader.ReadInt32();
            cullingMask = binaryReader.ReadInt32();
        }
Ejemplo n.º 5
0
    static int IntToEnum(IntPtr L)
    {
        int             arg0 = (int)LuaDLL.lua_tonumber(L, 1);
        LightRenderMode o    = (LightRenderMode)arg0;

        LuaScriptMgr.PushEnum(L, o);
        return(1);
    }
Ejemplo n.º 6
0
 void Start()
 {
     m_Trans       = transform;
     lamp          = GetComponent <Light>();
     shadowsBak    = lamp.shadows;
     renderModeBak = lamp.renderMode;
     if (LightMgr.Instance != null)
     {
         LightMgr.Instance.Registerlight(this);
     }
 }
Ejemplo n.º 7
0
 public void Init()
 {
     if (RCC_Settings.Instance.useLightsAsVertexLights)
     {
         renderMode = LightRenderMode.ForceVertex;
     }
     else
     {
         renderMode = LightRenderMode.ForcePixel;
     }
 }
Ejemplo n.º 8
0
        public LightKun(Component component) : base(component)
        {
            componentKunType = BehaviourKun.ComponentKunType.Light;
            cookie           = "";
            flare            = "";
            m_colorKun       = new ColorKun();
            var light = component as Light;

            if (light)
            {
#if UNITY_2019_1_OR_NEWER
                lightShape          = light.shape;
                useColorTemperature = light.useColorTemperature;
                colorTemperature    = light.colorTemperature;
                renderingLayerMask  = light.renderingLayerMask;
#endif
                enabled        = light.enabled;
                lightType      = light.type;
                range          = light.range;
                spotAngle      = light.spotAngle;
                innerSpotAngle = light.spotAngle;
                cookieSize     = light.cookieSize;
                if (light.cookie != null)
                {
                    cookie = light.cookie.name;
                }
                else
                {
                    cookie = "";
                }
                if (light.flare != null)
                {
                    flare = light.flare.name;
                }
                else
                {
                    flare = "";
                }
                color           = light.color;
                intensity       = light.intensity;
                bounceIntensity = light.bounceIntensity;

                shadowsType       = light.shadows;
                shadowsStrength   = light.shadowStrength;
                shadowsBias       = light.shadowBias;
                shadowsNormalBias = light.shadowNormalBias;
                shadowsNormalBias = light.shadowNormalBias;
                // halo
                renderMode  = light.renderMode;
                cullingMask = light.cullingMask;
            }
        }
Ejemplo n.º 9
0
        private void ResetToDefaults()
        {
            range     = 10;
            spotAngle = 30;

            color = new Color(255 / 255f, 244 / 255f, 214 / 255f, 255 / 255f);

            //color.r = 255/255f;
            //color.g = 244/255f;
            //color.b = 214/255f;
            //color.a = 255/255f;

            intensity       = 1;
            bounceIntensity = 1;
            shadows         = new Shadow();
            renderMode      = LightRenderMode.Auto;
            cullingMask     = -1;
        }
Ejemplo n.º 10
0
    private static int set_renderMode(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Light           light      = (Light)obj;
            LightRenderMode renderMode = (int)ToLua.CheckObject(L, 2, typeof(LightRenderMode));
            light.set_renderMode(renderMode);
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index renderMode on a nil value");
        }
        return(result);
    }
Ejemplo n.º 11
0
    private static int get_renderMode(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Light           light      = (Light)obj;
            LightRenderMode renderMode = light.get_renderMode();
            ToLua.Push(L, renderMode);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index renderMode on a nil value");
        }
        return(result);
    }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        GameObject[] noises = GameObject.FindGameObjectsWithTag(StringManager.Tags.noise);
        m_NoiseSources = new MeshRenderer[noises.Length];
        for (int i = 0; i < noises.Length; i++)
        {
            m_NoiseSources[i] = noises[i].GetComponent <MeshRenderer>();
        }

        GameObject[] waypoints = GameObject.FindGameObjectsWithTag(StringManager.Tags.Waypoints);
        m_Waypoints = new MeshRenderer[waypoints.Length];
        for (int i = 0; i < waypoints.Length; i++)
        {
            m_Waypoints[i] = waypoints[i].GetComponent <MeshRenderer>();
        }

        m_FlashLightColor      = m_FlashLight.GetComponent <Light>().color;
        m_FlashLightRenderMode = m_FlashLight.GetComponent <Light>().renderMode;
    }
Ejemplo n.º 13
0
 private void OnPreCull()
 {
     if (!this.GoodToGo)
     {
         SunshineKeywords.DisableShadows();
         return;
     }
     this.RenderCascades();
     this.ConfigureShaders();
     if (this.ShadowsActive)
     {
         this._lightShadows    = Sunshine.Instance.SunLight.shadows;
         this._lightRenderMode = Sunshine.Instance.SunLight.renderMode;
         Sunshine.Instance.SunLight.shadows    = LightShadows.None;
         Sunshine.Instance.SunLight.renderMode = LightRenderMode.ForcePixel;
     }
     if (Sunshine.Instance.RequiresPostprocessing && (this.AttachedCamera.depthTextureMode & DepthTextureMode.Depth) == DepthTextureMode.None && SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
     {
         this.AttachedCamera.depthTextureMode |= DepthTextureMode.Depth;
     }
 }
Ejemplo n.º 14
0
        public LightSerializable(Light obj) : base(obj)
        {
            type      = obj.type;
            range     = obj.range;
            spotAngle = obj.spotAngle;

            color           = obj.color;
            intensity       = obj.intensity;
            bounceIntensity = obj.bounceIntensity;

            shadows          = obj.shadows;
            shadowStrength   = obj.shadowStrength;
            shadowResolution = obj.shadowResolution;
            shadowBias       = obj.shadowBias;
            shadowNormalBias = obj.shadowNormalBias;
            shadowNearPlane  = obj.shadowNearPlane;

            cookie      = obj.cookie != null ? new TextureUnion(obj.cookie) : null;
            cookieSize  = obj.cookieSize;
            renderMode  = obj.renderMode;
            cullingMask = obj.cullingMask;
        }
Ejemplo n.º 15
0
    void OnPreCull()
    {
        if(!GoodToGo)
        {
            SunshineKeywords.DisableShadows();
            return;
        }

        RenderCascades();

        ConfigureShaders();

        if(ShadowsActive)
        {
            _lightShadows = Sunshine.Instance.SunLight.shadows;
            _lightRenderMode = Sunshine.Instance.SunLight.renderMode;
            Sunshine.Instance.SunLight.shadows = LightShadows.None; //Disable built-in shadows
            Sunshine.Instance.SunLight.renderMode = LightRenderMode.ForcePixel; //Force per-pixel lighting
        }

        if(Sunshine.Instance.RequiresPostprocessing)
        {
            //Check for existing depth textures...
            bool usingDepth = (AttachedCamera.depthTextureMode & DepthTextureMode.Depth) != 0;
            if(!usingDepth)
            {
                if(SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
                    AttachedCamera.depthTextureMode |= DepthTextureMode.Depth;
            }
        }
    }
Ejemplo n.º 16
0
 private void OnPreCull()
 {
     if (!this.GoodToGo)
     {
         SunshineKeywords.DisableShadows();
         return;
     }
     this.RenderCascades();
     this.ConfigureShaders();
     if (this.ShadowsActive)
     {
         this._lightShadows = Sunshine.Instance.SunLight.shadows;
         this._lightRenderMode = Sunshine.Instance.SunLight.renderMode;
         Sunshine.Instance.SunLight.shadows = LightShadows.None;
         Sunshine.Instance.SunLight.renderMode = LightRenderMode.ForcePixel;
     }
     if (Sunshine.Instance.RequiresPostprocessing && (this.AttachedCamera.depthTextureMode & DepthTextureMode.Depth) == DepthTextureMode.None && SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
     {
         this.AttachedCamera.depthTextureMode |= DepthTextureMode.Depth;
     }
 }