Exemplo n.º 1
0
 public override void Initialize()
 {
   base.Initialize();
   Material material = new Material();
   this.LastLevelMesh = new Mesh()
   {
     Effect = (BaseEffect) new FarawayEffect(),
     DepthWrites = false,
     Material = material,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     SamplerState = SamplerState.PointClamp
   };
   this.ThisLevelMesh = new Mesh()
   {
     Effect = (BaseEffect) new FarawayEffect(),
     DepthWrites = false,
     Material = material,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     SamplerState = SamplerState.PointClamp
   };
   this.NextLevelMesh = new Mesh()
   {
     Effect = (BaseEffect) new FarawayEffect(),
     DepthWrites = false,
     Material = material,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     SamplerState = SamplerState.PointClamp
   };
   this.LevelManager.LevelChanged += new Action(this.TryInitialize);
   ServiceHelper.AddComponent((IGameComponent) (this.Fader = new FarawayPlaceHost.PlaceFader(this.Game)));
   this.Fader.Visible = false;
 }
Exemplo n.º 2
0
 public DisplacedMeshRenderer(Common.Mesh mesh)
 {
     this.mesh = mesh;
     this.DisplacementScale = 1.0f;
     this.DisplaceMidLevel  = 0.5f;
     this.EnableNormalMap   = true;
 }
 public DisplacedMeshRenderer(Common.Mesh mesh)
 {
     this.mesh = mesh;
     this.DisplacementScale = 1.0f;
     this.DisplaceMidLevel = 0.5f;
     this.EnableNormalMap = true;
 }
Exemplo n.º 4
0
 public TargetRenderingManager(Game game)
   : base(game)
 {
   this.fullscreenPlane = new Mesh()
   {
     DepthWrites = false,
     AlwaysOnTop = true
   };
   this.fullscreenPlane.AddFace(Vector3.One * 2f, Vector3.Zero, FaceOrientation.Front, true);
 }
Exemplo n.º 5
0
 private void Reset()
 {
   this.FractalMeshes.Clear();
   this.OuterShellMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.LitVertexColored()
   };
   Fractal.AddShell(this.OuterShellMesh, true, true);
   Fractal.AddShell(this.OuterShellMesh, false, true);
   Mesh mesh1 = this.OuterShellMesh;
   bool positive = true;
   for (int index = 0; index < 15; ++index)
   {
     Mesh mesh2 = new Mesh()
     {
       Effect = (BaseEffect) new DefaultEffect.LitVertexColored(),
       Material = {
         Diffuse = Color.Cyan.ToVector3()
       }
     };
     Fractal.AddShell(mesh2, positive, false);
     mesh2.Culling = positive ? CullMode.CullCounterClockwiseFace : CullMode.CullClockwiseFace;
     mesh2.CustomData = (object) (bool) (positive ? 1 : 0);
     mesh2.Parent = mesh1;
     this.FractalMeshes.Add(mesh2);
     positive = !positive;
     mesh1 = mesh2;
   }
   Fractal fractal = this;
   Mesh mesh3 = new Mesh();
   Mesh mesh4 = mesh3;
   DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored();
   vertexColored1.Fullbright = true;
   DefaultEffect.VertexColored vertexColored2 = vertexColored1;
   mesh4.Effect = (BaseEffect) vertexColored2;
   Mesh mesh5 = mesh3;
   fractal.AxisMesh = mesh5;
   this.AxisMesh.AddColoredBox(new Vector3(1f, 1f, 10000f) / 200f, Vector3.Zero, Color.Blue, false);
   this.AxisMesh.AddColoredBox(new Vector3(1f, 10000f, 1f) / 200f, Vector3.Zero, Color.Green, false);
   this.AxisMesh.AddColoredBox(new Vector3(10000f, 1f, 1f) / 200f, Vector3.Zero, Color.Red, false);
   this.OuterShellMesh.Scale = Vector3.One * 2f;
 }
Exemplo n.º 6
0
 protected override void LoadContent()
 {
   base.LoadContent();
   this.shadowEffect = new CloudShadowEffect();
   this.shadowMesh = new Mesh()
   {
     DepthWrites = false,
     AlwaysOnTop = true,
     SamplerState = SamplerState.LinearWrap
   };
   foreach (FaceOrientation faceOrientation in Util.GetValues<FaceOrientation>())
   {
     if (FezMath.IsSide(faceOrientation))
       this.axisPerGroup.Add(this.shadowMesh.AddFace(Vector3.One, Vector3.Zero, faceOrientation, true), FezMath.AsAxis(faceOrientation) == Axis.X ? Axis.Z : Axis.X);
   }
   this.shadowMesh.Effect = (BaseEffect) this.shadowEffect;
   this.LevelManager.SkyChanged += new Action(this.InitializeShadows);
   this.InitializeShadows();
   this.LightingPostProcess.DrawOnTopLights += new Action(this.DrawLights);
 }
Exemplo n.º 7
0
 private void CreateAntiCubeFace()
 {
   Vector3 size = this.AoInstance.ArtObject.Size;
   Vector3 forward = MenuCubeFaceExtensions.GetForward(MenuCubeFace.AntiCubes);
   Vector3 right = MenuCubeFaceExtensions.GetRight(MenuCubeFace.AntiCubes);
   int offset = MenuCubeFaceExtensions.GetOffset(MenuCubeFace.AntiCubes);
   int spacing = MenuCubeFaceExtensions.GetSpacing(MenuCubeFace.AntiCubes);
   bool flag = this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha;
   if (this.GameState.SaveData.SecretCubes == 0)
   {
     this.AntiCubes = new Mesh()
     {
       Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/MENU_CUBE_COVER")),
       Blending = new BlendingMode?(BlendingMode.Alphablending),
       Material = this.AoInstance.Material,
       SamplerState = SamplerState.PointClamp
     };
     this.AntiCubes.Texture = this.LevelManager.WaterType != LiquidType.Sewer ? (this.LevelManager.WaterType != LiquidType.Lava ? (!this.LevelManager.BlinkingAlpha ? (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/MENU_CUBE_COVER")) : (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/MENU_CUBE_COVER_CMY"))) : (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/MENU_CUBE_COVER_VIRTUAL"))) : (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/MENU_CUBE_COVER_GB"));
     this.AntiCubes.Effect = flag ? (BaseEffect) new DefaultEffect.Textured() : (BaseEffect) new DefaultEffect.LitTextured();
     this.AntiCubes.AddFace(size, size * forward / 2f, FezMath.OrientationFromDirection(forward), true);
   }
   else
   {
     Trile trile = Enumerable.FirstOrDefault<Trile>(this.LevelManager.ActorTriles(ActorType.SecretCube));
     if (trile == null)
     {
       this.AntiCubes = new Mesh()
       {
         Effect = (BaseEffect) new DefaultEffect.LitTextured(),
         Texture = this.LevelMaterializer.TrilesMesh.Texture,
         Blending = new BlendingMode?(BlendingMode.Alphablending),
         Material = this.AoInstance.Material
       };
       Logger.Log("MenuCube", "No anti-cube trile in " + this.LevelManager.TrileSet.Name);
     }
     else
     {
       ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = trile.Geometry;
       this.AntiCubes = new Mesh()
       {
         Effect = flag ? (BaseEffect) new DefaultEffect.Textured() : (BaseEffect) new DefaultEffect.LitTextured(),
         Texture = this.LevelMaterializer.TrilesMesh.Texture,
         Blending = new BlendingMode?(BlendingMode.Opaque),
         Material = this.AoInstance.Material
       };
       for (int index = 0; index < this.GameState.SaveData.SecretCubes; ++index)
       {
         int num1 = index;
         if (num1 >= 14)
           num1 += 2;
         if (num1 >= 20)
           num1 += 2;
         Group group = this.AntiCubes.AddGroup();
         group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) geometry.Vertices), geometry.Indices, geometry.PrimitiveType);
         int num2 = num1 % 6;
         int num3 = num1 / 6;
         group.Position = size / 2f * (forward + Vector3.UnitY - right) + (float) (offset + num2 * spacing) / 16f * right + (float) (offset + num3 * spacing) / 16f * -Vector3.UnitY + 0.5f * -forward;
         group.Scale = new Vector3(0.5f);
         group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 1.570796f * (float) RandomHelper.Random.Next(0, 4));
       }
       Group cubesGroup = this.AntiCubes.CollapseToBufferWithNormal<VertexPositionNormalTextureInstance>();
       this.AntiCubes.CustomRenderingHandler = (Mesh.RenderingHandler) ((m, e) =>
       {
         foreach (Group item_0 in m.Groups)
         {
           (e as DefaultEffect).AlphaIsEmissive = item_0 == cubesGroup;
           item_0.Draw(e);
         }
       });
     }
     string text = this.GameState.SaveData.SecretCubes.ToString();
     int num = 2;
     Vector2 vector2_1 = this.FontManager.Small.MeasureString(text) * (float) num;
     Vector2 vector2_2 = vector2_1 / 16f / 2f - 1.0 / 16.0 * Vector2.One;
     if (Culture.IsCJK)
       vector2_2 /= 3.25f;
     Group group1 = this.GoldenCubes.AddFace(new Vector3(1f, vector2_2.Y, vector2_2.X), Vector3.Zero, FezMath.OrientationFromDirection(forward), true);
     group1.Position = size / 2f * forward + 0.499f * -forward;
     group1.Blending = new BlendingMode?(BlendingMode.Alphablending);
     if (Culture.IsCJK)
       group1.SamplerState = SamplerState.AnisotropicClamp;
     RenderTarget2D renderTarget = new RenderTarget2D(this.GraphicsDevice, (int) Math.Ceiling((double) vector2_1.X), (int) Math.Ceiling((double) vector2_1.Y), false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, this.GraphicsDevice.PresentationParameters.DepthStencilFormat, this.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);
     using (SpriteBatch spriteBatch = new SpriteBatch(this.GraphicsDevice))
     {
       this.GraphicsDevice.SetRenderTarget(renderTarget);
       this.GraphicsDevice.Clear(ClearOptions.Target, ColorEx.TransparentWhite, 1f, 0);
       GraphicsDeviceExtensions.BeginPoint(spriteBatch);
       spriteBatch.DrawString(this.FontManager.Small, text, Vector2.Zero, Color.White, 0.0f, new Vector2(0.0f, (float) (-(double) this.FontManager.TopSpacing * 4.0 / 5.0)), (float) num, SpriteEffects.None, 0.0f);
       spriteBatch.End();
       this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null);
       group1.Texture = (Texture) renderTarget;
     }
   }
 }
