示例#1
0
 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));
 }