Esempio n. 1
0
 private void DrawLights()
 {
     if (!this.Visible || this.GameState.Loading || (this.warpGateAo.ActorSettings.Inactive || Fez.LongScreenshot))
     {
         return;
     }
     foreach (WarpDestinations index in this.panels.Keys)
     {
         WarpPanel warpPanel = this.panels[index];
         if (warpPanel.Enabled)
         {
             (warpPanel.PanelMask.Effect as DefaultEffect).Pass = LightingEffectPass.Pre;
             warpPanel.PanelMask.Draw();
             (warpPanel.PanelMask.Effect as DefaultEffect).Pass = LightingEffectPass.Main;
         }
     }
 }
Esempio n. 2
0
 public override void Draw(GameTime gameTime)
 {
     if (this.GameState.Loading || this.warpGateAo.ActorSettings.Inactive)
     {
         return;
     }
     foreach (WarpDestinations index in this.panels.Keys)
     {
         WarpPanel warpPanel = this.panels[index];
         if (warpPanel.Enabled)
         {
             GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None);
             GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.WarpGate));
             warpPanel.PanelMask.Draw();
             GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All);
             GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDevice, CompareFunction.Equal, StencilMask.WarpGate);
             warpPanel.Layers.Draw();
             GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.None);
             GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDevice, new StencilMask?(StencilMask.None));
             warpPanel.PanelMask.Draw();
         }
     }
     GraphicsDeviceExtensions.SetColorWriteChannels(this.GraphicsDevice, ColorWriteChannels.All);
 }
Esempio n. 3
0
        private void UpdateParallax(TimeSpan elapsed)
        {
            if (!FezMath.IsOrthographic(this.CameraManager.Viewpoint))
            {
                return;
            }
            this.InterpolatedCenter = Vector3.Lerp(this.InterpolatedCenter, this.CameraManager.Center, MathHelper.Clamp((float)elapsed.TotalSeconds * this.CameraManager.InterpolationSpeed, 0.0f, 1f));
            Vector3 forward = this.CameraManager.View.Forward;

            forward.Z *= -1f;
            Vector3 right     = this.CameraManager.View.Right;
            Vector3 vector3_1 = FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint);
            Vector3 vector3_2 = (this.InterpolatedCenter - this.warpGateAo.Position) / 2.5f;
            Vector3 a         = (this.CameraManager.InterpolatedCenter - this.warpGateAo.Position) * vector3_1;

            foreach (WarpDestinations index in this.panels.Keys)
            {
                WarpPanel warpPanel = this.panels[index];
                if (warpPanel.Enabled && (double)FezMath.Dot(FezMath.AsVector(warpPanel.Face), forward) > 0.0)
                {
                    warpPanel.Timer += elapsed;
                    Vector3 vector3_3 = vector3_2 * vector3_1;
                    switch (index)
                    {
                    case WarpDestinations.First:
                        warpPanel.Layers.Groups[3].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds * 0.25 % 16.0 - 8.0) * right;
                        warpPanel.Layers.Groups[4].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds * 0.5 % 16.0 - 8.0) * right;
                        warpPanel.Layers.Groups[5].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds % 16.0 - 8.0) * right;
                        continue;

                    case WarpDestinations.Mechanical:
                        warpPanel.Layers.Groups[3].Position = vector3_3 + new Vector3(0.0f, 2f, 0.0f) + (float)(warpPanel.Timer.TotalSeconds % 16.0 - 8.0) * right;
                        warpPanel.Layers.Groups[4].Position = vector3_3 - new Vector3(0.0f, 2f, 0.0f) + (float)((warpPanel.Timer.TotalSeconds + 8.0) % 16.0 - 8.0) * right;
                        continue;

                    case WarpDestinations.Graveyard:
                        float m31_1 = (float)(((double)a.X + (double)a.Z) / 16.0);
                        float m32_1 = a.Y / 16f;
                        warpPanel.Layers.Groups[0].TextureMatrix.Set(new Matrix?(new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, m31_1, m32_1, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f)));
                        warpPanel.Layers.Groups[4].TextureMatrix.Set(new Matrix?(new Matrix(2f, 0.0f, 0.0f, 0.0f, 0.0f, 2f, 0.0f, 0.0f, m31_1 / 2f, (float)((double)m32_1 / 2.0 - warpPanel.Timer.TotalSeconds * 5.0), 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f)));
                        warpPanel.Layers.Groups[1].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds * 0.5 % 16.0 - 8.0) * right;
                        warpPanel.Layers.Groups[2].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds % 16.0 - 8.0) * right;
                        warpPanel.Layers.Groups[3].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds * 2.0 % 16.0 - 8.0) * right;
                        continue;

                    case WarpDestinations.Sewers:
                        Matrix matrix = new Matrix(4f, 0.0f, 0.0f, 0.0f, 0.0f, 4f, 0.0f, 0.0f, (float)(((double)a.X + (double)a.Z) / 8.0), a.Y / 8f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f);
                        warpPanel.Layers.Groups[0].TextureMatrix.Set(new Matrix?(matrix));
                        warpPanel.Layers.Groups[1].TextureMatrix.Set(new Matrix?(matrix));
                        warpPanel.Layers.Groups[2].TextureMatrix.Set(new Matrix?(matrix));
                        warpPanel.Layers.Groups[3].Position = vector3_3 + new Vector3(0.0f, -8f, 0.0f);
                        continue;

                    case WarpDestinations.Zu:
                        float m31_2 = (float)(-(double)FezMath.Dot(a, right) / 16.0);
                        float m32_2 = a.Y / 32f;
                        warpPanel.Layers.Groups[0].TextureMatrix.Set(new Matrix?(new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, m31_2, m32_2, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f)));
                        warpPanel.Layers.Groups[1].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds * 0.25 % 16.0 - 8.0) * right;
                        warpPanel.Layers.Groups[2].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds * 0.5 % 16.0 - 8.0) * right;
                        warpPanel.Layers.Groups[3].Position = vector3_3 - Vector3.UnitY * 1.5f + (float)(warpPanel.Timer.TotalSeconds % 16.0 - 8.0) * right;
                        continue;

                    default:
                        continue;
                    }
                }
            }
        }