Exemplo n.º 8
0
 public override void Initialize()
 {
   base.Initialize();
   if (!this.IsArtObject)
     this.LevelMaterializer.CullInstanceOut(this.TrileInstance);
   this.SpawnMesh = new Mesh()
   {
     SamplerState = SamplerState.PointClamp,
     DepthWrites = false,
     Effect = (BaseEffect) new CubemappedEffect()
   };
   IIndexedPrimitiveCollection primitiveCollection;
   if (this.IsArtObject)
   {
     ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Matrix> geometry = this.AoInstance.ArtObject.Geometry;
     primitiveCollection = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
     this.AoInstance.Material = new Material();
   }
   else
   {
     ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = this.TrileInstance.Trile.Geometry;
     primitiveCollection = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(geometry.Vertices, geometry.Indices, geometry.PrimitiveType);
   }
   Group group = this.SpawnMesh.AddGroup();
   group.Geometry = primitiveCollection;
   group.Rotation = this.IsArtObject ? this.AoInstance.Rotation : Quaternion.CreateFromAxisAngle(Vector3.UnitY, this.TrileInstance.Phi);
   if (!this.IsArtObject)
   {
     group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, this.TrileInstance.Phi);
     if (this.TrileInstance.Trile.ActorSettings.Type == ActorType.CubeShard || this.TrileInstance.Trile.ActorSettings.Type == ActorType.SecretCube || this.TrileInstance.Trile.ActorSettings.Type == ActorType.PieceOfHeart)
       group.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Left, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Down, 0.7853982f) * group.Rotation;
   }
   this.SpawnMesh.Position = this.IsArtObject ? this.AoInstance.Position : this.TrileInstance.Center;
   this.StarsTexture = this.CMProvider.Global.Load<Texture2D>("Other Textures/black_hole/Stars");
   GlitchyDespawner glitchyDespawner = this;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.Fullbright = true;
   DefaultEffect.Textured textured2 = textured1;
   glitchyDespawner.FullbrightEffect = (DefaultEffect) textured2;
   SoundEffectExtensions.EmitAt(this.CMProvider.Global.Load<SoundEffect>("Sounds/MiscActors/GlitchyRespawn"), this.SpawnMesh.Position);
   this.LightingPostProcess.DrawOnTopLights += new Action(this.DrawLights);
   this.LevelManager.LevelChanging += new Action(this.Kill);
 }
Exemplo n.º 9
0
 protected override void LoadContent()
 {
   this.SpriteBatch = new SpriteBatch(this.GraphicsDevice);
   this.tr = new GlyphTextRenderer(this.Game);
   ContentManager contentManager = this.CMProvider.Get(CM.Menu);
   this.PointerCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_POINTER");
   this.CanClickCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_A");
   this.ClickedCursor = contentManager.Load<Texture2D>("Other Textures/cursor/CURSOR_CLICKER_B");
   this.sAdvanceLevel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/AdvanceLevel");
   this.sCancel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Cancel");
   this.sConfirm = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Confirm");
   this.sCursorUp = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/CursorUp");
   this.sCursorDown = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/CursorDown");
   this.sExitGame = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/ExitGame");
   this.sReturnLevel = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ReturnLevel");
   this.sScreenNarrowen = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ScreenNarrowen");
   this.sScreenWiden = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ScreenWiden");
   this.sSliderValueDecrease = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/SliderValueDecrease");
   this.sSliderValueIncrease = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/SliderValueIncrease");
   this.sStartGame = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/StartGame");
   this.sAppear = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Appear");
   this.sDisappear = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/Menu/Disappear");
   this.LeaderboardsMenu.InputManager = this.InputManager;
   this.LeaderboardsMenu.GameState = this.GameState;
   this.LeaderboardsMenu.Font = this.Fonts.Big;
   this.LeaderboardsMenu.MouseState = this.MouseState;
   this.ControlsMenu.FontManager = this.Fonts;
   this.ControlsMenu.CMProvider = this.CMProvider;
   this.CreditsMenu.FontManager = this.Fonts;
   foreach (MenuLevel menuLevel in this.MenuLevels)
   {
     menuLevel.CMProvider = this.CMProvider;
     menuLevel.Initialize();
   }
   MenuBase menuBase1 = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored();
   vertexColored1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up));
   vertexColored1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f));
   DefaultEffect.VertexColored vertexColored2 = vertexColored1;
   mesh2.Effect = (BaseEffect) vertexColored2;
   mesh1.DepthWrites = false;
   mesh1.AlwaysOnTop = true;
   mesh1.Culling = CullMode.None;
   Mesh mesh3 = mesh1;
   menuBase1.Selector = mesh3;
   this.Selector.AddLines(new Color[4]
   {
     Color.White,
     Color.White,
     Color.White,
     Color.White
   }, new Vector3(-1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(1f, -1f, 10f));
   this.Selector.AddLines(new Color[4]
   {
     Color.White,
     Color.White,
     Color.White,
     Color.White
   }, new Vector3(-1f, 1f, 10f), new Vector3(0.0f, 1f, 10f), new Vector3(-1f, -1f, 10f), new Vector3(0.0f, -1f, 10f));
   this.Selector.AddLines(new Color[4]
   {
     Color.White,
     Color.White,
     Color.White,
     Color.White
   }, new Vector3(0.0f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(0.0f, -1f, 10f), new Vector3(1f, -1f, 10f));
   MenuBase menuBase2 = this;
   Mesh mesh4 = new Mesh();
   Mesh mesh5 = mesh4;
   DefaultEffect.VertexColored vertexColored3 = new DefaultEffect.VertexColored();
   vertexColored3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up));
   vertexColored3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f));
   DefaultEffect.VertexColored vertexColored4 = vertexColored3;
   mesh5.Effect = (BaseEffect) vertexColored4;
   mesh4.DepthWrites = false;
   mesh4.AlwaysOnTop = true;
   mesh4.Culling = CullMode.None;
   mesh4.Enabled = false;
   Mesh mesh6 = mesh4;
   menuBase2.Frame = mesh6;
   this.Frame.AddLines(new Color[8]
   {
     Color.White,
     Color.White,
     Color.White,
     Color.White,
     Color.White,
     Color.White,
     Color.White,
     Color.White
   }, new Vector3(-1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(1f, -1f, 10f), new Vector3(-1f, 1f, 10f), new Vector3(1f, 1f, 10f), new Vector3(-1f, -1f, 10f), new Vector3(1f, -1f, 10f));
   MenuBase menuBase3 = this;
   Mesh mesh7 = new Mesh();
   Mesh mesh8 = mesh7;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up));
   textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f));
   DefaultEffect.Textured textured2 = textured1;
   mesh8.Effect = (BaseEffect) textured2;
   mesh7.DepthWrites = false;
   mesh7.AlwaysOnTop = true;
   mesh7.SamplerState = SamplerState.PointClamp;
   Mesh mesh9 = mesh7;
   menuBase3.MenuLevelOverlay = mesh9;
   this.MenuLevelOverlay.AddFace(new Vector3(2f, 2f, 1f), new Vector3(0.0f, 0.0f, 10f), FaceOrientation.Back, true);
   MenuBase menuBase4 = this;
   Mesh mesh10 = new Mesh();
   Mesh mesh11 = mesh10;
   DefaultEffect.Textured textured3 = new DefaultEffect.Textured();
   textured3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.Zero, Vector3.UnitZ, Vector3.Up));
   textured3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic((float) this.GraphicsDevice.Viewport.Width, (float) this.GraphicsDevice.Viewport.Height, 0.1f, 100f));
   DefaultEffect.Textured textured4 = textured3;
   mesh11.Effect = (BaseEffect) textured4;
   mesh10.DepthWrites = false;
   mesh10.AlwaysOnTop = true;
   Mesh mesh12 = mesh10;
   menuBase4.Mask = mesh12;
   this.Mask.AddFace(new Vector3(2f, 2f, 1f), new Vector3(0.0f, 0.0f, 10f), FaceOrientation.Back, true);
   Waiters.Wait(0.0, new Action(this.Rescale));
   this.RenderToTexture();
 }
Exemplo n.º 10
0
 public SpeechBubble(Game game)
   : base(game)
 {
   this.textMesh = new Mesh()
   {
     AlwaysOnTop = true,
     SamplerState = SamplerState.PointClamp,
     Blending = new BlendingMode?(BlendingMode.Alphablending)
   };
   this.canvasMesh = new Mesh()
   {
     AlwaysOnTop = true,
     SamplerState = SamplerState.PointClamp,
     Blending = new BlendingMode?(BlendingMode.Alphablending)
   };
   this.DrawOrder = 150;
   this.Font = SpeechFont.Pixel;
   this.show = false;
 }
