protected override void LoadContent() { TrileSet trileSet = this.CMProvider.Global.Load <TrileSet>("Trile Sets/LOADING"); float viewAspect = 1.777778f; LoadingScreen loadingScreen = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured(); litTextured1.Specular = true; litTextured1.AlphaIsEmissive = true; litTextured1.Emissive = 0.5f; litTextured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f)); litTextured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); DefaultEffect.LitTextured litTextured2 = litTextured1; mesh2.Effect = (BaseEffect)litTextured2; mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending); mesh1.SamplerState = SamplerState.PointClamp; mesh1.AlwaysOnTop = false; mesh1.DepthWrites = true; mesh1.Texture = (Dirtyable <Texture>)((Texture)trileSet.TextureAtlas); mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float)Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f); mesh1.Position = new Vector3(5.5f * viewAspect, -4.5f, 0.0f); Mesh mesh3 = mesh1; loadingScreen.mesh = mesh3; Group group = this.mesh.AddGroup(); ShaderInstancedIndexedPrimitives <VertexPositionNormalTextureInstance, Vector4> geometry = trileSet.Triles[0].Geometry; group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionNormalTextureInstance>(Enumerable.ToArray <VertexPositionNormalTextureInstance>((IEnumerable <VertexPositionNormalTextureInstance>)geometry.Vertices), geometry.Indices, geometry.PrimitiveType); group.Scale = new Vector3(0.95f); this.starBack = this.CMProvider.Global.Load <Texture2D>("Other Textures/hud/starback"); this.sDrone = this.CMProvider.Global.Load <SoundEffect>("Sounds/Intro/FezLogoDrone"); ServiceHelper.AddComponent((IGameComponent)(this.fakeDot = new FakeDot(ServiceHelper.Game))); this.LevelManager.LevelChanged += (Action)(() => { lock (LoadingScreen.EffectRefreshMutex) { if (this.mesh.Effect != null) { this.mesh.Effect.Dispose(); } if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha) { Mesh temp_131 = this.mesh; DefaultEffect.Textured temp_135 = new DefaultEffect.Textured() { AlphaIsEmissive = true }; temp_131.Effect = (BaseEffect)temp_135; } else { Mesh temp_179 = this.mesh; DefaultEffect.LitTextured temp_187 = new DefaultEffect.LitTextured() { Specular = true, Emissive = 0.5f, AlphaIsEmissive = true }; temp_179.Effect = (BaseEffect)temp_187; } this.mesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f)); this.mesh.Effect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); this.mesh.TextureMatrix.Dirty = true; } }); }
protected override void LoadContent() { TrileSet trileSet = this.CMProvider.Global.Load<TrileSet>("Trile Sets/LOADING"); float viewAspect = 1.777778f; LoadingScreen loadingScreen = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.LitTextured litTextured1 = new DefaultEffect.LitTextured(); litTextured1.Specular = true; litTextured1.AlphaIsEmissive = true; litTextured1.Emissive = 0.5f; litTextured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f)); litTextured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); DefaultEffect.LitTextured litTextured2 = litTextured1; mesh2.Effect = (BaseEffect) litTextured2; mesh1.Blending = new BlendingMode?(BlendingMode.Alphablending); mesh1.SamplerState = SamplerState.PointClamp; mesh1.AlwaysOnTop = false; mesh1.DepthWrites = true; mesh1.Texture = (Dirtyable<Texture>) ((Texture) trileSet.TextureAtlas); mesh1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Right, (float) Math.Asin(Math.Sqrt(2.0) / Math.Sqrt(3.0))) * Quaternion.CreateFromAxisAngle(Vector3.Up, 0.7853982f); mesh1.Position = new Vector3(5.5f * viewAspect, -4.5f, 0.0f); Mesh mesh3 = mesh1; loadingScreen.mesh = mesh3; Group group = this.mesh.AddGroup(); ShaderInstancedIndexedPrimitives<VertexPositionNormalTextureInstance, Vector4> geometry = trileSet.Triles[0].Geometry; group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionNormalTextureInstance>(Enumerable.ToArray<VertexPositionNormalTextureInstance>((IEnumerable<VertexPositionNormalTextureInstance>) geometry.Vertices), geometry.Indices, geometry.PrimitiveType); group.Scale = new Vector3(0.95f); this.starBack = this.CMProvider.Global.Load<Texture2D>("Other Textures/hud/starback"); this.sDrone = this.CMProvider.Global.Load<SoundEffect>("Sounds/Intro/FezLogoDrone"); ServiceHelper.AddComponent((IGameComponent) (this.fakeDot = new FakeDot(ServiceHelper.Game))); this.LevelManager.LevelChanged += (Action) (() => { lock (LoadingScreen.EffectRefreshMutex) { if (this.mesh.Effect != null) this.mesh.Effect.Dispose(); if (this.LevelManager.WaterType == LiquidType.Sewer || this.LevelManager.WaterType == LiquidType.Lava || this.LevelManager.BlinkingAlpha) { Mesh temp_131 = this.mesh; DefaultEffect.Textured temp_135 = new DefaultEffect.Textured() { AlphaIsEmissive = true }; temp_131.Effect = (BaseEffect) temp_135; } else { Mesh temp_179 = this.mesh; DefaultEffect.LitTextured temp_187 = new DefaultEffect.LitTextured() { Specular = true, Emissive = 0.5f, AlphaIsEmissive = true }; temp_179.Effect = (BaseEffect) temp_187; } this.mesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * viewAspect, 14f, 0.1f, 100f)); this.mesh.Effect.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); this.mesh.TextureMatrix.Dirty = true; } }); }
public override void Initialize() { base.Initialize(); 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) }; float aspectRatio = this.GraphicsDevice.Viewport.AspectRatio; FakeDot fakeDot1 = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DotEffect dotEffect1 = new DotEffect(); dotEffect1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f)); dotEffect1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); DotEffect dotEffect2 = dotEffect1; mesh2.Effect = (BaseEffect)dotEffect2; mesh1.Blending = new BlendingMode?(BlendingMode.Additive); mesh1.DepthWrites = false; mesh1.Culling = CullMode.None; mesh1.AlwaysOnTop = true; mesh1.Material.Opacity = 0.3333333f; Mesh mesh3 = mesh1; fakeDot1.DotMesh = mesh3; FakeDot fakeDot2 = this; Mesh mesh4 = new Mesh(); Mesh mesh5 = mesh4; DefaultEffect.Textured textured1 = new DefaultEffect.Textured(); textured1.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f)); textured1.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); DefaultEffect.Textured textured2 = textured1; mesh5.Effect = (BaseEffect)textured2; mesh4.Texture = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/smooth_ray")); mesh4.Blending = new BlendingMode?(BlendingMode.Additive); mesh4.SamplerState = SamplerState.AnisotropicClamp; mesh4.DepthWrites = false; mesh4.AlwaysOnTop = true; Mesh mesh6 = mesh4; fakeDot2.RaysMesh = mesh6; FakeDot fakeDot3 = this; Mesh mesh7 = new Mesh(); Mesh mesh8 = mesh7; DefaultEffect.Textured textured3 = new DefaultEffect.Textured(); textured3.ForcedProjectionMatrix = new Matrix?(Matrix.CreateOrthographic(14f * aspectRatio, 14f, 0.1f, 100f)); textured3.ForcedViewMatrix = new Matrix?(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 10f), Vector3.Zero, Vector3.Up)); DefaultEffect.Textured textured4 = textured3; mesh8.Effect = (BaseEffect)textured4; mesh7.Texture = (Dirtyable <Texture>)((Texture)this.CMProvider.Global.Load <Texture2D>("Other Textures/rainbow_flare")); mesh7.Blending = new BlendingMode?(BlendingMode.Additive); mesh7.SamplerState = SamplerState.AnisotropicClamp; mesh7.DepthWrites = false; mesh7.AlwaysOnTop = true; Mesh mesh9 = mesh7; fakeDot3.FlareMesh = mesh9; 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 }; }