コード例 #1
0
        public static void UpdateEffectReflector(MyEffectReflectorBase effect, bool subtractCameraPosition)
        {
            Lights.MyLight light = null;
            if (MySession.PlayerShip != null)
            {
                light = MySession.PlayerShip.Light;
            }

            if (light != null && light.ReflectorOn)
            {
                effect.SetReflectorDirection(light.ReflectorDirection);
                effect.SetReflectorConeMaxAngleCos(light.ReflectorConeMaxAngleCos);
                effect.SetReflectorColor(light.ReflectorColor);
                effect.SetReflectorRange(light.ReflectorRange);
            }
            else
            {
                effect.SetReflectorRange(0);
            }

            if (subtractCameraPosition)
            {
                effect.SetCameraPosition(Vector3.Zero);
            }
            else
            {
                effect.SetCameraPosition(MyCamera.Position);
            }
        }
コード例 #2
0
        protected override void UnloadData()
        {
            MyEntities.UnloadData();
            MainCamera = null;
            base.UnloadData();

            if (m_sunFlare != null)
            {
                Lights.MyLights.RemoveLight(m_sunFlare);
            }
            m_sunFlare = null;
        }
コード例 #3
0
        public override void LoadData()
        {
            MainCamera = new MyCamera(MySandboxGame.Config.FieldOfView, MySandboxGame.ScreenViewport)
            {
                FarPlaneDistance = MySession.Static.Settings.ViewDistance
            };
            MyEntities.LoadData();

            Debug.Assert(m_sunFlare == null);
            m_sunFlare = Lights.MyLights.AddLight();
            m_sunFlare.Start(Lights.MyLight.LightTypeEnum.None, 1.0f);
            m_sunFlare.LightOwner          = Lights.MyLight.LightOwnerEnum.LargeShip;
            m_sunFlare.GlareOn             = MyFakes.SUN_GLARE;
            m_sunFlare.GlareIntensity      = 1;
            m_sunFlare.GlareSize           = 25000.0f;
            m_sunFlare.GlareQuerySize      = 100000.0f;
            m_sunFlare.GlareQueryFreqMinMs = 0;
            m_sunFlare.GlareQueryFreqRndMs = 0;
            m_sunFlare.GlareType           = VRageRender.Lights.MyGlareTypeEnum.Distant;
            m_sunFlare.GlareMaterial       = "SunGlareMain";
            m_sunFlare.GlareMaxDistance    = 2000000;
            UpdateSunLight();
        }