Exemplo n.º 11
0
 private static void AddShell(Mesh mesh, bool positive, bool full)
 {
   Vector3 vector3 = new Vector3(0.5f);
   Group group = mesh.AddGroup();
   if (positive)
   {
     if (full)
       group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalColor>(new VertexPositionNormalColor[12]
       {
         new VertexPositionNormalColor(new Vector3(1f, -1f, -1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, -1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, 1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, -1f, 1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, -1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, -1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, -1f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, 1f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, 1f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, -1f) * vector3, Vector3.UnitY, Color.White)
       }, new int[18]
       {
         0,
         2,
         1,
         0,
         3,
         2,
         4,
         6,
         5,
         4,
         7,
         6,
         8,
         10,
         9,
         8,
         11,
         10
       }, PrimitiveType.TriangleList);
     else
       group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalColor>(new VertexPositionNormalColor[24]
       {
         new VertexPositionNormalColor(new Vector3(1f, -1f, 0.0f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 0.0f, 0.0f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 0.0f, 1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, -1f, 1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, -1f, -1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, -1f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, 0.0f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, -1f, 0.0f) * vector3, Vector3.UnitX, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, -1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 0.0f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(0.0f, 0.0f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(0.0f, -1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(0.0f, -1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(0.0f, 1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, -1f, 1f) * vector3, Vector3.UnitZ, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, 0.0f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, 1f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(0.0f, 1f, 1f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(0.0f, 1f, 0.0f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, -1f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(-1f, 1f, 0.0f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, 0.0f) * vector3, Vector3.UnitY, Color.White),
         new VertexPositionNormalColor(new Vector3(1f, 1f, -1f) * vector3, Vector3.UnitY, Color.White)
       }, new int[36]
       {
         0,
         2,
         1,
         0,
         3,
         2,
         4,
         6,
         5,
         4,
         7,
         6,
         8,
         10,
         9,
         8,
         11,
         10,
         12,
         14,
         13,
         12,
         15,
         14,
         16,
         18,
         17,
         16,
         19,
         18,
         20,
         22,
         21,
         20,
         23,
         22
       }, PrimitiveType.TriangleList);
   }
   else
     group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalColor>(new VertexPositionNormalColor[24]
     {
       new VertexPositionNormalColor(new Vector3(-1f, 0.0f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, 1f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, 1f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, 0.0f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, -1f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, 1f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(1f, 1f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(1f, -1f, -1f) * vector3, -Vector3.UnitZ, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, 0.0f, 0.0f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, 1f, 0.0f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, 1f, -1f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, 0.0f, -1f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, -1f, 1f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, 1f, 1f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, 1f, 0.0f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, -1f, 0.0f) * vector3, -Vector3.UnitX, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, -1f, 0.0f) * vector3, -Vector3.UnitY, Color.White),
       new VertexPositionNormalColor(new Vector3(-1f, -1f, 1f) * vector3, -Vector3.UnitY, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, -1f, 1f) * vector3, -Vector3.UnitY, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, -1f, 0.0f) * vector3, -Vector3.UnitY, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, -1f, -1f) * vector3, -Vector3.UnitY, Color.White),
       new VertexPositionNormalColor(new Vector3(0.0f, -1f, 1f) * vector3, -Vector3.UnitY, Color.White),
       new VertexPositionNormalColor(new Vector3(1f, -1f, 1f) * vector3, -Vector3.UnitY, Color.White),
       new VertexPositionNormalColor(new Vector3(1f, -1f, -1f) * vector3, -Vector3.UnitY, Color.White)
     }, new int[36]
     {
       0,
       2,
       1,
       0,
       3,
       2,
       4,
       6,
       5,
       4,
       7,
       6,
       8,
       10,
       9,
       8,
       11,
       10,
       12,
       14,
       13,
       12,
       15,
       14,
       16,
       17,
       18,
       16,
       18,
       19,
       20,
       21,
       22,
       20,
       22,
       23
     }, PrimitiveType.TriangleList);
 }
Exemplo n.º 12
0
 public TrileMaterializer(Trile trile, Mesh levelMesh, bool mutableSurfaces)
 {
   ServiceHelper.InjectServices((object) this);
   this.trile = trile;
   if (mutableSurfaces)
   {
     this.surfaces = new List<TrixelSurface>();
     this.added = new HashSet<TrixelFace>();
     this.removed = new HashSet<TrixelFace>();
   }
   if (levelMesh == null)
     return;
   this.group = levelMesh.AddGroup();
   this.tempInstances = new List<Vector4>();
   this.tempInstanceIds = new List<TrileInstance>();
   this.group.Geometry = (IIndexedPrimitiveCollection) this.geometry;
 }
Exemplo n.º 13
0
 protected override void Dispose(bool disposing)
 {
   base.Dispose(disposing);
   if (this.LightingPostProcess != null)
     this.LightingPostProcess.DrawGeometryLights -= new Action(this.DrawLights);
   if (this.Geometry != null)
   {
     this.Geometry.Dispose();
     this.Geometry = (ShaderInstancedIndexedPrimitives<VertexPositionTextureInstance, Matrix>) null;
   }
   if (this.mesh != null)
   {
     this.mesh.Dispose();
     this.mesh = (Mesh) null;
   }
   this.effect = (PlaneParticleEffect) null;
   this.Initialized = false;
 }
Exemplo n.º 14
0
 private void CreateMapsFace()
 {
   bool flag = this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha;
   MenuCube menuCube = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured();
   litTextured1.Fullbright = flag;
   DefaultEffect.LitTextured litTextured2 = litTextured1;
   mesh2.Effect = (BaseEffect) litTextured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   mesh1.Material = this.AoInstance.Material;
   mesh1.SamplerState = SamplerState.PointClamp;
   Mesh mesh3 = mesh1;
   menuCube.Maps = mesh3;
   Quaternion fromAxisAngle = Quaternion.CreateFromAxisAngle(Vector3.Up, -1.570796f);
   int num1 = 0;
   foreach (string str in this.GameState.SaveData.Maps)
   {
     Texture2D texture2D1 = this.CMProvider.Global.Load<Texture2D>("Other Textures/maps/" + str + "_1");
     Texture2D texture2D2 = this.CMProvider.Global.Load<Texture2D>("Other Textures/maps/" + str + "_2");
     int num2 = (int) Math.Sqrt((double) MenuCubeFaceExtensions.GetCount(MenuCubeFace.Maps));
     Vector2 vector2 = new Vector2((float) (num1 % num2), (float) (num1 / num2));
     Vector3 size = this.AoInstance.ArtObject.Size;
     Vector3 vector3 = (float) ((double) vector2.X * (double) MenuCubeFaceExtensions.GetSpacing(MenuCubeFace.Maps) / 16.0) * MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) + (float) ((double) vector2.Y * (double) MenuCubeFaceExtensions.GetSpacing(MenuCubeFace.Maps) / 16.0) * -Vector3.UnitY + size / 2f * (MenuCubeFaceExtensions.GetForward(MenuCubeFace.Maps) + Vector3.Up - MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps)) + -MenuCubeFaceExtensions.GetForward(MenuCubeFace.Maps) * (float) MenuCubeFaceExtensions.GetDepth(MenuCubeFace.Maps) / 16f / 2f + (Vector3.Down + MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps)) * (float) MenuCubeFaceExtensions.GetOffset(MenuCubeFace.Maps) / 16f;
     Group group1 = this.Maps.AddGroup();
     group1.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<FezVertexPositionNormalTexture>(new FezVertexPositionNormalTexture[4]
     {
       new FezVertexPositionNormalTexture(new Vector3(-1f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(1f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(-1f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(1f, 1f)),
       new FezVertexPositionNormalTexture(new Vector3(0.0f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(0.0f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 1f))
     }, new int[6]
     {
       0,
       1,
       2,
       2,
       1,
       3
     }, PrimitiveType.TriangleList);
     group1.Scale = new Vector3(0.375f, 1f, 1f) * 1.5f;
     group1.Texture = (Texture) texture2D1;
     group1.Position = vector3 + MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) * 0.125f * 1.5f;
     group1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 0.3926991f) * fromAxisAngle;
     Group group2 = this.Maps.CloneGroup(group1);
     group2.InvertNormals<FezVertexPositionNormalTexture>();
     group2.Texture = (Texture) texture2D2;
     group2.CullMode = new CullMode?(CullMode.CullClockwiseFace);
     group2.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(-1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 1f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
     Group group3 = this.Maps.AddGroup();
     group3.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<FezVertexPositionNormalTexture>(new FezVertexPositionNormalTexture[4]
     {
       new FezVertexPositionNormalTexture(new Vector3(-0.5f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.625f, 1f)),
       new FezVertexPositionNormalTexture(new Vector3(0.5f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 1f))
     }, new int[6]
     {
       0,
       1,
       2,
       2,
       1,
       3
     }, PrimitiveType.TriangleList);
     group3.Scale = new Vector3(0.25f, 1f, 1f) * 1.5f;
     group3.Texture = (Texture) texture2D1;
     group3.Position = vector3;
     group3.Rotation = fromAxisAngle;
     Group group4 = this.Maps.CloneGroup(group3);
     group4.InvertNormals<FezVertexPositionNormalTexture>();
     group4.Texture = (Texture) texture2D2;
     group4.CullMode = new CullMode?(CullMode.CullClockwiseFace);
     group4.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(-1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 1f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
     Group group5 = this.Maps.AddGroup();
     group5.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<FezVertexPositionNormalTexture>(new FezVertexPositionNormalTexture[4]
     {
       new FezVertexPositionNormalTexture(new Vector3(0.0f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(0.0f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.375f, 1f)),
       new FezVertexPositionNormalTexture(new Vector3(1f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.0f, 0.0f)),
       new FezVertexPositionNormalTexture(new Vector3(1f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1.5f), new Vector2(0.0f, 1f))
     }, new int[6]
     {
       0,
       1,
       2,
       2,
       1,
       3
     }, PrimitiveType.TriangleList);
     group5.Scale = new Vector3(0.375f, 1f, 1f) * 1.5f;
     group5.Texture = (Texture) texture2D1;
     group5.Position = vector3 - MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) * 0.125f * 1.5f;
     group5.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 0.3926991f) * fromAxisAngle;
     Group group6 = this.Maps.CloneGroup(group5);
     group6.InvertNormals<FezVertexPositionNormalTexture>();
     group6.Texture = (Texture) texture2D2;
     group6.CullMode = new CullMode?(CullMode.CullClockwiseFace);
     group6.TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(-1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 1f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
     ++num1;
   }
 }
Exemplo n.º 15
0
 public SphereRenderer()
 {
     color = Color.Gray;
     mesh  = new Mesh();
     ID    = instanceID;
 }
Exemplo n.º 16
0
 private void CreateGoldenCubeFace()
 {
   Vector3 size1 = this.AoInstance.ArtObject.Size;
   Trile trile = Enumerable.FirstOrDefault<Trile>(this.LevelManager.ActorTriles(ActorType.CubeShard));
   bool flag = this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha;
   this.GoldenCubes = new Mesh()
   {
     Effect = flag ? (BaseEffect) new DefaultEffect.Textured() : (BaseEffect) new DefaultEffect.LitTextured(),
     Texture = this.LevelMaterializer.TrilesMesh.Texture,
     Blending = new BlendingMode?(BlendingMode.Opaque),
     Material = this.AoInstance.Material
   };
   if (trile == null)
     return;
   ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = trile.Geometry;
   int offset = MenuCubeFaceExtensions.GetOffset(MenuCubeFace.CubeShards);
   int spacing = MenuCubeFaceExtensions.GetSpacing(MenuCubeFace.CubeShards);
   for (int index = 0; index < this.GameState.SaveData.CubeShards; ++index)
   {
     int num1 = index;
     if (num1 >= 14)
       num1 += 2;
     if (num1 >= 20)
       num1 += 2;
     Group group = this.GoldenCubes.AddGroup();
     group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) geometry.Vertices), geometry.Indices, geometry.PrimitiveType);
     int num2 = num1 % 6;
     int num3 = num1 / 6;
     group.Position = size1 / 2f * (Vector3.UnitZ + Vector3.UnitY - Vector3.UnitX) + (float) (offset + num2 * spacing) / 16f * Vector3.UnitX + (float) (offset + num3 * spacing) / 16f * -Vector3.UnitY + 0.5f * -Vector3.UnitZ;
     group.Scale = new Vector3(0.5f);
   }
   Group cubesGroup = this.GoldenCubes.CollapseToBufferWithNormal<VertexPositionNormalTextureInstance>();
   this.GoldenCubes.CustomRenderingHandler = (Mesh.RenderingHandler) ((m, e) =>
   {
     foreach (Group item_0 in m.Groups)
     {
       (e as DefaultEffect).AlphaIsEmissive = item_0 == cubesGroup;
       item_0.Draw(e);
     }
   });
   Group group1 = this.GoldenCubes.AddFace(new Vector3(0.5f, 0.5f, 1f), Vector3.Zero, FaceOrientation.Front, true);
   group1.Position = size1 / 2f * (Vector3.UnitZ + Vector3.UnitY) + 21.0 / 16.0 * -Vector3.UnitY + 3.0 / 16.0 * -Vector3.UnitX + 0.499f * -Vector3.UnitZ;
   group1.Texture = (Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/hud/tiny_key");
   group1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   string text1 = this.GameState.SaveData.Keys.ToString();
   Vector2 vector2_1 = this.FontManager.Small.MeasureString(text1);
   Vector3 size2 = new Vector3(vector2_1 / 16f / 2f - 1.0 / 16.0 * Vector2.One, 1f);
   if (Culture.IsCJK)
     size2 /= 3f;
   Group group2 = this.GoldenCubes.AddFace(size2, Vector3.Zero, FaceOrientation.Front, true);
   group2.Position = size1 / 2f * (Vector3.UnitZ + Vector3.UnitY) + 1.25f * -Vector3.UnitY + 7.0 / 32.0 * Vector3.UnitX + 0.499f * -Vector3.UnitZ;
   group2.Blending = new BlendingMode?(BlendingMode.Alphablending);
   if (Culture.IsCJK)
     group2.SamplerState = SamplerState.AnisotropicClamp;
   RenderTarget2D renderTarget1 = new RenderTarget2D(this.GraphicsDevice, (int) vector2_1.X, (int) vector2_1.Y, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, this.GraphicsDevice.PresentationParameters.DepthStencilFormat, this.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);
   using (SpriteBatch spriteBatch = new SpriteBatch(this.GraphicsDevice))
   {
     this.GraphicsDevice.SetRenderTarget(renderTarget1);
     this.GraphicsDevice.Clear(ClearOptions.Target, ColorEx.TransparentWhite, 1f, 0);
     GraphicsDeviceExtensions.BeginPoint(spriteBatch);
     float num = Culture.IsCJK ? this.FontManager.TopSpacing * 2f : this.FontManager.TopSpacing;
     spriteBatch.DrawString(this.FontManager.Small, text1, Vector2.Zero, Color.White, 0.0f, new Vector2(0.0f, (float) (-(double) num * 4.0 / 5.0)), 1f, SpriteEffects.None, 0.0f);
     spriteBatch.End();
     this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null);
     group2.Texture = (Texture) renderTarget1;
   }
   string text2 = this.GameState.SaveData.CubeShards.ToString();
   int num4 = 2;
   Vector2 vector2_2 = this.FontManager.Small.MeasureString(text2) * (float) num4;
   size2 = new Vector3(vector2_2 / 16f / 2f - 1.0 / 16.0 * Vector2.One, 1f);
   if (Culture.IsCJK)
     size2 /= 3.25f;
   Group group3 = this.GoldenCubes.AddFace(size2, Vector3.Zero, FaceOrientation.Front, true);
   group3.Position = size1 / 2f * Vector3.UnitZ + 0.499f * -Vector3.UnitZ;
   group3.Blending = new BlendingMode?(BlendingMode.Alphablending);
   if (Culture.IsCJK)
     group3.SamplerState = SamplerState.AnisotropicClamp;
   RenderTarget2D renderTarget2 = new RenderTarget2D(this.GraphicsDevice, (int) Math.Ceiling((double) vector2_2.X), (int) Math.Ceiling((double) vector2_2.Y), false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, this.GraphicsDevice.PresentationParameters.DepthStencilFormat, this.GraphicsDevice.PresentationParameters.MultiSampleCount, RenderTargetUsage.PreserveContents);
   using (SpriteBatch spriteBatch = new SpriteBatch(this.GraphicsDevice))
   {
     this.GraphicsDevice.SetRenderTarget(renderTarget2);
     this.GraphicsDevice.Clear(ClearOptions.Target, ColorEx.TransparentWhite, 1f, 0);
     GraphicsDeviceExtensions.BeginPoint(spriteBatch);
     spriteBatch.DrawString(this.FontManager.Small, text2, Vector2.Zero, Color.White, 0.0f, new Vector2(0.0f, (float) (-(double) this.FontManager.TopSpacing * 4.0 / 5.0)), (float) num4, SpriteEffects.None, 0.0f);
     spriteBatch.End();
     this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null);
     group3.Texture = (Texture) renderTarget2;
   }
 }
