Esempio n. 1
0
        public static void UpdateEffectReflector(MyEffectReflectorBase effect, bool subtractCameraPosition)
        {
            MyRenderLight reflectorLight = null;

            foreach (MyRenderLight light in m_renderLights)
            {
                if (light.ReflectorOn)
                {
                    reflectorLight = light;
                    break;
                }
            }

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

            if (subtractCameraPosition)
            {
                effect.SetCameraPosition(Vector3.Zero);
            }
            else
            {
                effect.SetCameraPosition((Vector3)MyRenderCamera.Position);
            }
        }
Esempio n. 2
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);
            }
        }