public override void Prepare(Group group) { base.Prepare(group); this.matrices.World = (Matrix) group.WorldMatrix; if (group.Material != null) { if (this.lastDiffuse != group.Material.Diffuse) { this.material.Diffuse = group.Material.Diffuse; this.lastDiffuse = group.Material.Diffuse; } } else this.material.Diffuse = group.Mesh.Material.Diffuse; if (group.TexturingType == TexturingType.Texture2D) { this.texture.Set(group.Texture); this.groupTextureDirty = true; } else { if (!this.groupTextureDirty) return; this.texture.Set((Texture) group.Mesh.Texture); } }
public override void Prepare(Group group) { base.Prepare(group); this.isEmerged.Set((bool) group.CustomData); this.material.Diffuse = group.Material.Diffuse; this.material.Opacity = group.Material.Opacity; }
public override void Prepare(Group group) { if (this.IgnoreCache || !group.EffectOwner || group.InverseTransposeWorldMatrix.Dirty) { this.matrices.WorldInverseTranspose = (Matrix) group.InverseTransposeWorldMatrix; group.InverseTransposeWorldMatrix.Clean(); } this.matrices.World = (Matrix) group.WorldMatrix; if (group.TextureMatrix.Value.HasValue) { this.matrices.TextureMatrix = group.TextureMatrix.Value.Value; this.textureMatrixDirty = true; } else if (this.textureMatrixDirty) { this.matrices.TextureMatrix = Matrix.Identity; this.textureMatrixDirty = false; } this.animatedTexture.Set(group.Texture); this.material.Diffuse = group.Material.Diffuse; this.material.Opacity = group.Material.Opacity; PlaneCustomData planeCustomData = group.CustomData as PlaneCustomData; if (planeCustomData != null) { this.fullbright.Set(planeCustomData.Fullbright); this.alphaIsEmissive.Set(planeCustomData.AlphaIsEmissive); } else { this.fullbright.Set(false); this.alphaIsEmissive.Set(false); } }
public override void Prepare(Group group) { base.Prepare(group); if (this.IgnoreCache || !group.EffectOwner || group.InverseTransposeWorldMatrix.Dirty) { this.matrices.WorldInverseTranspose = (Matrix) group.InverseTransposeWorldMatrix; group.InverseTransposeWorldMatrix.Clean(); } this.material.Diffuse = group.Material.Diffuse; this.animatedTexture.Set(group.Texture); }
public override void Prepare(Group group) { base.Prepare(group); if (group.Material != null) { if (!(this.lastDiffuse != group.Material.Diffuse)) return; this.material.Diffuse = group.Material.Diffuse; this.lastDiffuse = group.Material.Diffuse; } else this.material.Diffuse = group.Mesh.Material.Diffuse; }
public override void Prepare(Group group) { base.Prepare(group); if (group.TexturingType == TexturingType.Texture2D) { this.texture.Set(group.Texture); this.groupTextureDirty = true; } else { if (!this.groupTextureDirty) return; this.texture.Set((Texture) group.Mesh.Texture); } }
public override void Initialize() { base.Initialize(); FezGrid fezGrid1 = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored(); vertexColored1.Fullbright = true; DefaultEffect.VertexColored vertexColored2 = vertexColored1; mesh2.Effect = (BaseEffect) vertexColored2; Mesh mesh3 = mesh1; fezGrid1.GoMesh = mesh3; this.GomezGroup = this.GoMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, Color.White, true, false, false); this.FezGroup = this.GoMesh.AddFace(Vector3.One / 2f, Vector3.Zero, FaceOrientation.Front, Color.Red, true, false, false); FezGrid fezGrid2 = this; Mesh mesh4 = new Mesh(); Mesh mesh5 = mesh4; DefaultEffect.VertexColored vertexColored3 = new DefaultEffect.VertexColored(); vertexColored3.Fullbright = true; DefaultEffect.VertexColored vertexColored4 = vertexColored3; mesh5.Effect = (BaseEffect) vertexColored4; Mesh mesh6 = mesh4; fezGrid2.TetraMesh = mesh6; Vector3[] pointPairs = new Vector3[2560]; for (int index = 0; index < 1280; ++index) { pointPairs[index * 2] = new Vector3(-640f, 0.0f, (float) (index - 640)); pointPairs[index * 2 + 1] = new Vector3(640f, 0.0f, (float) (index - 640)); } Color[] pointColors = Enumerable.ToArray<Color>(Enumerable.Repeat<Color>(Color.Red, 2560)); this.TetraMesh.AddLines(pointColors, pointPairs, true); this.TetraMesh.AddLines(pointColors, Enumerable.ToArray<Vector3>(Enumerable.Select<Vector3, Vector3>((IEnumerable<Vector3>) pointPairs, (Func<Vector3, Vector3>) (v => new Vector3(v.Z, 0.0f, v.X)))), true); this.CubeMesh = new Mesh() { Effect = (BaseEffect) new DefaultEffect.LitVertexColored() }; this.CubeMesh.AddFlatShadedBox(Vector3.One, Vector3.Zero, Color.White, true); this.StencilMesh = new Mesh() { Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false }; this.StencilMesh.AddFace(FezMath.XZMask * 1280f, Vector3.Zero, FaceOrientation.Top, true); this.LevelManager.ActualAmbient = new Color(0.25f, 0.25f, 0.25f); this.LevelManager.ActualDiffuse = Color.White; this.Reset(); }
public override void Initialize() { base.Initialize(); Pixelizer pixelizer = this; Mesh mesh1 = new Mesh(); Mesh mesh2 = mesh1; DefaultEffect.VertexColored vertexColored1 = new DefaultEffect.VertexColored(); vertexColored1.Fullbright = true; DefaultEffect.VertexColored vertexColored2 = vertexColored1; mesh2.Effect = (BaseEffect) vertexColored2; mesh1.AlwaysOnTop = true; mesh1.DepthWrites = false; Mesh mesh3 = mesh1; pixelizer.GoMesh = mesh3; this.GomezGroup = this.GoMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, Color.White, true, false, false); this.FezGroup = this.GoMesh.AddFace(Vector3.One / 2f, Vector3.Zero, FaceOrientation.Front, Color.Red, true, false, false); this.GoMesh.Effect.ForcedViewMatrix = new Matrix?(new Matrix(1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, 0.0f, 1f, 0.0f, 0.0f, 0.0f, -249.95f, 1f)); this.GoMesh.Effect.ForcedProjectionMatrix = new Matrix?(new Matrix(0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.3555556f, 0.0f, 0.0f, 0.0f, 0.0f, -0.0020004f, 0.0f, 0.0f, 0.0f, -0.00020004f, 1f)); this.LevelManager.ActualAmbient = new Color(0.25f, 0.25f, 0.25f); this.LevelManager.ActualDiffuse = Color.White; this.OldSfxVol = this.SoundManager.SoundEffectVolume; this.Reset(); }
public override void Prepare(Group group) { base.Prepare(group); this.cubeOffset.Set(Vector3.Transform(Vector3.Zero, (Matrix) group.WorldMatrix)); if (this.IgnoreCache || !group.EffectOwner || group.InverseTransposeWorldMatrix.Dirty) { this.matrices.WorldInverseTranspose = (Matrix) group.InverseTransposeWorldMatrix; group.InverseTransposeWorldMatrix.Clean(); } if (group.Material != null) { if (this.lastDiffuse != group.Material.Diffuse) { this.material.Diffuse = group.Material.Diffuse; this.lastDiffuse = group.Material.Diffuse; } } else this.material.Diffuse = group.Mesh.Material.Diffuse; if (group.Material != null) this.material.Opacity = group.Mesh.Material.Opacity * group.Material.Opacity; this.noTexture.Set(group.TexturingType != TexturingType.Texture2D); bool flag = (group.CustomData as NodeGroupData).Complete; this.complete.Set(flag); if (flag) { GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDeviceService.GraphicsDevice, new StencilMask?(StencilMask.Trails)); this.lastWasComplete = true; } else if (this.lastWasComplete) GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDeviceService.GraphicsDevice, CompareFunction.Always, StencilMask.None); if (group.TexturingType != TexturingType.Texture2D) return; this.texture.Set(group.Texture); this.textureSize.Set(new Vector2((float) group.TextureMap.Width, (float) group.TextureMap.Height)); }
public override void Prepare(Group group) { base.Prepare(group); if (group.CustomData != null && (bool) group.CustomData) { GraphicsDeviceExtensions.PrepareStencilWrite(this.GraphicsDeviceService.GraphicsDevice, new StencilMask?(StencilMask.Trails)); this.lastWasComplete = true; } else if (this.lastWasComplete) GraphicsDeviceExtensions.PrepareStencilRead(this.GraphicsDeviceService.GraphicsDevice, CompareFunction.Always, StencilMask.None); if (group.Material != null) { if (this.lastDiffuse != group.Material.Diffuse) { this.material.Diffuse = group.Material.Diffuse; this.lastDiffuse = group.Material.Diffuse; } } else this.material.Diffuse = group.Mesh.Material.Diffuse; if (group.Material == null) return; this.material.Opacity = group.Mesh.Material.Opacity * group.Material.Opacity; }
public override void Prepare(Group group) { base.Prepare(group); if (this.IgnoreCache || !group.EffectOwner || group.WorldMatrix.Dirty) { this.matrices.World = (Matrix) group.WorldMatrix; group.WorldMatrix.Clean(); } if (group.TextureMatrix.Value.HasValue) { this.matrices.TextureMatrix = group.TextureMatrix.Value.Value; this.textureMatrixDirty = true; } else { if (!this.textureMatrixDirty) return; this.matrices.TextureMatrix = Matrix.Identity; this.textureMatrixDirty = false; } }
public override void Prepare(Group group) { base.Prepare(group); this.matrices.World = (Matrix) group.WorldMatrix; }
public override void Prepare(Group group) { base.Prepare(group); this.material.Opacity = group.Material.Opacity; this.texture.Set(group.Texture); }
private static void AddPoints(Group g, Vector3[] pointCenters, Texture texture, float size) { BufferedIndexedPrimitives<VertexFakePointSprite> indexedPrimitives = new BufferedIndexedPrimitives<VertexFakePointSprite>(PrimitiveType.TriangleList); g.Geometry = (IIndexedPrimitiveCollection) indexedPrimitives; indexedPrimitives.Vertices = new VertexFakePointSprite[pointCenters.Length * 4]; indexedPrimitives.Indices = new int[pointCenters.Length * 6]; Random random = RandomHelper.Random; int length = StarField.Colors.Length; VertexFakePointSprite[] vertices = indexedPrimitives.Vertices; int[] indices = indexedPrimitives.Indices; for (int index1 = 0; index1 < pointCenters.Length; ++index1) { Color color = StarField.Colors[random.Next(0, length)]; int index2 = index1 * 4; vertices[index2] = new VertexFakePointSprite(pointCenters[index1], color, new Vector2(0.0f, 0.0f), new Vector2(-size, -size)); vertices[index2 + 1] = new VertexFakePointSprite(pointCenters[index1], color, new Vector2(1f, 0.0f), new Vector2(size, -size)); vertices[index2 + 2] = new VertexFakePointSprite(pointCenters[index1], color, new Vector2(1f, 1f), new Vector2(size, size)); vertices[index2 + 3] = new VertexFakePointSprite(pointCenters[index1], color, new Vector2(0.0f, 1f), new Vector2(-size, size)); int index3 = index1 * 6; indices[index3] = index2; indices[index3 + 1] = index2 + 1; indices[index3 + 2] = index2 + 2; indices[index3 + 3] = index2; indices[index3 + 4] = index2 + 2; indices[index3 + 5] = index2 + 3; } indexedPrimitives.UpdateBuffers(); indexedPrimitives.CleanUp(); g.Texture = texture; }
private void LateLoadContent() { this.GTR = new GlyphTextRenderer(this.Game); SpriteFont big = this.FontManager.Big; float scale = (Culture.IsCJK ? 0.6f : 1f) * SettingsManager.GetViewScale(this.GraphicsDevice); Vector2 vector2_1 = this.GTR.MeasureWithGlyphs(big, this.Text, scale); this.MiddlePartSize = vector2_1 * new Vector2(1f, 1.25f); int width = (int) this.MiddlePartSize.X; int height = (int) this.MiddlePartSize.Y; Vector2 vector2_2 = this.MiddlePartSize; if (this.TextTexture != null) { this.TextTexture.Dispose(); this.TextTexture = (RenderTarget2D) null; } this.TextTexture = new RenderTarget2D(this.GraphicsDevice, width, height, 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(this.TextTexture); GraphicsDeviceExtensions.PrepareDraw(this.GraphicsDevice); this.GraphicsDevice.Clear(ClearOptions.Target, new Color(215, 188, 122, 0), 1f, 0); GraphicsDeviceExtensions.BeginPoint(spriteBatch); this.GTR.DrawString(spriteBatch, big, this.Text, vector2_2 / 2f - vector2_1 / 2f + new Vector2(0.0f, this.FontManager.TopSpacing / 2f), TextScroll.TextColor, scale); spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } this.MiddlePartSize /= Culture.IsCJK ? 3f : 2f; this.MiddlePartSize -= new Vector2(16f, 0.0f); this.ScrollMesh = new Mesh() { Blending = new BlendingMode?(BlendingMode.Alphablending), Effect = (BaseEffect) new DefaultEffect.Textured(), AlwaysOnTop = true, DepthWrites = false, Material = { Opacity = 0.0f }, SamplerState = SamplerState.PointClamp }; this.LeftPart = this.ScrollMesh.AddFace(new Vector3(2f), new Vector3(0.0f, 0.5f, 0.0f), FaceOrientation.Front, true); this.LeftPart.Texture = (Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/SCROLL/SCROLL_A"); this.MiddlePart = this.ScrollMesh.AddFace(Vector3.One, Vector3.Zero, FaceOrientation.Front, true); this.MiddlePart.Texture = (Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/SCROLL/SCROLL_B"); this.RightPart = this.ScrollMesh.AddFace(new Vector3(2f), new Vector3(0.0f, -0.5f, 0.0f), FaceOrientation.Front, true); this.RightPart.Texture = (Texture) this.CMProvider.Global.Load<Texture2D>("Other Textures/SCROLL/SCROLL_C"); this.TextGroup = this.ScrollMesh.AddFace(new Vector3((float) (((double) this.MiddlePartSize.X + 16.0) / 16.0), this.MiddlePartSize.Y / 16f, 1f), new Vector3(-0.125f, 0.0f, 0.0f), FaceOrientation.Front, true); this.TextGroup.SamplerState = Culture.IsCJK ? SamplerState.AnisotropicClamp : SamplerState.PointClamp; this.TextGroup.Texture = (Texture) this.TextTexture; this.TextGroup.Material = new Material() { Opacity = 0.0f }; this.ScrollMesh.Effect.ForcedProjectionMatrix = new Matrix?(Matrix.Identity); this.ScrollMesh.Effect.ForcedViewMatrix = new Matrix?(Matrix.Identity); this.MiddlePartSize /= SettingsManager.GetViewScale(this.GraphicsDevice); this.GraphicsDevice.DeviceReset += new EventHandler<EventArgs>(this.UpdateViewScale); if (Culture.IsCJK) this.MiddlePartSize.X /= 2f; this.Ready = true; }
public override void Prepare(Group group) { base.Prepare(group); if (this.IgnoreCache || !group.EffectOwner || group.InverseTransposeWorldMatrix.Dirty) { this.matrices.WorldInverseTranspose = (Matrix) group.InverseTransposeWorldMatrix; group.InverseTransposeWorldMatrix.Clean(); } if (group.TexturingType == TexturingType.Texture2D) { this.textureEnabled.Set(true); this.texture.Set(group.Texture); this.groupTextureDirty = true; } else { if (!this.groupTextureDirty) return; this.textureEnabled.Set(group.Mesh.TexturingType == TexturingType.Texture2D); this.texture.Set((Texture) group.Mesh.Texture); } }
public override void Prepare(Group group) { base.Prepare(group); if (!this.IgnoreCache && group.EffectOwner && !group.InverseTransposeWorldMatrix.Dirty) return; this.matrices.WorldInverseTranspose = (Matrix) group.InverseTransposeWorldMatrix; group.InverseTransposeWorldMatrix.Clean(); }
public override void Prepare(Group group) { base.Prepare(group); this.material.Opacity = group.Material.Opacity * group.Mesh.Material.Opacity; this.matrices.World = (Matrix) group.WorldMatrix; }