Exemplo n.º 17
0
 private void FillInPlanes()
 {
   bool flag = true;
   Color color;
   if (this.LevelManager.WaterType == LiquidType.Sewer)
     color = new Color(32, 70, 49);
   else if (this.LevelManager.WaterType == LiquidType.Lava)
     color = Color.Black;
   else if (this.LevelManager.BlinkingAlpha)
   {
     color = Color.Black;
   }
   else
   {
     flag = false;
     color = new Color(56, 40, 95);
   }
   MenuCube menuCube = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.LitVertexColored litVertexColored1 = new DefaultEffect.LitVertexColored();
   litVertexColored1.Fullbright = flag;
   DefaultEffect.LitVertexColored litVertexColored2 = litVertexColored1;
   mesh2.Effect = (BaseEffect) litVertexColored2;
   mesh1.Material = this.AoInstance.Material;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   Mesh mesh3 = mesh1;
   menuCube.HidingPlanes = mesh3;
   Vector3 size = this.AoInstance.ArtObject.Size;
   int fromGroup = 0;
   foreach (MenuCubeFace face in Util.GetValues<MenuCubeFace>())
   {
     if (face != MenuCubeFace.AntiCubes || this.GameState.SaveData.SecretCubes > 0)
     {
       Vector3 vector3_1 = FezMath.Abs(MenuCubeFaceExtensions.GetForward(face));
       for (int index = 0; index < MenuCubeFaceExtensions.GetCount(face) && index < 32; ++index)
       {
         int num1 = index;
         if (num1 >= 14)
           num1 += 2;
         if (num1 >= 20)
           num1 += 2;
         Vector3 vector3_2 = (float) MenuCubeFaceExtensions.GetDepth(face) * MenuCubeFaceExtensions.GetForward(face) / 16f;
         Vector3 vector3_3 = (float) MenuCubeFaceExtensions.GetSize(face) * (Vector3.One - vector3_1) / 16f;
         Vector3 vector3_4 = -vector3_2 / 2f + vector3_3 * MenuCubeFaceExtensions.GetRight(face) / 2f;
         Vector3 vector3_5 = -vector3_2 / 2f + vector3_3 * -MenuCubeFaceExtensions.GetRight(face) / 2f;
         Vector3 vector3_6 = -vector3_2 / 2f + vector3_3 * Vector3.Up / 2f;
         Vector3 vector3_7 = -vector3_2 / 2f + vector3_3 * Vector3.Down / 2f;
         Vector3 vector3_8 = -MenuCubeFaceExtensions.GetForward(face) * (float) MenuCubeFaceExtensions.GetDepth(face) / 32f;
         Vector3 vector3_9 = Vector3.Up * vector3_3 / 2f;
         Vector3 vector3_10 = -MenuCubeFaceExtensions.GetForward(face) * (float) MenuCubeFaceExtensions.GetDepth(face) / 32f;
         Vector3 vector3_11 = Vector3.Up * vector3_3 / 2f;
         Vector3 vector3_12 = -MenuCubeFaceExtensions.GetRight(face) * vector3_3 / 2f;
         Vector3 vector3_13 = MenuCubeFaceExtensions.GetForward(face) * (float) MenuCubeFaceExtensions.GetDepth(face) / 32f;
         Vector3 vector3_14 = -MenuCubeFaceExtensions.GetRight(face) * vector3_3 / 2f;
         Vector3 vector3_15 = MenuCubeFaceExtensions.GetForward(face) * (float) MenuCubeFaceExtensions.GetDepth(face) / 32f;
         Group group = this.HidingPlanes.AddGroup();
         group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalColor>(new VertexPositionNormalColor[16]
         {
           new VertexPositionNormalColor(vector3_4 - vector3_8 + vector3_9, -MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_4 - vector3_8 - vector3_9, -MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_4 + vector3_8 + vector3_9, -MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_4 + vector3_8 - vector3_9, -MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_5 - vector3_10 + vector3_11, MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_5 - vector3_10 - vector3_11, MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_5 + vector3_10 + vector3_11, MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_5 + vector3_10 - vector3_11, MenuCubeFaceExtensions.GetRight(face), color),
           new VertexPositionNormalColor(vector3_6 - vector3_12 + vector3_13, Vector3.Down, color),
           new VertexPositionNormalColor(vector3_6 - vector3_12 - vector3_13, Vector3.Down, color),
           new VertexPositionNormalColor(vector3_6 + vector3_12 + vector3_13, Vector3.Down, color),
           new VertexPositionNormalColor(vector3_6 + vector3_12 - vector3_13, Vector3.Down, color),
           new VertexPositionNormalColor(vector3_7 - vector3_14 + vector3_15, Vector3.Up, color),
           new VertexPositionNormalColor(vector3_7 - vector3_14 - vector3_15, Vector3.Up, color),
           new VertexPositionNormalColor(vector3_7 + vector3_14 + vector3_15, Vector3.Up, color),
           new VertexPositionNormalColor(vector3_7 + vector3_14 - vector3_15, Vector3.Up, color)
         }, new int[24]
         {
           0,
           1,
           2,
           2,
           1,
           3,
           4,
           6,
           5,
           5,
           6,
           7,
           8,
           9,
           10,
           10,
           9,
           11,
           13,
           12,
           14,
           13,
           14,
           15
         }, PrimitiveType.TriangleList);
         int num2 = (int) Math.Sqrt((double) MenuCubeFaceExtensions.GetCount(face));
         int num3 = num1 % num2;
         int num4 = num1 / num2;
         Vector3 vector3_16 = (float) (num3 * MenuCubeFaceExtensions.GetSpacing(face)) / 16f * MenuCubeFaceExtensions.GetRight(face) + (float) (num4 * MenuCubeFaceExtensions.GetSpacing(face)) / 16f * -Vector3.UnitY + size / 2f * (MenuCubeFaceExtensions.GetForward(face) + Vector3.Up - MenuCubeFaceExtensions.GetRight(face)) + MenuCubeFaceExtensions.GetForward(face) * -8f / 16f + (Vector3.Down + MenuCubeFaceExtensions.GetRight(face)) * (float) MenuCubeFaceExtensions.GetOffset(face) / 16f;
         group.Position = vector3_16;
       }
       this.HidingPlanes.CollapseToBufferWithNormal<VertexPositionNormalColor>(fromGroup, this.HidingPlanes.Groups.Count - fromGroup).CustomData = (object) face;
       ++fromGroup;
     }
   }
 }
