private static Group AddT(Mesh m) { Vector3 vector3 = new Vector3(3f, 2f, 0.0f); Group group = m.AddGroup(); group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives <VertexPositionColor>(new VertexPositionColor[8] { new VertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(3f, 0.0f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(3f, 1f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(2f, 1f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(2f, 2f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(1f, 2f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(1f, 1f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(0.0f, 1f, 0.0f) - vector3 / 2f, Color.White) }, new int[9] { 0, 1, 2, 3, 4, 5, 6, 7, 0 }, PrimitiveType.LineStrip); return(group); }
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; }
public override void Initialize() { base.Initialize(); LogoMesh = new Mesh { AlwaysOnTop = true }; for (int i = 0; i < StripColors.Length; i++) { FezVertexPositionColor[] vertices = new FezVertexPositionColor[202]; for (int j = 0; j < vertices.Length; j++) { vertices[j] = new FezVertexPositionColor(Vector3.Zero, StripColors[i]); } LogoMesh.AddGroup().Geometry = new IndexedUserPrimitives <FezVertexPositionColor>(vertices, Enumerable.Range(0, vertices.Length).ToArray(), PrimitiveType.TriangleStrip); } float viewScale = GraphicsDevice.GetViewScale(); float xScale = GraphicsDevice.Viewport.Width / (1280f * viewScale); float yScale = GraphicsDevice.Viewport.Height / (720f * viewScale); int width = GraphicsDevice.Viewport.Width; int height = GraphicsDevice.Viewport.Height; LogoMesh.Position = new Vector3(-0.1975f / xScale, -0.25f / yScale, 0f); LogoMesh.Scale = new Vector3(new Vector2(500f) * viewScale / new Vector2(width, height), 1f); sPolytron = CMProvider.Get(CM.Intro).Load <SoundEffect>("Sounds/Intro/PolytronJingle"); DrawActionScheduler.Schedule(delegate { PolytronText = CMProvider.Get(CM.Intro).Load <Texture2D>("Other Textures/splash/polytron_neue" + (viewScale >= 1.5f ? "_1440" : "")); spriteBatch = new SpriteBatch(GraphicsDevice); LogoMesh.Effect = new DefaultEffect.VertexColored { ForcedProjectionMatrix = Matrix.CreateOrthographic(320f / 224f, 320f / 224f, 0.1f, 100f), ForcedViewMatrix = Matrix.CreateLookAt(Vector3.UnitZ, -Vector3.UnitZ, Vector3.Up) }; }); }
private static Group AddT(Mesh m) { Vector3 vector3 = new Vector3(3f, 2f, 0.0f); Group group = m.AddGroup(); group.Geometry = (IIndexedPrimitiveCollection) new IndexedUserPrimitives<VertexPositionColor>(new VertexPositionColor[8] { new VertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(3f, 0.0f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(3f, 1f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(2f, 1f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(2f, 2f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(1f, 2f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(1f, 1f, 0.0f) - vector3 / 2f, Color.White), new VertexPositionColor(new Vector3(0.0f, 1f, 0.0f) - vector3 / 2f, Color.White) }, new int[9] { 0, 1, 2, 3, 4, 5, 6, 7, 0 }, PrimitiveType.LineStrip); return group; }
private static void BuildMap(Mesh mesh) { Quaternion fromAxisAngle = Quaternion.CreateFromAxisAngle(Vector3.Up, -1.570796f); Vector3 zero = Vector3.Zero; Group group1 = mesh.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, -1f), new Vector2(1f, 0.0f)), new FezVertexPositionNormalTexture(new Vector3(-1f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), new Vector2(1f, 1f)), new FezVertexPositionNormalTexture(new Vector3(0.0f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), new Vector2(0.625f, 0.0f)), new FezVertexPositionNormalTexture(new Vector3(0.0f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), 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.Position = zero + MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) * 0.125f * 1.5f; group1.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 0.3926991f) * fromAxisAngle; Group group2 = mesh.CloneGroup(group1); group2.CullMode = new CullMode?(CullMode.CullClockwiseFace); group2.InvertNormals<FezVertexPositionNormalTexture>(); 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 = mesh.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, -1f), new Vector2(0.625f, 0.0f)), new FezVertexPositionNormalTexture(new Vector3(-0.5f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), new Vector2(0.625f, 1f)), new FezVertexPositionNormalTexture(new Vector3(0.5f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), new Vector2(0.375f, 0.0f)), new FezVertexPositionNormalTexture(new Vector3(0.5f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), 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.Position = zero; group3.Rotation = fromAxisAngle; Group group4 = mesh.CloneGroup(group3); group4.CullMode = new CullMode?(CullMode.CullClockwiseFace); group4.InvertNormals<FezVertexPositionNormalTexture>(); 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 = mesh.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, -1f), new Vector2(0.375f, 0.0f)), new FezVertexPositionNormalTexture(new Vector3(0.0f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), new Vector2(0.375f, 1f)), new FezVertexPositionNormalTexture(new Vector3(1f, 0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), new Vector2(0.0f, 0.0f)), new FezVertexPositionNormalTexture(new Vector3(1f, -0.5f, 0.0f), new Vector3(0.0f, 0.0f, -1f), 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.Position = zero - MenuCubeFaceExtensions.GetRight(MenuCubeFace.Maps) * 0.125f * 1.5f; group5.Rotation = Quaternion.CreateFromAxisAngle(Vector3.Up, 0.3926991f) * fromAxisAngle; Group group6 = mesh.CloneGroup(group5); group6.CullMode = new CullMode?(CullMode.CullClockwiseFace); group6.InvertNormals<FezVertexPositionNormalTexture>(); 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)); }
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); } }