Exemplo n.º 18
0
 private void CreateTomePages()
 {
   this.TomePages = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.LitTextured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/PAGES/tome_pages")),
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     SamplerState = SamplerState.PointClamp
   };
   Vector3 origin = new Vector3(0.0f, -0.875f, 0.0f);
   Vector3 size = new Vector3(0.875f, 0.875f, 0.0f);
   this.TomePages.AddFace(size, origin, FaceOrientation.Front, false);
   this.TomePages.AddFace(size, origin, FaceOrientation.Back, false);
   this.TomePages.CollapseWithNormalTexture<FezVertexPositionNormalTexture>();
   this.TomePages.Groups[0].Texture = (Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/PAGES/blank");
   for (int index1 = 0; index1 < 2; ++index1)
   {
     for (int index2 = 0; index2 < 4; ++index2)
     {
       this.TomePages.AddFace(size, origin, FaceOrientation.Front, false).TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(0.25f, 0.0f, 0.0f, 0.0f, 0.0f, 0.25f, 0.0f, 0.0f, (float) index1 / 2f, (float) index2 / 4f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
       this.TomePages.AddFace(size, origin, FaceOrientation.Back, false).TextureMatrix = (Dirtyable<Matrix?>) new Matrix?(new Matrix(0.25f, 0.0f, 0.0f, 0.0f, 0.0f, 0.25f, 0.0f, 0.0f, (float) (((double) index1 + 0.5) / 2.0), (float) index2 / 4f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f));
       this.TomePages.CollapseWithNormalTexture<FezVertexPositionNormalTexture>(this.TomePages.Groups.Count - 2, 2).Enabled = false;
     }
   }
 }
Exemplo n.º 19
0
Arquivo: Intro.cs Projeto: Zeludon/FEZ
 protected override void LoadContent()
 {
   ContentManager contentManager = this.CMProvider.Get(CM.Intro);
   StaticText.GetString("Loading");
   bool flag = (double) SettingsManager.GetViewScale(this.GraphicsDevice) >= 1.5;
   this.TrixelEngineText = contentManager.Load<Texture2D>("Other Textures/splash/trixels" + (flag ? "_1440" : ""));
   this.TrapdoorLogo = contentManager.Load<Texture2D>("Other Textures/splash/trapdoor");
   this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
   this.tr = new GlyphTextRenderer(this.Game);
   this.TrixelPlanes.Position = (Vector3.Right + Vector3.Up) * -0.125f - Vector3.Up * 0.25f;
   this.TrixelPlanes.Scale = new Vector3(0.75f);
   this.TrixelPlanes.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Back, Color.Magenta, true, false);
   this.TrixelPlanes.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Top, Color.Yellow, true, false);
   this.TrixelPlanes.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Left, Color.Cyan, true, false);
   SettingsManager.SetupViewport(this.GraphicsDevice, false);
   float aspectRatio1 = this.GraphicsDevice.Viewport.AspectRatio;
   Mesh mesh1 = this.TrixelPlanes;
   DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored();
   vertexColored1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(2f * aspectRatio1, 2f, 0.1f, 100f));
   vertexColored1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.UnitY - Vector3.UnitZ - Vector3.UnitX, Vector3.Zero, Vector3.Up));
   DefaultEffect.VertexColored vertexColored2 = vertexColored1;
   mesh1.Effect = (BaseEffect) vertexColored2;
   Intro intro1 = this;
   Mesh mesh2 = new Mesh();
   mesh2.AlwaysOnTop = true;
   mesh2.DepthWrites = false;
   Mesh mesh3 = mesh2;
   DefaultEffect.VertexColored vertexColored3 = new DefaultEffect.VertexColored();
   vertexColored3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(5f * aspectRatio1, 5f, 0.1f, 100f));
   vertexColored3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(Vector3.UnitY - Vector3.UnitZ - Vector3.UnitX, Vector3.Zero, Vector3.Up));
   DefaultEffect.VertexColored vertexColored4 = vertexColored3;
   mesh3.Effect = (BaseEffect) vertexColored4;
   Mesh mesh4 = mesh2;
   intro1.TrialMesh = mesh4;
   this.TrialMesh.AddColoredBox(Vector3.One, Vector3.Zero, new Color(209, 0, 55), true);
   ServiceHelper.AddComponent((IGameComponent) (this.PolytronLogo = new PolytronLogo(this.Game)));
   this.screen = Intro.Screen.WhiteScreen;
   Intro.FirstBootComplete = true;
   if (this.Restarted && !this.FullLogos)
     this.screen = Intro.Screen.Fez;
   if (this.GameState.ForcedSignOut)
   {
     this.InputManager.ClearActiveController();
     this.screen = Intro.Screen.SignInChooseDevice;
     ServiceHelper.AddComponent((IGameComponent) (Intro.Starfield = new StarField(this.Game)));
   }
   if (this.GameState.LoggedOutPlayerTag != null)
   {
     this.InputManager.ClearActiveController();
     this.screen = Intro.Screen.SignOutPrompt;
     ServiceHelper.AddComponent((IGameComponent) (Intro.Starfield = new StarField(this.Game)));
   }
   if (Fez.SkipLogos)
     this.screen = Intro.Screen.Fez;
   if (this.Fake)
   {
     this.screen = Intro.Screen.Polytron;
     this.PolytronLogo.Enabled = true;
   }
   if (this.Sell)
   {
     this.SoundManager.MuteAmbienceTracks();
     this.SoundManager.PlayNewSong("GOMEZ", 0.1f);
     this.screen = Intro.Screen.SellScreen;
   }
   this.GameState.ForceTimePaused = true;
   this.GameState.InCutscene = true;
   this.phaseTime = TimeSpan.FromSeconds(-0.600000023841858);
   this.sTitleBassHit = contentManager.Load<SoundEffect>("Sounds/Intro/LogoZoom");
   this.sTrixelIn = contentManager.Load<SoundEffect>("Sounds/Intro/TrixelLogoIn");
   this.sTrixelOut = contentManager.Load<SoundEffect>("Sounds/Intro/TrixelLogoOut");
   this.sExitGame = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/ExitGame");
   this.sConfirm = contentManager.Load<SoundEffect>("Sounds/Ui/Menu/Confirm");
   this.sDrone = contentManager.Load<SoundEffect>("Sounds/Intro/FezLogoDrone");
   this.sStarZoom = contentManager.Load<SoundEffect>("Sounds/Intro/StarZoom");
   ServiceHelper.AddComponent((IGameComponent) (this.FezLogo = new FezLogo(this.Game)
   {
     Glitched = this.Glitch
   }));
   if (this.Sell)
   {
     this.FezLogo.Inverted = true;
     this.FezLogo.TransitionStarted = true;
     this.FezLogo.LogoTextureXFade = 1f;
     this.FezLogo.Opacity = 1f;
     Intro.Starfield = this.FezLogo.Starfield;
     this.Enabled = this.Visible = false;
   }
   if (Intro.HasShownSaveIndicator)
     return;
   float aspectRatio2 = this.GraphicsDevice.Viewport.AspectRatio;
   Intro intro2 = this;
   Mesh mesh5 = new Mesh();
   Mesh mesh6 = mesh5;
   DefaultEffect.VertexColored vertexColored5 = new DefaultEffect.VertexColored();
   vertexColored5.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio2, 14f, 0.1f, 100f));
   vertexColored5.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up));
   DefaultEffect.VertexColored vertexColored6 = vertexColored5;
   mesh6.Effect = (BaseEffect) vertexColored6;
   mesh5.Blending = new BlendingMode?(BlendingMode.Alphablending);
   mesh5.AlwaysOnTop = true;
   mesh5.DepthWrites = false;
   Mesh mesh7 = mesh5;
   intro2.SaveIndicatorMesh = mesh7;
   this.SaveIndicatorMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, Color.Red, true);
 }
 public TessellatedMeshRenderer(Common.Mesh mesh)
 {
     this.mesh = mesh;
 }
Exemplo n.º 21
0
 public TrileMaterializer(Trile trile, Mesh levelMesh)
   : this(trile, levelMesh, false)
 {
 }
Exemplo n.º 22
0
 private void CreateHighlights()
 {
   this.Highlights = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.VertexColored(),
     Material = this.AoInstance.Material,
     Blending = new BlendingMode?(BlendingMode.Alphablending)
   };
   Color color = this.LevelManager.BlinkingAlpha ? Color.Yellow : Color.White;
   for (int index = 0; index < 4; ++index)
     this.Highlights.AddGroup();
   this.CreateFaceHighlights(MenuCubeFace.Maps, color);
   this.CreateFaceHighlights(MenuCubeFace.Artifacts, color);
 }
Exemplo n.º 23
0
 public override void Initialize()
 {
   base.Initialize();
   this.mesh = new Mesh()
   {
     Effect = (BaseEffect) (this.effect = new PlaneParticleEffect()),
     SkipStates = true
   };
   this.SetupGeometry();
   this.Initialized = true;
   this.LightingPostProcess.DrawGeometryLights += new Action(this.DrawLights);
 }
Exemplo n.º 24
0
 private void TryInitialize()
 {
   this.ThisLevelMesh.ClearGroups();
   this.NextLevelMesh.ClearGroups();
   lock (FarawayPlaceHost.FarawayWaterMutex)
     this.FarawayWaterMesh = (Mesh) null;
   (this.NextLevelMesh.Effect as FarawayEffect).CleanUp();
   foreach (Script script1 in Enumerable.Where<Script>((IEnumerable<Script>) this.LevelManager.Scripts.Values, (Func<Script, bool>) (x => Enumerable.Any<ScriptAction>((IEnumerable<ScriptAction>) x.Actions, (Func<ScriptAction, bool>) (y => y.Operation == "ChangeToFarAwayLevel")))))
   {
     Volume volume1;
     if (this.LevelManager.Volumes.TryGetValue(Enumerable.FirstOrDefault<ScriptTrigger>((IEnumerable<ScriptTrigger>) script1.Triggers, (Func<ScriptTrigger, bool>) (x =>
     {
       if (x.Object.Type == "Volume")
         return x.Event == "Enter";
       else
         return false;
     })).Object.Identifier.Value, out volume1))
     {
       FaceOrientation faceOrientation = Enumerable.FirstOrDefault<FaceOrientation>((IEnumerable<FaceOrientation>) volume1.Orientations);
       ScriptAction scriptAction1 = Enumerable.FirstOrDefault<ScriptAction>((IEnumerable<ScriptAction>) script1.Actions, (Func<ScriptAction, bool>) (x => x.Operation == "ChangeToFarAwayLevel"));
       string str1 = scriptAction1.Arguments[0];
       int num1 = 0;
       string songName;
       FaceOrientation orientation;
       Vector2 vector2;
       bool flag;
       float num2;
       float num3;
       float num4;
       using (MemoryContentManager memoryContentManager = new MemoryContentManager((IServiceProvider) this.Game.Services, this.Game.Content.RootDirectory))
       {
         string str2 = str1;
         if (!MemoryContentManager.AssetExists("Levels" + (object) '\\' + str1.Replace('/', '\\')))
           str2 = this.LevelManager.FullPath.Substring(0, this.LevelManager.FullPath.LastIndexOf("/") + 1) + str1.Substring(str1.LastIndexOf("/") + 1);
         LevelReader.MinimalRead = true;
         Level level;
         try
         {
           level = memoryContentManager.Load<Level>("Levels/" + str2);
         }
         catch (Exception ex)
         {
           Logger.Log("FarawayPlaceHost", Common.LogSeverity.Warning, "Couldn't load faraway place destination level : " + str1);
           continue;
         }
         LevelReader.MinimalRead = false;
         songName = level.SongName;
         int key;
         try
         {
           key = int.Parse(scriptAction1.Arguments[1]);
         }
         catch (Exception ex)
         {
           key = -1;
         }
         Volume volume2 = key == -1 || !level.Volumes.ContainsKey(key) ? level.Volumes[Enumerable.First<ScriptTrigger>((IEnumerable<ScriptTrigger>) Enumerable.First<Script>((IEnumerable<Script>) level.Scripts.Values, (Func<Script, bool>) (s => Enumerable.Any<ScriptAction>((IEnumerable<ScriptAction>) s.Actions, (Func<ScriptAction, bool>) (a =>
         {
           if (a.Object.Type == "Level" && a.Operation.Contains("Level"))
             return a.Arguments[0] == this.LevelManager.Name;
           else
             return false;
         })))).Triggers, (Func<ScriptTrigger, bool>) (t =>
         {
           if (t.Object.Type == "Volume")
             return t.Event == "Enter";
           else
             return false;
         })).Object.Identifier.Value] : level.Volumes[key];
         orientation = Enumerable.FirstOrDefault<FaceOrientation>((IEnumerable<FaceOrientation>) volume2.Orientations);
         Vector3 vector3 = (level.Size / 2f - (volume2.From + volume2.To) / 2f) * (FezMath.RightVector(FezMath.AsViewpoint(orientation)) + Vector3.Up);
         vector2 = new Vector2(vector3.X + vector3.Z, vector3.Y);
         flag = level.WaterType != LiquidType.None;
         num2 = level.WaterHeight - (volume2.From + volume2.To).Y / 2f + this.EngineState.WaterLevelOffset;
         num3 = this.LevelManager.WaterHeight - (volume1.From + volume1.To).Y / 2f - num2 / 4f;
         num4 = level.Size.Y;
         Script script2 = Enumerable.FirstOrDefault<Script>((IEnumerable<Script>) level.Scripts.Values, (Func<Script, bool>) (s =>
         {
           if (Enumerable.Any<ScriptTrigger>((IEnumerable<ScriptTrigger>) s.Triggers, (Func<ScriptTrigger, bool>) (t =>
           {
             if (t.Event == "Start")
               return t.Object.Type == "Level";
             else
               return false;
           })))
             return Enumerable.Any<ScriptAction>((IEnumerable<ScriptAction>) s.Actions, (Func<ScriptAction, bool>) (a =>
             {
               if (a.Object.Type == "Camera")
                 return a.Operation == "SetPixelsPerTrixel";
               else
                 return false;
             }));
           else
             return false;
         }));
         if (script2 != null)
         {
           ScriptAction scriptAction2 = Enumerable.First<ScriptAction>((IEnumerable<ScriptAction>) script2.Actions, (Func<ScriptAction, bool>) (a =>
           {
             if (a.Object.Type == "Camera")
               return a.Operation == "SetPixelsPerTrixel";
             else
               return false;
           }));
           try
           {
             num1 = int.Parse(scriptAction2.Arguments[0]);
           }
           catch (Exception ex)
           {
           }
         }
         num2 = level.WaterHeight;
       }
       Texture2D texture;
       try
       {
         string assetName = "Other Textures/faraway_thumbs/" + (object) str1 + " (" + (string) (object) FezMath.AsViewpoint(orientation) + ")";
         texture = this.CMProvider.CurrentLevel.Load<Texture2D>(assetName);
         texture.Name = assetName;
       }
       catch (Exception ex)
       {
         Logger.Log("FarawayPlacesHost", Common.LogSeverity.Warning, "Couldn't load faraway thumbnail for " + (object) str1 + " (viewpoint = " + (string) (object) FezMath.AsViewpoint(orientation) + ")");
         continue;
       }
       if (!Enumerable.Any<Group>((IEnumerable<Group>) this.ThisLevelMesh.Groups, (Func<Group, bool>) (x => x.Texture == texture)))
       {
         if (num1 == 0)
           num1 = (int) this.CameraManager.PixelsPerTrixel;
         Group group1 = this.ThisLevelMesh.AddFace(new Vector3((float) texture.Width, (float) texture.Height, (float) texture.Width) / 16f / 2f, Vector3.Zero, faceOrientation, true);
         Group group2 = this.NextLevelMesh.AddFace(new Vector3((float) texture.Width, (float) texture.Height, (float) texture.Width) / 16f / 2f, Vector3.Zero, faceOrientation, true);
         FarawayPlaceData farawayPlaceData = new FarawayPlaceData()
         {
           OriginalCenter = (volume1.From + volume1.To) / 2f,
           Viewpoint = FezMath.AsViewpoint(faceOrientation),
           Volume = volume1,
           DestinationOffset = vector2.X * FezMath.RightVector(FezMath.AsViewpoint(faceOrientation)) + Vector3.Up * vector2.Y,
           WaterLevelOffset = new float?(num3),
           DestinationLevelName = str1,
           DestinationWaterLevel = num2,
           DestinationLevelSize = num4
         };
         if (this.LevelManager.WaterType == LiquidType.None && flag)
         {
           if (this.HorizontalGradientTex == null || this.HorizontalGradientTex.IsDisposed)
             this.HorizontalGradientTex = this.CMProvider.Global.Load<Texture2D>("Other Textures/WaterHorizGradient");
           lock (FarawayPlaceHost.FarawayWaterMutex)
           {
             FarawayPlaceHost temp_380 = this;
             // ISSUE: explicit reference operation
             // ISSUE: variable of a reference type
             FarawayPlaceData& temp_381 = @farawayPlaceData;
             Mesh local_28 = new Mesh();
             Mesh temp_383 = local_28;
             DefaultEffect.Textured local_29 = new DefaultEffect.Textured();
             local_29.AlphaIsEmissive = false;
             DefaultEffect.Textured temp_387 = local_29;
             temp_383.Effect = (BaseEffect) temp_387;
             Mesh temp_388;
             Mesh local_43 = temp_388 = local_28;
             // ISSUE: explicit reference operation
             (^temp_381).WaterBodyMesh = temp_388;
             Mesh temp_389 = local_43;
             temp_380.FarawayWaterMesh = temp_389;
             this.FarawayWaterMesh.AddFace(Vector3.One, new Vector3(-0.5f, -1f, -0.5f) + FezMath.Abs(FezMath.AsVector(faceOrientation)) * 0.5f, faceOrientation, false).Material = new Material();
             this.FarawayWaterMesh.AddFace(Vector3.One, new Vector3(-0.5f, -1f, -0.5f) + FezMath.Abs(FezMath.AsVector(faceOrientation)) * 0.5f, faceOrientation, false).Material = new Material();
           }
         }
         group2.CustomData = group1.CustomData = (object) farawayPlaceData;
         group2.Position = group1.Position = farawayPlaceData.OriginalCenter;
         group2.Texture = group1.Texture = (Texture) texture;
         group2.Material = new Material()
         {
           Opacity = 0.125f
         };
         group1.Material = new Material()
         {
           Opacity = 0.125f
         };
         if (volume1.ActorSettings == null)
           volume1.ActorSettings = new VolumeActorSettings();
         volume1.ActorSettings.DestinationSong = songName;
         switch (num1)
         {
           case 1:
             volume1.ActorSettings.DestinationRadius = 80f;
             break;
           case 2:
             volume1.ActorSettings.DestinationRadius = 40f;
             break;
           case 3:
             volume1.ActorSettings.DestinationRadius = 26.66667f;
             break;
           case 4:
             volume1.ActorSettings.DestinationRadius = 20f;
             break;
           case 5:
             volume1.ActorSettings.DestinationRadius = 16f;
             break;
         }
         volume1.ActorSettings.DestinationPixelsPerTrixel = (float) num1;
         volume1.ActorSettings.DestinationOffset = vector2;
       }
     }
   }
 }
Exemplo n.º 25
0
 protected override void Dispose(bool disposing)
 {
   base.Dispose(disposing);
   foreach (Mesh mesh in this.FractalMeshes)
     mesh.Dispose();
   this.FractalMeshes.Clear();
   if (this.OuterShellMesh != null)
     this.OuterShellMesh.Dispose();
   this.OuterShellMesh = (Mesh) null;
   if (this.AxisMesh != null)
     this.AxisMesh.Dispose();
   this.AxisMesh = (Mesh) null;
 }
Exemplo n.º 26
0
 public override void Update(GameTime gameTime)
 {
   if (this.EngineState.Paused || this.EngineState.InMap || (!FezMath.IsOrthographic(this.CameraManager.Viewpoint) || this.CameraManager.ProjectionTransition))
     return;
   if (this.EngineState.FarawaySettings.InTransition && (double) this.EngineState.FarawaySettings.OriginFadeOutStep == 1.0 && !this.IsFake)
   {
     for (int i = this.NextLevelMesh.Groups.Count - 1; i >= 0; --i)
     {
       try
       {
         if (i < this.NextLevelMesh.Groups.Count)
         {
           Group group = this.NextLevelMesh.Groups[i];
           FarawayPlaceData farawayPlaceData = (FarawayPlaceData) group.CustomData;
           string levelName = this.LevelManager.Name.Substring(0, this.LevelManager.Name.LastIndexOf("/") + 1) + farawayPlaceData.DestinationLevelName;
           if (this.CameraManager.Viewpoint != farawayPlaceData.Viewpoint)
           {
             this.NextLevelMesh.RemoveGroupAt(i);
             (this.NextLevelMesh.Effect as FarawayEffect).CleanUp();
           }
           else
             this.CMProvider.GetForLevel(levelName).Load<Texture2D>(group.Texture.Name);
         }
       }
       catch (Exception ex)
       {
       }
     }
     this.hasntSnapped = true;
     Mesh mesh = this.NextLevelMesh;
     this.NextLevelMesh = this.LastLevelMesh;
     this.LastLevelMesh = mesh;
     this.LastWaterMesh = this.FarawayWaterMesh;
     this.ThisLevelMesh.ClearGroups();
     this.OriginalFakeRadius = (float) this.GraphicsDevice.Viewport.Width / (this.CameraManager.PixelsPerTrixel * 16f);
     this.DestinationFakeRadius = this.EngineState.FarawaySettings.DestinationRadius / 4f;
     this.EngineState.FarawaySettings.InterpolatedFakeRadius = this.CameraManager.Radius;
     this.LastLevelMesh.Effect.ForcedViewMatrix = new Matrix?(this.CameraManager.View);
     (this.LastLevelMesh.Effect as FarawayEffect).ActualOpacity = 1f;
     if (this.LastWaterMesh != null && this.LastWaterMesh.Groups.Count > 0)
     {
       this.LastWaterMesh.Effect.ForcedViewMatrix = new Matrix?(this.CameraManager.View);
       try
       {
         this.LastWaterMesh.Groups[0].Material.Opacity = this.LastWaterMesh.Groups[1].Material.Opacity = 1f;
       }
       catch (Exception ex)
       {
       }
       lock (FarawayPlaceHost.FarawayWaterMutex)
         this.FarawayWaterMesh = (Mesh) null;
     }
     this.IsFake = true;
     this.Fader.PlacesMesh = this.LastLevelMesh;
     this.Fader.FarawayWaterMesh = this.LastWaterMesh;
     this.LastLevelMesh.AlwaysOnTop = true;
     if (this.LastWaterMesh != null)
       this.LastWaterMesh.AlwaysOnTop = true;
     this.EngineState.FarawaySettings.LoadingAllowed = true;
   }
   if (!this.EngineState.FarawaySettings.InTransition && this.IsFake)
   {
     this.IsFake = false;
     this.Fader.Visible = false;
     lock (FarawayPlaceHost.FarawayPlaceMutex)
       this.Fader.PlacesMesh = (Mesh) null;
     lock (FarawayPlaceHost.FarawayWaterMutex)
       this.Fader.FarawayWaterMesh = (Mesh) null;
   }
   if (this.EngineState.FarawaySettings.InTransition)
   {
     float amount = this.EngineState.FarawaySettings.TransitionStep;
     this.Fader.Visible = true;
     float viewScale = SettingsManager.GetViewScale(this.GraphicsDevice);
     if (this.IsFake)
     {
       this.FakeRadius = MathHelper.Lerp(this.OriginalFakeRadius, this.DestinationFakeRadius, amount);
       this.EngineState.FarawaySettings.InterpolatedFakeRadius = MathHelper.Lerp(this.EngineState.FarawaySettings.InterpolatedFakeRadius, this.FakeRadius, MathHelper.Clamp((float) gameTime.ElapsedGameTime.TotalSeconds * this.CameraManager.InterpolationSpeed, 0.0f, 1f));
       this.LastLevelMesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(this.EngineState.FarawaySettings.InterpolatedFakeRadius / viewScale, this.EngineState.FarawaySettings.InterpolatedFakeRadius / this.CameraManager.AspectRatio / viewScale, this.CameraManager.NearPlane, this.CameraManager.FarPlane));
       if (this.LastWaterMesh != null)
         this.LastWaterMesh.Effect.ForcedProjectionMatrix = this.LastLevelMesh.Effect.ForcedProjectionMatrix;
       this.EngineState.SkipRendering = true;
       this.CameraManager.Radius = this.FakeRadius * 4f;
       (this.ThisLevelMesh.Effect as FarawayEffect).ActualOpacity = (float) (((double) amount - 0.5) * 2.0);
       (this.LastLevelMesh.Effect as FarawayEffect).ActualOpacity = 1f - this.EngineState.FarawaySettings.DestinationCrossfadeStep;
       try
       {
         if (this.FarawayWaterMesh != null)
         {
           lock (FarawayPlaceHost.FarawayWaterMutex)
           {
             if ((double) amount > 0.5)
             {
               this.FarawayWaterMesh.Groups[0].Material.Opacity = (float) (((double) amount - 0.5) * 2.0);
               this.FarawayWaterMesh.Groups[1].Material.Opacity = (float) (((double) amount - 0.5) * 2.0);
             }
             else
               this.FarawayWaterMesh.Groups[0].Material.Opacity = this.FarawayWaterMesh.Groups[1].Material.Opacity = 0.0f;
           }
         }
         else if (this.LastWaterMesh != null)
         {
           lock (FarawayPlaceHost.FarawayWaterMutex)
           {
             this.LastWaterMesh.Groups[0].Material.Opacity = 1f - this.EngineState.FarawaySettings.DestinationCrossfadeStep;
             this.LastWaterMesh.Groups[1].Material.Opacity = 1f - this.EngineState.FarawaySettings.DestinationCrossfadeStep;
             this.LastWaterMesh.Groups[0].Material.Diffuse = Vector3.Lerp(this.FogManager.Color.ToVector3(), this.EngineState.WaterBodyColor * this.LevelManager.ActualDiffuse.ToVector3(), (float) ((double) Easing.EaseIn((double) amount, EasingType.Sine) * 0.875 + 0.125));
             this.LastWaterMesh.Groups[1].Material.Diffuse = Vector3.Lerp(this.FogManager.Color.ToVector3(), this.EngineState.WaterFoamColor * this.LevelManager.ActualDiffuse.ToVector3(), (float) ((double) Easing.EaseIn((double) amount, EasingType.Sine) * 0.875 + 0.125));
           }
         }
       }
       catch (Exception ex)
       {
       }
       if ((double) this.EngineState.FarawaySettings.DestinationCrossfadeStep == 0.0 && !this.hasntSnapped)
       {
         this.hasntSnapped = false;
         this.CameraManager.SnapInterpolation();
       }
       this.EngineState.SkipRendering = false;
       foreach (Group group in this.LastLevelMesh.Groups)
         group.Material.Opacity = (float) ((double) Easing.EaseIn((double) amount, EasingType.Sine) * 0.875 + 0.125);
     }
     else
     {
       foreach (Group group in this.ThisLevelMesh.Groups)
         group.Material.Opacity = (float) ((double) Easing.EaseIn((double) amount, EasingType.Sine) * 0.875 + 0.125);
     }
   }
   if (this.EngineState.Loading)
     return;
   for (int index = 0; index < this.ThisLevelMesh.Groups.Count; ++index)
   {
     Group group1 = this.ThisLevelMesh.Groups[index];
     Group group2 = this.NextLevelMesh.Groups[index];
     FarawayPlaceData farawayPlaceData = (FarawayPlaceData) this.ThisLevelMesh.Groups[index].CustomData;
     Vector2 vector2 = farawayPlaceData.Volume.ActorSettings == null ? Vector2.Zero : farawayPlaceData.Volume.ActorSettings.FarawayPlaneOffset;
     bool flag = farawayPlaceData.Volume.ActorSettings != null && farawayPlaceData.Volume.ActorSettings.WaterLocked;
     float num1 = this.CameraManager.PixelsPerTrixel;
     if (this.EngineState.FarawaySettings.InTransition && FezMath.AlmostEqual(this.EngineState.FarawaySettings.DestinationCrossfadeStep, 1f))
       num1 = MathHelper.Lerp(this.CameraManager.PixelsPerTrixel, this.EngineState.FarawaySettings.DestinationPixelsPerTrixel, (float) (((double) this.EngineState.FarawaySettings.TransitionStep - 0.875) / 0.125));
     float num2 = (float) ((double) (-4 * (this.LevelManager.Descending ? -1 : 1)) / (double) num1 - 15.0 / 32.0 + 1.0);
     Vector3 vector3 = this.CameraManager.InterpolatedCenter - farawayPlaceData.OriginalCenter + num2 * Vector3.UnitY;
     float num3 = (float) (FarawayPlaceHost.GetCustomOffset((double) num1) * (this.LevelManager.Descending ? -1.0 : 1.0) + 15.0 / 32.0);
     float num4 = 0.0f;
     if (flag && farawayPlaceData.WaterLevelOffset.HasValue)
     {
       vector3 *= FezMath.XZMask;
       vector2 *= Vector2.UnitX;
       num4 = (float) ((double) farawayPlaceData.WaterLevelOffset.Value - (double) num3 / 4.0 - 0.5 + 0.125);
       farawayPlaceData.Volume.ActorSettings.WaterOffset = num4;
     }
     group1.Position = group2.Position = (farawayPlaceData.OriginalCenter + (farawayPlaceData.DestinationOffset + num3 * Vector3.UnitY) / 4f) * FezMath.ScreenSpaceMask(farawayPlaceData.Viewpoint) + FezMath.DepthMask(farawayPlaceData.Viewpoint) * this.CameraManager.InterpolatedCenter + FezMath.ForwardVector(farawayPlaceData.Viewpoint) * 30f + FezMath.RightVector(farawayPlaceData.Viewpoint) * vector2.X + Vector3.Up * vector2.Y + vector3 * FezMath.ScreenSpaceMask(farawayPlaceData.Viewpoint) / 2f + num4 * Vector3.UnitY;
     if (farawayPlaceData.WaterBodyMesh != null && farawayPlaceData.WaterBodyMesh.Groups.Count > 0)
     {
       this.waterRightVector = FezMath.RightVector(farawayPlaceData.Viewpoint);
       farawayPlaceData.WaterBodyMesh.Position = group1.Position * (FezMath.DepthMask(farawayPlaceData.Viewpoint) + Vector3.UnitY) + this.CameraManager.InterpolatedCenter * FezMath.SideMask(farawayPlaceData.Viewpoint) + ((float) ((double) farawayPlaceData.DestinationWaterLevel - (double) farawayPlaceData.DestinationLevelSize / 2.0 - 0.5) + this.EngineState.WaterLevelOffset) * Vector3.UnitY / 4f;
       farawayPlaceData.WaterBodyMesh.Groups[0].Scale = new Vector3(this.CameraManager.Radius);
       farawayPlaceData.WaterBodyMesh.Groups[0].Material.Diffuse = Vector3.Lerp(this.EngineState.WaterBodyColor * this.LevelManager.ActualDiffuse.ToVector3(), this.FogManager.Color.ToVector3(), 0.875f);
       farawayPlaceData.WaterBodyMesh.Groups[1].Scale = new Vector3(this.CameraManager.Radius, 1.0 / 16.0, this.CameraManager.Radius);
       farawayPlaceData.WaterBodyMesh.Groups[1].Material.Diffuse = Vector3.Lerp(this.EngineState.WaterFoamColor * this.LevelManager.ActualDiffuse.ToVector3(), this.FogManager.Color.ToVector3(), 0.875f);
     }
   }
   this.LastLevelMesh.Material.Diffuse = this.FogManager.Color.ToVector3();
 }
 public MeshRenderer(Common.Mesh mesh)
 {
     this.mesh = mesh;
     this.EnableNormalMap = true;
 }
 public MeshRenderer(Common.Mesh mesh)
 {
     this.mesh = mesh;
 }
Exemplo n.º 29
0
 public MeshRenderer(Common.Mesh mesh)
 {
     this.mesh            = mesh;
     this.EnableNormalMap = true;
 }
Exemplo n.º 30
0
 public virtual void Prepare(Mesh mesh)
 {
   this.eyeSign.Set(BaseEffect.sharedEyeSign);
   this.levelCenter.Set(BaseEffect.sharedLevelCenter);
   this.time.Set((float) this.stopWatch.Elapsed.TotalSeconds);
   if (mesh.TextureMatrix.Dirty || this.IgnoreCache)
   {
     this.matrices.TextureMatrix = (Matrix) mesh.TextureMatrix;
     mesh.TextureMatrix.Clean();
   }
   if (this.SimpleMeshPrepare)
     this.matrices.WorldViewProjection = this.viewProjection;
   else if (this.SimpleGroupPrepare)
   {
     Matrix matrix = this.viewProjection;
     if (this.ForcedViewMatrix.HasValue && !this.ForcedProjectionMatrix.HasValue)
       matrix = this.ForcedViewMatrix.Value * this.CameraProvider.Projection;
     else if (!this.ForcedViewMatrix.HasValue && this.ForcedProjectionMatrix.HasValue)
       matrix = this.CameraProvider.View * this.ForcedProjectionMatrix.Value;
     else if (this.ForcedViewMatrix.HasValue && this.ForcedProjectionMatrix.HasValue)
       matrix = this.ForcedViewMatrix.Value * this.ForcedProjectionMatrix.Value;
     this.matrices.WorldViewProjection = mesh.WorldMatrix * matrix;
   }
   else
     this.material.Opacity = mesh.Material.Opacity;
 }
Exemplo n.º 31
0
 public SkyHost(Game game)
   : base(game)
 {
   this.DrawOrder = 0;
   this.UpdateOrder = 11;
   SkyHost.Instance = this;
   this.stars = new Mesh()
   {
     Culling = CullMode.CullClockwiseFace,
     AlwaysOnTop = true,
     DepthWrites = false,
     SamplerState = SamplerState.PointWrap
   };
   ServiceHelper.AddComponent((IGameComponent) new CloudShadowsHost(game, this));
 }
Exemplo n.º 32
0
 private void InitializeSky()
 {
   if (this.LevelManager.Sky == null)
     return;
   ContentManager contentManager = this.LevelManager.Name == null ? this.CMProvider.Global : this.CMProvider.GetForLevel(this.LevelManager.Name);
   string str1 = "Skies/" + this.LevelManager.Sky.Name + "/";
   if (this.LevelManager.Sky.Name == this.lastSkyName && !this.EngineState.InEditor)
   {
     foreach (string str2 in this.LevelManager.Sky.Clouds)
       contentManager.Load<Texture2D>(str1 + str2);
     foreach (SkyLayer skyLayer in this.LevelManager.Sky.Layers)
       contentManager.Load<Texture2D>(str1 + skyLayer.Name);
     try
     {
       this.skyBackground = contentManager.Load<Texture2D>(str1 + this.LevelManager.Sky.Background);
     }
     catch (Exception ex)
     {
       this.skyBackground = contentManager.Load<Texture2D>("Skies/Default/SkyBack");
     }
     if (this.LevelManager.Sky.Stars == null)
       return;
     contentManager.Load<Texture2D>(str1 + this.LevelManager.Sky.Stars);
   }
   else
   {
     this.lastSkyName = this.LevelManager.Sky.Name;
     if (this.LevelManager.Sky.Stars != null)
       this.stars.Texture = (Dirtyable<Texture>) ((Texture) contentManager.Load<Texture2D>(str1 + this.LevelManager.Sky.Stars));
     else
       this.stars.Texture.Set((Texture) null);
     string assetName1 = str1 + this.LevelManager.Sky.Background;
     try
     {
       this.skyBackground = contentManager.Load<Texture2D>(assetName1);
     }
     catch (Exception ex)
     {
       this.skyBackground = contentManager.Load<Texture2D>("Skies/Default/SkyBack");
     }
     this.fogColors = new Color[this.skyBackground.Width];
     Color[] data1 = new Color[this.skyBackground.Width * this.skyBackground.Height];
     this.skyBackground.GetData<Color>(data1);
     Array.Copy((Array) data1, this.skyBackground.Width * this.skyBackground.Height / 2, (Array) this.fogColors, 0, this.skyBackground.Width);
     using (MemoryContentManager memoryContentManager = new MemoryContentManager(contentManager.ServiceProvider, contentManager.RootDirectory))
     {
       Texture2D texture2D = (Texture2D) null;
       if (this.LevelManager.Sky.CloudTint != null)
       {
         string assetName2 = str1 + this.LevelManager.Sky.CloudTint;
         try
         {
           texture2D = memoryContentManager.Load<Texture2D>(assetName2);
         }
         catch (Exception ex)
         {
           Logger.Log("Sky Init", Common.LogSeverity.Warning, "Cloud tinting texture could not be found");
         }
       }
       if (texture2D != null)
       {
         this.cloudColors = new Color[texture2D.Width];
         Color[] data2 = new Color[texture2D.Width * texture2D.Height];
         texture2D.GetData<Color>(data2);
         Array.Copy((Array) data2, texture2D.Width * (texture2D.Height / 2), (Array) this.cloudColors, 0, texture2D.Width);
       }
       else
         this.cloudColors = new Color[1]
         {
           Color.White
         };
     }
     this.cloudStates.Clear();
     foreach (Mesh mesh in this.cloudMeshes)
       mesh.Dispose();
     this.cloudMeshes.Clear();
     if (this.BgLayers != null)
       this.BgLayers.ClearGroups();
     else
       this.BgLayers = new Mesh()
       {
         AlwaysOnTop = true,
         DepthWrites = false,
         Effect = (BaseEffect) new DefaultEffect.Textured()
       };
     int num1 = 0;
     foreach (SkyLayer skyLayer in this.LevelManager.Sky.Layers)
     {
       Texture2D texture2D1 = contentManager.Load<Texture2D>(str1 + skyLayer.Name);
       Texture2D texture2D2 = (Texture2D) null;
       if (skyLayer.Name == "OBS_SKY_A")
         texture2D2 = contentManager.Load<Texture2D>(str1 + "OBS_SKY_C");
       int num2 = 0;
       foreach (FaceOrientation faceOrientation in Util.GetValues<FaceOrientation>())
       {
         if (FezMath.IsSide(faceOrientation))
         {
           Group group = this.BgLayers.AddFace(Vector3.One, -FezMath.AsVector(faceOrientation) / 2f, faceOrientation, true);
           group.Texture = texture2D2 == null || faceOrientation == FaceOrientation.Left ? (Texture) texture2D1 : (Texture) texture2D2;
           group.AlwaysOnTop = new bool?(skyLayer.InFront);
           group.Material = new Material()
           {
             Opacity = skyLayer.Opacity
           };
           group.CustomData = (object) new SkyHost.BgLayerState()
           {
             Layer = num1,
             Side = num2++,
             OriginalOpacity = skyLayer.Opacity
           };
         }
       }
       ++num1;
     }
     foreach (Layer key in Util.GetValues<Layer>())
       this.cloudStates.Add(key, new List<SkyHost.CloudState>());
     foreach (string str2 in this.LevelManager.Sky.Clouds)
       this.cloudMeshes.Add(new Mesh()
       {
         AlwaysOnTop = true,
         DepthWrites = false,
         Effect = (BaseEffect) new CloudsEffect(),
         Texture = (Dirtyable<Texture>) ((Texture) contentManager.Load<Texture2D>(str1 + str2)),
         Culling = CullMode.None,
         SamplerState = SamplerState.PointClamp
       });
     float num3 = 64f * this.LevelManager.Sky.Density;
     int num4 = (int) Math.Sqrt((double) num3);
     float num5 = num3 / (float) num4;
     float num6 = RandomHelper.Between(0.0, 6.28318548202515);
     float num7 = RandomHelper.Between(0.0, 192.0);
     if (this.cloudMeshes.Count > 0)
     {
       for (int index1 = 0; index1 < num4; ++index1)
       {
         for (int index2 = 0; (double) index2 < (double) num5; ++index2)
         {
           Group group = RandomHelper.InList<Mesh>(this.cloudMeshes).AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
           float num2 = RandomHelper.Between(0.0, 1.0 / (double) num4 * 6.28318548202515);
           float num8 = RandomHelper.Between(0.0, 1.0 / (double) num5 * 192.0);
           this.cloudStates[RandomHelper.EnumField<Layer>()].Add(new SkyHost.CloudState()
           {
             Group = group,
             Phi = (float) (((double) index1 / (double) num4 * 6.28318548202515 + (double) num6 + (double) num2) % 6.28318548202515),
             LocalHeightOffset = (float) (((double) index2 / (double) num5 * 96.0 * 2.0 + (double) num7 + (double) num8) % 192.0 - 96.0)
           });
           group.Material = new Material();
         }
       }
     }
     this.flickerIn = RandomHelper.Between(2.0, 10.0);
     this.ResizeLayers();
     this.ResizeStars();
     this.OnViewpointChanged();
     this.OnViewChanged();
   }
 }
 public MeshRenderer(Common.Mesh mesh)
 {
     this.mesh = mesh;
 }
Exemplo n.º 34
0
 public override void Initialize()
 {
   base.Initialize();
   this.GTR = new GlyphTextRenderer(this.Game);
   this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
   this.Scripting.CutsceneSkipped += new Action(this.OnCutsceneSkipped);
   this.Vertices = new List<Vector4>()
   {
     new Vector4(-1f, -1f, -1f, -1f),
     new Vector4(1f, -1f, -1f, -1f),
     new Vector4(-1f, 1f, -1f, -1f),
     new Vector4(1f, 1f, -1f, -1f),
     new Vector4(-1f, -1f, 1f, -1f),
     new Vector4(1f, -1f, 1f, -1f),
     new Vector4(-1f, 1f, 1f, -1f),
     new Vector4(1f, 1f, 1f, -1f),
     new Vector4(-1f, -1f, -1f, 1f),
     new Vector4(1f, -1f, -1f, 1f),
     new Vector4(-1f, 1f, -1f, 1f),
     new Vector4(1f, 1f, -1f, 1f),
     new Vector4(-1f, -1f, 1f, 1f),
     new Vector4(1f, -1f, 1f, 1f),
     new Vector4(-1f, 1f, 1f, 1f),
     new Vector4(1f, 1f, 1f, 1f)
   };
   this.DotMesh = new Mesh()
   {
     Effect = (BaseEffect) new DotEffect(),
     Blending = new BlendingMode?(BlendingMode.Additive),
     DepthWrites = false,
     Culling = CullMode.None,
     AlwaysOnTop = true,
     Material = {
       Opacity = 0.3333333f
     }
   };
   this.RaysMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/smooth_ray")),
     Blending = new BlendingMode?(BlendingMode.Additive),
     SamplerState = SamplerState.AnisotropicClamp,
     DepthWrites = false,
     AlwaysOnTop = true
   };
   this.FlareMesh = new Mesh()
   {
     Effect = (BaseEffect) new DefaultEffect.Textured(),
     Texture = (Dirtyable<Texture>) ((Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/rainbow_flare")),
     Blending = new BlendingMode?(BlendingMode.Additive),
     SamplerState = SamplerState.AnisotropicClamp,
     DepthWrites = false,
     AlwaysOnTop = true
   };
   DotHost dotHost = this;
   Mesh mesh1 = new Mesh();
   Mesh mesh2 = mesh1;
   DefaultEffect.Textured textured1 = new DefaultEffect.Textured();
   textured1.IgnoreCache = true;
   DefaultEffect.Textured textured2 = textured1;
   mesh2.Effect = (BaseEffect) textured2;
   mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending);
   mesh1.SamplerState = SamplerStates.PointMipClamp;
   mesh1.DepthWrites = false;
   mesh1.AlwaysOnTop = true;
   Mesh mesh3 = mesh1;
   dotHost.VignetteMesh = mesh3;
   this.VignetteMesh.AddFace(new Vector3(1f), Vector3.Zero, FaceOrientation.Front, true);
   this.BPromptMesh = new Mesh()
   {
     AlwaysOnTop = true,
     SamplerState = SamplerState.PointClamp,
     Blending = new BlendingMode?(BlendingMode.Alphablending),
     Effect = (BaseEffect) new DefaultEffect.Textured()
   };
   this.BPromptMesh.AddFace(new Vector3(1f, 1f, 0.0f), Vector3.Zero, FaceOrientation.Front, false);
   this.FlareMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true);
   this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotWireGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.LineList));
   this.DotMesh.AddGroup().Geometry = (IIndexedPrimitiveCollection) (this.DotFacesGeometry = new IndexedUserPrimitives<FezVertexPositionColor>(PrimitiveType.TriangleList));
   this.DotWireGeometry.Vertices = new FezVertexPositionColor[16];
   for (int index = 0; index < 16; ++index)
     this.DotWireGeometry.Vertices[index].Color = new Color(1f, 1f, 1f, 1f);
   this.DotWireGeometry.Indices = new int[64]
   {
     0,
     1,
     0,
     2,
     2,
     3,
     3,
     1,
     4,
     5,
     6,
     7,
     4,
     6,
     5,
     7,
     4,
     0,
     6,
     2,
     3,
     7,
     1,
     5,
     10,
     11,
     8,
     9,
     8,
     10,
     9,
     11,
     12,
     14,
     14,
     15,
     15,
     13,
     12,
     13,
     12,
     8,
     14,
     10,
     15,
     11,
     13,
     9,
     2,
     10,
     3,
     11,
     0,
     8,
     1,
     9,
     6,
     14,
     7,
     15,
     4,
     12,
     5,
     13
   };
   this.DotFacesGeometry.Vertices = new FezVertexPositionColor[96];
   for (int index1 = 0; index1 < 4; ++index1)
   {
     for (int index2 = 0; index2 < 6; ++index2)
     {
       Vector3 vector3 = Vector3.Zero;
       switch ((index2 + index1 * 6) % 6)
       {
         case 0:
           vector3 = new Vector3(0.0f, 1f, 0.75f);
           break;
         case 1:
           vector3 = new Vector3(0.1666667f, 1f, 0.75f);
           break;
         case 2:
           vector3 = new Vector3(0.3333333f, 1f, 0.75f);
           break;
         case 3:
           vector3 = new Vector3(0.5f, 1f, 0.75f);
           break;
         case 4:
           vector3 = new Vector3(0.6666667f, 1f, 0.75f);
           break;
         case 5:
           vector3 = new Vector3(0.8333333f, 1f, 0.75f);
           break;
       }
       for (int index3 = 0; index3 < 4; ++index3)
         this.DotFacesGeometry.Vertices[index3 + index2 * 4 + index1 * 24].Color = new Color(vector3.X, vector3.Y, vector3.Z);
     }
   }
   this.FaceVertexIndices = new int[96]
   {
     0,
     2,
     3,
     1,
     1,
     3,
     7,
     5,
     5,
     7,
     6,
     4,
     4,
     6,
     2,
     0,
     0,
     4,
     5,
     1,
     2,
     6,
     7,
     3,
     8,
     10,
     11,
     9,
     9,
     11,
     15,
     13,
     13,
     15,
     14,
     12,
     12,
     14,
     10,
     8,
     8,
     12,
     13,
     9,
     10,
     14,
     15,
     11,
     0,
     1,
     9,
     8,
     0,
     2,
     10,
     8,
     2,
     3,
     11,
     10,
     3,
     1,
     9,
     11,
     4,
     5,
     13,
     12,
     6,
     7,
     15,
     14,
     4,
     6,
     14,
     12,
     5,
     7,
     15,
     13,
     4,
     0,
     8,
     12,
     6,
     2,
     10,
     14,
     3,
     7,
     15,
     11,
     1,
     5,
     13,
     9
   };
   this.DotFacesGeometry.Indices = new int[144]
   {
     0,
     2,
     1,
     0,
     3,
     2,
     4,
     6,
     5,
     4,
     7,
     6,
     8,
     10,
     9,
     8,
     11,
     10,
     12,
     14,
     13,
     12,
     15,
     14,
     16,
     17,
     18,
     16,
     18,
     19,
     20,
     22,
     21,
     20,
     23,
     22,
     24,
     26,
     25,
     24,
     27,
     26,
     28,
     30,
     29,
     28,
     31,
     30,
     32,
     34,
     33,
     32,
     35,
     34,
     36,
     38,
     37,
     36,
     39,
     38,
     40,
     41,
     42,
     40,
     42,
     43,
     44,
     46,
     45,
     44,
     47,
     46,
     48,
     50,
     49,
     48,
     51,
     50,
     52,
     54,
     53,
     52,
     55,
     54,
     56,
     58,
     57,
     56,
     59,
     58,
     60,
     62,
     61,
     60,
     63,
     62,
     64,
     65,
     66,
     64,
     66,
     67,
     68,
     70,
     69,
     68,
     71,
     70,
     72,
     74,
     73,
     72,
     75,
     74,
     76,
     78,
     77,
     76,
     79,
     78,
     80,
     82,
     81,
     80,
     83,
     82,
     84,
     86,
     85,
     84,
     87,
     86,
     88,
     89,
     90,
     88,
     90,
     91,
     92,
     94,
     93,
     92,
     95,
     94
   };
   this.sHide = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Hide");
   this.sComeOut = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/ComeOut");
   this.sMove = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Move");
   this.sIdle = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/Idle");
   this.sHeyListen = this.CMProvider.Global.Load<SoundEffect>("Sounds/Dot/HeyListen");
   this.LevelManager.LevelChanged += new Action(this.RebuildFlare);
 }